/*
 * DPM website. It comes in the app's two styles, After Hours (the default) and Clipboard, each
 * in light and dark, and the colours, fonts and corner radii mirror the app's design tokens
 * (src/common/theme/tokens.ts) so the site and the app read as one product. The visitor picks
 * the style with the switcher in the header (site.js sets data-style on <html>); light and dark
 * follow the system.
 *
 * The fonts are the app's own (OFL, assets/fonts/), subset to Latin and served from this site:
 * no third-party font request, which from the EU would itself be a privacy issue. A browser
 * only downloads the faces the shown style uses.
 */

@font-face {
  font-family: "DM Serif Display";
  src: url("fonts/DMSerifDisplay_400Regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "DM Serif Display";
  src: url("fonts/DMSerifDisplay_400Regular_Italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: Manrope;
  src: url("fonts/Manrope_400Regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: Manrope;
  src: url("fonts/Manrope_600SemiBold.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}

@font-face {
  font-family: Manrope;
  src: url("fonts/Manrope_700Bold.woff2") format("woff2");
  font-weight: 700 800;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Sans Condensed";
  src: url("fonts/IBMPlexSansCondensed_400Regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Sans Condensed";
  src: url("fonts/IBMPlexSansCondensed_600SemiBold.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Sans Condensed";
  src: url("fonts/IBMPlexSansCondensed_700Bold.woff2") format("woff2");
  font-weight: 700 800;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Mono";
  src: url("fonts/IBMPlexMono_400Regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Mono";
  src: url("fonts/IBMPlexMono_600SemiBold.woff2") format("woff2");
  font-weight: 600 700;
  font-display: swap;
}

/* ── Styles ─────────────────────────────────────────────────────────────── */

/* After Hours, the default: warm and roomy, a serif voice for headings. */
:root {
  --background: #f6f2f7;
  --surface: #ffffff;
  --surface-variant: #ece5ef;
  --on-surface-variant: #6a3b86;
  --text: #21182c;
  --text-muted: #5f546b;
  --primary: #93500d;
  --on-primary: #ffffff;
  --border: #ddd3e3;
  --edge: #8a7e95;
  --frame: #21182c;
  --shadow: 0 1px 2px rgb(33 24 44 / 6%), 0 8px 24px rgb(33 24 44 / 9%);
  --card-border: none;

  --font-display: "DM Serif Display", Georgia, "Times New Roman", serif;
  --font-body:
    Manrope, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  /* DM Serif Display has one weight; asking for bold would make the browser fake it. */
  --display-weight: 400;
  --display-tracking: 0;

  --radius: 16px;
  --radius-lg: 24px;
  --radius-sm: 12px;
  --radius-pill: 999px;
  --phone-radius: 36px;

  /* Pattern-type colours, from PATTERN_TYPE_COLORS. */
  --coral: #ff6b6b;
  --teal: #4ecdc4;
  --violet: #9b59b6;
  --amber: #f39c12;

  --max: 1080px;
  --gutter: 20px;

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --background: #15121d;
    --surface: #201b2b;
    --surface-variant: #2b2439;
    --on-surface-variant: #d9c2ff;
    --text: #f1e8dc;
    --text-muted: #b0a6bd;
    --primary: #f3b46a;
    --on-primary: #2a1b0b;
    --border: #3a3149;
    --edge: #7d7290;
    --frame: #3a3149;
    --shadow: 0 1px 2px rgb(0 0 0 / 35%), 0 8px 24px rgb(0 0 0 / 30%);
  }
}

/* Clipboard: dense, condensed and squared-off, with mono labels. */
:root[data-style="clipboard"] {
  --background: #eef1ee;
  --surface: #ffffff;
  --surface-variant: #e1e7e2;
  --on-surface-variant: #24503f;
  --text: #141815;
  --text-muted: #515953;
  --primary: #b3300f;
  --on-primary: #ffffff;
  --border: #d0d7d1;
  --edge: #7c867e;
  --frame: #141815;
  /* Clipboard separates by rule rather than by depth. */
  --shadow: 0 1px 2px rgb(20 24 21 / 6%);
  --card-border: 1px solid var(--border);

  --font-display:
    "IBM Plex Sans Condensed", "Arial Narrow", system-ui, sans-serif;
  --font-body: "IBM Plex Sans Condensed", "Arial Narrow", system-ui, sans-serif;
  --display-weight: 700;
  --display-tracking: -0.01em;

  --radius: 4px;
  --radius-lg: 6px;
  --radius-sm: 3px;
  --radius-pill: 4px;
  --phone-radius: 18px;
}

@media (prefers-color-scheme: dark) {
  :root[data-style="clipboard"] {
    --background: #111513;
    --surface: #1a1f1c;
    --surface-variant: #262d28;
    --on-surface-variant: #9fd8c0;
    --text: #e6ebe7;
    --text-muted: #a0a9a2;
    --primary: #ff7a5c;
    --on-primary: #2a0a02;
    --border: #333b35;
    --edge: #737d75;
    --frame: #333b35;
    --shadow: 0 1px 2px rgb(0 0 0 / 30%);
  }
}

/* Each screenshot comes once per style; only the shown style's copy is displayed (and, being
   lazy, downloaded). */
:root[data-style="clipboard"] .for-ah,
:root:not([data-style="clipboard"]) .for-cb {
  display: none !important;
}

/* ── Base ───────────────────────────────────────────────────────────────── */

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

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

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
}

[data-style="clipboard"] body {
  line-height: 1.5;
}

img,
svg {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--primary);
  text-underline-offset: 2px;
}

h1,
h2,
h3 {
  line-height: 1.15;
  margin: 0 0 0.5em;
}

h1,
h2 {
  font-family: var(--font-display);
  font-weight: var(--display-weight);
  letter-spacing: var(--display-tracking);
}

h1 {
  font-size: clamp(2.3rem, 5.4vw, 3.7rem);
}

h2 {
  font-size: clamp(1.7rem, 3.6vw, 2.4rem);
}

h3 {
  font-size: 1.15rem;
  font-weight: 700;
}

p {
  margin: 0 0 1em;
}

.wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.muted {
  color: var(--text-muted);
}

.skip {
  position: absolute;
  left: -9999px;
}

.skip:focus {
  left: var(--gutter);
  top: 12px;
  z-index: 10;
  background: var(--surface);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
}

/* ── Header ─────────────────────────────────────────────────────────────── */

.site-header {
  position: sticky;
  top: 0;
  z-index: 5;
  background: color-mix(in srgb, var(--background) 85%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 64px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: var(--display-weight);
  font-size: 1.35rem;
  margin-right: auto;
}

.brand img {
  width: 36px;
  height: 36px;
}

/* The four pages, under a small "Usage" label, set apart from the style switch by a rule. */
.site-nav {
  display: flex;
  align-items: baseline;
  gap: 20px;
  font-size: 0.95rem;
  padding-right: 20px;
  border-right: 1px solid var(--border);
}

.nav-label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  opacity: 0.75;
  margin-right: -8px;
}

.site-nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 600;
}

.site-nav a:hover {
  color: var(--primary);
}

/* The page you are on, among the four. */
.site-nav a[aria-current="page"] {
  color: var(--primary);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 6px;
}

/* On a phone the four pages move to a row of their own under the brand, since they are how
   the site is read, and wrap rather than hide one off the edge. */
@media (max-width: 680px) {
  .site-header .wrap {
    flex-wrap: wrap;
    height: auto;
    padding-top: 10px;
    row-gap: 4px;
  }

  .site-nav {
    order: 3;
    width: 100%;
    flex-wrap: wrap;
    gap: 2px 16px;
    padding: 4px 0 10px;
    border-right: 0;
  }

  .nav-label {
    margin-right: 0;
  }

  .site-nav a {
    white-space: nowrap;
  }
}

/* The style switcher: a segmented control, like the app's. Hidden until site.js runs, since
   without the script it could not do anything. */
.style-switch {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  background: var(--surface-variant);
  border-radius: var(--radius-pill);
  flex-shrink: 0;
}

.style-switch[hidden] {
  display: none;
}

.style-switch button {
  appearance: none;
  border: 0;
  background: none;
  color: var(--text-muted);
  font: 600 0.85rem/1 var(--font-body);
  padding: 8px 12px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  white-space: nowrap;
}

.style-switch button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--primary);
  box-shadow: var(--shadow);
}

.style-switch button:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

.style-switch .ah-label {
  font-family: "DM Serif Display", Georgia, serif;
  font-weight: 400;
  font-size: 0.95rem;
}

.style-switch .cb-label {
  font-family: "IBM Plex Sans Condensed", "Arial Narrow", sans-serif;
  font-weight: 600;
}

/* ── Buttons ────────────────────────────────────────────────────────────── */

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: var(--radius-pill);
  font-weight: 700;
  text-decoration: none;
  border: 2px solid var(--primary);
}

.btn-primary {
  background: var(--primary);
  color: var(--on-primary);
}

.btn-secondary {
  color: var(--primary);
}

.btn:hover {
  filter: brightness(1.08);
}

.btn svg {
  width: 20px;
  height: 20px;
}

/* ── Hero ───────────────────────────────────────────────────────────────── */

.hero {
  padding: 64px 0 40px;
}

.hero .wrap {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 48px;
  align-items: center;
}

/* A small label above a heading: a tag in After Hours, a mono rubric in Clipboard. */
.eyebrow {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--on-surface-variant);
  background: var(--surface-variant);
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  margin-bottom: 18px;
}

[data-style="clipboard"] .eyebrow {
  font-family: var(--font-mono);
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--primary);
  background: none;
  padding: 0;
  border-left: 3px solid var(--primary);
  padding-left: 8px;
  border-radius: 0;
}

.lead {
  font-size: 1.2rem;
  color: var(--text-muted);
  max-width: 34em;
}

.status {
  margin-top: 18px;
  font-size: 0.9rem;
  color: var(--text-muted);
}

@media (max-width: 860px) {
  .hero {
    padding-top: 40px;
  }

  .hero .wrap {
    grid-template-columns: 1fr;
    gap: 32px;
  }
}

/* ── Sections ───────────────────────────────────────────────────────────── */

section {
  padding: 56px 0;
}

.section-head {
  max-width: 44em;
  margin-bottom: 32px;
}

.section-head p {
  color: var(--text-muted);
  font-size: 1.1rem;
}

/* Clear the sticky header when a link jumps to a section. */
[id] {
  scroll-margin-top: 72px;
}

@media (max-width: 680px) {
  [id] {
    scroll-margin-top: 136px;
  }
}

.band {
  background: var(--surface);
  border-block: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
}

/* Who it's for: one card per audience. */
.audiences {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.audience {
  background: var(--background);
  border-radius: var(--radius);
  border: var(--card-border);
  padding: 24px;
}

.audience p {
  color: var(--text-muted);
}

.audience p:last-child {
  margin: 0;
}

@media (max-width: 760px) {
  .audiences {
    grid-template-columns: 1fr;
  }
}

/* The idea: three steps. */
.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  counter-reset: step;
  padding: 0;
  margin: 0;
  list-style: none;
}

.steps li {
  counter-increment: step;
  background: var(--surface);
  border-radius: var(--radius);
  border: var(--card-border);
  box-shadow: var(--shadow);
  padding: 22px;
}

.steps li::before {
  content: counter(step);
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-pill);
  background: var(--primary);
  color: var(--on-primary);
  font-weight: 800;
  margin-bottom: 12px;
}

[data-style="clipboard"] .steps li::before {
  content: counter(step, decimal-leading-zero);
  font-family: var(--font-mono);
  font-weight: 600;
  width: auto;
  height: auto;
  display: block;
  background: none;
  color: var(--primary);
  border-radius: 0;
  margin-bottom: 6px;
}

.steps p {
  margin: 0;
  color: var(--text-muted);
}

@media (max-width: 760px) {
  .steps {
    grid-template-columns: 1fr;
  }
}

/* Feature rows: text beside an illustration. */
.feature {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: center;
  margin-bottom: 64px;
}

.feature:last-child {
  margin-bottom: 0;
}

.feature.flip .feature-art {
  order: -1;
}

.feature-art {
  background: var(--surface);
  border-radius: var(--radius);
  border: var(--card-border);
  box-shadow: var(--shadow);
  padding: 18px;
}

.feature ul {
  padding-left: 1.2em;
  margin: 0 0 1em;
}

.feature li {
  margin-bottom: 0.4em;
}

@media (max-width: 860px) {
  .feature {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .feature.flip .feature-art {
    order: 0;
  }
}

/* The three views of a list, named and drawn like the app's bottom tabs. */
.tabs-legend {
  display: grid;
  gap: 10px;
  padding: 0;
  margin: 0 0 1.2em;
  list-style: none;
}

.tabs-legend li {
  display: grid;
  grid-template-columns: 28px 1fr;
  column-gap: 14px;
  align-items: start;
  background: var(--background);
  border-radius: var(--radius-sm);
  border: var(--card-border);
  padding: 12px 16px;
  margin: 0;
}

.tabs-legend svg {
  grid-row: span 2;
  width: 26px;
  height: 26px;
  color: var(--primary);
  margin-top: 2px;
}

[data-style="clipboard"] .tabs-legend strong {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.tabs-legend span {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.45;
}

/* Card grid. */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 18px;
}

.card {
  background: var(--surface);
  border-radius: var(--radius);
  border: var(--card-border);
  padding: 22px;
  box-shadow: var(--shadow);
}

/* Four cards read better as two rows of two than as three and one. */
.cards.pairs {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 400px), 1fr));
}

.band .card {
  background: var(--background);
  box-shadow: none;
}

.card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.97rem;
}

.card .icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--surface-variant);
  color: var(--on-surface-variant);
  display: grid;
  place-items: center;
  margin-bottom: 14px;
}

.card .icon svg {
  width: 22px;
  height: 22px;
}

/* App screenshots, framed as a phone. Each comes in a light and a dark take, picked by
   prefers-color-scheme in the <picture>, so it follows the page's theme. */
.hero-art.shot,
.feature-art.shot {
  background: none;
  box-shadow: none;
  border: 0;
  padding: 0;
}

.shot img {
  width: 100%;
  max-width: 300px;
  margin: 0 auto;
  border: 8px solid var(--frame);
  border-radius: var(--phone-radius);
  box-shadow: var(--shadow);
}

/* Two shots side by side: a phone and a crop. */
.shot-pair {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 20px;
  align-items: start;
}

.shot-pair .shot-crop {
  margin-top: 48px;
}

@media (max-width: 480px) {
  .shot-pair {
    grid-template-columns: 1fr;
  }

  .shot-pair .shot-crop {
    margin-top: 0;
  }
}

/* The video tools, step by step: crops of the app's sheets, so a lighter frame than a phone. */
.video-steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  align-items: start;
}

.shot-crop {
  margin: 0;
}

.shot-crop img {
  display: block;
  width: 100%;
  max-width: 300px;
  height: auto;
  margin: 0 auto;
  border: 6px solid var(--frame);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.shot-crop figcaption {
  max-width: 300px;
  margin: 12px auto 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

@media (max-width: 860px) {
  .video-steps {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .video-steps {
    grid-template-columns: 1fr;
  }
}

/* Illustrations share the page's colours, so they follow the theme. */
.art-surface {
  fill: var(--surface);
}

.art-label-muted {
  fill: var(--text-muted);
  font: 600 11px var(--font-body);
}

.art-code {
  fill: var(--text);
  font: 600 34px var(--font-mono);
  letter-spacing: 3px;
}

/* The four ways to use DPM, as cards that lead to their pages. */
.paths {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}

.path {
  display: flex;
  flex-direction: column;
  background: var(--background);
  border-radius: var(--radius);
  border: var(--card-border);
  padding: 22px;
  color: var(--text);
  text-decoration: none;
}

section:not(.band) .path {
  background: var(--surface);
  box-shadow: var(--shadow);
}

.path:hover,
.path:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}

.path .eyebrow {
  align-self: flex-start;
  margin-bottom: 12px;
}

.path p {
  color: var(--text-muted);
  font-size: 0.97rem;
  margin: 0 0 16px;
}

.path .more {
  margin-top: auto;
  color: var(--primary);
  font-weight: 700;
}

@media (max-width: 960px) {
  .paths {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 560px) {
  .paths {
    grid-template-columns: 1fr;
  }
}

/* Read on: the other three pages, at the foot of each. */
.paths.read-on {
  grid-template-columns: repeat(3, 1fr);
}

@media (max-width: 860px) {
  .paths.read-on {
    grid-template-columns: 1fr;
  }
}

/* How-to steps with a body of text, for subscribing and setting up a course. */
.steps.long li p + p {
  margin-top: 0.6em;
}

/* Three levels of privacy, side by side. */
.levels {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.level {
  background: var(--background);
  border-radius: var(--radius);
  border: var(--card-border);
  padding: 22px;
}

.level p,
.level li {
  color: var(--text-muted);
  font-size: 0.97rem;
}

.level ul {
  padding-left: 1.2em;
  margin: 0;
}

.level p:last-child {
  margin: 0;
}

.levels + p {
  margin-top: 20px;
}

@media (max-width: 860px) {
  .levels {
    grid-template-columns: 1fr;
  }
}

/* ── FAQ ────────────────────────────────────────────────────────────────── */

.faq details {
  background: var(--surface);
  box-shadow: var(--shadow);
  border-radius: var(--radius-sm);
  border: var(--card-border);
  padding: 16px 20px;
  margin-bottom: 12px;
}

.band.faq details {
  background: var(--background);
  box-shadow: none;
}

.faq summary {
  cursor: pointer;
  font-weight: 700;
}

.faq details p {
  margin: 12px 0 0;
  color: var(--text-muted);
}

/* ── Footer ─────────────────────────────────────────────────────────────── */

.site-footer {
  padding: 40px 0 56px;
  font-size: 0.92rem;
  color: var(--text-muted);
  border-top: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}

.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 16px;
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
}

.site-footer a {
  color: var(--text-muted);
}

/* ── Long-form pages (privacy, alpha) ──────────────────────────────────────────── */

.prose {
  max-width: 46em;
  padding-block: 48px;
}

.prose h1 {
  font-size: clamp(1.9rem, 4vw, 2.6rem);
}

.prose h2 {
  font-size: 1.45rem;
  margin-top: 2em;
}

.prose h3 {
  font-size: 1.15rem;
  margin-top: 1.6em;
}

.prose code {
  font-family: var(--font-mono);
  font-size: 0.92em;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 1.2em;
  font-size: 0.95rem;
  display: block;
  overflow-x: auto;
}

.prose th,
.prose td {
  text-align: left;
  vertical-align: top;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}

.prose th {
  background: var(--surface-variant);
}
