/* =========================================================================
   Home page sections. Nine sections, nine distinct layout families.
   ========================================================================= */

@layer components {

/* ------------------------------------------------------------------- hero */

.hero {
  position: relative;
  padding-top: var(--s-7);
  padding-bottom: var(--s-8);
  overflow: clip;
}
@media (min-width: 1024px) {
  .hero {
    min-height: calc(100dvh - var(--header-h));
    display: grid;
    align-items: center;
    padding-top: var(--s-6);   /* well under the 96px cap */
    padding-bottom: var(--s-9);
  }
}

.hero-grid {
  display: grid;
  gap: var(--s-7);
  align-items: center;
}
@media (min-width: 1024px) {
  .hero-grid {
    grid-template-columns: minmax(0, 6.4fr) minmax(0, 5.6fr);
    gap: var(--s-5);
  }
}

.hero-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--s-5);
  position: relative;
  z-index: 2;
}

/* Archivo Expanded is a wide face. The scale is set so the two authored lines
   never wrap into a third, which is the rule in DESIGN.md section 10. */
.hero-title {
  font-size: clamp(2.1rem, 4.2vw, 3.4rem);
  font-stretch: 112%;
  line-height: 1.0;
  letter-spacing: -0.028em;
  max-width: 24ch;
  text-wrap: nowrap;
}
/* Below the tablet breakpoint the expanded width is what breaks the line, not
   the point size. Narrowing the face keeps both authored lines intact on a
   360px screen without dropping the headline to body scale. */
@media (max-width: 767px) {
  .hero-title {
    font-size: clamp(1.5rem, 7vw, 2.1rem);
    font-stretch: 102%;
    letter-spacing: -0.022em;
  }
}
.hero-title em {
  font-style: normal;              /* emphasis by colour, never a second family */
  color: var(--accent-text);
}

/* Each line is a mask; the inner span slides up from below it. */
.hero-line { display: block; overflow: hidden; padding-bottom: 0.06em; }
.hero-line > span { display: block; }
html.has-js .hero-line > span { transform: translate3d(0, 105%, 0); }

.hero-sub { max-width: 46ch; }

.hero-cta { display: flex; flex-wrap: wrap; gap: var(--s-3); }
/* Two stacked buttons of different widths read as an accident. On a phone they
   both go full width. */
@media (max-width: 560px) {
  .hero-cta { width: 100%; }
  .hero-cta .btn { flex: 1 1 100%; }
}

html.has-js .hero-sub,
html.has-js .hero-cta { opacity: 0; }

@media (prefers-reduced-motion: reduce) {
  html.has-js .hero-line > span { transform: none; }
  html.has-js .hero-sub,
  html.has-js .hero-cta { opacity: 1; }
}

/* ------------------------------------------------------------- hero stage */

/* The poster is 1100x820, so the stage matches that ratio and the wheel fills
   it instead of sitting letterboxed inside a square. */
.hero-stage {
  position: relative;
  aspect-ratio: 11 / 8.2;
  width: 100%;
  max-width: 560px;
  margin-inline: auto;
}
@media (min-width: 1024px) {
  .hero-stage {
    max-width: none;
    margin-inline: 0 calc(var(--gutter) * -1);
    aspect-ratio: 4 / 3.4;
  }
}

/* A soft accent bloom sits behind the wheel so the metal has something to
   catch. It is a background, not a glow on the object itself. */
.hero-stage::before {
  content: "";
  position: absolute;
  inset: 8% 4%;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 45%,
              color-mix(in srgb, var(--accent) 9%, transparent) 0%,
              transparent 60%);
  filter: blur(34px);
  z-index: 0;
  pointer-events: none;
}

.hero-canvas,
.hero-poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}
/* The end state lives in CSS and the fade is a Web Animations enhancement on
   top of it. A transition here would leave the canvas invisible on any tab
   whose document timeline is throttled at mount time. */
.hero-canvas { opacity: 0; }
.hero-canvas[data-ready="true"] { opacity: 1; }
.hero-poster { object-fit: contain; z-index: 2; }
.hero-poster[data-hidden="true"] { opacity: 0; pointer-events: none; }

/* ------------------------------------------------------- machine rail (2) */

.rail {
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scroll-snap-type: x mandatory;
  /* Without this the snap ignores the track's own gutter and pulls the first
     tile flush against the viewport edge. */
  scroll-padding-inline-start: var(--gutter);
  scrollbar-width: none;
  padding-bottom: var(--s-2);
}
.rail::-webkit-scrollbar { display: none; }

.rail-track {
  display: flex;
  gap: var(--s-4);
  padding-inline: var(--gutter);
  width: max-content;
  min-width: 100%;
}
@media (min-width: 1500px) {
  .rail-track {
    padding-inline: max(var(--gutter), calc((100vw - var(--container)) / 2 + var(--gutter)));
  }
}

.rail-item { scroll-snap-align: start; }

.mtile {
  display: grid;
  grid-template-rows: auto auto auto;
  gap: var(--s-2);
  position: relative;
  width: 230px;
  padding: var(--s-5);
  min-height: 210px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--bg-elev);
  box-shadow: var(--inset-hi);
  transition: border-color var(--d-ui) var(--ease),
              transform var(--d-ui) var(--ease),
              background-color var(--d-ui) var(--ease);
}
@media (min-width: 768px) { .mtile { width: 262px; min-height: 230px; } }

.mtile:hover {
  border-color: var(--accent);
  transform: translateY(-4px);
  background: var(--bg-elev-2);
}

.mtile-art {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: var(--r);
  background: var(--accent-soft);
  color: var(--accent-text);
  margin-bottom: var(--s-3);
}
.mtile-art svg { width: 24px; height: 24px; }

.mtile-name { font-weight: 600; font-size: var(--fs-body-l); align-self: end; }
.mtile-sub { font-size: var(--fs-sm); color: var(--text-dim); line-height: 1.45; }

.mtile-go {
  position: absolute;
  top: var(--s-5);
  inset-inline-end: var(--s-5);
  color: var(--text-faint);
  transition: transform var(--d-ui) var(--ease), color var(--d-ui) var(--ease);
}
.mtile-go svg { width: 17px; height: 17px; }
.mtile:hover .mtile-go { transform: translateX(4px); color: var(--accent-text); }

/* ------------------------------------------------------- category bento (3) */

.bento {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s-4);
}
@media (min-width: 700px) {
  .bento { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Six categories, six cells, deliberate rhythm: one tall anchor, two stacked,
   then a 1/3 + 2/3 pair and a full-width closer. No empty cells. */
@media (min-width: 1024px) {
  .bento[data-cells="6"] { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .bento[data-cells="6"] > :nth-child(1) { grid-column: span 3; grid-row: span 2; }
  .bento[data-cells="6"] > :nth-child(2) { grid-column: span 3; }
  .bento[data-cells="6"] > :nth-child(3) { grid-column: span 3; }
  .bento[data-cells="6"] > :nth-child(4) { grid-column: span 2; }
  .bento[data-cells="6"] > :nth-child(5) { grid-column: span 4; }
  .bento[data-cells="6"] > :nth-child(6) { grid-column: span 6; }

  .bento[data-cells="5"] { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .bento[data-cells="5"] > :nth-child(1) { grid-column: span 4; grid-row: span 2; }
  .bento[data-cells="5"] > :nth-child(2) { grid-column: span 2; }
  .bento[data-cells="5"] > :nth-child(3) { grid-column: span 2; }
  .bento[data-cells="5"] > :nth-child(4) { grid-column: span 3; }
  .bento[data-cells="5"] > :nth-child(5) { grid-column: span 3; }

  .bento[data-cells="4"] { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .bento[data-cells="4"] > :nth-child(1) { grid-column: span 3; }
  .bento[data-cells="4"] > :nth-child(2) { grid-column: span 2; }
  .bento[data-cells="4"] > :nth-child(3) { grid-column: span 2; }
  .bento[data-cells="4"] > :nth-child(4) { grid-column: span 3; }
}

.bcell {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: var(--s-5);
  min-height: 210px;
  padding: var(--s-5);
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--bg-elev);
  overflow: hidden;
  transition: border-color var(--d-ui) var(--ease), transform var(--d-ui) var(--ease);
}
.bcell:hover { border-color: var(--accent); transform: translateY(-3px); }

.bcell-art {
  align-self: flex-start;
  width: min(62%, 200px);
  aspect-ratio: 1;
  transition: transform var(--d-ui) var(--ease);
}
.bcell:hover .bcell-art { transform: scale(1.03) rotate(-1.5deg); }

/* The anchor cell is the widest, so its photo has to grow with it or the tile
   reads as an empty box with a stamp in the corner. */
@media (min-width: 1024px) {
  .bento > :nth-child(1) { min-height: 460px; }
  .bento > :nth-child(1) .bcell-art { width: min(72%, 380px); align-self: center; }
  .bento > :nth-child(6) .bcell-art { width: min(32%, 200px); }
}

.bcell-text { display: flex; flex-direction: column; gap: 3px; }
.bcell-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-stretch: 112%;
  font-size: 1.15rem;
  letter-spacing: -0.012em;
}
.bcell-sub { font-size: var(--fs-sm); color: var(--text-dim); max-width: 40ch; }
.bcell-count { font-size: 11px; color: var(--text-faint); letter-spacing: 0.05em; margin-top: 3px; }

@media (min-width: 1024px) {
  .bento > :nth-child(6) {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    min-height: 170px;
  }
  .bento > :nth-child(6) .bcell-art { margin-bottom: 0; order: 2; }
  .bento > :nth-child(6) .bcell-text { order: 1; }
}

/* ---------------------------------------------- pinned horizontal pan (4) */

.pan { position: relative; }
.pan-viewport { overflow: hidden; }

.pan-track {
  display: flex;
  align-items: center;
  gap: var(--s-6);
  padding-block: var(--s-9);
  padding-inline: var(--gutter);
  width: max-content;
}

/* Before GSAP takes over (small screens, reduced motion, no JS) the track is a
   normal horizontal scroller instead of a pinned pan. */
.pan-viewport:not([data-pinned="true"]) {
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding-inline-start: var(--gutter);
  scrollbar-width: none;
}
.pan-viewport:not([data-pinned="true"])::-webkit-scrollbar { display: none; }
.pan-viewport:not([data-pinned="true"]) .pan-card { scroll-snap-align: center; }

.pan-intro {
  flex: none;
  width: min(78vw, 400px);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--s-4);
  padding-inline-end: var(--s-6);
  border-inline-end: 1px solid var(--line);
}

.pan-card { flex: none; width: 250px; }
@media (min-width: 768px) { .pan-card { width: 290px; } }

/* --------------------------------------------------------- brand film (5) */

.film {
  position: relative;
  min-height: 62vh;
  display: grid;
  place-items: center;
  isolation: isolate;
  background: #0B0C0C;
  border-block: 1px solid var(--line);
}
@media (min-width: 1024px) { .film { min-height: 78vh; } }

.film-media { position: absolute; inset: 0; z-index: -1; }
.film-media video,
.film-media img { width: 100%; height: 100%; object-fit: cover; }
.film-media::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(11,12,12,0.55) 0%, rgba(11,12,12,0.30) 45%, rgba(11,12,12,0.82) 100%);
}

.film-overlay {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--s-5);
  padding-block: var(--s-8);
  color: #EDEFEE;
}
.film-title {
  font-size: var(--fs-display-l);
  line-height: 0.98;
  letter-spacing: -0.028em;
  max-width: 16ch;
}

/* -------------------------------------------------------------- facts (6) */

.facts {
  display: grid;
  gap: var(--s-5);
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  padding-top: var(--s-6);
}
@media (min-width: 900px) { .facts { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s-6); } }

.fact { display: flex; flex-direction: column-reverse; gap: var(--s-2); }
.fact dt { font-size: var(--fs-sm); color: var(--text-dim); }
.fact dd {
  font-size: clamp(2rem, 4.6vw, 3.4rem);
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--text);
}
@media (min-width: 900px) {
  .fact + .fact { border-inline-start: 1px solid var(--line); padding-inline-start: var(--s-6); }
}

/* ------------------------------------------------------- section head row */

.section-head-row {
  flex-direction: row;
  align-items: baseline;
  justify-content: space-between;
  max-width: none;
  gap: var(--s-5);
}

/* ------------------------------------------------------------- policy (8) */

.policy { display: grid; gap: var(--s-6); }
@media (min-width: 1024px) {
  .policy { grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); gap: var(--s-8); align-items: start; }
}
.policy-title { position: sticky; top: calc(var(--header-h) + var(--s-6)); }
@media (max-width: 1023px) { .policy-title { position: static; } }

.policy-list { display: flex; flex-direction: column; }
.policy-row {
  display: grid;
  gap: var(--s-2);
  padding-block: var(--s-5);
  border-top: 1px solid var(--line);   /* one hairline per row, never two */
}
.policy-row:last-child { border-bottom: 1px solid var(--line); }
@media (min-width: 700px) {
  .policy-row { grid-template-columns: 150px minmax(0, 1fr); gap: var(--s-5); }
}
.policy-row dt {
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
  padding-top: 4px;
}
.policy-row dd { color: var(--text-dim); max-width: 62ch; }

/* ------------------------------------------------------------- closer (9) */

.closer {
  background: var(--bg-elev);
  border-top: 1px solid var(--line);
  padding-block: var(--s-9);
}
.closer-inner { display: grid; gap: var(--s-6); align-items: center; }
@media (min-width: 900px) {
  .closer-inner { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--s-8); }
}
.closer-title { font-size: var(--fs-h1); letter-spacing: -0.025em; }
.closer-form { display: flex; gap: var(--s-3); }
.closer-form .input { min-height: 54px; font-size: var(--fs-body-l); }

}
