/* YONKO, yonko.space. Direction v3, Klein colourway: flat grounds, hard edges, one thing at a time. */

@font-face { font-family: "Archivo"; src: url(/fonts/archivo-var.woff2) format("woff2"); font-weight: 400 800; font-display: swap; }
@font-face { font-family: "Instrument Serif"; src: url(/fonts/instrument-serif-italic.woff2) format("woff2"); font-style: italic; font-weight: 400; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url(/fonts/plex-mono-400.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url(/fonts/plex-mono-500.woff2) format("woff2"); font-weight: 500; font-display: swap; }

:root {
  color-scheme: light;
  --paper: #F7F6F2;
  --ink: #121211;
  --klein: #002FA7;
  --grey: #6B6964;
  --brick: #A8432B;
  --pad: clamp(20px, 3.2vw, 48px);
  --serif: "Instrument Serif", Georgia, serif;
  --sans: "Archivo", Arial, Helvetica, sans-serif;
  --mono: "IBM Plex Mono", "Courier New", monospace;
  --ease-roll: cubic-bezier(.76, 0, .24, 1);
  --ease-out: cubic-bezier(.2, .7, .2, 1);
  background: var(--paper);
  color: var(--ink);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--sans); font-size: 16px; line-height: 1.4; -webkit-font-smoothing: antialiased; }
p, h1, h2, ol { margin: 0; }
a { color: inherit; }
img { display: block; }
.mono, .opening-corner, .hero-foot, .quotes-meta, .foot { font-family: var(--mono); font-size: 13px; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; }

/* Opening */
.opening { position: fixed; inset: 0; z-index: 20; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: clamp(40px, 7vh, 72px); padding: var(--pad); background: var(--klein); color: var(--paper); cursor: pointer; transition: transform .9s var(--ease-roll); }
.opening.is-leaving { transform: translateY(-100%); }
.opening.is-gone { display: none; }
.opening-corner { position: absolute; top: var(--pad); }
.opening-corner-l { left: var(--pad); }
.opening-corner-r { right: var(--pad); }
/* The figures stand on a hairline stage. They rise from behind it one by one,
   a slow wave of small hops travels along the line, they lean toward the pointer,
   and on Enter they leap up and away with the ground. */
.stage { position: relative; display: flex; flex-direction: column; align-items: center; }
.figures { display: flex; align-items: flex-end; gap: clamp(4px, 1.2vw, 18px); clip-path: inset(-80% -30% 0 -30%); }
.fig { display: block; transform-origin: 50% 100%; transform: rotate(calc(var(--lean, 0) * (.7 + var(--i) * .12) * 1deg)); transition: transform 1.1s cubic-bezier(.2, .8, .2, 1); }
.fig img { width: auto; height: clamp(84px, 17vw, 240px); transform-origin: 50% 100%; transform: translateY(104%);
  animation: reveal 1s cubic-bezier(.2, .9, .25, 1) forwards, hop 5.6s cubic-bezier(.45, 0, .3, 1) infinite;
  animation-delay: calc(.2s + var(--i) * .09s), calc(1.9s + var(--i) * .13s); }
@keyframes reveal { to { transform: translateY(0); } }
@keyframes hop {
  0%, 24%, 100% { transform: translateY(0) scale(1, 1); }
  5%  { transform: translateY(0) scale(1.05, .93); }
  12% { transform: translateY(-15%) scale(.97, 1.04); }
  18% { transform: translateY(0) scale(1.06, .92); }
  21% { transform: translateY(0) scale(.99, 1.01); }
}
.stage-line { width: 112%; height: 1px; background: rgba(247, 246, 242, .55); transform: scaleX(0); animation: draw 1.1s cubic-bezier(.6, 0, .2, 1) forwards; }
@keyframes draw { to { transform: scaleX(1); } }

.opening.is-exiting .figures { clip-path: inset(-400% -30% 0 -30%); }
.opening.is-exiting .fig img { animation: leap .55s cubic-bezier(.5, 0, .2, 1) both; animation-delay: calc(var(--i) * .045s); }
@keyframes leap {
  0%   { transform: translateY(0) scale(1, 1); }
  30%  { transform: translateY(0) scale(1.07, .88); }
  100% { transform: translateY(-160%) scale(.95, 1.08); opacity: 0; }
}
.opening.is-exiting .stage-line, .opening.is-exiting .enter, .opening.is-exiting .opening-corner { opacity: 0; transition: opacity .25s ease; }

/* Enter: a serif word over a hairline that fills while the opening counts down to opening itself. */
.enter { display: inline-flex; flex-direction: column; align-items: center; gap: 12px; padding: 8px 6px; border: 0; background: none; color: inherit; cursor: pointer; font-family: var(--serif); font-style: italic; font-size: clamp(26px, 2.4vw, 34px); line-height: 1; opacity: 0; animation: fade .7s ease 1.2s forwards; }
.enter-label { transition: transform .35s var(--ease-out); }
.enter-bar { position: relative; width: 96px; height: 1px; overflow: hidden; background: rgba(247, 246, 242, .28); transition: width .45s var(--ease-out); }
.enter-bar::after { content: ""; position: absolute; inset: 0; background: var(--paper); transform: scaleX(0); transform-origin: left; }
.opening.is-counting .enter-bar::after { transform: scaleX(1); transition: transform var(--auto, 4.4s) linear; }
.enter:hover .enter-label { transform: translateY(-3px); }
.enter:hover .enter-bar { width: 132px; }
.enter:focus-visible { outline: 1px solid var(--paper); outline-offset: 10px; }
@keyframes fade { to { opacity: 1; } }

/* Fixed bar: mark top left, request link top right. Colour follows the ground beneath it. */
.bar { position: fixed; top: 0; left: 0; right: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; padding: var(--pad); pointer-events: none; color: var(--ink); transition: color .3s ease; }
.bar > * { pointer-events: auto; }
.bar-mark img { width: clamp(40px, 4vw, 56px); height: auto; transition: filter .3s ease; }
/* Request button: a hard-edged outline that fills on hover, matching the solid form button.
   It steps aside once the request form itself is on screen. */
.bar-cta { display: inline-flex; align-items: center; gap: 10px; padding: 11px 16px; border: 1px solid currentColor; font-size: 15px; font-weight: 500; line-height: 1; text-decoration: none; transition: background .25s ease, color .25s ease, opacity .35s ease, transform .35s var(--ease-out); }
.bar-cta span { transition: transform .25s var(--ease-out); }
.bar-cta:hover span { transform: translateX(3px); }
.bar[data-ground="paper"] .bar-cta:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.bar[data-ground="klein"] .bar-cta:hover { background: var(--paper); color: var(--klein); border-color: var(--paper); }
.bar.is-at-request .bar-cta { opacity: 0; transform: translateY(-8px); pointer-events: none; }
.bar[data-ground="klein"] { color: var(--paper); }
.bar[data-ground="klein"] .bar-mark img { filter: invert(1) brightness(1.04); }
.bar a:focus-visible { outline: 2px solid currentColor; outline-offset: 6px; }

/* Hero */
.hero { min-height: 100svh; display: flex; flex-direction: column; justify-content: flex-end; gap: clamp(28px, 5vh, 56px); padding: calc(var(--pad) * 2 + 56px) var(--pad) var(--pad); }
.hero-sub { font-size: clamp(17px, 1.5vw, 21px); font-weight: 500; max-width: 24ch; }
.hero-line { font-family: var(--serif); font-style: italic; font-weight: 400; font-size: clamp(64px, 12.5vw, 220px); line-height: .9; letter-spacing: -.02em; }
.hero-foot { display: flex; align-items: center; gap: 14px; color: var(--grey); }
.scroll-cue { width: 48px; height: 1px; background: currentColor; transform-origin: left; animation: cue 2.4s ease-in-out infinite; }
@keyframes cue { 0% { transform: scaleX(0); } 50% { transform: scaleX(1); transform-origin: left; } 50.1% { transform-origin: right; } 100% { transform: scaleX(0); transform-origin: right; } }
body.is-opening .hero > * { opacity: 0; transform: translateY(24px); }
.hero > * { transition: opacity .8s ease, transform .8s var(--ease-out); }
.hero > :nth-child(2) { transition-delay: .12s; }
.hero > :nth-child(3) { transition-delay: .24s; }

/* Quotes: a flat Klein ground. Without the pager script they simply stack. */
.quotes { background: var(--klein); color: var(--paper); padding: calc(var(--pad) * 2 + 56px) var(--pad) calc(var(--pad) * 2); }
.quotes-meta { display: flex; justify-content: space-between; opacity: .85; transition: opacity .4s ease; }
.quotes-list { list-style: none; padding: 0; display: grid; gap: 12vh; margin: 10vh 0; }
.quote { font-family: var(--serif); font-style: italic; font-size: clamp(40px, 6.6vw, 112px); line-height: 1.02; letter-spacing: -.015em; max-width: 15em; text-wrap: balance; }
.quotes-dots { display: flex; gap: 10px; transition: opacity .4s ease; }
.quotes-dots button { width: 10px; height: 10px; padding: 0; border: 0; border-radius: 5px; background: var(--paper); opacity: .4; cursor: pointer; transition: width .45s var(--ease-out), opacity .3s ease; }
.quotes-dots button.is-active { width: 40px; opacity: 1; }

.quotes.is-pager { height: 820svh; padding: 0; }
/* The turn in the story ("Yonko goes looking for it.") lands larger than the lines around it. */
.quote-turn { font-size: clamp(52px, 9vw, 150px); line-height: .95; }
.is-pager .quotes-stage { position: sticky; top: 0; height: 100svh; display: flex; flex-direction: column; padding: calc(var(--pad) * 2 + 56px) var(--pad) var(--pad); }
.is-pager .quotes-list { position: relative; flex: 1; margin: 0; display: block; }
.is-pager:not(.is-ready) .quote { transition: none !important; }
.is-pager .quote { position: absolute; left: 0; right: 0; top: 50%; opacity: 0; transform: translateY(calc(-50% + 56px)); transition: transform .45s ease-in, opacity .2s ease; }
.is-pager .quote.is-active { opacity: 1; transform: translateY(-50%); transition: transform .75s var(--ease-out) .18s, opacity .45s ease .18s; }
.is-pager .quote.is-past { transform: translateY(calc(-50% - 56px)); }
.is-pager.is-moving .quotes-meta, .is-pager.is-moving .quotes-dots { opacity: .3; }

/* Request */
.request { min-height: 100vh; min-height: 100svh; display: flex; flex-direction: column; padding: calc(var(--pad) * 2 + 56px) var(--pad) var(--pad); }
.request-line { margin-top: auto; font-family: var(--serif); font-style: italic; font-weight: 400; font-size: clamp(52px, 8.5vw, 150px); line-height: .95; letter-spacing: -.02em; }
.request-note { margin-top: 20px; font-size: clamp(17px, 1.5vw, 21px); max-width: 34ch; }
form { position: relative; width: min(860px, 100%); margin-top: clamp(40px, 7vh, 72px); }
.row { display: flex; align-items: stretch; gap: 16px; }
input[type=email] { flex: 1; min-width: 0; padding: 14px 0; border: 0; border-bottom: 2px solid var(--ink); border-radius: 0; background: transparent; color: var(--ink); font: inherit; font-size: clamp(22px, 2.2vw, 30px); line-height: 1.2; }
input[type=email]::placeholder { color: var(--grey); opacity: 1; }
input[type=email]:focus { outline: none; border-bottom-color: var(--klein); }
button[type=submit] { flex: none; padding: 0 28px; border: 0; border-radius: 0; background: var(--ink); color: var(--paper); font: inherit; font-size: 18px; font-weight: 500; cursor: pointer; transition: background .2s ease; }
button[type=submit]:hover { background: var(--klein); }
button[type=submit] span { display: inline-block; margin-left: 6px; transition: transform .2s ease; }
button[type=submit]:hover span { transform: translateX(4px); }
button[type=submit]:focus-visible { outline: 2px solid var(--klein); outline-offset: 4px; }
button[disabled] { opacity: .55; cursor: progress; }
#status { min-height: 1.5em; margin-top: 16px; font-size: 16px; }
#status.ok { font-family: var(--serif); font-style: italic; font-size: clamp(22px, 2.2vw, 30px); }
#status.error { color: var(--brick); }
.request-privacy { margin-top: 8px; font-size: 14px; color: var(--grey); }
.request-privacy a { color: var(--ink); text-underline-offset: 3px; }
.foot a { text-decoration: none; border-bottom: 1px solid currentColor; }
.foot a:hover { color: var(--ink); }
.foot { display: flex; justify-content: space-between; gap: 24px; margin-top: clamp(80px, 14vh, 160px); color: var(--grey); }

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

@media (max-width: 640px) {
  .row { flex-direction: column; gap: 14px; }
  button[type=submit] { padding: 18px 20px; text-align: left; }
  .opening-corner-r { display: none; }
  .bar-cta { padding: 10px 12px; font-size: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; transition-delay: 0s !important; }
  .opening { display: none; }
}
