/* Inicio: hero bajo topbar. Menu intacto. */
body[data-page="inicio"] {
    overflow: hidden;
    height: 100vh;
}
body[data-page="inicio"] .app {
    height: 100vh;
    overflow: hidden;
}
body[data-page="inicio"] .main {
    min-height: 100vh;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
body[data-page="inicio"] .topbar { flex: 0 0 auto; }
body[data-page="inicio"] .content.agro-inicio-content {
    flex: 1 1 auto;
    min-height: 0;
    margin: 0;
    padding: var(--content-pad, 10px) !important;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}
html[data-sidebar-animating] .agro-hero,
html[data-sidebar-animating] .agro-hero * {
    animation-play-state: paused !important;
}
body[data-page="inicio"] .sidebar,
body[data-page="inicio"] .main {
    transition-duration: 0.16s;
}

/* Hero llena el content del portal */
.agro-inicio-content .agro-hero {
    --agro-h: 100%;
    --agro-r: 12px;
    flex: 1 1 auto;
    min-height: 0 !important;
    height: 100% !important;
    width: 100%;
    border-radius: var(--agro-r);
}

/* ===== Tokens (ajusta a las variables de tu portal) ===== */
  .agro-hero {
    --bg: #0f1c16;
    --panel: #142a21;
    --line: #234236;
    --text: #e8f5ee;
    --muted: #8fb3a1;
    --accent: #34d399;
    --grape: #7c4dbd;
    --pome: #c2273d;
    --avo: #6b9a3a;
    --berry: #3f5fb5;
  }
  .agro-hero {
    --field-h: clamp(200px, 27vh, 300px);                     /* alto del campo; el horizonte se calcula desde aquí */
    position: relative; overflow: hidden; isolation: isolate; box-sizing: border-box;
    width: 100%; height: var(--agro-h, 100%); min-height: 0;   /* pantalla completa (en el portal: --agro-h: calc(100dvh - 72px)) */
    border-radius: var(--agro-r, 0); background: var(--bg);
    color: var(--text); font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  }
  .fruit:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

  /* ===== Frutas / cultivos: mitad derecha (posición fina en .agro-layout) ===== */
  .fruits {
    position: relative;
    width: 100%;
    height: 100%;
    z-index: 4;
  }
  .fruit {
    position: absolute; width: var(--s); background: none; border: 0; padding: 0; cursor: pointer; isolation: isolate;
    left: var(--x); top: var(--y);
    transform: translate(calc(var(--mx, 0) * var(--d)), calc(var(--my, 0) * var(--d)));
    transition: transform .25s ease-out;
  }
  .fruit svg { width: 100%; display: block; filter: brightness(calc(.72 + var(--land, 1) * .28)) drop-shadow(0 10px 14px rgba(0,0,0,.45));
    animation: float var(--t) ease-in-out infinite; transition: scale .25s; }
  .fruit:hover svg, .fruit.on svg { scale: 1.12; }
  .fruit span {
    position: absolute; left: 50%; bottom: -22px; translate: -50% 0; font-size: .75rem;
    color: var(--muted); opacity: 0; transition: opacity .2s; white-space: nowrap;
  }
  .fruit:hover span, .fruit:focus-visible span, .fruit.on span { opacity: 1; }
  .fruit::before {                                             /* resplandor de cada fruta */
    content: ""; position: absolute; inset: -28%; z-index: -1; border-radius: 50%; pointer-events: none;
    background: radial-gradient(circle, var(--aura, rgba(255,255,255,.4)) 0, transparent 66%);
    opacity: .5; animation: aura 4.5s ease-in-out infinite alternate; }
  @keyframes aura { to { opacity: .95; scale: 1.14; } }
  @keyframes float { 0%,100% { translate: 0 0; rotate: -2deg; } 50% { translate: 0 -10px; rotate: 2deg; } }

  /* ===== Campo ===== */
  .agro-field { position: absolute; inset: auto 0 0 0; height: var(--field-h); z-index: 1; pointer-events: none; }
  .agro-field svg { width: 100%; height: 100%; display: block; }
  /* ===== Cielo vivo (lo controla el JS: ciclo día / tarde / noche) ===== */
  .sky { position: absolute; inset: 0; z-index: 0; overflow: hidden;
    background: linear-gradient(to bottom, var(--sky-top, #1b2f3a), var(--sky-bot, #3a9d7a) 78%); }
  .orb { position: absolute; left: 0; top: 0; width: 0; height: 0; will-change: transform; opacity: 0; }

  /* Sol: núcleo + halos + dos capas de rayos que giran en sentidos opuestos */
  .sunwrap .sun { position: absolute; left: 0; top: 0; width: 92px; height: 92px; margin: -46px 0 0 -46px; border-radius: 50%;
    background: radial-gradient(circle at 38% 34%, #fffbe0 0, rgb(var(--sun-rgb, 255,200,100)) 62%);
    box-shadow: 0 0 50px 20px rgba(var(--sun-rgb, 255,200,100), .5), 0 0 150px 70px rgba(var(--sun-rgb, 255,200,100), .22), 0 0 320px 140px rgba(var(--sun-rgb, 255,200,100), .1); }
  .rays { position: absolute; left: 0; top: 0; width: 760px; height: 760px; margin: -380px 0 0 -380px; border-radius: 50%;
    background: repeating-conic-gradient(rgba(var(--sun-rgb, 255,200,100), .2) 0 3deg, transparent 3deg 11deg);
    -webkit-mask: radial-gradient(circle, #000 8%, transparent 68%); mask: radial-gradient(circle, #000 8%, transparent 68%);
    animation: spin 80s linear infinite; }
  .rays.r2 { width: 560px; height: 560px; margin: -280px 0 0 -280px;
    background: repeating-conic-gradient(from 5deg, rgba(255,255,255,.14) 0 2deg, transparent 2deg 9deg);
    animation-duration: 55s; animation-direction: reverse; }
  .hglow { position: absolute; left: 0; top: 0; width: 1500px; height: 900px; margin: -450px 0 0 -750px; border-radius: 50%;
    background: radial-gradient(closest-side, rgba(var(--glow, 255,150,80), .65), rgba(var(--glow, 255,150,80), .22) 50%, transparent);
    mix-blend-mode: screen; opacity: 0; will-change: transform; }                /* resplandor del horizonte */
  .flares { position: absolute; inset: 0; pointer-events: none; }
  .flare { position: absolute; left: 0; top: 0; border-radius: 50%; mix-blend-mode: screen; opacity: 0; will-change: transform; }

  /* Luna: creciente con cráteres, halo y anillo */
  .moon { position: absolute; left: 0; top: 0; width: 76px; height: 76px; margin: -38px 0 0 -38px; filter: drop-shadow(0 0 12px rgba(214,226,255,.6)); }
  .moon-halo { position: absolute; left: 0; top: 0; width: 420px; height: 420px; margin: -210px 0 0 -210px; border-radius: 50%;
    background: radial-gradient(circle, rgba(190,210,255,.28) 0, rgba(190,210,255,.1) 30%, transparent 62%); }
  .moon-halo::after { content: ""; position: absolute; inset: 27%; border-radius: 50%;
    border: 1px solid rgba(210,225,255,.13); box-shadow: 0 0 30px rgba(190,210,255,.08); }

  /* Estrellas (colores y brillos distintos), Vía Láctea y estrellas fugaces */
  .stars { position: absolute; inset: 0 0 var(--field-h) 0; opacity: var(--night, 0);
    -webkit-mask: linear-gradient(#000 55%, transparent); mask: linear-gradient(#000 55%, transparent); }
  .stars i { position: absolute; width: var(--z); height: var(--z); border-radius: 50%; background: var(--sc, #eaf1ff);
    box-shadow: 0 0 calc(var(--z) * 2.5) var(--sc, #eaf1ff);
    animation: tw var(--td, 3.2s) ease-in-out infinite alternate; animation-delay: var(--dl, 0s); }
  .stars i.b::before, .stars i.b::after { content: ""; position: absolute; left: 50%; top: 50%; width: calc(var(--z) * 7); height: 1px;
    translate: -50% -50%; background: linear-gradient(90deg, transparent, #fff, transparent); opacity: .8; }
  .stars i.b::after { rotate: 90deg; }
  @keyframes tw { from { opacity: .3; } to { opacity: 1; } }
  .milky { position: absolute; left: -10%; top: 6%; width: 120%; height: 36%; rotate: -16deg; pointer-events: none;
    opacity: calc(var(--night, 0) * .9); }
  .milky::before { content: ""; position: absolute; inset: 0; filter: blur(16px);
    background: radial-gradient(ellipse 60% 48% at 50% 50%, rgba(200,205,255,.24), rgba(150,140,220,.1) 45%, transparent 75%); }
  .milky::after { content: ""; position: absolute; inset: 0; opacity: .5;
    background-image: radial-gradient(circle, #fff 0 .7px, transparent 1.4px), radial-gradient(circle, #cfd6ff 0 .6px, transparent 1.2px);
    background-size: 19px 17px, 11px 13px; background-position: 0 0, 5px 7px;
    -webkit-mask: radial-gradient(ellipse 55% 45% at 50% 50%, #000, transparent 80%); mask: radial-gradient(ellipse 55% 45% at 50% 50%, #000, transparent 80%); }
  .shoot { position: absolute; width: 140px; height: 2px; border-radius: 2px; rotate: 25deg; opacity: 0;
    background: linear-gradient(90deg, rgba(255,255,255,0), #fff); filter: drop-shadow(0 0 6px #fff); animation: shoot 1s ease-out forwards; }
  @keyframes shoot { 0% { opacity: 0; translate: 0 0; } 15% { opacity: 1; } 100% { opacity: 0; translate: 380px 177px; } }

  /* Nubes en 3 capas (color según la hora), pájaros de día */
  .clouds, .birds { position: absolute; left: 0; right: 0; top: 0; bottom: var(--field-h); container-type: inline-size; pointer-events: none; }
  .cloud { position: absolute; left: 0; top: var(--ty); width: var(--cw); translate: -460px 0; opacity: var(--co, .8);
    filter: blur(var(--cb, 0px)); animation: drift var(--cd, 120s) linear infinite; animation-delay: var(--cdl, 0s); }
  .cloud { display: block; height: auto; }
  @keyframes drift { from { translate: -460px 0; } to { translate: calc(100cqw + 60px) 0; } }
  .birds { opacity: var(--day, 0); }
  .flock { position: absolute; left: 0; top: var(--fy); translate: -140px 0; animation: fly var(--fd, 50s) linear infinite; animation-delay: var(--fdl, 0s); }
  .bd { position: absolute; width: 22px; color: rgba(14,32,28,.75); transform-origin: 50% 80%;
    animation: flap var(--fl, .5s) ease-in-out infinite alternate; }
  .bd svg { display: block; width: 100%; }
  @keyframes fly { from { translate: -140px 0; } to { translate: calc(100cqw + 60px) 0; } }
  @keyframes flap { to { scale: 1 .4; } }

  /* Luciérnagas, neblina, tinte de luz sobre el campo y faros */
  .flies { position: absolute; left: 0; right: 0; bottom: calc(var(--field-h) - 80px); height: 170px; z-index: 1;
    opacity: var(--night, 0); pointer-events: none; }
  .flies i { position: absolute; width: 3px; height: 3px; border-radius: 50%; background: #e2ff8a; box-shadow: 0 0 8px 3px rgba(200,255,100,.7);
    animation: wander var(--fd, 7s) ease-in-out infinite alternate, blink var(--bd, 2s) ease-in-out infinite; animation-delay: var(--dl, 0s); }
  @keyframes wander { to { translate: var(--fx) var(--fy); } }
  @keyframes blink { 0%, 100% { opacity: .1; } 50% { opacity: 1; } }
  .mist { position: absolute; left: -10%; right: -10%; bottom: calc(var(--field-h) - 70px); height: 170px; z-index: 1; pointer-events: none;
    opacity: var(--mist, .3); filter: blur(6px); animation: mistmove 22s ease-in-out infinite alternate;
    background: radial-gradient(ellipse 50% 60% at 30% 100%, rgba(255,255,255,.45), transparent 70%), radial-gradient(ellipse 45% 55% at 75% 100%, rgba(255,255,255,.35), transparent 70%); }
  @keyframes mistmove { from { translate: -3% 0; } to { translate: 3% 0; } }
  .tint { position: absolute; left: 0; right: 0; bottom: 0; height: calc(var(--field-h) + 20px); z-index: 2; pointer-events: none;
    mix-blend-mode: soft-light; background: var(--tint, transparent);
    -webkit-mask: linear-gradient(transparent, #000 45%); mask: linear-gradient(transparent, #000 45%); }   /* sin borde duro sobre el cielo */
  .truck svg polygon { opacity: calc(.3 + var(--night, 0) * .55); }
  .agro-field, .road-far, .road-near { filter: brightness(var(--land, 1)); }

  /* ===== Carretera con camiones (efecto de avance) ===== */
  .agro-road { position: absolute; inset: auto 0 0 0; height: 126px; z-index: 2; pointer-events: none; container-type: inline-size; }
  .road-far, .road-near { position: absolute; left: 0; right: 0; bottom: 64px; background-repeat: repeat-x; background-position: 0 100%; }
  .road-far  { height: 34px; background-size: 240px 34px; animation: sc-far 12s linear infinite;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='34'%3E%3Cg fill='%23173a2a'%3E%3Ccircle cx='20' cy='18' r='12'/%3E%3Ccircle cx='38' cy='22' r='9'/%3E%3Ccircle cx='96' cy='20' r='10'/%3E%3Ccircle cx='150' cy='17' r='13'/%3E%3Ccircle cx='170' cy='23' r='9'/%3E%3Ccircle cx='214' cy='20' r='11'/%3E%3C/g%3E%3Cg fill='%2312281d'%3E%3Crect x='19' y='26' width='3' height='8'/%3E%3Crect x='95' y='27' width='3' height='7'/%3E%3Crect x='149' y='26' width='3' height='8'/%3E%3Crect x='213' y='27' width='3' height='7'/%3E%3C/g%3E%3C/svg%3E"); }
  .road-near { height: 28px; background-size: 90px 28px; animation: sc-near 1.5s linear infinite;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='90' height='28'%3E%3Cpath d='M0 9H90M0 17H90' stroke='%23357f5c' stroke-width='1.2'/%3E%3Ccircle cx='18' cy='13' r='5' fill='%232a6a4a'/%3E%3Ccircle cx='28' cy='19' r='4' fill='%23245c40'/%3E%3Ccircle cx='62' cy='12' r='5' fill='%232a6a4a'/%3E%3Ccircle cx='72' cy='18' r='4' fill='%23245c40'/%3E%3Crect x='43' y='3' width='3' height='25' fill='%23516d5e'/%3E%3C/svg%3E"); }
  .road-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 66px; background: #0c1511; border-top: 2px solid #2a3a32; }
  .road-bar::after {
    content: ""; position: absolute; left: 0; right: 0; top: 31px; height: 3px; opacity: .7;
    background: repeating-linear-gradient(90deg, #d9d28a 0 28px, transparent 28px 60px); background-size: 60px 3px;
    animation: sc-dash 1s linear infinite;
  }
  .truck { position: absolute; bottom: 4px; left: 0; width: calc(var(--tw, 165px) * var(--k, 1)); z-index: 3; translate: -999px 0;
    transform-origin: 50% 100%; transition: transform .8s ease; }
  .truck svg { display: block; width: 100%; animation: bob .5s ease-in-out infinite alternate;
    filter: brightness(calc(.5 + var(--land, 1) * .5)); }
  .truck.near { z-index: 4; }                                                /* carril cercano (abajo) → */
  .truck.farl { bottom: 36px; transform: scale(.88); z-index: 3; }          /* carril lejano (arriba) ← */
  .truck.stop svg { animation: idle .22s ease-in-out infinite alternate; }    /* motor en ralentí */
  .truck.stop .wheel { animation-play-state: paused; }
  .truck.rev .wheel { animation-direction: reverse; }
  .agro-road.halt .road-far, .agro-road.halt .road-near, .agro-road.halt .road-bar::after { animation-play-state: paused; }

  /* Globo de diálogo estilo comic */
  .bubble { position: absolute; left: 50%; bottom: calc(100% + 6px); width: max-content; max-width: 230px;
    padding: 8px 12px; border-radius: 14px; background: #fffbe8; color: #16261e; text-align: center;
    font: 600 13px/1.3 system-ui, sans-serif; box-shadow: 0 6px 18px rgba(0,0,0,.35);
    opacity: 0; transform: translateX(-50%) scale(.6); transform-origin: 50% 100%;
    transition: opacity .2s, transform .25s cubic-bezier(.3, 1.6, .5, 1); }
  .bubble::after { content: ""; position: absolute; left: 50%; top: 100%; margin-left: -7px;
    border: 7px solid transparent; border-top-color: #fffbe8; }
  .bubble.on { opacity: 1; transform: translateX(-50%) scale(1); }
  .wheel { transform-box: fill-box; transform-origin: center; animation: spin .45s linear infinite; }
  @keyframes idle   { to { translate: .7px -.8px; } }
  @keyframes bob    { to { translate: 0 -1.5px; } }
  @keyframes spin   { to { rotate: 360deg; } }
  @keyframes sc-far  { to { background-position-x: -240px; } }
  @keyframes sc-near { to { background-position-x: -90px; } }
  @keyframes sc-dash { to { background-position-x: -60px; } }

  @media (max-width: 820px) {
    .agro-road { --tw: 120px; }
  }
  @media (prefers-reduced-motion: reduce) {
    .fruit svg, .stars i, .road-far, .road-near, .road-bar::after, .truck, .truck svg, .wheel { animation: none; }
    .truck { translate: 8cqw 0; }
    .rays, .moon-halo, .cloud, .flock, .bd, .shoot, .flies i, .mist, .fruit::before { animation: none; }
    .cloud { translate: calc(var(--cx, 20) * 1cqw) 0; }
    .flock, .shoot { display: none; }
    .truck.farl, .truck.tail { display: none; }
    .fruit, .agro-word { transition: none; }
  }

/*
 * Izquierda: texto pegado a la izq, un poco más abajo del centro
 * Derecha: cultivos centrados en su mitad, misma altura baja
 */
.agro-layout {
    position: absolute;
    inset: 0;
    z-index: 3;
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
    pointer-events: none;
    padding:
        clamp(16px, 3vh, 36px)
        clamp(16px, 3vw, 40px)
        calc(var(--field-h, 240px) + 8px);
    box-sizing: border-box;
}

.agro-copy {
    grid-column: 1;
    justify-self: start;
    align-self: center;
    margin-top: clamp(88px, 22vh, 220px);
    padding-left: clamp(4px, 1vw, 12px);
    text-align: left;
    max-width: min(440px, 92%);
    width: 100%;
    z-index: 5;
    pointer-events: none;
    text-shadow: 0 2px 18px rgba(0, 0, 0, 0.45);
}

.agro-lema {
    margin: 0 0 10px;
    font-size: clamp(0.72rem, 1.35vw, 0.88rem);
    font-weight: 700;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--accent, #34d399);
}

.agro-copy h1 {
    margin: 0 0 12px;
    font-family: "Fraunces", Georgia, "Times New Roman", serif;
    font-size: clamp(2.35rem, 5.5vw, 4rem);
    font-weight: 600;
    line-height: 1.05;
    letter-spacing: -0.02em;
    color: var(--text, #e8f5ee);
}

.agro-lead {
    margin: 0 0 8px;
    font-size: clamp(1.05rem, 2.1vw, 1.35rem);
    font-weight: 500;
    line-height: 1.35;
    color: var(--text, #e8f5ee);
}

.agro-word {
    display: inline-block;
    font-weight: 700;
    color: var(--accent, #34d399);
    transition: color 0.25s ease, opacity 0.2s ease, transform 0.25s ease;
}
.agro-word.is-out {
    opacity: 0;
    transform: translateY(5px);
}
.agro-word.is-uva-green { color: #6b9a3a; }
.agro-word.is-uva { color: var(--grape, #7c4dbd); }
.agro-word.is-granada { color: var(--pome, #c2273d); }
.agro-word.is-palta { color: var(--avo, #6b9a3a); }
.agro-word.is-arandanos { color: var(--berry, #3f5fb5); }

.agro-sub {
    margin: 0;
    font-size: clamp(0.85rem, 1.45vw, 1rem);
    color: var(--muted, #8fb3a1);
    line-height: 1.4;
}

/* Cultivos: un poco más grandes, pegados a la derecha, más abajo */
.agro-layout .fruits {
    grid-column: 2;
    justify-self: end;
    align-self: center;
    margin-top: clamp(88px, 22vh, 220px);
    position: relative;
    left: auto;
    top: auto;
    translate: none;
    width: min(420px, 86%);
    height: clamp(210px, 34vh, 320px);
    z-index: 4;
    pointer-events: auto;
}

.agro-field {
    z-index: 1;
}

@media (max-width: 900px) {
    .agro-layout {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto;
        row-gap: 20px;
        align-content: center;
    }
    .agro-copy {
        grid-column: 1;
        max-width: min(520px, 94%);
    }
    .agro-layout .fruits {
        grid-column: 1;
        width: min(480px, 94%);
        height: clamp(200px, 32vh, 300px);
    }
}
