/* MeetPi marketing site — one stylesheet, no build step.
   Tokens mirror web/src/styles/tokens.css (the product is the source of truth).
   Colour appears only as functional status, never as mood. */

/* ---------- Fonts (self-hosted, variable, latin subset) ---------- */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("assets/inter.woff2") format("woff2");
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url("assets/jetbrains-mono.woff2") format("woff2");
}

/* ---------- Tokens ---------- */
:root {
  --paper: #f4f2ec;
  --paper-raised: #fbfaf5;
  --ink: #17150f;
  --ink-soft: #59554a;
  --ink-faint: #726c5c;
  --hairline: #ded9cd;
  --hairline-strong: #c9c3b4;

  --in: #2e6b44;
  --in-tint: #e4ede4;
  --out: #a23b32;
  --out-tint: #f1e3e0;
  --wait: #8a6a1f;
  --wait-tint: #efe8d6;

  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;

  --radius: 12px;
  --radius-pill: 999px;
  --tap-min: 44px;
  --measure: 62ch;
  --page: 1080px;

  --texture-opacity: 0.4;
  --texture-blend: multiply;
  --texture-filter: none;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0f0e0b;
    --paper-raised: #191712;
    --ink: #f1eee4;
    --ink-soft: #a9a392;
    --ink-faint: #858071;
    --hairline: #29251d;
    --hairline-strong: #38332a;
    --in: #6fb98a;
    --in-tint: #17231a;
    --out: #e08a80;
    --out-tint: #2a1815;
    --wait: #d6b25e;
    --wait-tint: #241e10;
    --texture-opacity: 0.25;
    --texture-blend: screen;
    --texture-filter: invert(1);
    color-scheme: dark;
  }
}
/* Explicit choice beats the OS in both directions. */
:root[data-theme="light"] {
  --paper: #f4f2ec; --paper-raised: #fbfaf5; --ink: #17150f; --ink-soft: #59554a;
  --ink-faint: #726c5c; --hairline: #ded9cd; --hairline-strong: #c9c3b4;
  --in: #2e6b44; --in-tint: #e4ede4; --out: #a23b32; --out-tint: #f1e3e0;
  --wait: #8a6a1f; --wait-tint: #efe8d6;
  --texture-opacity: 0.4; --texture-blend: multiply; --texture-filter: none;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --paper: #0f0e0b; --paper-raised: #191712; --ink: #f1eee4; --ink-soft: #a9a392;
  --ink-faint: #858071; --hairline: #29251d; --hairline-strong: #38332a;
  --in: #6fb98a; --in-tint: #17231a; --out: #e08a80; --out-tint: #2a1815;
  --wait: #d6b25e; --wait-tint: #241e10;
  --texture-opacity: 0.25; --texture-blend: screen; --texture-filter: invert(1);
  color-scheme: dark;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; margin: 0; }

html { scroll-behavior: smooth; }
[id] { scroll-margin-top: 5.5rem; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1rem; /* 16px floor, never smaller for body copy */
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Paper grain: the one piece of atmosphere the brand permits. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  background: url("assets/paper-texture.webp");
  background-size: 640px;
  mix-blend-mode: var(--texture-blend);
  filter: var(--texture-filter);
  opacity: var(--texture-opacity);
  pointer-events: none;
  transform: translateZ(0);
}
body > * { position: relative; z-index: 1; }

::selection { background: var(--ink); color: var(--paper); }

a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible {
  outline: 2px solid var(--ink); /* focus is ink, not a stray blue */
  outline-offset: 3px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--ink);
  color: var(--paper);
  padding: 0.75rem 1.25rem;
  z-index: 50;
}
.skip-link:focus { left: 0.5rem; top: 0.5rem; }

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

/* ---------- Type ---------- */
h1, h2, h3 { line-height: 1.12; letter-spacing: -0.02em; font-weight: 800; text-wrap: balance; }

.display {
  font-size: clamp(2.25rem, 1.2rem + 4.5vw, 4.25rem);
  letter-spacing: -0.03em;
}
h2 { font-size: clamp(1.75rem, 1.2rem + 2vw, 2.5rem); }
h3 { font-size: 1.375rem; font-weight: 700; }

p { max-width: var(--measure); }
.lede { font-size: 1.125rem; color: var(--ink-soft); }
.small { font-size: 0.9375rem; color: var(--ink-soft); }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  display: block;
  margin-bottom: 1rem;
}

.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
time, .asof { font-family: var(--font-mono); font-size: 0.8125rem; color: var(--ink-soft); }

/* ---------- Status (colour never appears without its word) ---------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 0.15em 0.7em;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}
.pill::before { content: ""; width: 0.5em; height: 0.5em; border-radius: 50%; background: currentColor; }
.pill-in { color: var(--in); background: var(--in-tint); }
.pill-out { color: var(--out); background: var(--out-tint); }
.pill-wait { color: var(--wait); background: var(--wait-tint); }

/* ---------- Layout ---------- */
.wrap { max-width: var(--page); margin: 0 auto; padding: 0 1.25rem; }

section { padding: clamp(3.5rem, 8vw, 6.5rem) 0; }
section + section { border-top: 1px solid var(--hairline); }

.grid2 { display: grid; gap: 3rem; align-items: center; }
.grid3 { display: grid; gap: 2rem; }
@media (min-width: 880px) {
  .grid2 { grid-template-columns: 1fr 1fr; gap: 4rem; }
  .grid3 { grid-template-columns: 1fr 1fr 1fr; }
}

/* ---------- Header / nav ---------- */
.site-header {
  border-bottom: 1px solid var(--hairline);
  background: var(--paper);
  position: sticky;
  top: 0;
  z-index: 20;
}
@supports ((backdrop-filter: blur(6px)) or (-webkit-backdrop-filter: blur(6px))) and (background: color-mix(in srgb, red 50%, transparent)) {
  .site-header {
    background: color-mix(in srgb, var(--paper) 88%, transparent);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
  }
}
@media (max-width: 560px) {
  .site-header { position: static; }
}
.nav {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  min-height: 64px;
  flex-wrap: wrap;
  padding: 0.5rem 0;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 800;
  font-size: 1.125rem;
  letter-spacing: -0.03em;
  text-decoration: none;
}
.brand svg { width: 30px; height: auto; display: block; }
.nav-links {
  display: flex;
  gap: 1.25rem;
  align-items: center;
  flex-wrap: wrap;
  margin-left: auto;
  list-style: none;
  padding: 0;
}
.nav-links a { text-decoration: none; font-size: 0.9375rem; padding: 0.5rem 0; }
.nav-links a:hover { text-decoration: underline; }
.nav-links a[aria-current="page"] { text-decoration: underline; text-decoration-thickness: 2px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
  min-height: var(--tap-min);
  padding: 0.65rem 1.4rem;
  border-radius: var(--radius);
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease;
}
.btn:hover { opacity: 0.9; }
.btn:active { transform: translateY(1px); }
.btn .cost {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  opacity: 0.85;
}
.btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--hairline-strong);
}
.btn-row { display: flex; gap: 0.9rem; flex-wrap: wrap; align-items: center; }

/* ---------- Hero ---------- */
.hero { padding-top: clamp(3rem, 7vw, 5.5rem); }
.hero .display { margin: 0.25rem 0 1.25rem; font-variant-numeric: tabular-nums; }
.hero .lede { margin-bottom: 2rem; }

/* ---------- The exchange (SMS -> board), drawn with hairlines ---------- */
.exchange {
  display: grid;
  gap: 1.25rem;
  max-width: 420px;
  justify-self: center;
  width: 100%;
}
.demo-note {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--ink-soft);
  text-align: center;
}
.phone {
  border: 1px solid var(--hairline-strong);
  border-radius: 20px;
  background: var(--paper-raised);
  padding: 1.1rem;
  display: grid;
  gap: 0.7rem;
}
.phone-meta {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--ink-soft);
  text-align: center;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--hairline);
}
.bubble {
  border: 1px solid var(--hairline-strong);
  border-radius: 14px;
  padding: 0.65rem 0.9rem;
  font-size: 0.9375rem;
  line-height: 1.45;
  max-width: 88%;
  background: var(--paper);
}
.bubble-reply {
  justify-self: end;
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
  font-family: var(--font-mono);
  font-weight: 600;
}
.board {
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius);
  background: var(--paper-raised);
  padding: 1.1rem 1.2rem;
  display: grid;
  gap: 0.6rem;
}
.board-title {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  font-weight: 700;
}
.board-tally {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 1.25rem;
  font-weight: 700;
  display: flex;
  gap: 0.9rem;
  flex-wrap: wrap;
  align-items: center;
}
.board-names { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* Animation: additive only; the no-JS page shows the finished state. */
.js .exchange [data-step] { opacity: 0; transform: translateY(6px); }
.js .exchange.play [data-step] {
  animation: rise 0.45s ease forwards;
  animation-delay: calc(var(--step) * 0.9s);
}
@keyframes rise { to { opacity: 1; transform: none; } }

/* ---------- Cards / steps ---------- */
.card {
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  background: var(--paper-raised);
  padding: 1.75rem;
}
.card h3 { margin-bottom: 0.6rem; }
.step-num {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--ink-soft);
  display: block;
  margin-bottom: 0.75rem;
}

/* ---------- The week strip ---------- */
.week {
  display: grid;
  gap: 0;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  background: var(--paper-raised);
  overflow: hidden;
}
.week-row {
  display: grid;
  grid-template-columns: 5.5rem 1fr;
  gap: 1rem;
  padding: 0.9rem 1.25rem;
  align-items: baseline;
}
.week-row + .week-row { border-top: 1px solid var(--hairline); }
.week-day {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
}
.week-line { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 0.9375rem; }
@media (max-width: 520px) {
  .week-row { grid-template-columns: 1fr; gap: 0.15rem; }
}

/* ---------- Fact strip ---------- */
.facts { display: grid; gap: 1px; background: var(--hairline); border: 1px solid var(--hairline); border-radius: var(--radius); overflow: hidden; }
@media (min-width: 880px) { .facts { grid-template-columns: repeat(4, 1fr); } }
.fact { background: var(--paper-raised); padding: 1.5rem; }
.fact .mono { display: block; font-size: 1.375rem; font-weight: 700; margin-bottom: 0.35rem; }

/* ---------- Pricing ---------- */
.plans { display: grid; gap: 1.25rem; align-items: stretch; }
@media (min-width: 880px) { .plans { grid-template-columns: repeat(4, 1fr); } }
.plan {
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius);
  background: var(--paper-raised);
  padding: 1.6rem 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}
.plan-name { font-weight: 800; font-size: 1.125rem; letter-spacing: -0.01em; }
.plan-price { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 1.75rem; font-weight: 700; line-height: 1.1; }
.plan-price .per { font-size: 0.8125rem; font-weight: 500; color: var(--ink-soft); display: block; }
.plan ul { list-style: none; padding: 0; display: grid; gap: 0.45rem; font-size: 0.9375rem; }
.plan li { padding-left: 1.1rem; position: relative; }
.plan li::before { content: "·"; position: absolute; left: 0.25rem; font-weight: 800; }
.plan .who { margin-top: auto; font-size: 0.875rem; color: var(--ink-soft); border-top: 1px solid var(--hairline); padding-top: 0.9rem; }
.badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius-pill);
  padding: 0.2em 0.8em;
  color: var(--ink-soft);
}

/* ---------- FAQ ---------- */
.faq { display: grid; gap: 0; border-top: 1px solid var(--hairline); }
.faq details { border-bottom: 1px solid var(--hairline); }
.faq summary {
  cursor: pointer;
  font-weight: 700;
  padding: 1.1rem 0.25rem;
  list-style: none;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  min-height: var(--tap-min);
  align-items: center;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-family: var(--font-mono); font-size: 1.25rem; color: var(--ink-soft); flex-shrink: 0; }
.faq details[open] summary::after { content: "−"; }
.faq .answer { padding: 0 0.25rem 1.25rem; display: grid; gap: 0.75rem; }

/* ---------- Refusals ---------- */
.refusals { display: grid; gap: 0; counter-reset: refusal; border-top: 1px solid var(--hairline); }
.refusal {
  counter-increment: refusal;
  display: grid;
  grid-template-columns: 4rem 1fr;
  gap: 1.5rem;
  padding: 2rem 0;
  border-bottom: 1px solid var(--hairline);
}
.refusal::before {
  content: counter(refusal, decimal-leading-zero);
  font-family: var(--font-mono);
  font-size: 1.125rem;
  color: var(--ink-faint);
  padding-top: 0.4rem;
}
.refusal .r-title { font-size: clamp(1.375rem, 1rem + 1.5vw, 1.75rem); font-weight: 700; margin-bottom: 0.5rem; }
@media (max-width: 520px) {
  .refusal { grid-template-columns: 1fr; gap: 0.25rem; }
}

/* ---------- The ground-marks plate (the site's one generated image) ----------
   The plate is printed on paper and stays light in both themes: on dark
   surfaces it is presented framed, never re-tinted. Copy set into its open
   upper half uses fixed ink-on-paper colours for AA in both themes. */
.plate {
  position: relative;
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius);
  overflow: hidden;
  background: #f4f2ec;
}
.plate-video {
  max-width: 520px;
  margin: 3.5rem auto 0;
  aspect-ratio: 3 / 4;
}
.plate-video video,
.plate-video img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--hairline);
  padding: 3rem 0 4rem;
  color: var(--ink-soft);
  font-size: 0.9375rem;
}
.footer-grid { display: grid; gap: 2rem; }
@media (min-width: 880px) { .footer-grid { grid-template-columns: 2fr 1fr 1fr; } }
.site-footer ul { list-style: none; padding: 0; display: grid; gap: 0.5rem; }
.site-footer .brand { color: var(--ink); margin-bottom: 0.75rem; }
.theme-toggle {
  font: inherit;
  font-size: 0.875rem;
  background: none;
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius-pill);
  color: inherit;
  padding: 0.4rem 1rem;
  min-height: var(--tap-min);
  cursor: pointer;
}
html:not(.js) .theme-toggle { display: none; }

/* ---------- Print ---------- */
@media print {
  .site-header, .skip-link, .theme-toggle, .plate-video { display: none; }
  body::before { display: none; }
  .faq details { break-inside: avoid; }
}

/* ---------- Motion discipline ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
  html { scroll-behavior: auto; }
  .js .exchange [data-step] { opacity: 1; transform: none; }
}
