/* PolicyPlayground site. Tokens come from the app:
   colours from app/crates/app/src/palette.rs,
   spacing, radii and strokes from app/crates/app/src/playground/ui/kit/theme.rs.
   See README.md for how to refresh them. */

@font-face {
  font-family: "Nunito";
  src: url("/fonts/Nunito.woff2") format("woff2");
  font-weight: 200 1000;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("/fonts/JetBrainsMono.woff2") format("woff2");
  font-weight: 100 800;
  font-display: swap;
}
@font-face {
  font-family: "Caveat";
  src: url("/fonts/Caveat.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}

:root {
  /* palette.rs */
  --paper: #f6f0e4;
  --paper-deep: #ede4d3;
  --card: #fdfaf4;
  --ink: #3b3346;
  --ink-soft: #746a7e;
  --coral: #e8735a;
  --sage: #9db89a;
  --sky: #8fb8de;
  --butter: #f2c86b;
  --lilac: #c1b4df;
  --red: #cc3238;
  --amber: #c47a0e;
  --focus: #3c7ac8;
  --backdrop: #e2e9ec;
  --night: #2d2736;
  --night-line: #4d4559;
  --moon: #ede8e0;
  --moon-soft: #a8a1b3;

  /* theme.rs: space */
  --space-xxs: 2px;
  --space-xs: 4px;
  --space-s: 8px;
  --space-m: 12px;
  --space-l: 16px;
  --space-xl: 24px;
  --space-xxl: 32px;
  /* Page-scale steps, multiples of the app's scale. */
  --space-3xl: 64px;
  --space-4xl: 96px;

  /* theme.rs: radius, stroke */
  --radius-card: 16px;
  --radius-control: 14px;
  --radius-row: 12px;
  --radius-field: 18px;
  --radius-print: 8px;
  --stroke-card: 1.6px;
  --stroke-bold: 1.8px;
  --stroke-light: 1.4px;
  --stroke-rule: 1px;

  /* theme.rs: layout */
  --gutter: var(--space-m);
  --card-pad-x: var(--space-l);
  --card-pad-y: var(--space-m);
  --stack: var(--space-s);

  --font-body: "Nunito", ui-rounded, "SF Pro Rounded", system-ui, sans-serif;
  --font-hand: "Caveat", "Bradley Hand", cursive;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --page: 1120px;
  --side: var(--space-l);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 17px/1.55 var(--font-body);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration-color: var(--coral); text-underline-offset: 3px; }
a:hover { color: var(--coral); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 4px; }

img, video { display: block; width: 100%; height: auto; }

.wrap {
  width: 100%;
  max-width: calc(var(--page) + 2 * var(--side));
  margin: 0 auto;
  padding: 0 var(--side);
}

/* ------------------------------------------------------------ header */

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-l);
  padding-top: var(--space-xl);
  padding-bottom: var(--space-xl);
}

.wordmark {
  margin: 0;
  font: 700 34px/1 var(--font-hand);
  letter-spacing: 0.2px;
}
.wordmark a { text-decoration: none; color: var(--ink); }
.wordmark a::after {
  /* The app's coral pencil underline. */
  content: "";
  display: block;
  height: 3px;
  margin-top: 2px;
  border-radius: 2px;
  background: var(--coral);
  transform: rotate(-0.6deg);
}

.nav { display: flex; gap: var(--space-l); align-items: center; }
.nav a { text-decoration: none; font-weight: 600; }

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 var(--space-l);
  border: var(--stroke-bold) solid var(--ink);
  border-radius: var(--radius-control);
  background: var(--card);
  font-weight: 700;
  text-decoration: none;
}
.pill:hover { color: var(--ink); background: var(--paper-deep); }

/* ------------------------------------------------------------ sections */

section { padding-top: var(--space-4xl); }
section:first-of-type { padding-top: var(--space-xl); }

h1, h2 {
  margin: 0 0 var(--space-xl);
  font-family: var(--font-hand);
  font-weight: 700;
  line-height: 1.05;
}
h1 { font-size: clamp(40px, 6vw, 60px); }
h2 { font-size: clamp(34px, 4.4vw, 44px); }

/* A sketch card: the app's card, with a pencil outline that strays a
   little (the app's wobble, done here with an SVG displacement filter). */
.sketch {
  position: relative;
  background: var(--card);
  border-radius: var(--radius-card);
}
.sketch::before {
  content: "";
  position: absolute;
  inset: 0;
  border: var(--stroke-card) solid var(--ink);
  border-radius: inherit;
  filter: url(#pencil);
  pointer-events: none;
  z-index: 1;
}

/* ------------------------------------------------------------ hero */

.hero-media {
  padding: var(--space-s);
}
.hero-media video,
.hero-media img {
  border-radius: calc(var(--radius-card) - var(--space-s));
  aspect-ratio: 16 / 10;
  object-fit: cover;
  background: var(--backdrop);
}

/* The precision layer: a night card with exact values. */
.readout {
  margin-top: var(--space-xl);
  padding: var(--space-l) var(--space-xl);
  background: var(--night);
  color: var(--moon);
  border-radius: var(--radius-print);
  font: 400 14px/1.6 var(--font-mono);
  font-variant-numeric: tabular-nums;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-l) var(--space-xl);
}
.readout div { display: flex; flex-direction: column; gap: var(--space-xxs); }
.readout dt { color: var(--moon-soft); font-size: 12px; text-transform: lowercase; }
.readout dd { margin: 0; }

dl { margin: 0; }

/* ------------------------------------------------------------ cards
   (benchmarks, simulators) */

h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  line-height: 1.3;
}

.cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-xl);
  align-items: start;
}
.card {
  padding: var(--space-xl);
  display: flex;
  flex-direction: column;
  gap: var(--stack);
}
.card p { margin: 0; color: var(--ink-soft); }
.card .status-tag {
  order: -1;
  font: 500 13px/1 var(--font-mono);
  color: var(--ink-soft);
  text-transform: lowercase;
}
.card .status-tag::before {
  /* A status dot: sage for what you can use now, lilac for the rest. */
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: var(--space-s);
  border-radius: 50%;
  background: var(--lilac);
  vertical-align: 1px;
}
.card:first-child .status-tag::before { background: var(--sage); }
.card.plain-line { padding-left: 0; padding-right: 0; justify-content: center; }
.card.plain-line p { font-weight: 600; }

/* ------------------------------------------------------------ in the app */

.things {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-xxl);
}
.thing { margin: 0; padding: var(--space-s) var(--space-s) var(--space-l); }
.thing video {
  border-radius: calc(var(--radius-card) - var(--space-s));
  aspect-ratio: 16 / 10;
  object-fit: cover;
  background: var(--backdrop);
  margin-bottom: var(--space-l);
}
.thing h3, .thing p { padding: 0 var(--space-m); }
.thing p { margin: var(--stack) 0 0; color: var(--ink-soft); }

/* ------------------------------------------------------------ upcoming */

.next {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-l) var(--space-xl);
}
.next li {
  padding: var(--space-l) var(--space-xl);
  border-radius: var(--radius-row);
  background: var(--paper-deep);
}
.next p { margin: var(--space-xs) 0 0; color: var(--ink-soft); }

/* ------------------------------------------------------------ waitlist */

.join { padding: var(--space-xxl); max-width: 640px; }
.join h2 { margin-bottom: var(--space-l); }
.join form { display: flex; gap: var(--space-m); flex-wrap: wrap; }
.join input[type="email"] {
  flex: 1 1 260px;
  min-height: 48px;
  padding: 0 var(--space-l);
  border: var(--stroke-bold) solid var(--ink);
  border-radius: var(--radius-field);
  background: var(--card);
  color: var(--ink);
  font: 400 17px var(--font-body);
}
.join input[type="email"]::placeholder { color: var(--ink-soft); }
.join button {
  min-height: 48px;
  padding: 0 var(--space-xl);
  border: var(--stroke-bold) solid var(--ink);
  border-radius: var(--radius-field);
  background: var(--coral);
  color: var(--card);
  font: 800 17px var(--font-body);
  cursor: pointer;
}
.join button:hover { filter: brightness(0.95); }
.join button:disabled { opacity: 0.6; cursor: default; }
.join .status { min-height: 1.55em; margin: var(--space-m) 0 0; font-weight: 700; }
.join .status.error { color: var(--red); }
.join .note { margin: var(--space-l) 0 0; color: var(--ink-soft); font-size: 14px; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* ------------------------------------------------------------ footer */

footer.wrap {
  margin-top: var(--space-4xl);
  padding-top: var(--space-xl);
  padding-bottom: var(--space-xxl);
  border-top: var(--stroke-rule) solid var(--paper-deep);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-s) var(--space-xl);
  justify-content: space-between;
  color: var(--ink-soft);
  font-size: 14px;
}

/* ------------------------------------------------------------ plain pages
   (the Worker's confirmation and unsubscribe pages, and 404) */

body.plain { display: grid; place-items: center; min-height: 100vh; padding: var(--side); }
.plain-card { max-width: 480px; }
.plain-card .wordmark { margin-bottom: var(--space-xl); }
.plain-card button {
  min-height: 44px;
  padding: 0 var(--space-xl);
  border: var(--stroke-bold) solid var(--ink);
  border-radius: var(--radius-field);
  background: var(--coral);
  color: var(--card);
  font: 800 16px var(--font-body);
  cursor: pointer;
}

/* ------------------------------------------------------------ narrow */

@media (max-width: 860px) {
  .readout { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cards { grid-template-columns: 1fr; gap: var(--space-l); }
  .card.plain-line { padding-top: 0; }
  section { padding-top: var(--space-3xl); }
}

@media (max-width: 600px) {
  .things { grid-template-columns: 1fr; gap: var(--space-xl); }
  .next { grid-template-columns: 1fr; }
  .join { padding: var(--space-xl) var(--space-l); }
  .top { padding-top: var(--space-l); padding-bottom: var(--space-l); }
  .wordmark { font-size: 28px; }
}
