/* Aardvark Decor homepage trailer ("The Reel") - Lane 1
   Presentation only. Consumes existing tokens plus the two approved literals
   (#120b05 deep brown ink, #fffaf2 warm cream). No new colors, no libraries.
   Every animation is gated behind motion-safe AND data-motion!=off, so the
   page is a complete, static editorial layout without JS or with motion off. */

/* ---------- B0 cold open ---------- */
.t-intro {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  pointer-events: none;
  background: #120b05;
  color: #fffaf2;
  opacity: 0;
  visibility: hidden;
}
.t-intro span {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 6vw, 3.4rem);
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.t-hero {
  position: relative;
  min-height: 100svh;
  display: grid;
  align-items: end;
  overflow: hidden;
  color: #fffaf2;
  background: #120b05;
}
.t-hero__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
}
.t-hero__scrim {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(180deg, rgba(18,11,5,.12), rgba(18,11,5,.55) 58%, rgba(18,11,5,.9));
}
.t-hero__inner {
  position: relative;
  z-index: 2;
  max-width: 760px;
  padding-block: clamp(2rem, 9vh, 5.5rem);
}
.t-hero__inner > * + * { margin-top: 1rem; }
.t-hero__kicker { color: #fffaf2; }
.t-wordmark {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  font-size: clamp(1rem, 2.6vw, 1.5rem);
  margin: 0;
  opacity: .92;
}
.t-hero__title { font-size: clamp(2rem, 6vw, 4rem); margin: 0; }
.t-hero__lede { max-width: 44ch; color: #fffaf2; }
.t-controls { display: flex; flex-wrap: wrap; gap: .7rem; margin-top: 1.4rem; }
.t-btn { min-height: var(--tap-min); }
/* Native button defaults do not reliably inherit CTA text colors. */
.t-controls .t-btn { color: #fffaf2; background: rgba(18,11,5,.34); }
.paths__links .t-btn { color: #120b05; background: #fffaf2; }
/* Pause and Replay are enhancement-only: hidden unless trailer.js is active,
   so the no-JS page shows no inert buttons. Skip stays visible (real anchor). */
[data-motion-toggle], [data-replay] { display: none; }
html.t-enh [data-motion-toggle], html.t-enh [data-replay] { display: inline-flex; }

/* ---------- Scenes (shared, static default) ---------- */
.scene { position: relative; }
.scene__pin {
  padding-block: var(--space-section);
  display: grid;
  gap: var(--space-block);
  align-items: center;
}
.scene--craft .scene__pin { grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); }
.scene--custom .scene__pin { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
.scene--lanes .scene__pin { display: block; }
.scene__text > * + * { margin-top: 1rem; }
.scene__text--center { text-align: center; max-width: 60ch; margin-inline: auto; }
.scene__media { margin: 0; }
.scene__frame { display: grid; gap: var(--space-card); }
.scene__layer {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lift);
  display: block;
}
.scene__media figcaption { margin-top: .55rem; }

/* B2 lane montage */
.scene__lanes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-card);
  margin-top: var(--space-block);
}
.t-lane {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  padding: 1rem;
  border: 1px solid var(--c-line);
  border-radius: var(--radius-lg);
  background: var(--c-surface-raised);
  box-shadow: var(--shadow-card);
  text-decoration: none;
  color: var(--c-ink);
}
.t-lane__frame { display: block; border-radius: var(--radius-md); overflow: hidden; }
.t-lane__frame img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; }
.t-lane__name { font-family: var(--font-display); font-size: clamp(1.15rem, 2vw, 1.5rem); }
.t-lane__line { color: var(--c-ink-soft); }
.t-lane:focus-visible { outline: 3px solid var(--c-focus); outline-offset: 3px; }

/* ---------- B3 the work ---------- */
.t-work-head { max-width: 62ch; margin-bottom: var(--space-block); }
.t-work-head > * + * { margin-top: .5rem; }

/* ---------- B4 built to fit ---------- */
.t-steps {
  list-style: none;
  padding: 0;
  margin: 1rem 0;
  display: grid;
  gap: 1rem;
  counter-reset: step;
}
.t-steps li { position: relative; padding-left: 2.9rem; }
.t-steps li::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #120b05;
  color: #fffaf2;
  font-family: var(--font-display);
  font-weight: 900;
}

/* ---------- B5 choose your path ---------- */
.t-paths { background: #120b05; color: #fffaf2; }
.t-paths .kicker { color: #fffaf2; }
.t-paths h2:focus-visible { outline: 3px solid var(--c-focus); outline-offset: 4px; }
.t-doors {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-card);
  margin-block: var(--space-block);
}
.t-door {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  min-height: 210px;
  padding: clamp(1.2rem, 3vw, 2rem);
  border-radius: var(--radius-lg);
  text-decoration: none;
  background: #fffaf2;
  color: #120b05;
  box-shadow: var(--shadow-lift);
}
.t-door__num { font-weight: 900; letter-spacing: .08em; font-size: var(--fs-small); text-transform: uppercase; }
.t-door__name { font-family: var(--font-display); font-size: clamp(1.4rem, 3vw, 2rem); }
.t-door__line { color: rgba(18,11,5,.78); }
.t-door:focus-visible { outline: 3px solid #fffaf2; outline-offset: 4px; }
.t-path-strip { display: flex; flex-wrap: wrap; gap: .8rem; align-items: center; }
.t-paths .cta-primary { background: #fffaf2; color: #120b05; }
.t-path-strip a:not(.cta-primary), .t-path-strip .cta-ghost { color: #fffaf2; }
.t-path-strip button.t-btn { color: #120b05; background: #fffaf2; }

/* ---------- Motion-safe enhancements (never affect no-JS / reduced / paused) ---------- */
@media (prefers-reduced-motion: no-preference) {
  .t-intro { animation: t-intro-open 1.35s ease both; }
  .t-intro span { animation: t-intro-mark 1.1s ease both; }
  /* B0 entrance + slow scale */
  html.t-enh:not([data-motion="off"]) .t-hero__img { animation: t-ken 24s ease-out both; }
  html.t-enh:not([data-motion="off"]):not(.is-seen) .t-wordmark { animation: t-rise .7s ease both; }
  html.t-enh:not([data-motion="off"]):not(.is-seen) .t-hero__title { animation: t-rise .7s .08s ease both; }
  html.t-enh:not([data-motion="off"]):not(.is-seen) .t-hero__lede { animation: t-rise .7s .16s ease both; }

  /* One-time entrance reveals (mobile everywhere, B3 all widths) */
  html.t-enh:not([data-motion="off"]) .reveal {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity .45s ease, transform .45s ease;
  }
  html.t-enh:not([data-motion="off"]) .reveal.is-visible { opacity: 1; transform: none; }
  html.t-enh:not([data-motion="off"]) .t-work .reveal:nth-child(2) { transition-delay: .05s; }
  html.t-enh:not([data-motion="off"]) .t-work .reveal:nth-child(3) { transition-delay: .1s; }
  html.t-enh:not([data-motion="off"]) .t-work .reveal:nth-child(4) { transition-delay: .15s; }
  html.t-enh:not([data-motion="off"]) .t-work .reveal:nth-child(5) { transition-delay: .2s; }
  html.t-enh:not([data-motion="off"]) .t-work .reveal:nth-child(6) { transition-delay: .25s; }

  /* quiet hover lift */
  .t-lane, .t-door { transition: transform .15s ease, box-shadow .15s ease; }
  .t-lane:hover, .t-door:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); }
}

/* ---------- Desktop scroll-driven scenes ---------- */
@media (min-width: 821px) and (prefers-reduced-motion: no-preference) {
  html.t-enh:not([data-motion="off"]) .scene { min-height: 180vh; }
  html.t-enh:not([data-motion="off"]) .scene__pin {
    position: sticky;
    top: var(--header-h);
    min-height: calc(100vh - var(--header-h));
    align-content: center;
  }
  /* staggered step entrance driven by --scene-progress and per-element --i */
  html.t-enh:not([data-motion="off"]) .scene__step {
    --start: calc(var(--i) * 0.16);
    --local: clamp(0, calc((var(--scene-progress, 0) - var(--start)) / 0.3), 1);
    opacity: var(--local);
    transform: translateY(calc((1 - var(--local)) * 28px));
  }
  /* B1 becomes a crossfade stack */
  html.t-enh:not([data-motion="off"]) .scene--craft .scene__frame {
    position: relative;
    display: block;
    aspect-ratio: 16 / 9;
  }
  html.t-enh:not([data-motion="off"]) .scene--craft .scene__layer {
    position: absolute;
    inset: 0;
    height: 100%;
    aspect-ratio: auto;
  }
}

@keyframes t-ken { from { transform: scale(1); } to { transform: scale(1.06); } }
@keyframes t-rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes t-intro-open {
  0% { opacity: 1; visibility: visible; }
  58% { opacity: 1; visibility: visible; }
  100% { opacity: 0; visibility: hidden; }
}
@keyframes t-intro-mark {
  0% { opacity: 0; transform: translateY(12px); letter-spacing: .16em; }
  30%, 65% { opacity: 1; transform: none; }
  100% { opacity: 0; transform: translateY(-8px); letter-spacing: .1em; }
}

/* ---------- Mobile layout (<=820px): no pinning, compact stack, native strip ----------
   Kept close to the current homepage length: shorter hero, tighter scene padding,
   single hero image per scene, and compact lane rows. */
@media (max-width: 820px) {
  .t-hero { min-height: 46svh; }
  .t-hero__inner { padding-block: clamp(1.2rem, 4vh, 2rem); }
  .t-hero__inner > * + * { margin-top: .65rem; }
  .t-controls { margin-top: .9rem; }
  .scene__pin { padding-block: clamp(.9rem, 3.5vw, 1.5rem); gap: .9rem; }
  .scene__text > * + * { margin-top: .55rem; }
  /* letterboxed (short) scene images keep the stacked page close to the homepage length */
  .scene__layer { aspect-ratio: 2 / 1; }
  /* tighten the two full-width sections to hold page length near the homepage */
  .t-work-section, .t-paths { padding-block: clamp(1rem, 4vw, 1.6rem); }
  .t-work-head { margin-bottom: .8rem; }
  .t-work-head > * + * { margin-top: .3rem; }
  .scene__media figcaption { margin-top: .4rem; }
  .t-steps { gap: .55rem; margin: .6rem 0; }
  .t-steps li { padding-left: 2.7rem; }
  .scene--craft .scene__pin,
  .scene--custom .scene__pin { grid-template-columns: 1fr; }
  /* B1: primary image only on mobile to hold the page length down */
  .scene--craft .scene__layer--top { display: none; }
  /* B2 lanes become compact thumbnail rows */
  .scene__lanes { grid-template-columns: 1fr; gap: .6rem; margin-top: .9rem; }
  .t-lane {
    display: grid;
    grid-template-columns: 64px 1fr;
    grid-template-areas: "thumb name" "thumb line" "thumb label";
    column-gap: .9rem;
    row-gap: .1rem;
    align-items: center;
    padding: .65rem;
  }
  .t-lane__frame { grid-area: thumb; align-self: center; }
  .t-lane__frame img { aspect-ratio: 1 / 1; }
  .t-lane__name { grid-area: name; }
  .t-lane__line { grid-area: line; }
  .t-lane .concept-label { grid-area: label; }
  /* B5 doors stack and shrink */
  .t-paths .stack > * + * { margin-top: .7rem; }
  .t-doors { grid-template-columns: 1fr; margin-block: .9rem; gap: .8rem; }
  .t-door { min-height: 0; gap: .3rem; }
  .t-path-strip { gap: .6rem; }
  /* B3: horizontal scroll-snap strip when JS is on; stacked grid fallback without JS */
  html.t-enh .t-work {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: 70%;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
    padding-bottom: .5rem;
  }
  html.t-enh .t-work > * { scroll-snap-align: start; }
  /* strip cards live in a horizontal scroller, so vertical intersection would
     never reveal the off-screen ones; keep them visible and let the swipe
     provide the progressive discovery */
  html.t-enh .t-work .reveal { opacity: 1; transform: none; }
  /* shorter card images and tighter cards inside the mobile strip (my namespace) */
  .t-work .product-card { padding: 1rem; }
  .t-work .product-card img { aspect-ratio: 16 / 9; margin-bottom: .7rem; }
  .t-work .product-card h3 { margin-bottom: .3rem; }
}
