/* =========================================================
   Green Sectors page - modern animated styles
   ========================================================= */

:root {
    --sec-deep: #1B5E20;
    --sec-soft: #66BB6A;
    --sec-teal: #14B8A6;
    --sec-leaf: #E8F5E9;
}

/* ---------- Hero ---------- */
.sectors-hero {
    position: relative;
    overflow: hidden;
    padding: 25px 0 25px;
    background: linear-gradient(135deg, #0F3D14 0%, #1B5E20 50%, #14B8A6 100%);
    color: #fff;
}
/* Wave */
.sectors-hero__wave {
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    z-index: 1;
    line-height: 0;
}

    .sectors-hero__wave svg {
        width: 100%;
        height: 40px;
        display: block;
    }
.sectors-hero__bg { position: absolute; inset: 0; z-index: 0; overflow: hidden; }
.s-blob {
    position: absolute; border-radius: 50%;
    filter: blur(70px); opacity: .55;
    animation: sBlobFloat 14s ease-in-out infinite;
}
.s-blob--1 { width: 420px; height: 420px; background: #66BB6A; top: -120px; left: -80px; }
.s-blob--2 { width: 360px; height: 360px; background: #14B8A6; bottom: -120px; right: -60px; animation-delay: 3s; }
.s-blob--3 { width: 300px; height: 300px; background: #A7F3D0; top: 30%; left: 50%; opacity: .35; animation-delay: 6s; }
@keyframes sBlobFloat {
    0%,100% { transform: translate(0,0) scale(1); }
    50%     { transform: translate(30px,-20px) scale(1.05); }
}
.s-grid {
    position: absolute; inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,.06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.06) 1px, transparent 1px);
    background-size: 44px 44px;
    mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%);
    -webkit-mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%);
}

.sectors-hero .container { position: relative; z-index: 1; }

.sectors-breadcrumb {
    background: transparent;
    padding: 0;
    margin-bottom: 1.25rem;
}
.sectors-breadcrumb .breadcrumb-item,
.sectors-breadcrumb .breadcrumb-item a {
    color: rgba(255,255,255,.8);
    text-decoration: none;
}
.sectors-breadcrumb .breadcrumb-item.active { color: #fff; }
.sectors-breadcrumb .breadcrumb-item + .breadcrumb-item::before { color: rgba(255,255,255,.55); }

.sectors-hero__pill {
    display: inline-flex; align-items: center; gap: .4rem;
    background: rgba(255,255,255,.12);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,.25);
    padding: .4rem .95rem;
    border-radius: 999px;
    font-size: .82rem;
    font-weight: 500;
    margin-bottom: 1rem;
    animation: fadeDown .7s ease both;
}
.sectors-hero__pill .dot {
    width: 8px; height: 8px;
    background: #86EFAC; border-radius: 50%;
    box-shadow: 0 0 0 0 rgba(134,239,172,.7);
    animation: dotPulse 2s infinite;
}
@keyframes dotPulse {
    0%   { box-shadow: 0 0 0 0 rgba(134,239,172,.7); }
    70%  { box-shadow: 0 0 0 9px rgba(134,239,172,0); }
}
@keyframes fadeDown {
    from { opacity: 0; transform: translateY(-12px); }
    to   { opacity: 1; transform: translateY(0); }
}

.sectors-hero__title {
    font-size: clamp(2rem, 4.5vw, 3.5rem);
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -.02em;
    margin-bottom: .85rem;
    animation: fadeUp .8s ease both .15s;
}
.sectors-hero__lead {
    max-width: 640px;
    color: rgba(255,255,255,.85);
    font-size: 1.05rem;
    animation: fadeUp .8s ease both .3s;
}
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(18px); }
    to   { opacity: 1; transform: translateY(0); }
}

.gradient-text {
    background: linear-gradient(90deg, #A7F3D0, #5EEAD4, #FDE68A);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
}

/* Toolbar */
.sectors-toolbar {
    display: flex; flex-wrap: wrap;
    gap: 1rem; align-items: center;
    margin-top: 1.75rem;
    animation: fadeUp .8s ease both .45s;
}
.sectors-search {
    position: relative;
    flex: 1 1 320px;
    max-width: 460px;
}
.sectors-search i {
    position: absolute;
    top: 50%; left: 16px;
    transform: translateY(-50%);
    color: var(--sec-deep);
    z-index: 2;
}
.sectors-search input.form-control {
    padding: .8rem 1rem .8rem 2.6rem;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,.4);
    background: rgba(255,255,255,.95);
    box-shadow: 0 10px 24px rgba(0,0,0,.15);
    color: var(--sec-deep);
    font-weight: 500;
}
.sectors-search input.form-control:focus {
    box-shadow: 0 0 0 4px rgba(167,243,208,.35), 0 10px 24px rgba(0,0,0,.18);
    border-color: #A7F3D0;
}
.sectors-meta {
    color: rgba(255,255,255,.9);
    font-size: .9rem;
}
.sectors-meta strong { color: #fff; font-size: 1rem; }

/* ---------- Grid ---------- */
.sectors-grid-section {
    padding: 0 0 40px;
    margin-top: -180px;
    position: relative;
    z-index: 2;
}

/* =========================================================
   SPANISH HAND FAN LAYOUT
   ========================================================= */
.fan-stage {
    position: relative;
    width: 100%;
    /* Height grows with card count to reserve space for the arc + hover lift */
    min-height: 680px;
    padding-top: 0;
    perspective: 1400px;
    user-select: none;
}

/* Pivot point: bottom-center of the fan, around which all cards rotate */
.fan-pivot {
    position: absolute;
    left: 50%;
    bottom: 40px;
    width: 0;
    height: 0;
    transform-style: preserve-3d;
}

/* Each card wrapper is anchored AT the pivot, then rotated by --angle.
   The card itself is translated upward along the radius. */
.fan-card-wrapper {
    position: absolute;
    left: 0; bottom: 0;
    width: 260px;
    height: 360px;
    margin-left: -130px; /* center on pivot */
    transform-origin: 50% 100%; /* rotate around bottom-center */
    transform: rotate(var(--angle, 0deg)) translateY(-30px);
    transition: transform .55s cubic-bezier(.22, 1, .36, 1),
                z-index 0s linear .15s,
                filter .45s ease;
    will-change: transform;
    /* Initial reveal */
    opacity: 0;
    animation: fanDeal .8s cubic-bezier(.22, 1, .36, 1) forwards;
    animation-delay: calc(var(--i, 0) * 70ms + 150ms);
    z-index: calc(10 + var(--i, 0));
}

@keyframes fanDeal {
    0% {
        opacity: 0;
        transform: rotate(0deg) translateY(40px) scale(.6);
    }
    100% {
        opacity: 1;
        transform: rotate(var(--angle, 0deg)) translateY(-30px);
    }
}

/* The visible card surface */
.fan-card {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, #ffffff 0%, #F8FBF8 100%);
    border-radius: 18px 18px 22px 22px;
    border: 1px solid rgba(16, 24, 40, .08);
    box-shadow:
        0 18px 30px rgba(16, 24, 40, .18),
        0 2px 6px rgba(16, 24, 40, .08);
    overflow: hidden;
    transition: box-shadow .45s ease, border-color .45s ease, transform .45s ease;
    /* Subtle paper texture via gradient */
    background-image:
        radial-gradient(circle at 20% 0%, rgba(102,187,106,.06), transparent 50%),
        radial-gradient(circle at 80% 100%, rgba(20,184,166,.06), transparent 50%),
        linear-gradient(180deg, #ffffff 0%, #F8FBF8 100%);
}

.fan-card::before {
    /* Top accent ribbon */
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 5px;
    background: linear-gradient(90deg, #1B5E20, #66BB6A, #14B8A6);
}

.fan-card__rib {
    /* Decorative "fan rib" line down the middle */
    position: absolute;
    left: 50%;
    top: 12px; bottom: 12px;
    width: 1px;
    background: linear-gradient(180deg,
        rgba(20,184,166,.0) 0%,
        rgba(20,184,166,.15) 30%,
        rgba(20,184,166,.15) 70%,
        rgba(20,184,166,0) 100%);
    transform: translateX(-50%);
    pointer-events: none;
}

.fan-card__glow {
    display: none;
}

.fan-card__inner {
    position: relative;
    z-index: 1;
    padding: 1.4rem 1.1rem 1.2rem;
    height: 100%;
    display: flex; flex-direction: column;
    text-align: center;
}

.fan-card__icon {
    width: 58px; height: 58px;
    border-radius: 16px;
    margin: .25rem auto .85rem;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 1.6rem;
    color: #fff;
    background: linear-gradient(135deg, #1B5E20, #66BB6A, #14B8A6);
    box-shadow: 0 10px 22px rgba(20, 184, 166, .3);
    transition: transform .45s cubic-bezier(.4, 1.4, .6, 1);
}

.fan-card__title {
    font-weight: 700;
    color: #1F2A37;
    font-size: 1.05rem;
    margin-bottom: .4rem;
    line-height: 1.25;
}
.fan-card__desc {
    color: #6B7280;
    font-size: .82rem;
    line-height: 1.45;
    margin-bottom: .75rem;
    flex-grow: 1;
    /* Clamp to 4 lines */
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.fan-card__growth {
    display: inline-flex; align-items: center; gap: .35rem;
    background: var(--sec-leaf);
    color: var(--sec-deep);
    padding: .25rem .7rem;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 600;
    margin: 0 auto .8rem;
    width: fit-content;
}
.fan-card__cta {
    display: inline-flex; align-items: center; gap: .3rem; justify-content: center;
    color: var(--sec-deep);
    font-weight: 600;
    text-decoration: none;
    font-size: .88rem;
    padding: .45rem .9rem;
    border-radius: 999px;
    border: 1.5px solid rgba(27, 94, 32, .25);
    transition: background .25s ease, color .25s ease, border-color .25s ease;
    margin: 0 auto;
}
.fan-card__cta i { transition: transform .25s ease; }
.fan-card__cta:hover {
    background: linear-gradient(135deg, #1B5E20, #14B8A6);
    color: #fff;
    border-color: transparent;
}
.fan-card__cta:hover i { transform: translateX(4px); }

/* Hover: pull card out, straighten, lift, bring to front */
.fan-card-wrapper {
    /* extra var used by neighbor push effect */
    --push: 0deg;
}

.fan-card-wrapper:hover {
    transform: rotate(0deg) translateY(-220px) scale(1.55);
    z-index: 9999;
    filter: none;
}
.fan-card-wrapper:hover .fan-card {
    box-shadow: none;
    border-color: rgba(102, 187, 106, .55);
    background:
        radial-gradient(circle at 50% 100%, rgba(102, 187, 106, .15), transparent 65%),
        linear-gradient(180deg, #ffffff 0%, #F4FBF5 100%);
}
.fan-card-wrapper:hover .fan-card__glow { opacity: 1; }
.fan-card-wrapper:hover .fan-card__icon {
    transform: rotate(-8deg) scale(1.15);
    box-shadow: none;
}
.fan-card-wrapper:hover .fan-card__title { color: #1B5E20; }

/* Push neighbors away from the hovered card */
.fan-card-wrapper:hover + .fan-card-wrapper {
    transform: rotate(calc(var(--angle, 0deg) + 8deg)) translateY(-30px);
}
.fan-card-wrapper:has(+ .fan-card-wrapper:hover) {
    transform: rotate(calc(var(--angle, 0deg) - 8deg)) translateY(-30px);
}

/* Dim & shrink non-hovered cards strongly when one is focused */
.fan-stage:hover .fan-card-wrapper:not(:hover) {
    filter: brightness(.9) saturate(.88);
    opacity: .9;
}
.fan-stage:hover .fan-card-wrapper:not(:hover) .fan-card {
    transform: scale(.98);
    transition: transform .45s ease;
}

/* Fan handle / pivot decoration */
.fan-handle {
    position: absolute;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    width: 14px;
    height: 60px;
    background: linear-gradient(180deg, #1B5E20, #0F3D14);
    border-radius: 6px;
    box-shadow: 0 8px 18px rgba(0,0,0,.15);
    z-index: 5;
}
.fan-handle__knob {
    position: absolute;
    top: -10px; left: 50%;
    transform: translateX(-50%);
    width: 24px; height: 24px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, #66BB6A, #1B5E20 70%);
    box-shadow: 0 4px 10px rgba(0,0,0,.25), inset 0 -3px 6px rgba(0,0,0,.3);
}

.fan-hint {
    margin-top: 1.25rem;
}

/* Responsive: stack cards vertically on small screens */
@media (max-width: 768px) {
    .fan-stage {
        min-height: auto;
        padding: 1rem 0 2rem;
        perspective: none;
    }
    .fan-pivot {
        position: static;
        width: 100%;
        display: flex;
        flex-direction: column;
        gap: 1rem;
        align-items: center;
    }
    .fan-card-wrapper {
        position: relative;
        left: auto; bottom: auto;
        margin: 0;
        width: min(92%, 360px);
        height: auto;
        transform: none !important;
        animation: fadeUpMobile .5s ease both;
        animation-delay: calc(var(--i, 0) * 60ms);
    }
    .fan-card { position: relative; }
    .fan-card-wrapper:hover {
        transform: translateY(-4px) !important;
    }
    .fan-handle, .fan-hint { display: none; }
    @keyframes fadeUpMobile {
        from { opacity: 0; transform: translateY(16px); }
        to   { opacity: 1; transform: translateY(0); }
    }
}

/* Empty state */
.sectors-empty {
    text-align: center;
    padding: 4rem 1rem;
    color: #6B7280;
}
.sectors-empty i {
    font-size: 3rem;
    color: #cbd5e1;
    margin-bottom: .75rem;
    display: block;
}
.sectors-empty h5 { font-weight: 700; color: #1F2A37; }

/* Reveal */
[data-reveal] {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity .7s ease, transform .7s ease;
}
[data-reveal].is-visible {
    opacity: 1;
    transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .001s !important;
        transition-duration: .001s !important;
    }
}
