/* Hózhó. home experience. Colours come only from brand/tokens.css. */

/* Registered so grounds can turn like a page between sections. */
@property --ground      { syntax: "<color>"; inherits: true; initial-value: transparent; }
@property --panel       { syntax: "<color>"; inherits: true; initial-value: transparent; }
@property --ink         { syntax: "<color>"; inherits: true; initial-value: transparent; }
@property --ink-muted   { syntax: "<color>"; inherits: true; initial-value: transparent; }
@property --rule        { syntax: "<color>"; inherits: true; initial-value: transparent; }
@property --rule-strong { syntax: "<color>"; inherits: true; initial-value: transparent; }

/* Sandstone ground, composed from tokens (on-accent type, 5.6:1). */
[data-theme="sandstone"] {
  --ground: var(--hz-sandstone);
  --panel: var(--hz-sandstone);
  --ink: var(--on-accent);
  --ink-muted: var(--on-accent);
  --rule: var(--on-accent);
  --rule-strong: var(--on-accent);
}

:root {
  --pad: var(--space-page);
  --head-h: 72px;
  --ease: cubic-bezier(.16, 1, .3, 1);
  --turn: 1100ms;
}
@media (max-width: 1100px) { :root { --pad: 48px; } }
@media (max-width: 700px)  { :root { --pad: 20px; --head-h: 56px; } }

*, *::before, *::after { box-sizing: border-box; border-radius: var(--radius-none); }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background-color: var(--ground);
  background-image: url("img/grain.png");
  background-size: 256px 256px;
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--font-text);
  transition: --ground var(--turn) var(--ease), --panel var(--turn) var(--ease),
    --ink var(--turn) var(--ease), --ink-muted var(--turn) var(--ease),
    --rule var(--turn) var(--ease), --rule-strong var(--turn) var(--ease);
  overflow-x: hidden;
}
html.is-locked, html.is-locked body { overflow: hidden; }
img { display: block; max-width: 100%; height: auto; }
h1, h2, h3, p, ol, dl, dd { margin: 0; padding: 0; }
ol { list-style: none; }
a { color: inherit; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; letter-spacing: inherit; text-transform: inherit; }
::selection { background: var(--ink); color: var(--ground); }

:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* Type: fluid versions of the token styles */
.system { font-family: var(--font-mono); font-size: 12px; line-height: 1.4; letter-spacing: 0.14em; text-transform: uppercase; }
.body { font-size: clamp(17px, 1.3vw, 20px); line-height: 1.45; }
.lede { font-size: clamp(22px, 2.2vw, 32px); line-height: 1.35; }
.subhead { font-family: var(--font-display); font-weight: 400; font-size: clamp(26px, 2.3vw, 36px); line-height: 1.05; }
.headline-xl { font-family: var(--font-display); font-weight: 700; font-size: clamp(40px, 5.4vw, 88px); line-height: 1.02; }
.black { font-weight: 900; }
.thin { font-weight: 200; }
.muted { color: var(--ink-muted); }

.skip { position: fixed; left: var(--pad); top: 8px; z-index: 100; padding: 12px 16px; background: var(--ink); color: var(--ground); transform: translateY(-200%); text-decoration: none; }
.skip:focus { transform: none; }

/* Buttons: square, mono caps */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 52px; padding: 0 32px; text-decoration: none; transition: opacity 400ms var(--ease); }
.btn--bone { background: var(--hz-bone-ink); color: var(--hz-jet); }
.btn--jet { background: var(--hz-jet); color: var(--hz-bone-ink); }
.btn:hover { opacity: .86; }

.todo { color: inherit; }

/* ---------- Gate ---------- */
.gate {
  position: fixed; inset: 0; z-index: 90;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 32px var(--pad);
  background-color: var(--hz-jet); background-image: url("img/grain.png"); background-size: 256px;
  color: var(--hz-bone-ink);
}
html.no-js .gate { display: none; }
.gate__row { display: flex; justify-content: space-between; gap: 24px; color: var(--hz-bone-ink); }
.gate__row .todo { opacity: 1; }
.gate__center { display: grid; justify-items: center; gap: 36px; }
.gate__word { font-family: var(--font-display); font-weight: 900; letter-spacing: -0.045em; font-size: clamp(56px, 9vw, 140px); line-height: 1; }
.gate__load { width: min(280px, 60vw); height: 2px; background: var(--rule); }
.gate__fill { display: block; height: 100%; background: var(--hz-bone-ink); transform-origin: left; transform: scaleX(0); transition: transform 700ms var(--ease); }
.gate__enter { opacity: 0; visibility: hidden; transition: opacity 900ms var(--ease), visibility 0s 900ms; }
.gate.is-ready .gate__enter { opacity: 1; visibility: visible; transition: opacity 900ms var(--ease); }
.gate.is-ready .gate__load { opacity: 0; transition: opacity 600ms var(--ease); }
.gate { transition: opacity 1200ms var(--ease), visibility 0s 1200ms; }
.gate.is-gone { opacity: 0; visibility: hidden; }
@media (max-width: 700px) { .gate__row .todo { display: none; } }

/* ---------- Running header ---------- */
.head {
  position: fixed; inset: 0 0 auto; z-index: 50;
  padding: 0 var(--pad);
  color: var(--ink);
  background-color: var(--ground);
  background-image: url("img/grain.png");
  background-size: 256px 256px;
  background-attachment: fixed;
  transition: opacity 900ms var(--ease);
}
.head__row { height: var(--head-h); display: grid; grid-template-columns: 1fr auto 1fr auto; align-items: center; gap: 32px; }
.head__brand { text-decoration: none; }
.head__section { text-align: center; color: var(--ink-muted); }
#section-label { display: inline-block; transition: opacity 400ms var(--ease); }
#section-label.is-swapping { opacity: 0; }
.head__nav { display: flex; gap: 28px; justify-content: flex-end; }
.head__nav a { position: relative; text-decoration: none; padding-bottom: 3px; }
.head__nav a::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: currentColor; transform: scaleX(0); transform-origin: left; transition: transform 700ms var(--ease); }
.head__nav a:hover::after { transform: scaleX(1); }
.head__folio { color: var(--ink-muted); min-width: 64px; text-align: right; }
.head__rule { height: 1px; background: var(--rule); overflow: hidden; }
.head__rule span { display: block; height: 100%; background: var(--rule-strong); transform-origin: left; transform: scaleX(0); }
.head.is-dim { opacity: 0; }
.head.is-dim:focus-within, .head.is-dim:hover { opacity: 1; }
@media (max-width: 900px) {
  .head__row { grid-template-columns: 1fr auto; }
  .head__nav, .head__section { display: none; }
}

/* ---------- The print: the mark arrives the way ink comes through a screen ---------- */
.print { position: relative; display: block; }
.print img { display: block; width: 100%; height: auto; }
.print__canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }

/* ---------- Sections ---------- */
.sec { position: relative; padding: calc(var(--head-h) + 64px) var(--pad) 96px; }

/* 01 Arrival */
.arrival { min-height: 100svh; display: grid; grid-template-rows: 1fr auto; padding-bottom: 40px; }
.arrival__mark { display: grid; place-items: center; }
.arrival__mark .print { width: min(46vh, 70vw); }
.arrival__foot { display: grid; gap: 40px; }
.arrival__line { font-family: var(--font-display); font-weight: 900; font-size: clamp(48px, 7vw, 120px); line-height: 1; }
.arrival__line span { display: block; }
.facts { display: flex; gap: 12px 40px; flex-wrap: wrap; color: var(--ink-muted); padding-top: 16px; border-top: 1px solid var(--rule); }
.cue { margin-left: auto; }
.cue::after { content: ""; display: inline-block; width: 1px; height: 12px; margin-left: 12px; vertical-align: -2px; background: currentColor; animation: cue 2400ms var(--ease) infinite; transform-origin: top; }
@keyframes cue { 0% { transform: scaleY(0); } 50% { transform: scaleY(1); } 100% { transform: scaleY(1); opacity: 0; } }

/* 02 The word */
.word { padding: 0; }
.word__pin { min-height: 100svh; position: relative; display: grid; grid-template-columns: repeat(12, 1fr); grid-template-rows: auto 1fr auto; column-gap: var(--space-gutter); padding: calc(var(--head-h) + 48px) var(--pad) 48px; }
.word__label { grid-column: 1 / -1; color: var(--ink-muted); }
.word__lede { grid-column: 7 / -1; align-self: center; max-width: 30ch; }
.word__lede .w { color: var(--ink-muted); transition: color 700ms var(--ease); }
.word__lede .w.on { color: var(--ink); }
.word__mark { grid-column: 1 / -1; font-family: var(--font-display); font-weight: 900; letter-spacing: -0.045em; font-size: clamp(96px, 23vw, 420px); line-height: .82; margin-left: -.04em; }
@media (max-width: 800px) { .word__pin { grid-template-columns: minmax(0, 1fr); column-gap: 0; } .word__lede { grid-column: 1; } }

/* 03 Collection */
.collection { padding: 0; }
.collection__pin { min-height: 100svh; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr auto; gap: 32px; padding: calc(var(--head-h) + 40px) 0 32px; overflow: hidden; }
.collection__head { display: flex; justify-content: space-between; align-items: end; gap: 32px; padding: 0 var(--pad); flex-wrap: wrap; }
.collection__title { font-family: var(--font-display); font-size: clamp(44px, 6vw, 104px); line-height: 1; }
.collection__meta { display: flex; gap: 40px; }
.track-wrap { display: flex; align-items: center; min-width: 0; min-height: 0; }
.track { list-style: none; margin: 0; padding: 0 var(--pad); display: flex; gap: var(--space-gutter); will-change: transform; }
.tile { flex: 0 0 auto; width: clamp(240px, min(28vw, 48vh), 560px); }
.tile__media { position: relative; display: block; width: 100%; aspect-ratio: 1; overflow: hidden; background: var(--on-accent); }
.tile__media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: opacity 800ms var(--ease); }
.tile__back { opacity: 0; }
.tile__media:hover .tile__back, .tile__media:focus-visible .tile__back, .tile.is-back .tile__back { opacity: 1; }
.tile__media:focus-visible { outline-color: var(--on-accent); outline-offset: 4px; }
.tile__side { position: absolute; left: 16px; bottom: 14px; color: var(--hz-jet); }
.tile__side span { transition: opacity 600ms var(--ease); }
.tile__side .b { position: absolute; left: 0; opacity: 0; }
.tile__media:hover .tile__side .f, .tile.is-back .tile__side .f { opacity: 0; }
.tile__media:hover .tile__side .b, .tile.is-back .tile__side .b { opacity: 1; }
.tile__flip { display: none; text-decoration: underline; text-underline-offset: 5px; }
@media (hover: none) { .tile__flip { display: inline; } }
.tile__meta { display: grid; grid-template-columns: auto 1fr auto auto; gap: 16px; padding-top: 14px; margin-top: 14px; border-top: 1px solid var(--rule); }
.tile__meta .n { text-align: left; }
.collection__foot { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 32px; padding: 0 var(--pad); }
.track-rule { height: 1px; overflow: hidden; }
.track-rule span { display: block; height: 100%; background: var(--ink); transform-origin: left; transform: scaleX(.1667); }

/* Phones and reduced motion: native horizontal scroll instead of the pinned track */
.collection.is-native .track-wrap { overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.collection.is-native .track-wrap::-webkit-scrollbar { display: none; }
.collection.is-native .tile { scroll-snap-align: start; scroll-margin-left: var(--pad); width: min(78vw, 420px); }
.collection.is-native .track::after { content: ""; flex: 0 0 1px; }
@media (max-width: 700px) { .collection__foot > span:first-child { display: none; } .collection__foot { grid-template-columns: 1fr auto; } }

/* 04 Film */
.film { min-height: 100svh; display: grid; align-content: center; gap: 40px; padding-bottom: 140px; }
.film__head { display: flex; justify-content: space-between; color: var(--ink-muted); }
.film__frame { position: relative; width: 100%; aspect-ratio: 16 / 9; max-height: calc(100svh - var(--head-h) - 120px); margin: 0 auto; background: var(--panel); overflow: hidden; }
@supports (aspect-ratio: 1) { .film__frame { width: min(100%, calc((100svh - var(--head-h) - 120px) * 16 / 9)); } }
.film__card, .film__pending { position: absolute; inset: 0; display: grid; place-items: center; align-content: center; gap: 20px; padding: 32px; text-align: center; }
.film__corner { position: absolute; inset: 24px 28px auto; display: flex; justify-content: space-between; color: var(--ink-muted); }
.film__mark { width: clamp(120px, 20%, 280px); }
.film__card .print { justify-self: center; }
.film__line { font-family: var(--font-display); font-weight: 400; font-size: clamp(24px, 3vw, 48px); line-height: 1.05; }
.film__credit { color: var(--ink-muted); }
.film__play { position: absolute; left: 28px; bottom: 24px; }
.film__anchor { font-family: var(--font-display); font-size: clamp(32px, 4.4vw, 72px); line-height: 1.05; }
@media (max-width: 700px) { .film__play { position: static; min-height: 44px; padding: 0 24px; } .film__corner, .film__credit { display: none; } .film__card { gap: 12px; padding: 16px; } .film__mark { width: 84px; } .film__line { font-size: 22px; } }

/* 05 Made with */
.made { min-height: 100svh; display: grid; align-items: end; }
.made__grid { display: grid; grid-template-columns: 5fr 6fr; gap: var(--space-gutter) calc(var(--space-gutter) * 2); align-items: end; }
.made__grid .headline-xl { margin: 32px 0; }
.made__lede { max-width: 34ch; }
@media (max-width: 900px) { .made__grid { grid-template-columns: 1fr; gap: 64px; } }

.spec { display: grid; }
.spec__row { position: relative; display: grid; grid-template-columns: minmax(120px, 2fr) 3fr; gap: 24px; align-items: baseline; padding: 20px 0; }
.spec__row::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: var(--border-hairline); background: var(--rule-strong); transform-origin: left; transform: scaleX(var(--draw, 1)); }
.spec__row:last-child::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: var(--border-hairline); background: var(--rule-strong); transform-origin: left; transform: scaleX(var(--draw, 1)); }
.spec dt { color: var(--ink-muted); }
.spec dd { font-size: clamp(18px, 1.6vw, 24px); line-height: 1.3; }
.spec .todo-row dd { font-size: 12px; }
.spec--static .spec__row { padding: 14px 0; }
.spec--static .spec__row::before, .spec--static .spec__row:last-child::after { background: var(--rule); }
.spec--static dd { font-size: 18px; }

/* 06 Close */
.close { min-height: 100svh; display: grid; grid-template-rows: 1fr auto auto; gap: 64px; padding-bottom: 32px; }
.close__line { align-self: end; font-family: var(--font-display); font-weight: 900; font-size: clamp(56px, 11vw, 200px); line-height: .95; }
.signup { display: grid; gap: 12px; max-width: 640px; }
.signup__row { display: flex; gap: 0; }
.signup input { flex: 1; min-width: 0; min-height: 52px; padding: 0 16px; font: 400 18px/1 var(--font-text); color: var(--ink); background: transparent; border: 1px solid var(--rule-strong); border-right: 0; }
.signup input::placeholder { color: var(--ink-muted); }
.signup input:focus-visible { outline-offset: -3px; }
.signup__note { margin-top: 6px; }

.foot { display: grid; gap: 20px; padding-top: 32px; border-top: 1px solid var(--rule); }
.foot__mark { width: 72px; margin-bottom: 24px; }
.foot__row { display: flex; justify-content: space-between; gap: 16px 32px; flex-wrap: wrap; }

/* ---------- Product view ---------- */
.piece {
  width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 0 var(--pad) 32px; border: 0;
  background-color: var(--ground); background-image: url("img/grain.png"); background-size: 256px;
  color: var(--ink); overflow-y: auto; overscroll-behavior: contain;
  opacity: 0; transition: opacity 700ms var(--ease), display 700ms allow-discrete, overlay 700ms allow-discrete;
}
.piece[open] { opacity: 1; }
@starting-style { .piece[open] { opacity: 0; } }
.piece::backdrop { background: var(--hz-jet); opacity: 0; transition: opacity 700ms var(--ease), display 700ms allow-discrete, overlay 700ms allow-discrete; }
.piece[open]::backdrop { opacity: 1; }
@starting-style { .piece[open]::backdrop { opacity: 0; } }
.piece__bar { position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; align-items: center; height: var(--head-h); background: var(--ground); border-bottom: 1px solid var(--rule-strong); }
.piece__navs { display: flex; gap: 28px; }
.piece__navs button { padding: 10px 0; }
.piece__grid { display: grid; grid-template-columns: 7fr 5fr; gap: calc(var(--space-gutter) * 2); padding-top: 40px; align-items: start; }
.piece__media { position: relative; aspect-ratio: 1; background: var(--on-accent); overflow: hidden; }
.piece__media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: opacity 800ms var(--ease); }
.piece__media img.is-hidden { opacity: 0; }
.piece__toggle { position: absolute; left: 20px; bottom: 16px; display: flex; gap: 20px; color: var(--hz-jet); }
.piece__toggle button { padding: 8px 0; opacity: .6; }
.piece__toggle button[aria-pressed="true"] { opacity: 1; text-decoration: underline; text-underline-offset: 6px; }
.piece__info { display: grid; gap: 20px; position: sticky; top: calc(var(--head-h) + 40px); }
.piece__name { font-family: var(--font-display); font-weight: 700; font-size: clamp(44px, 5vw, 88px); line-height: 1; margin-top: 8px; }
.piece__line { font-family: var(--font-display); font-size: clamp(28px, 2.6vw, 44px); line-height: 1.05; margin-bottom: 16px; }
.piece .btn { justify-self: start; margin-top: 16px; }
.piece__swap { transition: opacity 500ms var(--ease); }
.piece__swap.is-out { opacity: 0; }
@media (max-width: 900px) { .piece__grid { grid-template-columns: 1fr; } .piece__info { position: static; } }

/* ---------- Motion safety ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0s !important; animation: none !important; }
  body { transition: none; }
}
[hidden] { display: none !important; }
