/* Inicio explorable: progreso, índice lateral, marquesina, dos frentes, archivo, proceso, materiales y contacto.
   Todo está acotado a body.home para no tocar las demás páginas. */

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* Aparición al hacer scroll (solo si hay JS) */
html.js body.home .rev { opacity: 0; transform: translateY(26px); transition: opacity .7s ease, transform .7s cubic-bezier(.2,.7,.2,1); transition-delay: var(--d, 0s); }
html.js body.home .rev.visto { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { html.js body.home .rev { opacity: 1; transform: none; transition: none; } }

/* Barra de progreso de lectura */
body.home .progreso { position: fixed; left: 0; top: 0; right: 0; height: 3px; z-index: 1200; pointer-events: none; }
body.home .progreso i { display: block; height: 100%; transform-origin: 0 50%; transform: scaleX(0); background: var(--cromo); box-shadow: 0 0 12px rgba(126,232,255,.55); }

/* Índice lateral: puntos que muestran dónde estás */
body.home .rail { position: fixed; left: 18px; top: 50%; transform: translateY(-50%); z-index: 900; display: flex; flex-direction: column; gap: 14px; }
body.home .rail a { position: relative; display: block; width: 10px; height: 10px; border: 1px solid #8a8a85; border-radius: 50%; transition: background .25s, border-color .25s, transform .25s; }
body.home .rail a span { position: absolute; left: 22px; top: 50%; transform: translateY(-50%) translateX(-6px); white-space: nowrap; font: 700 10px/1 var(--mono); letter-spacing: 2px; text-transform: uppercase; color: #fff; opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; background: #000; padding: 5px 8px; border: 1px solid #333; border-radius: 6px; }
body.home .rail a:hover span, body.home .rail a:focus-visible span { opacity: 1; transform: translateY(-50%); }
body.home .rail a.activo { background: var(--cromo); border-color: transparent; transform: scale(1.35); }
@media (max-width: 1100px) { body.home .rail { display: none; } }

/* Aviso de exploración en el hero */
body.home .hero-explora { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); font: 700 11px/1 var(--mono); letter-spacing: 3px; text-transform: uppercase; color: #bbb; text-decoration: none; display: inline-flex; align-items: center; gap: 10px; }
body.home .hero-explora b { display: inline-block; animation: hm-baja 1.6s ease-in-out infinite; color: #7ee8ff; }
@keyframes hm-baja { 0%,100% { transform: translateY(0); } 50% { transform: translateY(5px); } }
@media (prefers-reduced-motion: reduce) { body.home .hero-explora b { animation: none; } }
body.home .y2k-hero { position: relative; }
body.home .y2k-hero__vis { --mx: 50%; --my: 50%; }
body.home .destello { position: absolute; inset: 0; pointer-events: none; border-radius: inherit; background: radial-gradient(circle at var(--mx) var(--my), rgba(126,232,255,.22), transparent 38%); mix-blend-mode: screen; opacity: 0; transition: opacity .3s; }
body.home .y2k-hero__vis:hover .destello { opacity: 1; }

/* Marquesina */
body.home .marquesina { overflow: hidden; border-block: 1px solid #1c1c1c; background: #050505; padding: 14px 0; }
body.home .marquesina__pista { display: flex; width: max-content; animation: hm-marquesina 38s linear infinite; }
body.home .marquesina:hover .marquesina__pista { animation-play-state: paused; }
body.home .marquesina span { font: 700 13px/1 var(--mono); letter-spacing: 4px; text-transform: uppercase; color: #8a8a85; padding-right: 36px; white-space: nowrap; }
body.home .marquesina span i { font-style: normal; color: #b9a7ff; margin-left: 36px; }
@keyframes hm-marquesina { to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { body.home .marquesina__pista { animation: none; } }

/* Secciones */
body.home .seccion { max-width: 1240px; margin: 0 auto; padding: 96px 40px 24px; }
body.home .seccion__cab { margin-bottom: 40px; max-width: 760px; }
body.home .seccion__cab h2 { font: 700 clamp(28px, 4.6vw, 56px)/1.08 var(--display); text-transform: uppercase; letter-spacing: -1px; margin: 14px 0 16px; }
body.home .seccion__cab h2 em { font-style: normal; background: var(--cromo); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
body.home .seccion__cab p { color: #a9a9a4; font-size: 16px; line-height: 1.7; max-width: 620px; }

/* Dos frentes */
body.home .frentes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 22px; perspective: 1200px; }
body.home .frente { position: relative; display: flex; flex-direction: column; border: 1px solid #262626; border-radius: 18px; overflow: hidden; background: #070707; text-decoration: none; color: #fff; transform: perspective(1000px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); transition: transform .18s ease-out, border-color .25s, box-shadow .25s; will-change: transform; }
body.home .frente:hover { border-color: #b9a7ff; box-shadow: 0 24px 60px rgba(185,167,255,.14); }
body.home .frente__img { aspect-ratio: 4 / 3; background: #0b0b0b; overflow: hidden; }
body.home .frente__img img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .6s cubic-bezier(.2,.7,.2,1); }
body.home .frente:hover .frente__img img { transform: scale(1.06); }
body.home .frente__txt { padding: 26px 26px 30px; display: flex; flex-direction: column; gap: 12px; }
body.home .frente__txt h3 { font: 700 22px/1.2 var(--display); text-transform: uppercase; letter-spacing: -.3px; }
body.home .frente__txt p { color: #aaa; font-size: 14px; line-height: 1.7; }
body.home .frente__cta { margin-top: 6px; font: 700 12px/1 var(--mono); letter-spacing: 2px; text-transform: uppercase; color: #7ee8ff; }
body.home .frente__cta::after { content: ' →'; display: inline-block; transition: transform .25s; }
body.home .frente:hover .frente__cta::after { transform: translateX(6px); }

/* Archivo (galería de Sanity) */
body.home #proyectos { padding-bottom: 8px; }
body.home main .gallery { max-width: 1240px; padding: 0 40px; margin: 0 auto; }
body.home .ver-todo { display: inline-block; margin: 18px 40px 0; font: 700 12px/1 var(--mono); letter-spacing: 2px; text-transform: uppercase; color: #fff; text-decoration: none; border-bottom: 1px solid #b9a7ff; padding-bottom: 6px; }
body.home .ver-todo-wrap { max-width: 1240px; margin: 0 auto; }

/* Proceso */
body.home .proceso { list-style: none; display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; position: relative; counter-reset: paso; }
body.home .proceso::before { content: ''; position: absolute; left: 0; right: 0; top: 22px; height: 2px; background: linear-gradient(90deg, #e8e8ee, #b9a7ff, #7ee8ff); opacity: .35; }
body.home .paso { position: relative; padding-top: 52px; counter-increment: paso; }
body.home .paso::before { content: counter(paso, decimal-leading-zero); position: absolute; top: 0; left: 0; width: 46px; height: 46px; display: grid; place-items: center; font: 700 13px/1 var(--mono); color: #000; background: var(--cromo); border-radius: 50%; box-shadow: 0 0 0 6px #000; }
body.home .paso h3 { font: 700 17px/1.2 var(--display); text-transform: uppercase; margin-bottom: 10px; }
body.home .paso p { color: #a9a9a4; font-size: 14px; line-height: 1.7; }
body.home .paso small { display: block; margin-top: 12px; font: 400 11px/1.5 var(--mono); letter-spacing: 1px; color: #7ee8ff; text-transform: uppercase; }

/* Materiales */
body.home .materiales { display: grid; grid-template-columns: 1fr 1.1fr; gap: 28px; align-items: stretch; }
body.home .mat-lista { display: flex; flex-direction: column; gap: 10px; }
body.home .mat-lista button { text-align: left; background: #070707; color: #bbb; border: 1px solid #262626; border-radius: 14px; padding: 18px 20px; font: 700 15px/1.3 var(--display); text-transform: uppercase; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 12px; transition: border-color .2s, color .2s, background .2s, transform .2s; }
body.home .mat-lista button small { font: 400 11px/1.4 var(--mono); letter-spacing: 1px; color: #777; text-transform: none; }
body.home .mat-lista button:hover { border-color: #666; color: #fff; transform: translateX(4px); }
body.home .mat-lista button[aria-selected="true"] { border-color: #b9a7ff; color: #fff; background: #0d0b18; }
body.home .mat-lista button:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
body.home .mat-panel { position: relative; border-radius: 18px; border: 1px solid #262626; overflow: hidden; min-height: 340px; display: flex; align-items: flex-end; background: #111; }
body.home .mat-panel .muestra { position: absolute; inset: 0; transition: opacity .5s; opacity: 0; }
body.home .mat-panel .muestra.on { opacity: 1; }
body.home .mat-panel .muestra::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 35%, rgba(0,0,0,.82)); }
body.home .m-concreto { background: radial-gradient(circle at 25% 20%, #c5c5ce, transparent 55%), linear-gradient(135deg, #a3a3ad, #6a6a74); }
body.home .m-concreto::before { content: ''; position: absolute; inset: 0; opacity: .5; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 .9 0'/></filter><rect width='200' height='200' filter='url(%23n)' opacity='.55'/></svg>"); }
body.home .m-madera { background: repeating-linear-gradient(92deg, rgba(0,0,0,.0) 0 7px, rgba(60,30,10,.22) 7px 9px, rgba(0,0,0,0) 9px 21px), linear-gradient(110deg, #c89363, #94653a 55%, #b57e4d); }
body.home .m-plastico { background: repeating-linear-gradient(0deg, rgba(255,255,255,.14) 0 2px, rgba(0,0,0,0) 2px 7px), linear-gradient(135deg, #b9a7ff, #5b4fb8 60%, #7ee8ff); }
body.home .m-carton { background: repeating-linear-gradient(90deg, rgba(110,75,40,.28) 0 3px, rgba(0,0,0,0) 3px 9px), linear-gradient(180deg, #d8b88a, #b8905c); }
body.home .m-papel { background: radial-gradient(circle at 70% 25%, #fff, transparent 55%), repeating-linear-gradient(45deg, rgba(0,0,0,.05) 0 1px, rgba(0,0,0,0) 1px 6px), linear-gradient(135deg, #f1ece1, #cfc7b6); }
body.home .mat-panel .mat-info { position: relative; z-index: 1; padding: 28px; }
body.home .mat-panel h3 { font: 700 26px/1.1 var(--display); text-transform: uppercase; }
body.home .mat-panel p { margin-top: 10px; color: #e4e4e0; font-size: 15px; line-height: 1.6; max-width: 440px; }

/* Contacto */
body.home .cierre-home { max-width: 1240px; margin: 0 auto; padding: 110px 40px 70px; text-align: center; }
body.home .cierre-home h2 { font: 700 clamp(30px, 6vw, 72px)/1.05 var(--display); text-transform: uppercase; letter-spacing: -1.5px; margin: 14px 0 22px; }
body.home .cierre-home h2 em { font-style: normal; background: var(--cromo); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
body.home .cierre-home p { color: #a9a9a4; max-width: 520px; margin: 0 auto 30px; line-height: 1.7; }
body.home .cierre-acciones { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
body.home .copiar { font-family: var(--mono); cursor: pointer; }
body.home .pie-home { max-width: 1240px; margin: 0 auto; padding: 0 40px 60px; display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; font: 400 11px/1.6 var(--mono); letter-spacing: 2px; text-transform: uppercase; color: #6f6f6a; border-top: 1px solid #161616; padding-top: 26px; }
body.home .pie-home a { color: #9a9a95; text-decoration: none; }
body.home .pie-home a:hover { color: #fff; }

@media (max-width: 900px) {
  body.home .seccion { padding: 64px 20px 12px; }
  body.home .frentes { grid-template-columns: 1fr; }
  body.home .proceso { grid-template-columns: 1fr; gap: 28px; }
  body.home .proceso::before { left: 22px; right: auto; top: 0; bottom: 0; width: 2px; height: auto; }
  body.home .paso { padding: 0 0 0 66px; min-height: 46px; }
  body.home .materiales { grid-template-columns: 1fr; }
  body.home .mat-panel { min-height: 260px; }
  body.home main .gallery { padding: 0 20px; }
  body.home .ver-todo { margin-left: 20px; }
  body.home .cierre-home { padding: 72px 20px 48px; }
  body.home .pie-home { padding-inline: 20px; }
  body.home .hero-explora { display: none; }
}

body.home .copiar { background: transparent; color: #fff; border: 1px solid #3a3a3a; }
body.home .copiar:hover { border-color: #b9a7ff; }

/* ===== Cada vista, un póster: en pantallas grandes cada sección ocupa exactamente la pantalla y nada queda cortado ===== */
@media (min-width: 901px) and (min-height: 560px) {
  html { scroll-snap-type: y proximity; scroll-padding-top: var(--hh, 66px); }
  body.home .y2k-hero,
  body.home .seccion,
  body.home .cierre-home { min-height: calc(100svh - var(--hh, 66px)); scroll-snap-align: start; }
  body.home .seccion,
  body.home .cierre-home { display: flex; flex-direction: column; justify-content: center; padding-top: 28px; padding-bottom: 28px; margin-bottom: 0; }
  body.home .seccion__cab { margin-bottom: clamp(18px, 4vh, 44px); }
  body.home .seccion__cab h2 { font-size: clamp(28px, 7.4vh, 64px); margin: 10px 0 0; }

  /* Dos frentes */
  body.home .frente__img { aspect-ratio: auto; height: clamp(150px, 36vh, 420px); }
  body.home .frente__txt { padding: 18px 22px 22px; gap: 8px; }
  body.home .frente__txt h3 { font-size: clamp(16px, 2.6vh, 22px); }
  body.home .frente__txt p { font-size: 14px; line-height: 1.5; }

  /* Archivo: cuatro tarjetas en una sola fila */
  body.home #proyectos { padding-bottom: 0; min-height: 0; justify-content: flex-end; }
  body.home .archivo-poster { min-height: calc(100svh - var(--hh, 66px)); display: flex; flex-direction: column; justify-content: center; scroll-snap-align: start; }
  body.home .archivo-poster #proyectos { min-height: 0; padding-bottom: 0; }
  body.home .archivo-poster main { margin: 0; }
  body.home .archivo-poster .gallery { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; column-count: auto; }
  body.home .archivo-poster .gallery-item { margin: 0; background: #070707; }
  body.home .archivo-poster .gallery-item img { height: clamp(180px, 46vh, 520px); object-fit: cover; width: 100%; }
  body.home .archivo-poster .gallery-item .post-tags { display: flex; padding: 0 14px 14px; gap: 6px; flex-wrap: wrap; }
  body.home .archivo-poster .gallery-item h3 { padding: 12px 14px 14px; font-size: 14px; }
  body.home .archivo-poster .ver-todo-wrap { margin-top: 6px; }
  body.home .archivo-poster #gallery-loading { min-height: 30vh !important; }

  /* Proceso, materiales y contacto */
  body.home .paso h3 { font-size: clamp(16px, 2.8vh, 24px); }
  body.home .paso p { font-size: clamp(14px, 2.2vh, 17px); }
  body.home .mat-panel { min-height: clamp(260px, 46vh, 520px); }
  body.home .mat-lista button { padding: clamp(10px, 2vh, 18px) 20px; }
  body.home .cierre-home h2 { font-size: clamp(32px, 9vh, 84px); }
}

/* Ajuste fino del póster: títulos en una o dos líneas y imágenes que escalan con la altura de la pantalla */
@media (min-width: 901px) and (min-height: 560px) {
  body.home .seccion__cab { max-width: none; margin-bottom: clamp(14px, 3vh, 34px); }
  body.home .seccion__cab h2 { font-size: clamp(26px, 6vh, 56px); line-height: 1.04; }
  body.home .frente__img { height: clamp(130px, 31vh, 380px); }
  body.home .frente__txt { padding: 14px 20px 18px; gap: 6px; }
  body.home .archivo-poster .gallery-item img { height: clamp(150px, 37vh, 440px); }
  body.home .paso { padding-top: 48px; }
  body.home .mat-panel { min-height: clamp(240px, 44vh, 480px); }
  body.home .mat-lista button { padding: clamp(8px, 1.8vh, 16px) 18px; font-size: clamp(12px, 2vh, 15px); }
}

/* El hero también es una pantalla completa: la foto se adapta a la altura disponible */
@media (min-width: 901px) and (min-height: 560px) {
  body.home .y2k-hero { height: calc(100svh - var(--hh, 66px)); min-height: 0; padding-top: 2vh; padding-bottom: 5vh; box-sizing: border-box; align-items: center; }
  body.home .y2k-hero__vis { aspect-ratio: auto; height: min(74vh, 580px); max-height: none; }
  body.home .y2k-hero h1 { font-size: clamp(30px, 8.4vh, 64px); }
}

/* Ilustraciones de los servicios: completas, sin recortes, y más compactas */
body.home .frente__img { display: block; position: relative; }
body.home .frente__img img { object-fit: contain; width: 100%; height: 100%; position: absolute; inset: 0; }
@media (min-width: 901px) and (min-height: 560px) {
  body.home .frente__img { height: clamp(120px, 28vh, 320px); }
  html.js { scroll-snap-type: none; }
  body.home .pie-home { border-top: 0; padding: 18px 40px 0; margin-top: 4vh; max-width: 1240px; }
  body.home .cierre-home { padding-bottom: 8px; }
}

/* Tarjetas de servicios: ilustración cuadrada a la izquierda y texto a la derecha, para verla completa y bien grande */
@media (min-width: 901px) and (min-height: 560px) {
  body.home .frente { flex-direction: row; align-items: stretch; }
  body.home .frente__img { width: min(48%, 46vh); height: auto; aspect-ratio: 1 / 1; flex: none; }
  body.home .frente__txt { flex: 1; justify-content: center; padding: 18px 22px; }
}

/* Archivo: las portadas se ven completas (formato 4:5), sin recortes */
@media (min-width: 901px) and (min-height: 560px) {
  body.home .archivo-poster .gallery-item img { height: auto; aspect-ratio: 4 / 5; max-height: 44vh; width: 100%; object-fit: contain; background: #fff; }
}

@media (min-width: 901px) and (min-height: 560px) {
  /* Fotos horizontales (no portadas 4:5): llenan el marco */
  body.home .archivo-poster .gallery-item img.apaisada { object-fit: cover; }
}

/* Ajuste automático: si una pantalla no cabe, sus bloques se reducen proporcionalmente (variable --k calculada en home.js) */
@media (min-width: 901px) and (min-height: 560px) {
  body.home .seccion > *, body.home .cierre-home > *, body.home .archivo-poster > * { zoom: var(--k, 1); }
  body.home .archivo-poster .gallery-item img { max-height: 40vh; }
}

/* ===== Celular y tablet: cada vista ocupa la pantalla y cada deslizamiento cae exactamente en una (ajuste nativo obligatorio) ===== */
@media (max-width: 900px), (pointer: coarse) {
  html.js { scroll-snap-type: y mandatory; }
  body.home .y2k-hero, body.home .seccion, body.home .cierre-home, body.home .archivo-poster { scroll-snap-align: start; scroll-snap-stop: always; }
  body.home .archivo-poster > .seccion { scroll-snap-align: none; scroll-snap-stop: normal; }
}
@media (max-width: 900px) {
  html.js { scroll-padding-top: var(--hh, 60px); }
  body.home .y2k-hero { min-height: calc(100svh - var(--hh, 60px)); scroll-margin-top: 0; }
  body.home .seccion, body.home .cierre-home { min-height: calc(100svh - var(--hh, 60px)); box-sizing: border-box; display: flex; flex-direction: column; justify-content: center; padding-top: 30px; padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
  body.home .archivo-poster { min-height: calc(100svh - var(--hh, 60px)); box-sizing: border-box; display: flex; flex-direction: column; justify-content: center; padding-block: 24px; }
  body.home .archivo-poster > .seccion { min-height: 0; padding-block: 0 12px; }
  body.home .pie-home { margin-top: 24px; }
}
@media (prefers-reduced-motion: reduce) { html.js { scroll-snap-type: none; } }

/* Celular: tarjetas compactas y ajuste automático para que cada vista quepa completa en la pantalla */
@media (max-width: 900px) {
  body.home .seccion > *, body.home .cierre-home > *, body.home .archivo-poster > * { zoom: var(--k, 1); }
  body.home .seccion__cab { margin-bottom: 16px; }
  body.home .seccion__cab h2 { font-size: clamp(24px, 8vw, 34px); margin: 10px 0 8px; }
  body.home .seccion__cab p { font-size: 14px; line-height: 1.55; }
  body.home .frentes { gap: 12px; }
  body.home .frente { flex-direction: row; }
  body.home .frente__img { width: 36%; flex: none; height: auto; aspect-ratio: 1 / 1; }
  body.home .frente__txt { padding: 12px 14px; gap: 4px; justify-content: center; }
  body.home .frente__txt h3 { font-size: 15px; }
  body.home .frente__txt p { font-size: 12.5px; line-height: 1.45; }
  body.home .frente__cta { margin-top: 2px; font-size: 11px; }
}
@media (max-width: 900px) {
  body.home .y2k-hero > * { zoom: var(--k, 1); }
  body.home .archivo-poster .gallery-item img { max-height: 26svh; object-fit: contain; background: #fff; }
}

/* En móvil, el índice lateral se convierte en una guía táctil de secciones. */
@media (max-width: 1100px), (pointer: coarse) {
  body.home .rail {
    display: flex;
    position: fixed;
    left: 12px; right: 84px; top: auto;
    bottom: calc(10px + env(safe-area-inset-bottom));
    transform: none;
    flex-direction: row;
    gap: 3px;
    width: auto;
    max-width: none;
    padding: 5px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    border: 1px solid #35323f;
    border-radius: 999px;
    background: rgba(8,8,11,.94);
    backdrop-filter: blur(14px);
    box-shadow: 0 8px 30px rgba(0,0,0,.42);
  }
  body.home .rail::-webkit-scrollbar { display: none; }
  body.home .rail a {
    position: relative;
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 7px;
    width: auto; height: 36px;
    padding: 0 11px;
    border: 0;
    border-radius: 999px;
    color: #aaa;
    text-decoration: none;
  }
  body.home .rail a::before { content: ''; width: 6px; height: 6px; flex: 0 0 6px; border: 1px solid #888; border-radius: 50%; }
  body.home .rail a span {
    position: static;
    transform: none;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font-size: 9px;
    letter-spacing: 1px;
    opacity: 1;
    pointer-events: auto;
  }
  body.home .rail a.activo { transform: none; background: #1a1821; color: #fff; }
  body.home .rail a.activo::before { background: var(--cromo); border-color: transparent; }
  body.home .rail a:focus-visible { outline: 2px solid #7ee8ff; outline-offset: 1px; }
  body.home .cierre-home { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
}
