/* M1 layout. Phone first (390), then 768, then 1440.
   This static layout is also the reduced-motion layout: plain stacked sections. */

.skip {
  position: fixed;
  top: var(--gutter);
  left: var(--gutter);
  z-index: 30;
  transform: translateY(-200%);
}
.skip:focus-visible { transform: none; background: var(--color-walnut-shadow); }

/* Fixed minimal nav */
.nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 62px;
  padding: max(var(--spacing-9), env(safe-area-inset-top)) var(--gutter) var(--spacing-9);
  pointer-events: none;
}
.nav > * { pointer-events: auto; }
.nav__mark {
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  background-size: 0 1px;
}
.nav__links { display: none; gap: var(--spacing-24); }
.nav__links .link {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  background-size: 0 1px;
}
.nav__links .link[aria-current='true'] {
  background-image: none;
  border-bottom: 1px dashed currentColor;
  padding-bottom: 1px;
  min-height: 0;
}

.nav__menu { position: relative; }
.nav__menu summary { list-style: none; }
.nav__menu summary::-webkit-details-marker { display: none; }
.nav__menu[open] summary { background: var(--color-walnut-shadow); }
.nav__sheet {
  position: absolute;
  right: 0;
  top: calc(100% + var(--spacing-8));
  display: grid;
  min-width: 180px;
  padding: var(--spacing-12) var(--card-padding);
  border: 1px solid var(--color-cork-border);
  border-radius: var(--radius-cards);
  background: var(--color-walnut-shadow);
}
.nav__sheet .link {
  display: flex;
  align-items: center;
  min-height: var(--tap);
  background-size: 0 1px;
  font-size: 14px;
}

@media (min-width: 768px) {
  .nav__links { display: flex; }
  .nav__menu { display: none; }
}
/* Phone: a solid bar, so the nav never sits on top of pills or copy (art review). */
@media (max-width: 767px) {
  .nav {
    min-height: 64px;
    padding-top: max(var(--spacing-10), env(safe-area-inset-top));
    padding-bottom: var(--spacing-10);
    background: var(--color-walnut-shadow);
    pointer-events: auto;
  }
}

/* Vertical serial label, right edge */
.serial {
  position: fixed;
  right: 0;
  top: 50%;
  z-index: 10;
  display: flex;
  gap: var(--spacing-18);
  padding-right: max(var(--spacing-6), env(safe-area-inset-right));
  font-size: 10px;
  line-height: 1;
  writing-mode: vertical-rl;
  transform: translateY(-50%);
  pointer-events: none;
}
.serial__count { font-variant-numeric: tabular-nums; }

/* 0 Hero */
.hero {
  position: relative;
  display: grid;
  grid-template-rows: 1fr auto;
  min-height: 100svh;
  padding: 92px var(--gutter) var(--gutter);
  overflow: clip;
  isolation: isolate;
}
/* M1 stand-in for the rendered bench: the slate apron as a flat CSS surface. */
.hero__bench {
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(120% 80% at 70% 40%, transparent 40%, rgba(16, 9, 4, 0.55) 100%),
    var(--color-slate-apron);
}
.hero__copy { align-self: start; }
.hero__tag {
  font-size: var(--text-chip);
  line-height: 1.2;
  margin-bottom: var(--spacing-10);
}
.hero__mark {
  font-size: clamp(var(--text-display), 19vw, 220px);
  line-height: var(--leading-display);
  font-weight: var(--font-weight-medium);
  margin-left: -0.04em;
}
.hero__card {
  align-self: end;
  display: grid;
  gap: var(--spacing-12);
  max-width: 340px;
  padding: var(--card-padding);
  border: 1px solid var(--color-cork-border);
  border-radius: var(--radius-cards);
  background: rgba(16, 9, 4, 0.62);
  margin-right: var(--spacing-18); /* clears the serial label */
}
.hero__card-title {
  font-size: var(--text-subheading);
  line-height: var(--leading-subheading);
  font-weight: var(--font-weight-medium);
}

/* Void sections: phone stack is heading, object, then copy */
.void {
  display: grid;
  grid-template-rows: auto minmax(44svh, 1fr) auto;
  gap: var(--element-gap);
  min-height: 100svh;
  padding: 92px calc(var(--gutter) + var(--spacing-18)) var(--spacing-41) var(--gutter);
  border-top: 1px dashed var(--color-cork-border);
}
.void__head {
  font-size: var(--text-heading);
  line-height: var(--leading-heading);
  font-weight: var(--font-weight-medium);
  max-width: 12ch;
}
.stage {
  /* The fixed WebGL canvas shows through here from M3 on. */
  min-height: 44svh;
}
.void__side {
  display: grid;
  align-content: end;
  gap: var(--element-gap);
}
.body {
  font-size: var(--text-body);
  line-height: var(--leading-body);
  font-weight: var(--font-weight-regular);
  text-transform: none;
  text-align: left;
  max-width: 28ch;
}

.beats, .parts {
  display: grid;
  gap: var(--spacing-10);
  font-size: var(--text-heading-sm);
  line-height: var(--leading-heading-sm);
}
.beats li { display: flex; gap: var(--spacing-12); align-items: baseline; }
.beats span { font-size: var(--text-chip); font-variant-numeric: tabular-nums; }
.parts {
  grid-template-columns: repeat(2, max-content);
  column-gap: var(--spacing-31);
  font-size: var(--text-subheading);
  line-height: var(--leading-subheading);
}
.parts li::before {
  content: '';
  display: inline-block;
  width: 18px;
  margin-right: var(--spacing-8);
  vertical-align: middle;
  border-top: 1px dashed var(--color-driftwood);
}

[data-grind] { justify-self: start; }
[data-grind]:disabled { cursor: default; }

/* 768: object gets more room, copy sits in two columns below */
@media (min-width: 768px) {
  .void {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto minmax(50svh, 1fr);
    padding-right: calc(var(--gutter) + var(--spacing-24));
  }
  .void__head { grid-column: 1; grid-row: 1; }
  .void__side { grid-column: 2; grid-row: 1; align-content: start; }
  .stage { grid-column: 1 / -1; grid-row: 2; }
}

/* 1440: the system's three columns, text / object / text */
@media (min-width: 1100px) {
  .void {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr) minmax(0, 1fr);
    grid-template-rows: 1fr;
    align-items: center;
    padding: 92px calc(var(--gutter) + var(--spacing-31)) var(--gutter) var(--gutter);
  }
  .void__head { grid-column: 1; grid-row: 1; align-self: center; }
  .stage { grid-column: 2; grid-row: 1; min-height: 70svh; }
  .void__side { grid-column: 3; grid-row: 1; align-content: center; }
  .hero__card { max-width: 380px; }
}

/* Footer: the ASCII field is full bleed and keeps its aspect before anything is drawn. */
.footer {
  position: relative;
  display: grid;
  gap: var(--spacing-24);
  padding: 0 var(--gutter) max(var(--gutter), env(safe-area-inset-bottom));   /* field sits right under the divider */
  border-top: 1px dashed var(--color-cork-border);
}
.footer__ascii {
  position: relative;
  margin: 0 calc(-1 * var(--gutter));
  aspect-ratio: 16 / 7;
}
@media (max-width: 767px) {
  .footer__ascii { aspect-ratio: 4 / 5; }
}
.footer__glyphs {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
/* Brand mark inside the scene, upper left. */
.footer__mark {
  position: absolute;
  top: clamp(18px, 6%, 48px);
  left: var(--gutter);
  pointer-events: none;
}
.footer__name {
  font-size: var(--text-display);
  line-height: var(--leading-display);
  font-weight: var(--font-weight-medium);
}
.footer__tag {
  margin-top: var(--spacing-10);
  font-size: var(--text-chip);
  line-height: 1.2;
}
/* Phone: the upright mill stands at 68% of the width, so the wordmark steps down to 40 px and
   the tagline breaks into two lines; at 51 px both would run into the mill. */
@media (max-width: 767px) {
  .footer__name { font-size: 40px; }
  .footer__tag { max-width: 17ch; }
}
/* Without JS the words sit in a row at the foot of the field. */
.footer__pile {
  position: absolute;
  left: var(--gutter);
  right: var(--gutter);
  bottom: 8%;
  display: flex;
  flex-wrap: wrap;
  gap: 0 var(--spacing-12);
}
.pile-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: var(--tap);
  min-height: var(--tap);
  padding: 0 var(--spacing-6);
  font-family: var(--font-display);
  font-size: var(--text-chip);
  font-weight: var(--font-weight-medium);
  line-height: 1;
  color: var(--color-warm-cream);
  text-decoration: none;
  text-transform: uppercase;
}
.pile-link span {
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 0 1px;
  background-position: 0 100%;
  background-repeat: no-repeat;
  padding-bottom: 2px;
  transition: background-size var(--dur-ui) var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .pile-link:hover span { background-size: 100% 1px; }
}
.pile-link:focus-visible { outline: 1px dashed var(--color-warm-cream); outline-offset: 0; border-radius: var(--radius-cards); }
/* Once JS has placed them, each word sits on the pile surface. */
.footer__ascii.is-drawn .footer__pile { inset: 0; display: block; }
.footer__ascii.is-drawn .pile-link { position: absolute; top: 0; left: 0; }

.credits {
  display: grid;
  gap: var(--spacing-12);
  scroll-margin-top: 80px;
}
.credits__title { font-size: var(--text-chip); font-weight: var(--font-weight-medium); }
.credits__list { display: grid; gap: var(--spacing-8); font-size: var(--text-chip); line-height: 1.2; }
.credit__label { color: var(--color-warm-cream); }
.credit__value { color: var(--color-ember-accent); }   /* Ember lives here and nowhere else */
.credits__controls { display: flex; flex-wrap: wrap; gap: var(--spacing-8); }
.footer__legal { max-width: 60ch; }

section[id] { scroll-margin-top: 0; }

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
