/* ==========================================================================
   Ridge — réplica de OFFGRID (bicicleta gravel)
   Secciones: tokens · base · header · hero pinned (zoom 2,8×) · naranja ·
   dashboard · crema · producto · FAQ · footer · responsive · reduced motion
   ========================================================================== */

/* ---------- Tokens ---------- */
:root {
  /* Paleta (hex de la referencia) */
  --crema: #f0e6c8; /* titular del hero, texto sobre oscuro */
  --crema-2: #ddd6c4; /* fondo sección crema */
  --terracota: #b5602a; /* franja de roca al pie del hero */
  --naranja: #e8501d; /* sección naranja, gráfico, slider, botón */
  --oliva: #2a2d26; /* fondo dashboard */
  --gris-1: #5c5b57; /* desierto oscuro (fallback del fondo) */
  --gris-2: #8f8d86; /* desierto claro */
  --negro: #141412; /* tinta sobre naranja / crema */
  --negro-suave: #3a3a35;
  --producto: #ece4cf; /* fondo sección producto (inferido) */
  --footer: #1a1a17; /* fondo footer (inferido) */

  /* Tipografía: Archivo con eje wdth (condensada para display, normal para UI) */
  --font: "Archivo", "Archivo Narrow", "Helvetica Neue", Arial, sans-serif;
  --display-stretch: 68%;
  --display-weight: 800;

  /* Escala (1440) */
  --fs-h1: clamp(58px, 8.6vw, 124px);
  --fs-h1b: clamp(44px, 5.6vw, 80px);
  --fs-h2: clamp(44px, 6.3vw, 90px);
  --fs-h2s: clamp(40px, 5.6vw, 80px);
  --fs-lead: clamp(15px, 1.15vw, 17px);
  --fs-body: 14px;
  --fs-label: 9px;
  --fs-nav: 12px;

  /* Espaciado */
  --gutter: 5vw;
  --section-y: clamp(96px, 12vw, 176px);

  /* Movimiento */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in: cubic-bezier(0.55, 0, 1, 0.45);
  --dur: 0.75s;

  /* Progreso del hero (0–1), lo escribe app.js */
  --p: 0;
}

/* ---------- Base ---------- */
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--fs-body);
  line-height: 1.5;
  color: var(--crema);
  background: var(--negro);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
img {
  display: block;
  max-width: 100%;
}
a {
  color: inherit;
  text-decoration: none;
}
h1,
h2,
h3,
p,
figure,
dl,
dd {
  margin: 0;
}
:focus-visible {
  outline: 2px solid var(--naranja);
  outline-offset: 4px;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.wrap {
  width: min(100% - 2 * var(--gutter), 1320px);
  margin-inline: auto;
}

/* Titulares display: sans condensada extra-bold mayúsculas */
.display {
  font-family: var(--font);
  font-stretch: var(--display-stretch);
  font-weight: var(--display-weight);
  text-transform: uppercase;
  line-height: 0.9;
  letter-spacing: -0.01em;
}
.overline {
  font-size: var(--fs-label);
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  opacity: 0.85;
}
.lead {
  font-size: var(--fs-lead);
  line-height: 1.45;
}
.body {
  font-size: var(--fs-body);
  line-height: 1.55;
  max-width: 44ch;
}
.text-link {
  display: inline-block;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
  padding-bottom: 2px;
  border-bottom: 1px solid currentColor;
  transition: opacity 0.3s var(--ease-out);
}
.text-link:hover {
  opacity: 0.7;
}

/* ---------- Header ---------- */
.nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 26px var(--gutter);
  font-size: var(--fs-nav);
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--crema);
  transition: transform 0.6s var(--ease-out), opacity 0.4s;
}
.nav.is-hidden {
  transform: translateY(-100%);
  opacity: 0;
}
.wordmark {
  font-weight: 600;
  letter-spacing: 0.18em;
  font-size: 13px;
}
.wm-icon {
  font-weight: 400;
  letter-spacing: 0;
  margin-left: 2px;
}
.nav-link {
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s;
}
.nav-link:hover {
  border-color: currentColor;
}

/* ---------- Hero pinned ---------- */
.hero-wrap {
  position: relative;
  height: 350vh; /* 250 vh de pin + 100 vh que la sección naranja tapa por encima */
  z-index: 1;
}
.hero {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  background: linear-gradient(var(--gris-2), var(--gris-1));
}

/* Placa: mismo tamaño y posición para fondo y bici, en proporción de la foto (1672×941).
   Comportamiento "cover" alineado a la izquierda: la bici queda en x 20–90 %. */
.plate {
  position: absolute;
  top: 50%;
  left: 0;
  translate: 0 -50%;
  width: max(100%, calc(100vh * 1672 / 941));
  aspect-ratio: 1672 / 941;
}
.plate > img,
.bike-cut {
  width: 100%;
  height: 100%;
  object-fit: fill;
}

/* Capa 1: fondo quieto. Al escalar la bici, el fondo pierde foco (rack focus) y se oscurece. */
.plate-bg {
  z-index: 1;
}
/* Copia pre-desenfocada y oscurecida: se cruza con opacity (barato) en vez de filter por frame */
.plate-bg .bg-blur {
  position: absolute;
  inset: 0;
  opacity: min(1, calc(var(--p) * 2.2)); /* el fondo se desenfoca temprano y tapa el relleno */
  will-change: opacity;
}
.rock-band {
  position: absolute;
  inset: auto 0 0 0;
  height: 30%;
  background: linear-gradient(to bottom, transparent, var(--terracota) 60%);
  mix-blend-mode: color;
  opacity: 0.85;
}

/* Capa 2: texto del hero */
.hero-copy {
  position: absolute;
  z-index: 2;
  left: var(--gutter);
  top: 12%;
  width: 60%;
  opacity: calc(1 - var(--p) * 3.33); /* 1 → 0 en p 0–0,3 */
}
.hero-copy .overline {
  margin-bottom: 22px;
}
.hero-copy h1 {
  font-size: var(--fs-h1);
  color: var(--crema);
}
.hero-copy .lead {
  margin-top: 30px;
  color: var(--crema);
}
.hero-copy .text-link {
  margin-top: 26px;
  color: var(--crema);
}

/* Capa 3: bici recortada */
.plate-bike {
  z-index: 3;
  pointer-events: none;
}
.bike-rig {
  position: absolute;
  inset: 0;
  transform-origin: 68.96% 63.97%; /* buje delantero */
  will-change: transform;
}
.bike-idle,
.bike-cursor {
  position: absolute;
  inset: 0;
}
.bike-idle {
  animation: breathe 6s ease-in-out infinite;
}
@keyframes breathe {
  0%,
  100% {
    transform: translate(0, 0);
  }
  50% {
    transform: translate(0.5%, -0.6%);
  }
}
.bike-cut {
  position: absolute;
  inset: 0;
  /* bike-cut.webp trae la silueta en el canal alfa: no hace falta clip-path */
}
/* Sombra de contacto bajo cada rueda (escala con la bici) */
.contact-shadow {
  position: absolute;
  width: 22.7%;
  aspect-ratio: 380 / 56;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(10, 8, 6, 0.75), rgba(10, 8, 6, 0.35) 45%, transparent 72%);
  translate: -50% -50%;
  filter: blur(4px);
}
.shadow-rear {
  left: 29.55%;
  top: 85.6%;
}
.shadow-front {
  left: 68.96%;
  top: 85.8%;
}

/* Capa 4: texto 2 ("SEGUÍ EL QUIZÁS.") anclado a la derecha, x 60–92 % */
.hero-copy-2 {
  position: absolute;
  z-index: 4;
  left: 60%;
  right: 8%;
  top: 50%;
  translate: 0 -50%;
  opacity: 0; /* app.js: 0 → 1 en p 0,6–0,8 */
  color: var(--crema);
}
.hero-copy-2 h2 {
  font-size: var(--fs-h1b);
}
.hero-copy-2 .lead {
  margin-top: 24px;
}

/* Labels fijos en el pie del hero */
.hero-foot {
  position: fixed;
  z-index: 15;
  left: var(--gutter);
  right: var(--gutter);
  bottom: 26px;
  display: flex;
  justify-content: space-between;
  font-size: var(--fs-label);
  font-weight: 500;
  letter-spacing: 0.22em;
  color: var(--crema);
  transition: opacity 0.35s;
}
.hero-foot.is-hidden {
  opacity: 0;
}

/* ---------- Sección naranja ---------- */
.orange {
  position: relative;
  z-index: 2;
  margin-top: -100vh; /* se desliza por encima del hero pinned */
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding: var(--section-y) 0;
  background: var(--naranja);
  color: var(--negro);
}
.orange .overline {
  margin-bottom: 26px;
  opacity: 1;
}
.orange h2 {
  font-size: var(--fs-h2);
}
.orange .body {
  margin-top: 34px;
  font-size: 15px;
  max-width: 52ch;
}

/* ---------- Dashboard ---------- */
.dash {
  position: relative;
  z-index: 2;
  background: var(--oliva);
  color: var(--crema);
  padding: var(--section-y) 0;
}
.dash-head {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 40px;
  align-items: end;
}
.dash-head .overline {
  margin-bottom: 22px;
}
.dash-head h2 {
  font-size: var(--fs-h2s);
}
.dash-head .body {
  max-width: 38ch;
  opacity: 0.85;
  justify-self: end;
}
.dash-grid {
  display: grid;
  grid-template-columns: 1.55fr 1fr;
  gap: clamp(32px, 4vw, 64px);
  margin-top: 72px;
  align-items: stretch;
}
.chart-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.chart {
  width: 100%;
  height: 260px;
  overflow: visible;
}
.chart-grid line {
  stroke: rgba(240, 230, 200, 0.12);
  stroke-width: 1;
}
.chart-fill {
  fill: url(#chart-grad);
  transition: opacity 0.8s;
}
.chart-line {
  fill: none;
  stroke: var(--naranja);
  stroke-width: 2.5;
  stroke-linejoin: round;
  stroke-linecap: round;
  stroke-dasharray: 2400;
  stroke-dashoffset: 2400;
}
.chart-card.in .chart-line {
  animation: draw 1.8s var(--ease-out) forwards;
}
@keyframes draw {
  to {
    stroke-dashoffset: 0;
  }
}
.chart-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  letter-spacing: 0.06em;
  opacity: 0.75;
}
.slider-row {
  display: block;
}
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 22px;
  margin: 0;
  background: transparent;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 2px;
  background: linear-gradient(90deg, var(--naranja) var(--fill, 50%), rgba(240, 230, 200, 0.25) 0);
}
input[type="range"]::-moz-range-track {
  height: 2px;
  background: rgba(240, 230, 200, 0.25);
}
input[type="range"]::-moz-range-progress {
  height: 2px;
  background: var(--naranja);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  margin-top: -8px;
  border-radius: 50%;
  background: var(--naranja);
  border: 2px solid var(--oliva);
  box-shadow: 0 0 0 1px var(--naranja);
}
input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--naranja);
  border: 2px solid var(--oliva);
  box-shadow: 0 0 0 1px var(--naranja);
}
.pills {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 26px;
  flex-wrap: wrap;
}
.pill-label {
  font-size: var(--fs-label);
  letter-spacing: 0.22em;
  font-weight: 500;
  margin-right: 10px;
  opacity: 0.7;
}
.pill {
  font: inherit;
  font-size: 10px;
  letter-spacing: 0.18em;
  font-weight: 500;
  color: var(--crema);
  background: transparent;
  border: 1px solid rgba(240, 230, 200, 0.28);
  border-radius: 999px;
  padding: 8px 16px;
  cursor: pointer;
  transition: border-color 0.3s, background 0.3s;
}
.pill:hover {
  border-color: rgba(240, 230, 200, 0.6);
}
.pill[aria-selected="true"] {
  border-color: var(--naranja);
  color: var(--naranja);
}

.panel {
  border: 1px solid rgba(240, 230, 200, 0.16);
  padding: 34px 32px 32px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.panel-title {
  font-family: var(--font);
  font-stretch: var(--display-stretch);
  font-weight: 800;
  font-size: clamp(30px, 2.8vw, 40px);
  line-height: 1;
  transition: opacity 0.35s var(--ease-out), translate 0.35s var(--ease-out);
}
.panel.swap .panel-title,
.panel.swap .spec {
  opacity: 0;
  translate: 0 6px;
}
.spec {
  display: flex;
  flex-direction: column;
  transition: opacity 0.35s var(--ease-out), translate 0.35s var(--ease-out);
}
.spec > div {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 13px 0;
  border-top: 1px solid rgba(240, 230, 200, 0.16);
  font-size: 13px;
}
.spec > div:last-child {
  border-bottom: 1px solid rgba(240, 230, 200, 0.16);
}
.spec dt {
  opacity: 0.6;
}
.spec dd {
  text-align: right;
}
.btn-square {
  align-self: flex-start;
  margin-top: auto;
  background: var(--naranja);
  color: var(--negro);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 16px 22px;
  border-radius: 0;
  transition: background 0.3s, transform 0.5s var(--ease-out);
}
.btn-square:hover {
  background: #ff5f28;
  transform: translateY(-2px);
}

/* ---------- Sección crema ---------- */
.cream {
  position: relative;
  z-index: 2;
  background: var(--crema-2);
  color: var(--negro);
  padding: var(--section-y) 0;
}
.cream-grid {
  display: grid;
  grid-template-columns: 40% 1fr;
  gap: 5%;
  align-items: center;
}
.cream .overline {
  margin-bottom: 24px;
  opacity: 1;
}
.cream h2 {
  font-size: var(--fs-h2s);
}
.cream .body {
  margin-top: 30px;
  max-width: 40ch;
  color: var(--negro-suave);
}
.cream-photo {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--gris-2);
}
/* Recorte del cuarto superior izquierdo de la foto (montañas y niebla, sin la bici) */
.cream-photo img {
  position: absolute;
  width: 298%;
  max-width: none;
  left: 0;
  top: 0;
  filter: sepia(0.28) saturate(0.85) contrast(1.04);
}

/* ---------- Sección producto ---------- */
.product {
  position: relative;
  z-index: 2;
  background: var(--producto);
  color: var(--negro);
  padding: var(--section-y) 0;
}
.product-grid {
  display: grid;
  grid-template-columns: 42% 1fr;
  gap: 8%;
  align-items: center;
}
.product-photo {
  position: relative;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  background: var(--gris-1);
}
/* Recorte de la horquilla y cubierta delantera; velo de polvo terracota */
.product-photo img {
  position: absolute;
  width: 357%;
  max-width: none;
  left: -207%;
  top: -48%;
  filter: contrast(1.05) saturate(0.9);
}
.product-photo::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(181, 96, 42, 0.45), transparent 55%);
  mix-blend-mode: multiply;
}
.product-copy h2 {
  font-size: var(--fs-h2s);
}
.product-copy .lead {
  margin-top: 30px;
  font-weight: 500;
}
.product-copy .body {
  margin-top: 18px;
  color: var(--negro-suave);
}
.product-copy .text-link {
  margin-top: 30px;
}

/* FAQ */
.faq {
  display: grid;
  grid-template-columns: 42% 1fr;
  gap: 8%;
  margin-top: var(--section-y);
  align-items: start;
}
.faq h2 {
  font-size: var(--fs-h2s);
}
.faq-item {
  border-top: 1px solid rgba(20, 20, 18, 0.18);
}
.faq-item:last-child {
  border-bottom: 1px solid rgba(20, 20, 18, 0.18);
}
.faq-item summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding: 22px 0;
  font-size: 16px;
  font-weight: 500;
}
.faq-item summary::-webkit-details-marker {
  display: none;
}
.plus {
  font-size: 22px;
  font-weight: 300;
  line-height: 1;
  transition: transform 0.4s var(--ease-out);
}
.faq-item[open] .plus {
  transform: rotate(45deg);
}
.faq-item p {
  padding: 0 0 22px;
  max-width: 52ch;
  color: var(--negro-suave);
}

/* ---------- Footer (inferido) ---------- */
.footer {
  position: relative;
  z-index: 2;
  background: var(--footer);
  color: var(--crema);
  padding: 56px var(--gutter) 40px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 24px;
}
.foot-labels {
  display: flex;
  gap: 28px;
  font-size: var(--fs-label);
  letter-spacing: 0.22em;
  font-weight: 500;
  opacity: 0.7;
}
.foot-nav {
  display: flex;
  gap: 22px;
  justify-self: end;
  font-size: 12px;
  letter-spacing: 0.06em;
}
.foot-nav a {
  opacity: 0.75;
  transition: opacity 0.3s;
}
.foot-nav a:hover {
  opacity: 1;
}

/* ---------- Reveals (disparados por IntersectionObserver) ---------- */
.reveal {
  opacity: 0;
  translate: 0 28px;
  transition: opacity var(--dur) var(--ease-out), translate var(--dur) var(--ease-out);
  transition-delay: calc(var(--i, 0) * 70ms);
}
.reveal.in {
  opacity: 1;
  translate: 0 0;
}

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  .dash-head,
  .dash-grid,
  .cream-grid,
  .product-grid,
  .faq {
    grid-template-columns: 1fr;
  }
  .dash-head .body {
    justify-self: start;
  }
  .cream-photo {
    order: -1;
  }
  .footer {
    grid-template-columns: 1fr;
    justify-items: start;
  }
  .foot-nav {
    justify-self: start;
  }
}
@media (max-width: 640px) {
  :root {
    --gutter: 20px;
  }
  /* La placa se centra en la bici y baja: el texto queda en el tercio superior */
  .plate {
    left: 50%;
    top: 60%;
    translate: -50% -50%;
    width: auto;
    height: 114vh;
  }
  .hero-copy {
    top: 9%;
    width: 92%;
  }
  .hero-copy .overline {
    margin-bottom: 14px;
  }
  .hero-copy h1 {
    font-size: clamp(44px, 13vw, 60px);
  }
  .hero-copy .lead {
    margin-top: 16px;
    font-size: 15px;
  }
  .hero-copy .text-link {
    margin-top: 16px;
  }
  .hero-copy-2 {
    left: var(--gutter);
    right: var(--gutter);
    top: auto;
    bottom: 12%;
    translate: 0 0;
  }
  .hero-copy-2 h2 {
    font-size: 15vw;
  }
  .hero-foot {
    flex-direction: column;
    gap: 6px;
    bottom: 16px;
  }
  .orange h2,
  .dash-head h2,
  .cream h2,
  .product-copy h2,
  .faq h2 {
    font-size: clamp(44px, 13vw, 60px);
  }
  .chart {
    height: 180px;
  }
  .panel {
    padding: 26px 22px 24px;
  }
  .spec > div {
    flex-direction: column;
    gap: 4px;
  }
  .spec dd {
    text-align: left;
  }
}

/* ---------- Reduced motion: todo visible y quieto ---------- */
@media (prefers-reduced-motion: reduce) {
  .hero-wrap {
    height: auto;
  }
  .hero {
    position: relative;
  }
  .plate-bg {
    filter: none;
  }
  .hero-copy {
    opacity: 1;
  }
  .bike-idle {
    animation: none;
  }
  /* El texto 2 queda visible como tarjeta arriba a la derecha, sobre la niebla */
  .hero-copy-2 {
    top: 14%;
    left: 64%;
    right: var(--gutter);
    translate: 0 0;
    opacity: 1;
    padding: 28px;
    background: rgba(20, 20, 18, 0.5);
    backdrop-filter: blur(8px);
  }
  .hero-copy-2 h2 {
    font-size: clamp(36px, 4vw, 56px);
  }
  .orange {
    margin-top: 0;
  }
  .hero-foot {
    position: absolute;
    top: calc(100vh - 40px);
    bottom: auto;
  }
  .reveal {
    opacity: 1;
    translate: 0 0;
    transition: none;
  }
  .chart-line {
    stroke-dashoffset: 0;
  }
  .chart-card.in .chart-line {
    animation: none;
  }
  .nav,
  .plus,
  .btn-square,
  .panel-title,
  .spec {
    transition: none;
  }
}
