/* =========================================================================
   THE HOOK & PRINTER
   Craft × Machine — the page lives between two worlds and morphs between
   them as you scroll. Every colour comes from the logo: linen, charcoal,
   brass, steel.
   ========================================================================= */

/* ---------- 1. tokens ---------------------------------------------------- */
:root {
  /* craft world — warm, organic */
  --craft-bg:    #ece2cf;
  --craft-bg-2:  #f7f1e4;
  --craft-line:  #cfc0a2;
  --craft-ink:   #211e18;
  --craft-ink-2: #6b6252;
  --yarn:        #c0543c;
  --moss:        #7a8c5c;

  /* machine world — cool, precise */
  --mach-bg:     #0d0d10;
  --mach-bg-2:   #16161b;
  --mach-line:   #2b2b33;
  --mach-ink:    #efedf4;
  --mach-ink-2:  #9997a5;
  --brass:       #e2a72c;
  --steel:       #8b95a3;

  --measure: 62ch;
  --pad: clamp(1.25rem, 5vw, 6rem);
  --radius: 18px;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --ease-io: cubic-bezier(.65, 0, .35, 1);

  --font-display: 'Bricolage Grotesque', 'Segoe UI', system-ui, sans-serif;
  --font-body: 'Inter', 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'Space Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;

  /* live world tokens — swapped by [data-world] */
  --bg: var(--craft-bg);
  --bg-2: var(--craft-bg-2);
  --line: var(--craft-line);
  --ink: var(--craft-ink);
  --ink-2: var(--craft-ink-2);
  --accent: var(--yarn);
}

html[data-world='machine'] {
  --bg: var(--mach-bg);
  --bg-2: var(--mach-bg-2);
  --line: var(--mach-line);
  --ink: var(--mach-ink);
  --ink-2: var(--mach-ink-2);
  --accent: var(--brass);
}

/* ---------- 2. reset ----------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  font-size: clamp(1rem, .96rem + .2vw, 1.075rem);
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
  overflow-x: hidden;
  transition: background-color .8s var(--ease), color .8s var(--ease);
  cursor: none;
}
@media (hover: none), (pointer: coarse) { body { cursor: auto; } }

img, svg, canvas { display: block; max-width: 100%; }
img { height: auto; }
a { color: inherit; }
button { font: inherit; color: inherit; background: none; border: 0; }
:where(a, button, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

.skip {
  position: fixed; top: -100px; left: 1rem; z-index: 999;
  background: var(--accent); color: #fff; padding: .7rem 1.1rem;
  border-radius: 8px; text-decoration: none; font-weight: 600;
}
.skip:focus { top: 1rem; }

/* ---------- 3. type utilities -------------------------------------------- */
.mono { font-family: var(--font-mono); font-size: .74rem; letter-spacing: .1em; text-transform: uppercase; }

.eyebrow {
  font-family: var(--font-mono);
  font-size: .72rem; letter-spacing: .22em; text-transform: uppercase;
  color: var(--ink-2);
  display: flex; align-items: center; gap: .8rem;
}
.eyebrow::before {
  content: ''; width: 2.2rem; height: 1px; background: currentColor; flex: none;
}
.eyebrow--hero { justify-content: center; }
.eyebrow--hero::after { content: ''; width: 2.2rem; height: 1px; background: currentColor; }

.section-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.3rem, 1.4rem + 4.4vw, 5.2rem);
  line-height: .96;
  letter-spacing: -.035em;
  margin: .35em 0 .3em;
}
.section-lede { color: var(--ink-2); max-width: 46ch; }
.section-head { margin-bottom: clamp(2.5rem, 6vw, 4.5rem); }

/* ---------- 4. buttons --------------------------------------------------- */
.btn {
  --btn-bg: var(--ink);
  --btn-fg: var(--bg);
  display: inline-flex; align-items: center; gap: .6rem;
  padding: .95rem 1.7rem;
  border-radius: 100px;
  background: var(--btn-bg); color: var(--btn-fg);
  font-weight: 600; font-size: .96rem; text-decoration: none;
  position: relative; overflow: hidden; isolation: isolate;
  transition: transform .5s var(--ease), box-shadow .5s var(--ease);
  will-change: transform;
}
.btn::before {
  content: ''; position: absolute; inset: 0; z-index: -1;
  background: var(--accent);
  transform: translateY(101%);
  transition: transform .55s var(--ease);
}
.btn:hover::before { transform: translateY(0); }
.btn:hover { color: #fff; box-shadow: 0 14px 34px -14px rgba(0,0,0,.5); }

.btn--craft  { --btn-bg: var(--craft-ink); --btn-fg: var(--craft-bg-2); }
.btn--brass  { --btn-bg: var(--brass); --btn-fg: #17140b; }
.btn--brass::before { background: #fff; }
.btn--brass:hover { color: #17140b; }
.btn--ghost {
  --btn-bg: transparent; --btn-fg: var(--ink);
  box-shadow: inset 0 0 0 1.5px currentColor;
}
.btn--wa { --btn-bg: #1fa855; --btn-fg: #fff; }
.btn--ig { --btn-bg: #c9377d; --btn-fg: #fff; }
.btn svg { width: 1.05em; height: 1.05em; fill: currentColor; flex: none; }

/* ---------- 5. reveal ---------------------------------------------------- */
.reveal {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity .85s var(--ease), transform .85s var(--ease);
  transition-delay: var(--d, 0ms);
}
.reveal.is-in { opacity: 1; transform: none; }

/* headings that "print" themselves layer by layer */
.print-in { clip-path: inset(0 0 100% 0); }
.print-in.is-in { animation: printDown .85s steps(16) forwards; }
@keyframes printDown { to { clip-path: inset(0 0 -2% 0); } }

/* ---------- 6. intro ----------------------------------------------------- */
.intro {
  position: fixed; inset: 0; z-index: 200;
  display: grid; place-content: center; justify-items: center; gap: 1.4rem;
  background: var(--mach-bg);
  transition: opacity .7s var(--ease), visibility .7s;
}
.intro.is-done { opacity: 0; visibility: hidden; pointer-events: none; }
.intro__mark { position: relative; width: min(34vw, 160px); aspect-ratio: 1; }
.intro__ring { position: absolute; inset: -8%; overflow: visible; }
.intro__ring circle, .intro__ring path { fill: none; stroke-linecap: round; }
.intro__circle { stroke: rgba(255,255,255,.1); stroke-width: 1; }
.intro__thread {
  stroke: var(--brass); stroke-width: 2.5;
  stroke-dasharray: 340; stroke-dashoffset: 340;
  animation: threadWind 1.4s var(--ease-io) forwards;
}
@keyframes threadWind { to { stroke-dashoffset: 0; } }
.intro__logo {
  width: 100%; height: 100%; object-fit: contain;
  opacity: 0; transform: scale(.82);
  animation: introLogo .8s .55s var(--ease) forwards;
}
@keyframes introLogo { to { opacity: 1; transform: none; } }
.intro__word {
  font-family: var(--font-display); font-weight: 800;
  font-size: clamp(1rem, 3.4vw, 1.5rem); letter-spacing: -.02em;
  color: var(--mach-ink); opacity: 0;
  animation: introLogo .7s .95s var(--ease) forwards;
}
.intro__word em { color: var(--brass); font-style: normal; }

/* ---------- 7. cursor + scroll stitch ------------------------------------ */
.yarn-cursor {
  position: fixed; inset: 0; z-index: 150;
  pointer-events: none; width: 100%; height: 100%;
}
@media (hover: none), (pointer: coarse) { .yarn-cursor { display: none; } }

.stitchline {
  position: fixed; top: 0; right: max(.5rem, 1.4vw); z-index: 40;
  width: 20px; height: 100vh; pointer-events: none;
  opacity: .55;
}
.stitchline path {
  fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linecap: round;
  stroke-dasharray: 1 1; stroke-dashoffset: 1;
  transition: stroke .8s var(--ease);
}
@media (max-width: 720px) { .stitchline { display: none; } }

/* ---------- 8. nav ------------------------------------------------------- */
.nav {
  position: fixed; inset: 0 0 auto; z-index: 100;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1rem var(--pad);
  transition: background-color .5s var(--ease), transform .5s var(--ease), border-color .5s;
  border-bottom: 1px solid transparent;
  /* Always tinted: the bar floats over the split hero, so without a backdrop
     the links land on the dark half and vanish. */
  background: color-mix(in srgb, var(--bg) 74%, transparent);
  backdrop-filter: blur(14px) saturate(1.3);
}
.nav.is-stuck {
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  border-bottom-color: var(--line);
}
.nav.is-hidden { transform: translateY(-105%); }

.nav__brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; font-weight: 700; position: relative; z-index: 2; }
.nav__brand img { width: 38px; height: 38px; }
.nav__brand span { font-family: var(--font-display); font-size: .98rem; letter-spacing: -.02em; white-space: nowrap; }
.nav__brand em { color: var(--accent); font-style: normal; }

.nav__links { display: flex; gap: clamp(1rem, 2.4vw, 2.2rem); }
.nav__links a {
  text-decoration: none; font-size: .92rem; font-weight: 500;
  position: relative; padding: .3rem 0;
}
.nav__links a::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 1.5px;
  background: var(--accent); transform: scaleX(0); transform-origin: right;
  transition: transform .45s var(--ease);
}
.nav__links a:hover::after, .nav__links a.is-here::after { transform: scaleX(1); transform-origin: left; }

.nav__tools { display: flex; align-items: center; gap: .5rem; position: relative; z-index: 2; }
.lang {
  display: flex; align-items: center; gap: .25rem;
  font-family: var(--font-mono); font-size: .74rem; letter-spacing: .06em;
  padding: .45rem .7rem; border-radius: 100px;
  box-shadow: inset 0 0 0 1.2px var(--line);
  cursor: pointer; transition: box-shadow .4s;
}
.lang:hover { box-shadow: inset 0 0 0 1.2px var(--accent); }
.lang__opt { color: var(--ink-2); transition: color .35s; }
.lang__sep { color: var(--line); }
html[data-lang='es'] .lang__opt[data-lang-opt='es'],
html[data-lang='en'] .lang__opt[data-lang-opt='en'] { color: var(--ink); font-weight: 700; }

.burger { display: none; width: 42px; height: 42px; cursor: pointer; padding: 10px; }
.burger span { display: block; height: 1.8px; background: currentColor; border-radius: 2px; transition: transform .4s var(--ease), opacity .3s; }
.burger span + span { margin-top: 6px; }
.burger[aria-expanded='true'] span:first-child { transform: translateY(3.9px) rotate(45deg); }
.burger[aria-expanded='true'] span:last-child { transform: translateY(-3.9px) rotate(-45deg); }

@media (max-width: 860px) {
  .burger { display: block; }
  .nav__links {
    position: fixed; inset: 0 0 auto; padding: 6rem var(--pad) 2.5rem;
    flex-direction: column; gap: 1.2rem;
    background: var(--bg); border-bottom: 1px solid var(--line);
    transform: translateY(-100%); transition: transform .6s var(--ease);
    z-index: 1;
  }
  .nav__links.is-open { transform: none; }
  .nav__links a { font-size: 1.6rem; font-family: var(--font-display); font-weight: 600; }
}

/* ---------- 9. hero ------------------------------------------------------ */
.hero {
  position: relative; min-height: 100svh;
  display: grid; place-items: center;
  /* minmax(0,1fr) stops a wide child from forcing the track past the viewport */
  grid-template-columns: minmax(0, 1fr);
  padding: 7rem var(--pad) 5rem;
  overflow: hidden;
  background: var(--craft-bg);
  color: var(--craft-ink);
  isolation: isolate;
}
.hero__canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -2; }

/* the machine half is clipped in by JS via --seam (0..100) */
.hero::after {
  content: ''; position: absolute; inset: 0; z-index: -1;
  background:
    radial-gradient(120% 90% at 78% 20%, rgba(226,167,44,.16), transparent 60%),
    var(--mach-bg);
  clip-path: polygon(calc(var(--seam, 54%) + 8%) 0, 100% 0, 100% 100%, calc(var(--seam, 54%) - 8%) 100%);
  transition: clip-path .9s var(--ease);
}
.hero__seam {
  position: absolute; top: 0; bottom: 0; z-index: 0; pointer-events: none;
  background: linear-gradient(to bottom, transparent, rgba(226,167,44,.5), transparent);
  width: 1.5px; left: var(--seam, 54%);
  transform: skewX(-6deg);
  opacity: .7;
}

/* A linen label. The hero text is centred, so it crosses the seam onto the
   dark half — these chips keep every line readable over both worlds and
   echo the linen badge in the logo. */
.hero__label {
  background: color-mix(in srgb, var(--craft-bg-2) 90%, transparent);
  backdrop-filter: blur(10px);
  color: var(--craft-ink);
  box-shadow: inset 0 0 0 1px var(--craft-line);
}

.hero__side {
  position: absolute; top: 50%; z-index: 1;
  font-family: var(--font-mono); font-size: .68rem;
  letter-spacing: .3em; text-transform: uppercase;
  writing-mode: vertical-rl;
}
.hero__side--craft   { left: max(.8rem, 2vw);  color: var(--craft-ink-2); transform: translateY(-50%) rotate(180deg); }
.hero__side--machine { right: max(.8rem, 2vw); color: var(--steel); transform: translateY(-50%); }
@media (max-width: 860px) { .hero__side { display: none; } }

.hero__inner {
  position: relative; z-index: 2; text-align: center;
  width: min(100%, 78rem); min-width: 0;
  display: grid; justify-items: center;
}
.eyebrow--hero {
  padding: .55rem 1.2rem; border-radius: 100px;
  width: max-content; max-width: 100%;
}
@media (max-width: 720px) {
  /* the rules either side of the eyebrow stop the line wrapping — drop them */
  .eyebrow--hero { width: auto; flex-wrap: wrap; justify-content: center; text-align: center; }
  .eyebrow--hero::before, .eyebrow--hero::after { display: none; }
}

/* --- wordmark --- */
/* "The Hook" leans into the craft half, "Printer" into the machine half —
   each word sits on the world it belongs to, and the logo pins the seam. */
.wordmark {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.6rem, 1rem + 9.4vw, 9rem);
  line-height: .88;
  letter-spacing: -.045em;
  margin: 1.2rem 0 .1em;
  width: 100%;
  display: grid; gap: .02em;
}
.wordmark__row { position: relative; display: inline-block; width: max-content; }
.wordmark__row--craft   { justify-self: start; margin-left: max(0px, 2vw); }
.wordmark__row--machine { justify-self: end;   margin-right: max(0px, 2vw); }

@media (max-width: 720px) {
  .wordmark { justify-items: center; }
  .wordmark__row--craft, .wordmark__row--machine { justify-self: center; margin: 0; }

  /* On a narrow screen a vertical seam slices straight through both words —
     "ook" lands on black, "Print" lands on linen, and each half disappears.
     Lay the seam flat instead and run it through the logo: the wordmark is
     already stacked, so each word keeps the world it was drawn for.
     --hseam is measured off the logo in app.js. */
  .hero::after {
    clip-path: polygon(0 calc(var(--hseam, 50%) + 2.5%), 100% calc(var(--hseam, 50%) - 2.5%), 100% 100%, 0 100%);
  }
  .hero__seam {
    top: var(--hseam, 50%); bottom: auto; left: 0; right: 0;
    width: auto; height: 1.5px;
    background: linear-gradient(to right, transparent, rgba(226,167,44,.55), transparent);
    transform: skewY(-6deg);
  }
  /* the drifting-yarn canvas is drawn for a vertical split; drop it here and
     let the hero load lighter on phones */
  .hero__canvas { display: none; }
}
.wordmark__row--craft { color: var(--craft-ink); }
.wordmark__row--machine { color: var(--mach-ink); }

/* letters flown in one by one, as if pulled by the thread */
.wordmark__word .ch {
  display: inline-block;
  opacity: 0; transform: translateY(.42em) rotate(6deg);
  animation: chIn .8s var(--ease) forwards;
  animation-delay: calc(var(--i) * 55ms + 200ms);
}
.wordmark__word .ch--space { width: .28em; }
@keyframes chIn { to { opacity: 1; transform: none; } }

.wordmark__yarn {
  position: absolute; left: -4%; right: -4%; bottom: -.1em;
  width: 108%; height: .42em; overflow: visible;
}
.wordmark__yarn path {
  fill: none; stroke: var(--yarn); stroke-width: 5; stroke-linecap: round;
  stroke-dasharray: 100; stroke-dashoffset: 100;
  animation: yarnDraw 1.5s .45s var(--ease-io) forwards;
}
@keyframes yarnDraw { to { stroke-dashoffset: 0; } }

.wordmark__amp {
  justify-self: center;
  width: clamp(4.5rem, 13vw, 9rem); aspect-ratio: 1;
  margin: .04em 0;
  opacity: 0; transform: scale(.4) rotate(-90deg);
  animation: ampIn 1s .8s var(--ease) forwards;
}
.wordmark__amp img { width: 100%; height: 100%; object-fit: contain; }
@keyframes ampIn { to { opacity: 1; transform: none; } }

/* "Printer" builds up in layers with a nozzle running across it */
.wordmark__print { display: inline-block; overflow: hidden; }
.wordmark__print > span {
  display: inline-block;
  clip-path: inset(100% 0 0 0);
  animation: layerUp 1.35s 1.05s steps(18) forwards;
}
@keyframes layerUp { to { clip-path: inset(-4% 0 0 0); } }

/* the print head runs the width of the word, descending one layer per pass */
.wordmark__nozzle {
  position: absolute; top: -.06em; left: 0;
  width: .1em; height: .14em; border-radius: 2px 2px 50% 50%;
  background: var(--brass);
  box-shadow: 0 0 18px 3px rgba(226,167,44,.6);
  opacity: 0;
  animation: nozzleRun .34s 1.05s steps(9, end) 4 alternate, nozzleFade 1.7s 1.05s forwards;
}
@keyframes nozzleRun { from { left: 0; } to { left: calc(100% - .1em); } }
@keyframes nozzleFade { 0%, 82% { opacity: 1; } 100% { opacity: 0; } }

.hero__tagline {
  max-width: 36ch; margin: 1.5rem auto 0;
  padding: .8rem 1.4rem; border-radius: 16px;
  font-size: clamp(1rem, .9rem + .5vw, 1.2rem);
  opacity: 0; animation: chIn .9s 1.5s var(--ease) forwards;
}

.hero__cta {
  display: flex; flex-wrap: wrap; gap: .8rem; justify-content: center;
  margin-top: 2rem;
  opacity: 0; animation: chIn .9s 1.7s var(--ease) forwards;
}

.hero__scroll {
  position: absolute; bottom: 1.4rem; left: 50%; transform: translateX(-50%);
  z-index: 2;
  display: flex; flex-direction: column; align-items: center; gap: .45rem;
  padding: .45rem .85rem .55rem; border-radius: 100px;
  font-family: var(--font-mono); font-size: .6rem; letter-spacing: .26em;
  text-transform: uppercase;
  opacity: 0; animation: chIn 1s 2s var(--ease) forwards;
}
.hero__scroll i { display: block; width: 1px; height: 1.3rem; background: currentColor; transform-origin: top; animation: scrollPulse 1.9s var(--ease-io) infinite; }
@keyframes scrollPulse { 0% { transform: scaleY(0); } 45% { transform: scaleY(1); } 100% { transform: scaleY(0); transform-origin: bottom; } }

/* ---------- 10. duality -------------------------------------------------- */
.duality {
  padding: clamp(4.5rem, 12vw, 9rem) var(--pad);
  background: linear-gradient(180deg, var(--craft-bg) 0%, var(--craft-bg-2) 45%, var(--mach-bg) 100%);
  color: var(--craft-ink);
}
.duality .eyebrow { justify-content: center; color: var(--craft-ink-2); }
.duality .eyebrow::after { content: ''; width: 2.2rem; height: 1px; background: currentColor; }

.duality__grid {
  display: grid; gap: clamp(1.5rem, 4vw, 3rem);
  grid-template-columns: 1fr auto 1fr;
  align-items: stretch;
  margin: clamp(2.5rem, 6vw, 4rem) auto 0;
  max-width: 76rem;
}
.pane { padding: clamp(1.5rem, 3vw, 2.4rem); border-radius: var(--radius); }
.pane h2 { font-family: var(--font-display); font-weight: 800; font-size: clamp(1.7rem, 1.2rem + 2vw, 3rem); letter-spacing: -.03em; margin: 1rem 0 .5rem; }
.pane p { max-width: 40ch; }
.pane__spec { margin-top: 1.2rem; opacity: .65; }
.pane__art { width: 100%; aspect-ratio: 2 / 1; }
.pane__art svg { width: 100%; height: 100%; overflow: visible; }

.pane--craft { background: color-mix(in srgb, var(--craft-bg-2) 70%, transparent); box-shadow: inset 0 0 0 1px var(--craft-line); }
.pane--craft p { color: var(--craft-ink-2); }
.pane--craft .pane__stitches path { fill: none; stroke: var(--yarn); stroke-width: 4; stroke-linecap: round; }

.pane--machine { background: var(--mach-bg-2); color: var(--mach-ink); box-shadow: inset 0 0 0 1px var(--mach-line); }
.pane--machine p { color: var(--mach-ink-2); }
.pane--machine .pane__layers rect { fill: var(--brass); }

.duality__zip { position: relative; width: 2px; background: linear-gradient(var(--craft-line), var(--brass), var(--mach-line)); border-radius: 2px; }
.duality__zip span {
  position: absolute; left: 50%; top: 0; width: 11px; height: 11px;
  border-radius: 50%; background: var(--brass); transform: translate(-50%, -50%);
  box-shadow: 0 0 16px 3px rgba(226,167,44,.55);
  animation: zipRun 4.5s var(--ease-io) infinite;
}
@keyframes zipRun { 0%, 100% { top: 0; } 50% { top: 100%; } }

@media (max-width: 860px) {
  .duality__grid { grid-template-columns: 1fr; }
  .duality__zip { width: auto; height: 2px; background: linear-gradient(90deg, var(--craft-line), var(--brass), var(--mach-line)); }
  .duality__zip span { top: 50%; animation-name: zipRunX; }
  @keyframes zipRunX { 0%, 100% { left: 0; } 50% { left: 100%; } }
}

.duality__punch {
  max-width: 30ch; margin: clamp(2.5rem, 6vw, 4rem) auto 0; text-align: center;
  font-family: var(--font-display); font-weight: 600;
  font-size: clamp(1.25rem, 1rem + 1.6vw, 2.2rem); line-height: 1.25;
  letter-spacing: -.02em;
  color: var(--mach-ink);
}

/* ---------- 11. work ----------------------------------------------------- */
.work {
  padding: clamp(4.5rem, 12vw, 9rem) var(--pad) clamp(5rem, 12vw, 9rem);
  background: var(--mach-bg); color: var(--mach-ink);
}
.work .eyebrow, .work .section-lede { color: var(--mach-ink-2); }

.filters { display: flex; flex-wrap: wrap; gap: .55rem; margin-bottom: clamp(2rem, 5vw, 3rem); }
.chip {
  padding: .55rem 1.15rem; border-radius: 100px; cursor: pointer;
  font-size: .88rem; font-weight: 500; color: var(--mach-ink-2);
  box-shadow: inset 0 0 0 1px var(--mach-line);
  transition: color .35s, box-shadow .35s, background-color .35s;
}
.chip:hover { color: var(--mach-ink); box-shadow: inset 0 0 0 1px var(--steel); }
.chip.is-on { background: var(--brass); color: #17140b; font-weight: 700; box-shadow: none; }

.grid {
  display: grid; gap: clamp(1rem, 2.4vw, 1.8rem);
  /* 250 rather than 270: at 1280px the wider track fell one column short and
     the grid dropped to 3, so every row became "featured + one" */
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr));
  /* featured cards span two tracks — dense backfills the gaps they leave */
  grid-auto-flow: row dense;
}
.card { grid-column: span 1; }
.card.is-featured { grid-column: span 2; }
@media (max-width: 620px) { .card.is-featured { grid-column: span 1; } }

.card__hit {
  display: block; width: 100%; text-align: left; cursor: pointer;
  border-radius: var(--radius); overflow: hidden;
  background: var(--mach-bg-2);
  box-shadow: inset 0 0 0 1px var(--mach-line);
  transition: transform .6s var(--ease), box-shadow .6s var(--ease);
  will-change: transform;
}
.card__hit:hover { transform: translateY(-6px); box-shadow: inset 0 0 0 1px var(--steel), 0 26px 50px -26px rgba(0,0,0,.85); }
/* the card clips its overflow, so pull the focus ring inside where it shows */
.card__hit:focus-visible { outline-offset: -3px; }

.card__frame {
  position: relative; overflow: hidden;
  background: var(--tint, var(--mach-bg-2));
  aspect-ratio: 4 / 5;
}
.card.is-featured .card__frame { aspect-ratio: 8 / 5; }
@media (max-width: 620px) { .card.is-featured .card__frame { aspect-ratio: 4 / 5; } }

.card__frame img {
  width: 100%; height: 100%; object-fit: cover;
  clip-path: inset(100% 0 0 0);
  filter: grayscale(1) contrast(1.15) brightness(.75);
  transition: filter 1.1s .35s var(--ease), transform 1.1s var(--ease);
}
.card.is-in .card__frame img { animation: cardIn 1s var(--ease) forwards; filter: none; }
@keyframes cardIn { to { clip-path: inset(0 0 0 0); } }
/* print pieces stack up in visible layers, crochet pieces sweep in smoothly */
.card[data-kind='print'].is-in .card__frame img { animation-timing-function: steps(14); }
.card__hit:hover .card__frame img { transform: scale(1.045); }

/* the stitch / layer overlay that draws then dissolves */
.card__weave {
  position: absolute; inset: 0; width: 100%; height: 100%;
  pointer-events: none; opacity: 0;
}
.card.is-in .card__weave { animation: weave 1.9s var(--ease) forwards; }
@keyframes weave {
  0%   { opacity: 0; }
  22%  { opacity: .85; }
  70%  { opacity: .5; }
  100% { opacity: 0; }
}
.card__weave path, .card__weave line {
  fill: none; stroke: var(--brass); stroke-width: 1.1; stroke-linecap: round;
  stroke-dasharray: 1 1; stroke-dashoffset: 1;
}
.card.is-in .card__weave path, .card.is-in .card__weave line {
  animation: weaveDraw 1.2s var(--ease-io) forwards;
  animation-delay: calc(var(--i) * 28ms);
}
@keyframes weaveDraw { to { stroke-dashoffset: 0; } }

.card__meta { padding: 1.1rem 1.2rem 1.25rem; }
.card__kind { color: var(--steel); font-size: .66rem; }
.card__name { font-family: var(--font-display); font-weight: 700; font-size: 1.24rem; letter-spacing: -.02em; margin: .35rem 0 .2rem; }
.card__tag { color: var(--mach-ink-2); font-size: .9rem; }
.card__foot { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-top: .9rem; }
.card__price { font-family: var(--font-display); font-weight: 800; font-size: 1.15rem; }
.card__price.is-ask { font-family: var(--font-mono); font-size: .72rem; font-weight: 400; letter-spacing: .1em; text-transform: uppercase; color: var(--steel); }
.card__go { font-family: var(--font-mono); font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; color: var(--brass); display: flex; align-items: center; gap: .35rem; }
.card__go::after { content: '→'; transition: transform .4s var(--ease); }
.card__hit:hover .card__go::after { transform: translateX(4px); }

.work__empty { color: var(--mach-ink-2); padding: 3rem 0; }

/* ---------- 12. process -------------------------------------------------- */
.process {
  padding: clamp(4.5rem, 12vw, 9rem) var(--pad);
  background: var(--craft-bg); color: var(--craft-ink);
}
.process .eyebrow { color: var(--craft-ink-2); }
.steps {
  list-style: none; padding: 0;
  display: grid; gap: clamp(1.2rem, 3vw, 2rem);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  counter-reset: step;
}
.step { position: relative; padding-top: 1.6rem; border-top: 1.5px solid var(--craft-line); }
.step::before {
  content: ''; position: absolute; top: -1.5px; left: 0; height: 1.5px; width: 0;
  background: var(--yarn); transition: width 1s var(--ease); transition-delay: var(--d, 0ms);
}
.step.is-in::before { width: 100%; }
.step__n { color: var(--yarn); }
.step h3 { font-family: var(--font-display); font-weight: 700; font-size: 1.3rem; letter-spacing: -.02em; margin: .5rem 0 .4rem; }
.step p { color: var(--craft-ink-2); font-size: .96rem; }

/* ---------- 13. custom --------------------------------------------------- */
.custom {
  position: relative; overflow: hidden;
  padding: clamp(5rem, 13vw, 10rem) var(--pad);
  background: var(--mach-bg); color: var(--mach-ink);
  text-align: center;
  display: grid; justify-items: center; gap: .4rem;
}
.custom .eyebrow { color: var(--mach-ink-2); justify-content: center; }
.custom .eyebrow::after { content: ''; width: 2.2rem; height: 1px; background: currentColor; }
.custom__body { max-width: 48ch; color: var(--mach-ink-2); margin-bottom: 1.6rem; }
.custom__art { position: absolute; inset: 0; z-index: 0; opacity: .5; pointer-events: none; }
.custom__art svg { width: 100%; height: 100%; }
.custom > *:not(.custom__art) { position: relative; z-index: 1; }
.custom__yarn, .custom__layer {
  fill: none; stroke-width: 2.5; stroke-linecap: round;
  stroke-dasharray: 100; stroke-dashoffset: 100;
}
.custom__yarn { stroke: var(--yarn); }
.custom__layer { stroke: var(--brass); }
.custom__knot { fill: var(--brass); }
.custom.is-in .custom__yarn, .custom.is-in .custom__layer { animation: yarnDraw 1.4s var(--ease-io) forwards; }
.custom.is-in .custom__knot { animation: knotPop .6s 1.3s var(--ease) forwards; }
@keyframes knotPop { 0% { r: 0; } 60% { r: 11; } 100% { r: 7; } }

/* ---------- 14. contact + footer ----------------------------------------- */
.contact {
  position: relative; overflow: hidden;
  padding: clamp(4.5rem, 12vw, 9rem) var(--pad);
  background: var(--craft-bg-2); color: var(--craft-ink);
  text-align: center;
  display: grid; justify-items: center;
}
.contact .eyebrow { color: var(--craft-ink-2); justify-content: center; }
.contact .eyebrow::after { content: ''; width: 2.2rem; height: 1px; background: currentColor; }
.contact__stamp {
  position: absolute; right: -8%; top: 50%; translate: 0 -50%;
  width: min(46vw, 420px); aspect-ratio: 1; opacity: .07; pointer-events: none;
  animation: spin 60s linear infinite;
}
.contact__stamp img { width: 100%; height: 100%; }
@keyframes spin { to { transform: rotate(360deg); } }

.contact__links { display: flex; flex-wrap: wrap; gap: .7rem; justify-content: center; margin-top: 2rem; }
.contact__where { margin-top: 1.6rem; color: var(--craft-ink-2); }

.foot {
  display: flex; flex-wrap: wrap; gap: .6rem 1.5rem; justify-content: space-between;
  padding: 1.6rem var(--pad); background: var(--craft-bg-2); color: var(--craft-ink-2);
  border-top: 1px solid var(--craft-line);
  font-size: .82rem;
}

/* ---------- 15. detail sheet --------------------------------------------- */
.sheet {
  width: min(1080px, 94vw); max-height: 92svh; padding: 0; border: 0;
  border-radius: var(--radius); overflow: hidden;
  background: var(--mach-bg-2); color: var(--mach-ink);
  box-shadow: 0 50px 100px -30px rgba(0,0,0,.85);
}
.sheet::backdrop { background: rgba(6,6,8,.82); backdrop-filter: blur(6px); }
.sheet[open] { animation: sheetIn .5s var(--ease); }
@keyframes sheetIn { from { opacity: 0; transform: translateY(24px) scale(.97); } }

.sheet__x {
  position: absolute; top: .8rem; right: .8rem; z-index: 3;
  width: 42px; height: 42px; border-radius: 50%; cursor: pointer;
  display: grid; place-items: center;
  background: rgba(10,10,12,.6); backdrop-filter: blur(8px);
  box-shadow: inset 0 0 0 1px var(--mach-line);
  transition: background-color .35s, transform .35s var(--ease);
}
.sheet__x:hover { background: var(--brass); transform: rotate(90deg); }
.sheet__x svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.sheet__x:hover svg { stroke: #17140b; }

.sheet__body { display: grid; grid-template-columns: 1.05fr .95fr; max-height: 92svh; }

.sheet__media { background: #0a0a0c; display: grid; grid-template-rows: 1fr auto; min-height: 0; }
.sheet__stage { position: relative; aspect-ratio: 4 / 5; overflow: hidden; }

@media (max-width: 820px) {
  .sheet__body { grid-template-columns: 1fr; overflow-y: auto; }
  /* An aspect-ratio here overflows its grid row once the dialog hits its
     92svh cap, and the stage paints over the thumbnail strip. A definite
     height keeps the thumbs where they belong. */
  .sheet__stage { aspect-ratio: auto; height: 46svh; }
}
.sheet__stage .shot {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  opacity: 0; pointer-events: none;
  transition: opacity .5s var(--ease);
}
.sheet__stage .shot.is-on { opacity: 1; pointer-events: auto; }
/* let the whole clip show rather than cropping a portrait video to the frame */
.sheet__stage video.shot { object-fit: contain; background: #000; }

.sheet__thumbs { display: flex; gap: .5rem; padding: .7rem; overflow-x: auto; scrollbar-width: thin; }
.sheet__thumbs[hidden] { display: none; }
.sheet__thumbs button {
  flex: none; width: 60px; aspect-ratio: 1; border-radius: 8px; overflow: hidden;
  cursor: pointer; opacity: .5; transition: opacity .3s, box-shadow .3s;
  box-shadow: inset 0 0 0 1.5px transparent;
}
.sheet__thumbs button.is-on { opacity: 1; box-shadow: inset 0 0 0 1.5px var(--brass); }
.sheet__thumbs img { width: 100%; height: 100%; object-fit: cover; }
.sheet__thumbs button { position: relative; }

/* play badge — on the video thumbnail and on the card that has footage */
.playbadge {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: rgba(8,8,10,.35);
}
.playbadge svg { width: 40%; height: 40%; fill: #fff; filter: drop-shadow(0 2px 6px rgba(0,0,0,.6)); }

.card__vid {
  position: absolute; right: .7rem; bottom: .7rem;
  width: 42px; height: 42px; border-radius: 50%; overflow: hidden;
  box-shadow: 0 6px 18px -6px rgba(0,0,0,.8);
  pointer-events: none;
}
.card__vid .playbadge { background: rgba(226,167,44,.92); }
.card__vid .playbadge svg { width: 52%; height: 52%; fill: #17140b; filter: none; }

.sheet__info { padding: clamp(1.5rem, 3.5vw, 2.6rem); overflow-y: auto; }
.sheet__kind { color: var(--brass); }
.sheet__title { font-family: var(--font-display); font-weight: 800; font-size: clamp(1.7rem, 1.3rem + 1.6vw, 2.6rem); letter-spacing: -.03em; line-height: 1.05; margin: .5rem 0 .25rem; }
.sheet__tagline { color: var(--steel); font-size: 1.02rem; }
.sheet__desc { color: var(--mach-ink-2); margin-top: 1.1rem; }
.sheet__specs { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: .45rem; margin-top: 1.3rem; }
.sheet__specs li {
  font-family: var(--font-mono); font-size: .68rem; letter-spacing: .06em;
  padding: .4rem .75rem; border-radius: 100px;
  box-shadow: inset 0 0 0 1px var(--mach-line); color: var(--mach-ink-2);
}
.sheet__price { font-family: var(--font-display); font-weight: 800; font-size: 2rem; margin-top: 1.5rem; }
.sheet__price.is-ask { font-family: var(--font-mono); font-size: .8rem; font-weight: 400; letter-spacing: .1em; text-transform: uppercase; color: var(--steel); }
.sheet__buy { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.2rem; }

/* ---------- 16. reduced motion ------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .reveal { opacity: 1; transform: none; }
  .print-in { clip-path: none; }
  .card__frame img { clip-path: none; filter: none; }
  .wordmark__word .ch, .wordmark__amp, .hero__tagline, .hero__cta, .hero__scroll { opacity: 1; transform: none; }
  .wordmark__print > span { clip-path: none; }
  .wordmark__yarn path, .custom__yarn, .custom__layer { stroke-dashoffset: 0; }
  .wordmark__nozzle, .yarn-cursor, .duality__zip span { display: none; }
  body { cursor: auto; }
  .step::before { width: 100%; }
}
