/* New Deal Systems. Seven colors, three faces, one scroll. */

@font-face { font-family: "Gloock"; src: url("assets/fonts/Gloock-Regular-latin.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Libre Franklin"; src: url("assets/fonts/LibreFranklin-Variable.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Libre Franklin"; src: url("assets/fonts/LibreFranklin-Italic-Variable.woff2") format("woff2"); font-weight: 100 900; font-style: italic; font-display: swap; }
@font-face { font-family: "Obel Mono"; src: url("assets/fonts/ObelMono-Variable.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }

:root {
  --black: #0a0a0a;
  --stone: #16161a;
  --iron: #24232a;
  --bruise: #24102f;
  --nightshade: #5a3277;
  --ash: #8a8a8a;
  --bone: #ece6da;
  --hair: rgb(236 230 218 / 0.09);

  --display: "Gloock", "Iowan Old Style", Georgia, serif;
  --sans: "Libre Franklin", "Franklin Gothic Medium", "Helvetica Neue", Arial, sans-serif;
  --mono: "Obel Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-io: cubic-bezier(0.65, 0, 0.35, 1);

  --gutter: max(16px, env(safe-area-inset-left), env(safe-area-inset-right), 4vw);
  --pin-pad: clamp(56px, 11vh, 128px);

  /* Motion hooks. wake.js writes these on <html>; without it the page shows its end states. */
  --lit: 1;
  --zoom: 0;
  --line: 1;
  --dock: 1;
  --grow: 0.58;
  --arch-y: 64%;
  --zoom-max: 17;

  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  background: var(--black);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--black) url("assets/img/grain-512.png") repeat;
  background-size: 512px 512px;
  color: var(--bone);
  font: 400 1rem/1.55 var(--sans);
  font-kerning: normal;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

img { display: block; max-width: 100%; }

::selection { background: var(--bone); color: var(--black); }

:focus-visible {
  outline: 2px solid var(--bone);
  outline-offset: 4px;
  border-radius: 1px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* 1-2. The mark ----------------------------------------------------------------- */

.wake-track { position: relative; }

.scene {
  position: relative;
  height: 100vh;
  height: 100svh;
  min-height: 480px;
  display: grid;
  place-items: center;
  overflow: clip;
}

.ground {
  position: absolute;
  inset: 0;
  opacity: 0.5;
  pointer-events: none;
}
.ground img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 30%;
}
/* The art fades into the black at its edges, so no seam meets the grain. */
.ground::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(120% 90% at 50% 40%, transparent 45%, var(--black) 100%);
}

.mark {
  position: relative;
  width: clamp(168px, 30vmin, 340px);
  aspect-ratio: 766 / 898;
  transform-origin: 50% var(--arch-y);
}

.mark-flat,
.mark-metal {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  -webkit-mask: url("assets/img/newdeal-mark.svg") center / 100% 100% no-repeat;
  mask: url("assets/img/newdeal-mark.svg") center / 100% 100% no-repeat;
}
/* At rest: ash at a third, so the mark reads as a dark, flat shape on black. */
.mark-flat { background: var(--ash); opacity: 0; }
.mark-metal { object-fit: fill; }
/* If the metal fails to load, the flat mark stands in at full ash. */
.mark-metal[hidden] { display: none; }
.mark:has(.mark-metal[hidden]) .mark-flat { opacity: 1 !important; }

/* 3-4. The line ------------------------------------------------------------------ */

.works { position: relative; }

.line-track { padding-top: var(--pin-pad); }

.line-pin {
  padding: 0 var(--gutter) clamp(40px, 7vh, 80px);
  text-align: center;
}

.line {
  margin: 0 auto;
  font: 400 clamp(min(2.75rem, 12.5vw), 7.2vw, 9rem)/0.95 var(--display);
  letter-spacing: 0;
  color: var(--bone);
  text-wrap: balance;
  transform-origin: 50% 50%;
}

/* 5. The works ------------------------------------------------------------------- */

.plates {
  display: grid;
  grid-template-columns: 1.7fr 1fr;
  gap: clamp(14px, 1.8vw, 24px);
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.plate {
  position: relative;
  background: var(--black);
  box-shadow: inset 0 0 0 1px var(--hair);
}

/* The p0ssess card is the product's own hero, on the same black it was drawn on. */
.plate-possess {
  padding: clamp(20px, 2.6vw, 40px);
}
.possess-hero {
  width: 100%;
  height: auto;
}

.plate-body {
  margin-top: clamp(22px, 2.6vw, 36px);
  padding-top: clamp(20px, 2.2vw, 30px);
  box-shadow: inset 0 1px 0 var(--hair);
}

.plate-text {
  max-width: 34em;
  margin: 0 0 1.5rem;
  color: var(--ash);
  font-size: 1rem;
}

.plate-price {
  margin: 0 0 1rem;
  font: 400 clamp(1.5rem, 2.3vw, 2.125rem)/1.15 var(--display);
  color: var(--bone);
  text-wrap: balance;
}

.plate-link { margin: 0; }

.plate-link a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font: 500 0.9375rem/1 var(--mono);
  color: var(--bone);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 6px;
  text-decoration-color: var(--ash);
}
/* Hover: the underline comes up to bone and thickens. It stays a readable cue (15.9:1). */
.plate-link a:hover,
.plate-link a:focus-visible {
  text-decoration-color: var(--bone);
  text-decoration-thickness: 2px;
  text-underline-offset: 8px;
}

/* The sealed slot: a plain dark plate. Nothing on it but its edge. */
.plate-sealed {
  background: var(--stone);
  min-height: 280px;
}
.plate-sealed::before {
  content: "";
  position: absolute;
  inset: clamp(14px, 1.6vw, 22px);
  box-shadow: inset 0 0 0 1px var(--hair);
  pointer-events: none;
}

/* 6. The end --------------------------------------------------------------------- */

.close {
  padding: clamp(140px, 26vh, 300px) var(--gutter) clamp(120px, 20vh, 220px);
}

.quote {
  max-width: 21em;
  margin: 0 auto;
  font-size: clamp(1.625rem, 3.3vw, 3.125rem);
  text-align: center;
}

.quote blockquote { margin: 0; }

.quote blockquote p {
  margin: 0;
  font: 400 1em/1.16 var(--display);
  color: var(--bone);
  text-wrap: balance;
}

.quote figcaption {
  margin-top: 2.25rem;
  font: 400 0.875rem/1.4 var(--sans);
  color: var(--ash);
}
.quote cite { font-style: italic; }

.label {
  display: flex;
  justify-content: center;
  padding: 0 var(--gutter) calc(48px + env(safe-area-inset-bottom));
}
.label p {
  margin: 0;
  padding: 9px 14px 8px;
  font: 500 0.75rem/1.2 var(--mono);
  font-variant-numeric: tabular-nums;
  color: var(--ash);
  box-shadow: inset 0 0 0 1px rgb(138 138 138 / 0.35);
}

/* Phones ------------------------------------------------------------------------- */

@media (max-width: 760px) {
  .plates { grid-template-columns: 1fr; }
  .plate-sealed { min-height: 0; aspect-ratio: 16 / 9; }
  .line { max-width: 5.6em; }
}

/* Motion: only with wake.js running and motion allowed. ------------------------- */

@media (prefers-reduced-motion: no-preference) {
  .plate-link a { transition: text-decoration-color 0.4s var(--ease-out), text-underline-offset 0.4s var(--ease-out); }

  /* html.js (inline script): only the dark rest mark, so the first paint is already at rest.
     If wake.js never runs, the inline script drops .js after 4 s and the mark lights. */
  html.js { --lit: 0; }
  .js .mark-flat { opacity: calc(0.3 * (1 - var(--lit))); }
  .js .mark-metal { opacity: var(--lit); }
  .js .ground { opacity: calc(var(--lit) * 0.55); }
  .js .mark { width: clamp(112px, 16vmin, 200px); }

  /* html.wake-on (wake.js running): the whole scroll. */
  html.wake-on { --lit: 0; --zoom: 0; --line: 0; --dock: 0; }
  .wake-on .mark-flat { opacity: calc(0.3 * (1 - var(--lit))); }
  .wake-on .mark-metal { opacity: var(--lit); }
  .wake-on .ground { opacity: calc(var(--lit) * 0.55 * clamp(0, (0.96 - var(--zoom)) / 0.26, 1)); }
  .wake-on .ground img { transform: scale(calc(1 + var(--zoom) * var(--zoom) * 0.3)); }

  .wake-on .mark {
    width: clamp(112px, 16vmin, 200px);
    transform: scale(calc((1 + var(--lit) * 0.5) * (1 + var(--zoom) * var(--zoom) * var(--zoom) * var(--zoom-max))));
    opacity: calc(1 - clamp(0, (var(--zoom) - 0.86) / 0.14, 1));
  }

  .wake-on .wake-track { height: 320vh; height: 320svh; }
  .wake-on .scene { position: sticky; top: 0; }

  /* The line track starts while the mark is still passing, so the heading takes over from the metal. */
  .wake-on .line-track {
    position: relative;
    z-index: 1;
    margin-top: -140vh;
    margin-top: -140svh;
    pointer-events: none;
  }
  /* Scroll room for the pinned line. A spacer, not padding: sticky stops at the content box. */
  .wake-on .line-track::after {
    content: "";
    display: block;
    height: 160vh;
    height: 160svh;
  }
  .wake-on .line-pin { position: sticky; top: var(--pin-pad); }
  .wake-on .line {
    opacity: var(--line);
    transform:
      translateY(calc((50svh - var(--pin-pad) - 50%) * (1 - var(--dock))))
      scale(calc(1 + var(--grow) * (1 - var(--dock))));
    will-change: transform, opacity;
  }
}

@media (prefers-reduced-motion: no-preference) and (max-width: 760px) {
  :root { --grow: 0.75; --zoom-max: 10; }
}
