/* Colours and fonts follow the app (../anolog/lib/core/theme). */

@font-face { font-family: "Space Grotesk"; src: url("fonts/SpaceGrotesk-Regular.otf") format("opentype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Space Grotesk"; src: url("fonts/SpaceGrotesk-Medium.otf") format("opentype"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Space Grotesk"; src: url("fonts/SpaceGrotesk-Bold.otf") format("opentype"); font-weight: 700; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("fonts/JetBrainsMono-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("fonts/JetBrainsMono-Medium.ttf") format("truetype"); font-weight: 500; font-display: swap; }

:root {
  --bg: #0c0e11;
  --panel: #14171c;
  --panel-2: #1a1e24;
  --text: #e6e9ee;
  --muted: #8b929c;
  --line: rgba(230, 233, 238, 0.12);
  --accent: #f2a93b;
  --sans: "Space Grotesk", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  color-scheme: dark;
}

/* Dark is the default whatever the system says. Light only when picked
   with the toggle (assets/theme.js sets data-theme). */
:root[data-theme="light"] {
  --bg: #e9ebee;
  --panel: #f6f7f9;
  --panel-2: #ffffff;
  --text: #15181d;
  --muted: #5c636d;
  --line: rgba(21, 24, 29, 0.14);
  --accent: #b36f00;
  color-scheme: light;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 17px/1.6 var(--sans);
  -webkit-text-size-adjust: 100%;
}

.wrap { max-width: 720px; margin: 0 auto; padding: 0 16px; }

a { color: var(--accent); text-underline-offset: 3px; }

/* Header and footer */

.site-header { border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; }

.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 700; font-size: 20px; }
.brand img { width: 32px; height: 32px; }

.nav { display: flex; gap: 18px; }
.nav a { font: 500 12px/1 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); text-decoration: none; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--accent); }
.nav { align-items: center; }

.theme-toggle { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; margin-right: -8px; padding: 0; border: 0; border-radius: 8px; background: none; color: var(--muted); cursor: pointer; }
.theme-toggle:hover { color: var(--accent); }
.theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.theme-toggle svg { width: 20px; height: 20px; }
/* Shows the theme a tap switches to. */
.theme-toggle .moon, :root[data-theme="light"] .theme-toggle .sun { display: none; }
:root[data-theme="light"] .theme-toggle .moon { display: block; }

.site-footer { border-top: 1px solid var(--line); margin-top: 64px; padding: 24px 0 40px; color: var(--muted); font-size: 14px; }
.site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; }
.site-footer a { color: var(--muted); }

/* Type */

h1, h2, h3 { line-height: 1.2; font-weight: 700; }
h1 { font-size: clamp(32px, 8vw, 48px); margin: 0 0 16px; letter-spacing: -0.01em; }
h2 { font-size: 24px; margin: 48px 0 12px; }
h3 { font-size: 18px; margin: 28px 0 8px; }

.label { font: 500 12px/1.4 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); margin: 0 0 12px; }
.lead { font-size: 20px; color: var(--muted); margin: 0 0 24px; }
.muted { color: var(--muted); }

/* Home */

.hero { padding: 56px 0 8px; }

.status {
  display: inline-block;
  font: 500 12px/1 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 8px 10px;
}

.cards { display: grid; gap: 12px; margin: 32px 0 0; padding: 0; list-style: none; }
@media (min-width: 600px) { .cards { grid-template-columns: 1fr 1fr; } }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 18px; }
.card h3 { margin: 0 0 6px; }
.card p { margin: 0; color: var(--muted); font-size: 15px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th { text-align: left; font: 500 11px/1.4 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); padding: 8px 12px 8px 0; border-bottom: 1px solid var(--line); }
td { padding: 10px 12px 10px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
td:first-child { font-weight: 500; white-space: nowrap; }

/* Screens showcase: a phone that swaps shots, chips that pick one.
   Inside the page column like every other section. */

.showcase-label { font: 500 11px/1 var(--mono); text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }

.switcher { display: grid; gap: 20px; margin-top: 24px; }
.phone { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.phone-shell { width: min(240px, 100%); padding: 8px; border: 1px solid var(--line); border-radius: 28px; background: var(--panel); }
.phone-shell img { display: block; width: 100%; height: auto; aspect-ratio: 9 / 16; border-radius: 20px; background: var(--panel-2); }
.phone figcaption { display: flex; flex-direction: column; gap: 4px; text-align: center; min-height: 64px; max-width: 280px; }
.phone figcaption strong { font-weight: 500; font-size: 17px; }
.phone figcaption span { color: var(--muted); font-size: 14px; line-height: 1.4; }

.side { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.chips { display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x proximity; margin: 0 -16px; padding: 4px 16px 10px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips button { flex: 0 0 auto; scroll-snap-align: center; min-height: 44px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); color: var(--text); font: 400 14px/1 var(--sans); white-space: nowrap; cursor: pointer; }
.chips button:hover { border-color: var(--muted); }
.chips button[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }
.chips button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.onehand { list-style: none; margin: 0; padding: 0; }
.onehand li { display: grid; grid-template-columns: 64px 1fr; gap: 12px; align-items: baseline; padding: 12px 0; border-top: 1px solid var(--line); font-size: 15px; line-height: 1.45; }
.onehand li:last-child { border-bottom: 1px solid var(--line); }

@media (min-width: 680px) {
  .switcher { grid-template-columns: 260px minmax(0, 1fr); gap: 32px; align-items: start; }
  .phone-shell { width: 260px; }
  .chips { flex-wrap: wrap; overflow: visible; margin: 0; padding: 0; }
  .chips button { min-height: 36px; padding: 0 12px; font-size: 13px; }
}

/* Long-form pages */

.doc { padding-top: 48px; }
.doc p, .doc li { max-width: 65ch; }
.doc ul { padding-left: 20px; }
.doc li { margin: 6px 0; }

.summary { background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 10px; padding: 16px 18px; margin: 24px 0; }
.summary p { margin: 0; }

/* Help page */

.toc { display: grid; gap: 20px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 18px; margin: 32px 0 0; }
.toc ol { margin: 10px 0 0; padding-left: 22px; }
.toc li { margin: 6px 0; }
.doc section { scroll-margin-top: 16px; }
.steps { padding-left: 22px; }
.steps li { margin: 10px 0; padding-left: 4px; }
.split { display: grid; gap: 24px; }

@media (min-width: 640px) {
  .toc { grid-template-columns: 1fr 1fr; }
  .split { grid-template-columns: minmax(0, 1fr) 240px; align-items: start; }
  .split .phone-shell { width: 240px; }
}

/* Widgets: two launcher pages at true cell proportions, numbered against a
   legend. Each number sits on its widget's empty corner. One cell is 171 x 306 image px with a 48 px gutter, so the gap is
   0.2807 of a cell and a row is 1.7895 cells tall. */

.widgets-undo { color: var(--text); font: 500 12px/1 var(--mono); text-transform: uppercase; letter-spacing: 0.08em; }

.pages { display: grid; gap: 16px; margin-top: 24px; }
.page { container-type: inline-size; max-width: 420px; }
.home {
  --c: calc((100cqw - 20px) / 4.842);
  --g: calc(var(--c) * 0.2807);
  list-style: none; margin: 0; padding: 10px;
  display: grid; gap: var(--g);
  grid-template-columns: repeat(4, var(--c));
  grid-auto-rows: calc(var(--c) * 1.7895);
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
}
.home .cell { position: relative; margin: 0; }
.home .cell img { display: block; width: 100%; height: 100%; object-fit: contain; }
.home .n { position: absolute; z-index: 1; left: -7px; top: -7px; min-width: 18px; height: 18px; padding: 0 5px; display: inline-flex; align-items: center; justify-content: center; border-radius: 9px; background: var(--panel-2); border: 1px solid var(--line); color: var(--text); font: 500 10px/1 var(--mono); }
.home .c2 { grid-column: span 2; }
.home .c3 { grid-column: span 3; }
.home .c4 { grid-column: span 4; }
.home .r2 { grid-row: span 2; }
.home .cell .w-light { display: none; }
:root[data-theme="light"] .home .cell .w-dark { display: none; }
:root[data-theme="light"] .home .cell .w-light { display: block; }

.legend { list-style: none; margin: 24px 0 0; padding: 0; display: grid; border-top: 1px solid var(--line); }
.legend li { display: grid; grid-template-columns: 28px 1fr; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); line-height: 1.45; }
.legend .n { font: 500 12px/1.6 var(--mono); color: var(--muted); }
.legend strong { display: block; font-weight: 500; font-size: 15px; }
.legend p { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.grow { margin: 20px 0 0; color: var(--muted); font-size: 15px; }

@media (min-width: 640px) {
  .pages { grid-template-columns: 1fr 1fr; }
  .page { max-width: none; }
  .legend { grid-template-columns: 1fr 1fr; column-gap: 24px; }
}
