/* Koini, koini.net. One static stylesheet; colours and type follow DESIGN.md. */

@font-face {
  font-family: "Commissioner";
  src: url("fonts/Commissioner.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --lacquer: #0f0e0d;
  --raised: #1b1917;
  --seam: #2a2623;
  --shu: #b8261b;
  --shu-worn: #6e1710;
  --bone: #e8e1d5;
  --paper: #f3eee5;
  --bone-muted: #a69e92;
  --ink: #0f0e0d;
  --ink-muted: #5c544a;
  /* Content never runs the full width of the window: it sits in a centred
     column of at most --page, and the gutter grows to take up the rest.
     Backgrounds still reach the edges. */
  --page: 1240px;
  --gutter: max(clamp(20px, 5vw, 72px), calc((100vw - var(--page)) / 2));
  --column: calc(100vw - 2 * var(--gutter));
  --measure: 34rem;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; }

html {
  background: var(--lacquer);
  color-scheme: dark;
  scroll-behavior: smooth;
  scroll-padding-top: 88px;
  scrollbar-color: var(--seam) var(--lacquer);
  overflow-x: clip;
}

body {
  margin: 0;
  position: relative; /* so .koi-sea spans the whole page, not one screen */
  /* No background here: the page colour is on <html>, so the layers below the text (card, koi, band) show through. */
  color: var(--bone);
  font-family: "Commissioner", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-variation-settings: "FLAR" 40;
  font-size: 1.125rem;
  line-height: 1.55;
  font-weight: 380;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  caret-color: var(--shu);
  overflow-x: clip;
}

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

a { color: inherit; text-underline-offset: 0.22em; text-decoration-thickness: 1px; }

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

h1, h2, h3 {
  margin: 0;
  font-variation-settings: "FLAR" 100;
  font-weight: 440;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

p { margin: 0 0 1em; max-width: var(--measure); text-wrap: pretty; }
p:last-child { margin-bottom: 0; }

.skip {
  position: absolute; left: var(--gutter); top: -100px; z-index: 20;
  padding: 10px 16px; background: var(--bone); color: var(--ink); border-radius: 999px;
}
.skip:focus { top: 12px; }

/* Buttons: one red action; the quiet one is bone on black. */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 0 26px;
  border-radius: 999px;
  background: var(--shu); color: var(--bone);
  font-weight: 560; font-size: 1rem; text-decoration: none; white-space: nowrap;
  transition: background-color 180ms var(--ease), transform 180ms var(--ease);
}
.btn:hover { background: #931d14; }
.btn:active { transform: scale(0.98); background: var(--shu-worn); }
.btn.quiet { background: transparent; box-shadow: inset 0 0 0 1px #4a443e; font-weight: 480; }
.btn.quiet:hover { background: var(--raised); }
.btn.small { min-height: 40px; padding: 0 18px; font-size: 0.9375rem; }

/* Top bar */
.top {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: 16px var(--gutter);
  background: rgba(15, 14, 13, 0.88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--raised);
}
.logo { display: inline-flex; }
.logo img { display: block; height: 30px; width: auto; }
.top nav { display: flex; align-items: center; gap: clamp(14px, 2.4vw, 34px); font-size: 0.9375rem; }
.top nav a:not(.btn) { color: var(--bone-muted); text-decoration: none; transition: color 160ms; }
.top nav a:not(.btn):hover { color: var(--bone); }

/* Hero: the card is the one object on the page. */
.hero {
  /* The hero's height, shared with the card so the card always fits inside it. */
  --hero-h: min(880px, calc(100svh - 64px));
  position: relative;
  min-height: var(--hero-h);
  padding: clamp(56px, 11vh, 132px) var(--gutter) clamp(72px, 12vh, 140px);
  overflow: clip;
}
.hero-text { position: relative; z-index: 2; max-width: 46rem; }
h1 { font-size: clamp(2.75rem, 7.2vw, 6rem); line-height: 1; letter-spacing: -0.03em; font-weight: 400; }
h1 mark {
  display: inline-block; background: var(--shu); color: var(--bone);
  line-height: 0.92; padding: 0.03em 0.1em 0.1em; margin: 0.08em 0 0 -0.03em;
}
h1 mark::selection { background: var(--bone); color: var(--ink); }
.lede { margin-top: clamp(28px, 4vh, 44px); font-size: clamp(1.125rem, 1.5vw, 1.3125rem); color: #c2b8a9; max-width: 33rem; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 36px; max-width: none; }

.object {
  position: absolute; z-index: -2;
  left: calc(var(--gutter) + var(--column) * 0.58); top: 26%;
  /* As wide as the layout allows, but never so tall that the tilted card
     runs past the bottom of the hero (a card is 1.585 times wider than tall). */
  width: min(max(620px, 56vw), calc(var(--hero-h) * 0.95));
  transform: rotate(6deg); transform-origin: 0 0;
  border-radius: 3.97% / 6.3%;
  box-shadow: 0 44px 70px -24px #000, 0 14px 26px -10px rgba(0, 0, 0, 0.6), inset 0 0 0 1px rgba(232, 225, 213, 0.06);
  animation: settle 1200ms var(--ease) both;
}
.object img { display: block; width: 100%; height: auto; border-radius: inherit; }
@keyframes settle {
  from { transform: translate(6%, 5%) rotate(10deg); clip-path: inset(0 0 100% 0 round 34px); }
  to { transform: rotate(6deg); clip-path: inset(0 0 0 0 round 34px); }
}

/* The swimming koi: a small canvas that follows the fish (see koi.js). */
/* It swims under the words: above the page and the card, below all text and panels. */
/* It is part of the page and scrolls with it. .koi-sea covers the page and clips the fish at its edges. */
.koi-sea { position: absolute; left: 0; top: 0; width: 100%; height: 100%; overflow: hidden; z-index: -1; pointer-events: none; }
.koi { position: absolute; left: 0; top: 0; display: none; will-change: transform; }
.koi-anchor { position: absolute; left: 68.224%; top: 66.667%; width: 0; height: 0; }
/* The card without its koi, faded in over the card while the koi is away. */
.object .koi-blank { position: absolute; inset: 0; height: 100%; opacity: 0; transition: opacity 700ms ease; }
.object .koi-blank.on { opacity: 1; }

/* How it runs: three plain statements, heading left, text right. */
.runs { padding: clamp(72px, 12vh, 150px) var(--gutter) clamp(48px, 8vh, 96px); }
.section-title { font-size: clamp(1.75rem, 3.6vw, 3rem); line-height: 1.08; max-width: 22ch; margin-bottom: clamp(48px, 8vh, 96px); }
.point {
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 24px clamp(32px, 6vw, 96px);
  padding: clamp(32px, 5vh, 56px) 0;
  border-top: 1px solid var(--seam);
}
.point h3 { font-size: clamp(1.5rem, 2.4vw, 2.125rem); line-height: 1.12; max-width: 16ch; }
.point p { color: #c2b8a9; }

/* Open to your AI: a raised black band, a step lighter than the page. */
.open {
  position: relative;
  display: grid; grid-template-columns: minmax(0, 6fr) minmax(0, 5fr); gap: 48px clamp(40px, 7vw, 120px); align-items: center;
  padding: clamp(88px, 14vh, 170px) var(--gutter);
}
/* The band sits below the koi, so the koi can cross it. */
.open::before { content: ""; position: absolute; inset: 0; z-index: -2; background: var(--raised); }
.open h2, .markets h2, .account h2, .hear h2 { font-size: clamp(2rem, 4.4vw, 3.75rem); line-height: 1.04; letter-spacing: -0.025em; max-width: 15ch; margin-bottom: clamp(24px, 4vh, 40px); }
.open p, .markets p, .account p { color: #c2b8a9; }
.mandate { margin: 0; padding: 30px 32px 14px; background: var(--lacquer); border-radius: 20px; box-shadow: 0 30px 50px -28px #000; }
.mandate figcaption { color: var(--bone-muted); font-size: 0.875rem; margin-bottom: 14px; }
.mandate dl { margin: 0; }
.mandate dl div { display: grid; grid-template-columns: 7.5rem 1fr; gap: 16px; padding: 15px 0; border-top: 1px solid var(--seam); }
.mandate dt { color: var(--bone-muted); font-size: 0.9375rem; }
.mandate dd { margin: 0; font-weight: 480; }
.num { font-variant-numeric: tabular-nums; }

/* Markets, and the list of rules the product is built to. */
.markets { padding: clamp(72px, 12vh, 140px) var(--gutter) clamp(64px, 10vh, 120px); }
.markets-intro { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 24px clamp(32px, 6vw, 96px); }
.markets h2 { margin-bottom: 0; }
.rules { margin: clamp(48px, 8vh, 88px) 0 0; }
.rules > div {
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 12px clamp(32px, 6vw, 96px);
  padding: 26px 0; border-top: 1px solid var(--seam);
}
.rules dt { font-size: 1.3125rem; line-height: 1.25; font-weight: 460; font-variation-settings: "FLAR" 100; letter-spacing: -0.01em; }
.rules dt span { display: block; margin-top: 4px; font-size: 0.9375rem; font-weight: 380; letter-spacing: 0; color: var(--bone-muted); font-variation-settings: "FLAR" 40; }
.rules dd { margin: 0; }
.rules ul { margin: 0; padding: 0; list-style: none; }
.rules li { max-width: var(--measure); color: #c2b8a9; font-size: 1rem; line-height: 1.5; }
.rules li + li { margin-top: 10px; }
.markets .rules-note { margin: 28px 0 0; padding-top: 22px; border-top: 1px solid var(--seam); max-width: none; font-size: 0.875rem; color: var(--bone-muted); }

/* The account, with the sample screen from the brand board. */
.account {
  display: grid; grid-template-columns: minmax(0, 6fr) minmax(0, 5fr); gap: 56px clamp(40px, 7vw, 120px); align-items: center;
  padding: clamp(88px, 14vh, 170px) var(--gutter);
  border-top: 1px solid var(--seam);
}
.screen {
  justify-self: center; width: min(100%, 340px);
  padding: 26px 24px 24px; border-radius: 20px;
  background: #131110; box-shadow: inset 0 0 0 1px var(--seam), 0 40px 70px -30px #000;
  font-size: 1rem;
}
.screen header { display: flex; justify-content: space-between; align-items: center; color: var(--bone-muted); font-size: 0.8125rem; }
.screen header img { height: 20px; width: auto; }
.balance { margin-top: 34px; font-size: 2.5rem; line-height: 1; font-weight: 420; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; font-variation-settings: "FLAR" 100; }
.screen > p { margin: 8px 0 0; color: var(--bone-muted); font-size: 0.875rem; }
.screen ul { list-style: none; margin: 26px 0 0; padding: 0; }
.screen li { display: grid; grid-template-columns: 10px 1fr auto; gap: 12px; align-items: center; padding: 13px 0; border-top: 1px solid var(--raised); font-variant-numeric: tabular-nums; }
.screen li i { width: 8px; height: 8px; border-radius: 50%; }
.screen li.you i { background: var(--shu); }
.screen small { display: block; font-size: 0.8125rem; color: var(--bone-muted); }
.screen .send { display: flex; margin-top: 20px; }

/* Closing */
.hear { padding: clamp(88px, 14vh, 170px) var(--gutter); border-top: 1px solid var(--seam); }
.hear p { color: #c2b8a9; }
.hear p:last-child { margin-top: 32px; }

.foot {
  display: grid; grid-template-columns: auto 1fr auto; gap: 20px 28px; align-items: center;
  padding: 36px var(--gutter) 44px; border-top: 1px solid var(--raised);
  color: var(--bone-muted); font-size: 0.875rem;
}
.foot p { margin: 0; max-width: 44rem; }
.foot img { display: block; }
.copy { white-space: nowrap; }
.credit { grid-column: 1 / -1; font-size: 0.75rem; }
.credit a { color: inherit; }

@media (max-width: 900px) {
  .top nav a:not(.btn) { display: none; }
  /* On a phone the whole card sits under the text, tilted about its own centre. */
  .hero { min-height: 0; padding-bottom: 80vw; }
  .object { left: 8vw; top: auto; bottom: 10vw; width: 84vw; transform-origin: 50% 50%; }
  .point, .markets-intro, .rules > div, .open, .account { grid-template-columns: minmax(0, 1fr); }
  .foot { grid-template-columns: auto 1fr; }
  .copy { grid-column: 1 / -1; }
}

@media (max-width: 420px) {
  .mandate { padding: 24px 20px 8px; }
  .mandate dl div { grid-template-columns: 5.5rem 1fr; }
  .actions .btn { flex: 1 1 auto; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .object { animation: none; }
  .btn { transition: none; }
}

/* Sign-up */
.signup { margin-top: 36px; max-width: 34rem; }
.signup label { display: block; margin-bottom: 10px; font-size: 0.9375rem; color: var(--bone-muted); }
.signup-row { display: flex; gap: 12px; }
.signup input[type="email"] {
  flex: 1 1 auto; min-width: 0; min-height: 48px; padding: 0 20px;
  border: 0; border-radius: 999px;
  background: var(--raised); color: var(--bone);
  box-shadow: inset 0 0 0 1px #4a443e;
  font: inherit; font-size: 1rem;
  transition: box-shadow 160ms var(--ease);
}
.signup input[type="email"]:hover { box-shadow: inset 0 0 0 1px var(--bone-muted); }
.signup input[type="email"]:focus-visible { outline: 2px solid var(--bone); outline-offset: 2px; border-radius: 999px; }
.signup input[aria-invalid="true"] { box-shadow: inset 0 0 0 2px var(--bone); }
.signup button { border: 0; cursor: pointer; font-family: inherit; font-variation-settings: inherit; }
.signup button[disabled] { background: var(--seam); color: var(--bone-muted); cursor: default; }
.trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.hear .signup p.signup-status { margin: 16px 0 0; color: var(--bone); font-weight: 480; }
.hear .signup p.signup-status:empty { margin: 0; }
.hear .signup p.signup-note { margin-top: 16px; font-size: 0.875rem; color: var(--bone-muted); }
.signup.done .signup-row, .signup.done > label { display: none; }

@media (max-width: 560px) {
  .signup-row { flex-direction: column; }
}
