/* BAYTIMOD — site 2026. Brand tokens from "Mini CG" (Torch Red, Half White, Deep Onyx, Ardesia). */

/* taste-skill-ignore: brand typefaces fixed by the Mini CG */
@font-face { font-family: "Roboto Condensed"; src: url("../assets/fonts/roboto-condensed.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Roboto"; src: url("../assets/fonts/roboto.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }

@layer reset, tokens, base, layout, sections, motion;

@layer tokens {
  :root {
    --torch: #e71e25;
    --half-white: #fffefa;
    --onyx: #272a31;
    --ardesia: #4d4f52;

    --bg: var(--onyx);
    --surface: color-mix(in oklab, var(--onyx) 78%, var(--ardesia));
    --ink: var(--half-white);
    --muted: #c4c5c7;
    --accent: var(--torch);
    --field: color-mix(in oklab, var(--half-white) 84%, var(--ardesia)); /* light grey ground for the configurator */
    --field-ink: var(--onyx);
    --field-muted: #4d4f52;

    --font-display: "Roboto Condensed", "Arial Narrow", sans-serif;
    --font-text: "Roboto", system-ui, sans-serif;

    --step-small: clamp(0.875rem, 0.85rem + 0.1vw, 0.9375rem);
    --step-body: clamp(1.0625rem, 1rem + 0.25vw, 1.1875rem);
    --step-lead: clamp(1.25rem, 1.1rem + 0.7vw, 1.625rem);
    --step-head: clamp(2rem, 1.2rem + 2.4vw, 3.5rem);
    --step-big: clamp(3.5rem, 2rem + 9vw, 11rem);

    --margin: clamp(16px, 2.2vw, 32px);
    --gap-section: clamp(96px, 12vw, 200px);
    --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
    --ease-io: cubic-bezier(0.77, 0, 0.175, 1);
  }
  @media (prefers-color-scheme: light) { :root { color-scheme: dark; } }
}

@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  * { margin: 0; }
  html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
  img, svg, video { display: block; max-width: 100%; }
  button, input, select, textarea { font: inherit; color: inherit; }
  a { color: inherit; }
  ul, ol { padding: 0; list-style: none; }
}

@layer base {
  body {
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font-text);
    font-size: var(--step-body);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
  }
  ::selection { background: var(--torch); color: var(--half-white); }
  :focus-visible { outline: 3px solid var(--torch); outline-offset: 3px; }
  .on-field :focus-visible, .on-red :focus-visible { outline-color: var(--onyx); }

  h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 700; text-transform: uppercase; line-height: 0.98; letter-spacing: -0.005em; text-wrap: balance; }
  h2 { font-size: var(--step-head); }
  p { text-wrap: pretty; max-width: 62ch; }
  .sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .skip { position: absolute; left: 8px; top: 8px; z-index: 100; background: var(--torch); color: var(--half-white); padding: 12px 18px; font-weight: 700; clip-path: inset(50%); width: 1px; height: 1px; overflow: hidden; white-space: nowrap; }
  .skip:focus { clip-path: none; width: auto; height: auto; }

  /* buttons: on hover a red fill fades in, a white light runs round the edge and the button lifts (after davi.com) */
  .btn {
    position: relative; isolation: isolate; z-index: 0;
    display: inline-flex; align-items: center; justify-content: center; gap: 12px;
    min-height: 56px; padding: 0 28px;
    background: var(--torch); color: var(--half-white);
    font-family: var(--font-display); font-weight: 700; font-size: var(--step-lead); text-transform: uppercase; letter-spacing: 0.02em;
    text-decoration: none; border: 0; border-radius: 0; cursor: pointer;
    transition: transform 240ms cubic-bezier(0.4, 0, 0.2, 1), box-shadow 300ms ease, color 240ms ease;
    touch-action: manipulation; -webkit-tap-highlight-color: transparent;
    --btn-fill: linear-gradient(180deg, var(--torch), color-mix(in oklab, var(--torch) 82%, var(--half-white)));
    --btn-ring: 255 255 255; --btn-ring-hi: #fff; --btn-hover-ink: var(--half-white);
    --btn-glow: 0 10px 24px color-mix(in srgb, var(--torch) 22%, transparent), 0 0 16px color-mix(in srgb, var(--torch) 20%, transparent);
  }
  .btn::before, .btn::after { content: ""; position: absolute; pointer-events: none; z-index: -1; opacity: 0; }
  .btn::before { inset: 0; background: var(--btn-fill); transition: opacity 240ms ease; }
  .btn::after {
    inset: -1px; padding: 2px;
    background: conic-gradient(from var(--btn-angle), transparent 0deg 220deg, rgb(var(--btn-ring) / 0.4) 285deg, var(--btn-ring-hi) 308deg, rgb(var(--btn-ring) / 0.9) 320deg, rgb(var(--btn-ring) / 0.15) 348deg, transparent 360deg);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0); -webkit-mask-composite: xor;
    mask: linear-gradient(#fff 0 0) content-box exclude, linear-gradient(#fff 0 0);
    filter: drop-shadow(0 0 8px rgb(var(--btn-ring) / 0.3));
    animation: btn-orbit 1.8s linear infinite paused; transition: opacity 260ms ease;
  }
  .btn svg { width: 1.1em; height: 1.1em; transition: transform 200ms var(--ease-out); }
  .btn:active { transform: translateY(0) scale(0.98); transition-duration: 50ms; }
  .btn:focus-visible::before, .btn:focus-visible::after { opacity: 1; animation-play-state: running; }
  @media (hover: hover) and (pointer: fine) {
    .btn:hover { transform: translateY(-1px); color: var(--btn-hover-ink); box-shadow: var(--btn-glow); }
    .btn:hover::before, .btn:hover::after { opacity: 1; animation-play-state: running; }
    .btn:hover svg { transform: translateX(4px); }
  }
  .btn--ink { background: var(--onyx); color: var(--half-white); }
  /* on a red panel the red fill would vanish: go deep onyx instead */
  .on-red .btn { --btn-fill: linear-gradient(180deg, var(--onyx), color-mix(in oklab, var(--onyx) 70%, #000)); }
  /* outline button: turns polished silver, a light band sweeps across it and a white light runs round the edge */
  .btn--line {
    --btn-fill: linear-gradient(105deg, #b9bdc4 0%, #eceef1 14%, #9da2aa 28%, #f7f8fa 42%, #ffffff 50%, #f7f8fa 58%, #a3a8b0 72%, #e6e8eb 86%, #b9bdc4 100%);
    --btn-ring: 255 255 255; --btn-ring-hi: #fff; --btn-hover-ink: var(--onyx);
    --btn-glow: 0 10px 24px rgb(0 0 0 / 0.3), 0 0 18px rgb(220 224 230 / 0.35);
  }
  .btn--line::before { background-size: 200% 100%; background-repeat: repeat-x; animation: btn-sheen 2.6s linear infinite paused; }
  .btn--line:hover { text-shadow: 0 1px 0 rgb(255 255 255 / 0.55); }
  @media (prefers-reduced-motion: reduce) { .btn::after, .btn--line::before { animation: none; } }
}

@property --btn-angle { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
@keyframes btn-orbit { to { --btn-angle: 360deg; } }
@keyframes btn-sheen { to { background-position-x: 200%; } }

@layer layout {
  .wrap { padding-inline: var(--margin); }
  .grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: clamp(12px, 1.6vw, 24px); }
  section { position: relative; }
  .section-pad { padding-block: var(--gap-section); }
  .on-field { background: var(--field); color: var(--field-ink); }
  .on-red { background: var(--torch); color: var(--onyx); }
}

@layer sections {
  /* ===== NAV ===== */
  .nav { position: absolute; inset: 0 0 auto 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; padding: 20px var(--margin); }
  .nav__brand { display: block; width: 44px; color: var(--torch); }
  .nav__brand svg { width: 100%; height: auto; }
  .nav ul { display: flex; gap: clamp(16px, 2.4vw, 40px); }
  .nav a { text-decoration: none; font-weight: 500; font-size: var(--step-small); padding: 12px 2px; min-height: 44px; display: inline-flex; align-items: center; color: var(--half-white); }
  .nav ul a { position: relative; }
  .nav ul a::after { content: ""; position: absolute; left: 0; right: 0; bottom: 6px; height: 3px; background: var(--torch); transform: scaleX(0); transform-origin: left; transition: transform 240ms var(--ease-out); }
  @media (hover: hover) and (pointer: fine) { .nav ul a:hover::after { transform: scaleX(1); } }
  .nav__menu { display: none; }

  /* ===== HERO — film title, bottom edge ===== */
  .hero { position: relative; min-height: 100svh; display: grid; grid-template-rows: 1fr auto; overflow: clip; color: var(--half-white); isolation: isolate; }
  .hero__media { position: absolute; inset: 0; z-index: -2; background: var(--onyx); }
  .hero__media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 1600ms ease-in-out; }
  .hero__media img.is-on { opacity: 1; }
  .hero__media > img:first-child, .hero__media > picture:first-child img { opacity: 1; }
  .hero__scrim { position: absolute; inset: auto 0 0 0; height: 55%; z-index: -1; background: rgb(39 42 49 / 0.82); mask-image: linear-gradient(to top, #000 55%, transparent); /* taste-skill-ignore */ -webkit-mask-image: linear-gradient(to top, #000 55%, transparent); /* taste-skill-ignore */ pointer-events: none; }
  .hero__tint { position: absolute; inset: 0; z-index: -1; background: rgb(39 42 49 / 0.35); }
  .hero__bottom { padding: 0 var(--margin) clamp(18px, 2.6vw, 34px); display: grid; gap: clamp(14px, 2vw, 26px); }
  .hero__row { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
  .hero h1 { font-size: var(--step-head); line-height: 1; max-width: 28ch; }
  .hero__lead { font-size: var(--step-lead); line-height: 1.25; max-width: 34ch; margin-top: 14px; font-weight: 500; }
  .hero__name { color: var(--half-white); width: 100%; }
  .hero__name svg { width: 100%; height: auto; overflow: visible; }

  /* ===== CONFIGURATOR — the live thing ===== */
  .config { padding-block: var(--gap-section); }
  .config__head { grid-column: 1 / span 5; }
  .config__head h2 { margin-bottom: 24px; }
  .config__draw { grid-column: 1 / -1; margin-top: clamp(32px, 4vw, 64px); display: grid; grid-template-columns: subgrid; align-items: start; }
  .drawing { grid-column: 1 / span 8; background: var(--onyx); padding: clamp(12px, 2vw, 28px); }
  .drawing svg { width: 100%; height: auto; }
  .controls { grid-column: 9 / -1; display: grid; gap: 28px; }
  .field label { display: flex; justify-content: space-between; align-items: baseline; font-weight: 500; margin-bottom: 8px; }
  .field output { font-family: var(--font-display); font-weight: 700; font-size: var(--step-lead); font-variant-numeric: tabular-nums; }
  .field input[type="range"] { width: 100%; height: 44px; accent-color: var(--torch); background: transparent; cursor: pointer; touch-action: pan-y; }
  .results { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  .results div { background: var(--onyx); color: var(--ink); padding: 18px 20px; }
  .results dt { font-size: var(--step-small); color: var(--muted); }
  .results dd { font-family: var(--font-display); font-weight: 700; font-size: var(--step-lead); font-variant-numeric: tabular-nums; margin-top: 4px; }
  .config__note { font-size: var(--step-small); color: var(--field-muted); max-width: 44ch; }

  /* drawing paint */
  .d-steel { stroke: var(--torch); fill: none; stroke-linecap: square; stroke-linejoin: miter; }
  .d-ground { fill: #4d4f52; }
  .d-dim { stroke: #c4c5c7; fill: none; }
  .d-label { fill: #fffefa; font-family: var(--font-display); font-weight: 700; font-size: 18px; text-anchor: middle; }
  .d-purlin { fill: #fffefa; }
  .d-ghost { stroke: #4d4f52; fill: none; }

}

@layer motion {
  /* entrance — transform and opacity only, gated on JS so content never hides without it */
  .js [data-in] { opacity: 0; transform: translateY(24px); transition: opacity 420ms var(--ease-out), transform 420ms var(--ease-out); transition-delay: calc(var(--i, 0) * 70ms); }
  .js [data-in].in { opacity: 1; transform: none; }

  /* hero load-in */
  @keyframes rise { from { opacity: 0; transform: translateY(28px); } to { opacity: 1; transform: none; } }
  .hero h1, .hero__row .btn { animation: rise 800ms var(--ease-out) 150ms both; }
  .hero__row .btn { animation-delay: 260ms; }
  @keyframes drop { from { opacity: 0; transform: translateY(-130%) rotate(-6deg); } 55% { opacity: 1; } to { opacity: 1; transform: none; } }
  .hero__name svg path { transform-box: fill-box; transform-origin: 50% 100%; animation: drop 900ms cubic-bezier(0.3, 1.35, 0.5, 1) both; animation-delay: calc(var(--n, 0) * 90ms + 120ms); }
  .hero__name .l { transform-box: fill-box; transform-origin: 50% 100%; }

  /* native scroll-driven: the name slides up and scales out of the footer reveal */
  @supports (animation-timeline: view()) {
    @keyframes lift { to { transform: translateY(calc(var(--n) * -16px - 24px)) rotate(calc((var(--n) - 3.5) * 2.4deg)); } }
    .hero__name .l { animation: lift linear both; animation-timeline: scroll(root); animation-range: 0 75svh; }
    @keyframes grow { to { transform: scaleX(1); } }
    .progress { animation: grow linear both; animation-timeline: scroll(root); }
    .hero__media { animation: hero-out linear both; animation-timeline: scroll(root); animation-range: 0 100svh; }
    @keyframes hero-out { to { transform: translateY(12%); } }
  }

  @media (prefers-reduced-motion: reduce) {
    .js [data-in] { opacity: 1; transform: none; transition: none; }
    .hero h1, .hero__row .btn, .hero__name svg path, .hero__name .l, .hero__media, .progress, .cta__pattern::before { animation: none; }
    .hero__media img { transition: none; }
  }
}

@media (max-width: 899px) {
  .nav ul { display: none; }
  .nav__menu { display: inline-flex; align-items: center; min-height: 44px; padding: 0 4px; background: none; border: 0; font-weight: 500; font-size: var(--step-small); color: var(--half-white); cursor: pointer; }
  .nav__menu[aria-expanded="true"] + ul { display: grid; position: absolute; top: 72px; right: var(--margin); left: var(--margin); background: var(--onyx); padding: 8px 20px; z-index: 6; }
  .hero { padding-top: 96px; }
  .hero__row { flex-direction: column; align-items: stretch; }
  .hero__row .btn { width: 100%; }
  .hero__media img { object-position: 60% 50%; }


  .config__head, .drawing, .controls { grid-column: 1 / -1; }
  .drawing { margin-bottom: 24px; }
}

.d-ghost-s { stroke: #4d4f52; fill: none; stroke-linecap: square; stroke-linejoin: miter; }

/* ===== ANIMATED LAYER ===== */
.sparks { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 50; }
.sparks--hero, .sparks--local { position: absolute; z-index: -1; }
.progress { position: fixed; top: 0; left: 0; right: 0; height: 5px; background: var(--torch); transform: scaleX(0); transform-origin: left; z-index: 60; }
@supports not (animation-timeline: scroll()) { .progress { display: none; } }

/* masked word reveal */
.js [data-split] .w { display: inline-block; overflow: clip; vertical-align: top; padding-bottom: 0.1em; margin-bottom: -0.1em; }
.js [data-split] .w > span { display: inline-block; transform: translateY(108%); transition: transform 800ms var(--ease-out); transition-delay: calc(var(--k, 0) * 55ms); }
.js [data-split].in .w > span { transform: none; }

/* weld-draw of the steel drawings */
@keyframes weld { to { stroke-dashoffset: 0; } }
.js .drawlive:not(.settled) .d-steel, .js .drawlive:not(.settled) .d-ghost-s { stroke-dasharray: 1000; stroke-dashoffset: 1000; }
.js .drawlive:not(.settled).on .d-steel { animation: weld 1.7s var(--ease-io) forwards; }
.js .drawlive:not(.settled).on .d-ghost-s { animation: weld 1.2s var(--ease-io) 0.9s forwards; }
.js .drawlive:not(.settled) .d-purlin { opacity: 0; }
.js .drawlive.on:not(.settled) .d-purlin { opacity: 1; transition: opacity 400ms 1.5s; }

/* ===== MONTAGE (pinned, scroll-driven) ===== */
.montage { height: 340svh; background: var(--surface); position: relative; }
.montage__stick { isolation: isolate; position: sticky; top: 0; height: 100svh; display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); align-items: center; gap: clamp(16px, 3vw, 48px); padding: 0 var(--margin); overflow: clip; }
.montage__text { display: grid; gap: 28px; align-content: center; }
.montage h2 { font-size: var(--step-lead); color: var(--muted); }
.montage__names { display: flex; gap: clamp(16px, 2vw, 32px); flex-wrap: wrap; }
.montage__names button { background: none; border: 0; border-bottom: 4px solid transparent; cursor: pointer; font-family: var(--font-display); font-weight: 700; font-size: var(--step-lead); text-transform: uppercase; color: var(--muted); padding: 8px 0; min-height: 44px; transition: color 200ms var(--ease-out), border-color 200ms var(--ease-out); }
.montage__names button[aria-current="true"] { color: var(--ink); border-bottom-color: var(--torch); }
@media (hover: hover) and (pointer: fine) { .montage__names button:hover { color: var(--ink); } }
.chapters { display: grid; }
.chapter { grid-area: 1 / 1; opacity: 0; visibility: hidden; transform: translateY(28px); transition: opacity 400ms var(--ease-out), transform 400ms var(--ease-out), visibility 0s linear 400ms; pointer-events: none; }
.chapter.is-active { opacity: 1; visibility: visible; transform: none; pointer-events: auto; transition-delay: 0s; }
.chapter h3 { font-size: var(--step-head); margin-bottom: 20px; }
.chapter p { max-width: 40ch; }
.chapter ul { margin-top: 20px; display: grid; gap: 4px; }
.chapter li { padding-left: 22px; position: relative; }
.chapter li::before { content: ""; position: absolute; left: 0; top: 0.62em; width: 10px; height: 10px; background: var(--torch); clip-path: polygon(0 0, 100% 50%, 0 100%); }
.montage__art { min-width: 0; }
.montage__svg { width: 100%; height: auto; max-height: 86svh; }
/* snap points: the page settles on each step of the montage */
html { scroll-snap-type: y proximity; }
.montage__snap { position: absolute; left: 0; width: 1px; height: 100svh; scroll-snap-align: start; pointer-events: none; }
@media (max-width: 899px) { .montage__snap { display: none; } }
@media (prefers-reduced-motion: reduce) { html { scroll-snap-type: none; } }
.montage__beam { position: absolute; left: 0; right: 0; bottom: 0; height: 10px; background: var(--torch); transform: scaleX(0); transform-origin: left; }
.m-steel { stroke: var(--torch); fill: none; stroke-width: 9; stroke-linejoin: miter; stroke-linecap: square; }
.m-long { stroke: var(--torch); fill: none; stroke-width: 4; }
.m-brace { stroke: var(--half-white); fill: none; stroke-width: 3; }
.m-outline { stroke: #c4c5c7; fill: none; stroke-width: 3; stroke-linejoin: miter; }
.m-dim { stroke: #c4c5c7; fill: none; stroke-width: 2; }
.m-text { fill: #c4c5c7; font-family: var(--font-display); font-weight: 700; font-size: 20px; letter-spacing: 0.06em; }
html:not(.js) .montage, .montage.is-static { height: auto; }
html:not(.js) .montage__stick, .is-static .montage__stick { position: static; height: auto; padding-block: var(--gap-section); }
html:not(.js) .chapters, .is-static .chapters { gap: 48px; }
html:not(.js) .chapter, .is-static .chapter { grid-area: auto; opacity: 1; visibility: visible; transform: none; }
html:not(.js) .montage__names, .is-static .montage__names { display: none; }

@media (max-width: 899px) {
  .montage { height: auto; }
  .montage__stick { position: static; height: auto; display: block; padding: 0 var(--margin) 56px; overflow: visible; isolation: auto; }
  .montage__art { position: sticky; top: 0; z-index: 2; background: var(--surface); padding: 64px 0 8px; }
  .montage__svg { max-height: 34svh; }
  .montage__text { gap: 0; padding-top: 24px; }
  .montage__names { display: none; }
  .montage h2 { margin-bottom: 8px; }
  .chapters { gap: 0; }
  .chapter { grid-area: auto; opacity: 1; visibility: visible; transform: none; min-height: 56svh; display: block; }
  .chapter h3 { font-size: var(--step-head); margin-bottom: 12px; }
  .chapter ul { margin-top: 16px; }
  .sparks--local { display: none !important; }
  .montage__beam { display: none; }
}
