/* tome.courses — the website around the app (the app itself lives at app.tome.courses).
   Layout concept: a quiet library page. One reading column, wide bands for the shelf of courses and the
   screenshots, and a single bold object: the catalogue card that describes a .course file.
   Fonts and colours are the app's own (packages/player-web/src/styles.css), so the site and the app feel like one thing.
   Everything is self-hosted: the site loads nothing from other companies, as the privacy policy says. */

@font-face { font-family: 'Literata'; src: url('/fonts/literata-latin-opsz-normal.woff2') format('woff2'); font-weight: 200 900; font-style: normal; font-display: swap; }
@font-face { font-family: 'Literata'; src: url('/fonts/literata-latin-opsz-italic.woff2') format('woff2'); font-weight: 200 900; font-style: italic; font-display: swap; }
@font-face { font-family: 'Archivo'; src: url('/fonts/archivo-latin-500-normal.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Archivo'; src: url('/fonts/archivo-latin-600-normal.woff2') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Archivo'; src: url('/fonts/archivo-latin-700-normal.woff2') format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'JetBrains Mono'; src: url('/fonts/jetbrains-mono-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-display: swap; }

:root {
  --paper: #f7f8fa;
  --page: #ffffff;
  --ink: #1b2030;
  --ink-2: #4b5163;
  --muted: #6f7586;
  --rule: #e3e6ec;
  --primary: #2b4acb;
  --on-primary: #ffffff;
  --amber: #c26a00;
  --author: #a85400;       /* authors' pages: amber instead of indigo */
  --on-author: #ffffff;
  --card: #fffdf6;          /* the catalogue card's stock */
  --card-rule: #e9dcc0;
  --card-ink: #3a3326;
  --card-red: #b4472d;      /* the ruled header line on old library cards */
  --code-bg: #eef0f4;
  --shadow: rgba(27, 32, 48, 0.10);
  --show-light: block;
  --show-dark: none;

  --serif: 'Literata', Georgia, 'Times New Roman', serif;
  --sans: 'Archivo', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --measure: 38rem;
  --wide: 70rem;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #12151d; --page: #1a1e29; --ink: #e6e8ef; --ink-2: #b9bfcd; --muted: #8e95a6; --rule: #2d3344;
    --primary: #8fa6ff; --on-primary: #0f1320; --amber: #f0a54a; --author: #f0a54a; --on-author: #1d1405;
    --card: #262318; --card-rule: #4a4130; --card-ink: #ece3cf; --card-red: #e0866c;
    --code-bg: #232838; --shadow: rgba(0, 0, 0, 0.45);
    --show-light: none; --show-dark: block;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #12151d; --page: #1a1e29; --ink: #e6e8ef; --ink-2: #b9bfcd; --muted: #8e95a6; --rule: #2d3344;
  --primary: #8fa6ff; --on-primary: #0f1320; --amber: #f0a54a; --author: #f0a54a; --on-author: #1d1405;
  --card: #262318; --card-rule: #4a4130; --card-ink: #ece3cf; --card-red: #e0866c;
  --code-bg: #232838; --shadow: rgba(0, 0, 0, 0.45);
  --show-light: none; --show-dark: block;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { font-size: 17px; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--serif); line-height: 1.6; font-optical-sizing: auto; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--primary); text-underline-offset: 0.18em; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; border-radius: 4px; }
code { font-family: var(--mono); font-size: 0.85em; background: var(--code-bg); padding: 0.1em 0.35em; border-radius: 4px; }
.light-only { display: var(--show-light); }
.dark-only { display: var(--show-dark); }

.wrap { max-width: var(--wide); margin: 0 auto; padding-left: max(20px, env(safe-area-inset-left, 0px)); padding-right: max(20px, env(safe-area-inset-right, 0px)); }
.measure { max-width: var(--measure); }

h1, h2, h3, .eyebrow, .btn, .nav, .foot { font-family: var(--sans); }
h1 { font-size: clamp(2.4rem, 6vw, 4rem); line-height: 1.02; letter-spacing: -0.035em; font-weight: 700; margin: 0; text-wrap: balance; }
h2 { font-size: clamp(1.6rem, 3.2vw, 2.1rem); line-height: 1.15; letter-spacing: -0.02em; font-weight: 700; margin: 0 0 0.6rem; text-wrap: balance; }
h3 { font-size: 1.05rem; font-weight: 600; margin: 0 0 0.3rem; letter-spacing: -0.005em; }
p { margin: 0 0 1em; }
.eyebrow { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin: 0 0 0.8rem; }
.lede { font-size: 1.22rem; font-style: italic; color: var(--ink-2); line-height: 1.5; }

/* ── Header ─────────────────────────────────────────────────────────── */
.nav { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-block: 1.1rem; }
.brand { display: flex; align-items: center; gap: 0.55rem; color: var(--ink); text-decoration: none; font-weight: 700; font-size: 1.15rem; letter-spacing: -0.01em; }
.brand img { width: 28px; height: 28px; }
.nav-links { display: flex; align-items: center; gap: 1.4rem; font-size: 0.92rem; font-weight: 500; }
.nav-links a { color: var(--ink-2); text-decoration: none; }
.nav-links a:hover { color: var(--ink); }
@media (max-width: 640px) { .nav-links .hide-sm { display: none; } }

/* ── Buttons ────────────────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: 0.5rem; font-size: 0.95rem; font-weight: 600; text-decoration: none; padding: 0.7rem 1.15rem; border-radius: 999px; border: 1px solid transparent; line-height: 1.2; }
.btn.primary { background: var(--primary); color: var(--on-primary); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.quiet { color: var(--ink); border-color: var(--rule); background: var(--page); }
.btn.quiet:hover { border-color: var(--ink-2); }
.nav .btn { padding: 0.5rem 0.95rem; font-size: 0.88rem; }
.actions { display: flex; flex-wrap: wrap; gap: 0.7rem; align-items: center; }
.note { font-family: var(--sans); font-size: 0.85rem; color: var(--muted); }

/* ── Hero ───────────────────────────────────────────────────────────── */
.hero { padding-block: clamp(2.5rem, 7vw, 5rem) 0; }
.hero-text { display: grid; gap: 1.4rem; max-width: 44rem; }
.hero-text .lede { margin: 0; max-width: 34rem; }
.hero-shots { position: relative; margin-top: clamp(2.5rem, 6vw, 4rem); padding-bottom: 3rem; }
.shot { border-radius: 12px; overflow: hidden; border: 1px solid var(--rule); box-shadow: 0 30px 60px -30px var(--shadow), 0 2px 6px var(--shadow); background: var(--page); }
.shot.desktop { width: 86%; aspect-ratio: 16 / 10; }
.shot.phone { position: absolute; right: 0; bottom: 0; width: 25%; max-width: 250px; aspect-ratio: 390 / 844; border-radius: 22px; border: 6px solid var(--ink); }
.shot img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
@media (max-width: 640px) {
  .shot.desktop { width: 100%; }
  .shot.phone { width: 38%; right: -4px; bottom: -0.5rem; border-width: 4px; border-radius: 16px; }
  .hero-shots { padding-bottom: 4.5rem; }
}

/* ── Sections ───────────────────────────────────────────────────────── */
section { padding-block: clamp(3.5rem, 8vw, 6rem) 0; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(2rem, 5vw, 4.5rem); align-items: center; }
@media (max-width: 860px) { .split { grid-template-columns: minmax(0, 1fr); } }

/* The shelf: course covers stand like books. */
.shelf { list-style: none; margin: 2rem 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2rem 1.6rem; max-width: 46rem; }
@media (max-width: 860px) { .shelf { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.shelf li { display: grid; gap: 0.7rem; align-content: start; min-width: 0; }
.shelf img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 3px 8px 8px 3px; box-shadow: inset 6px 0 0 rgba(0,0,0,0.18), 0 14px 24px -16px var(--shadow), 0 1px 3px var(--shadow); }
.shelf h3 { margin: 0; font-size: 0.98rem; line-height: 1.3; }
.shelf p { margin: 0; font-size: 0.9rem; color: var(--ink-2); line-height: 1.45; }
.shelf .meta { font-family: var(--sans); font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }

/* Three plain points, no boxes. */
.points { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2rem; margin-top: 2.2rem; }
@media (max-width: 860px) { .points { grid-template-columns: minmax(0, 1fr); gap: 1.4rem; } }
.points > div { border-top: 2px solid var(--ink); padding-top: 1rem; min-width: 0; }
.points p { margin: 0; color: var(--ink-2); }

/* The catalogue card — the page's one bold object. */
.catcard { --line: 1.9rem; position: relative; background: var(--card); color: var(--card-ink); border-radius: 4px; padding: 0 0 2.2rem;
  box-shadow: 0 24px 40px -24px var(--shadow), 0 1px 2px var(--shadow); font-family: var(--mono); font-size: 0.82rem; transform: rotate(-1.2deg); max-width: 34rem; }
/* The punched hole at the foot of an old library card */
.catcard::after { content: ""; position: absolute; left: 50%; bottom: 0.7rem; width: 1.1rem; height: 1.1rem; margin-left: -0.55rem; border-radius: 50%; background: var(--paper); box-shadow: inset 0 1px 2px var(--shadow); }
/* The heading sits above the red rule, however many lines the title takes */
.catcard .head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; line-height: 1.35; padding: 1.1rem 1.5rem 0.8rem; border-bottom: 2px solid color-mix(in srgb, var(--card-red) 70%, transparent); }
.catcard .head b { font-family: var(--sans); font-size: 1rem; letter-spacing: -0.01em; min-width: 0; }
.catcard .head span { flex: none; }
/* Ruled lines under every row; wrapped values stay on the lines because every line is the same height */
.catcard dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); column-gap: 1.2rem; margin: 0; padding: 0 1.5rem; line-height: var(--line);
  background-image: repeating-linear-gradient(to bottom, transparent 0, transparent calc(var(--line) - 1px), var(--card-rule) calc(var(--line) - 1px), var(--card-rule) var(--line)); }
.catcard dt { color: var(--card-red); }
.catcard dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 520px) {
  .catcard { font-size: 0.72rem; --line: 1.75rem; }
  .catcard .head { padding: 0.9rem 1.1rem 0.7rem; }
  .catcard .head b { font-size: 0.95rem; }
  .catcard dl { padding: 0 1.1rem; column-gap: 0.9rem; }
}
@media (prefers-reduced-motion: no-preference) { .catcard { transition: transform 0.4s ease; } .catcard:hover { transform: rotate(0deg); } }

/* Getting Tome, by device. */
.devices { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.2rem; margin-top: 2.2rem; }
@media (max-width: 860px) { .devices { grid-template-columns: minmax(0, 1fr); } }
.device { background: var(--page); border: 1px solid var(--rule); border-radius: 12px; padding: 1.4rem; display: grid; gap: 0.8rem; align-content: start; min-width: 0; }
.device ol { margin: 0; padding-left: 1.2rem; color: var(--ink-2); font-size: 0.95rem; }
.device li + li { margin-top: 0.3rem; }
.device .actions { margin-top: 0.2rem; }
.badge { font-family: var(--sans); font-size: 0.7rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--amber); border: 1px solid currentColor; padding: 0.15rem 0.5rem; border-radius: 999px; justify-self: start; }

/* For authors */
.terminal { background: #141823; color: #dfe4f0; border-radius: 12px; padding: 1.2rem 1.4rem; font-family: var(--mono); font-size: 0.85rem; line-height: 1.8; overflow-x: auto; box-shadow: 0 24px 40px -24px var(--shadow); }
.terminal .c { color: #8890a6; }
.terminal .p { color: #f0a54a; user-select: none; }
.list-plain { margin: 0 0 1.2rem; padding-left: 1.2rem; color: var(--ink-2); }
.list-plain li + li { margin-top: 0.35rem; }

/* ── Footer ─────────────────────────────────────────────────────────── */
.foot { margin-top: clamp(4rem, 9vw, 7rem); border-top: 1px solid var(--rule); padding-block: 2rem 2.5rem; font-size: 0.88rem; color: var(--muted); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; }
.foot a { color: var(--ink-2); }
.foot nav { display: flex; gap: 1.2rem; flex-wrap: wrap; }

/* ── Text pages (privacy) ───────────────────────────────────────────── */
.doc { padding-block: clamp(2rem, 6vw, 4rem) 0; }
.doc h1 { font-size: clamp(2rem, 5vw, 2.8rem); margin-bottom: 0.4rem; }
.doc h2 { font-size: 1.3rem; margin-top: 2.4rem; }
.doc table { width: 100%; border-collapse: collapse; font-size: 0.95rem; margin: 0 0 1.2rem; }
.doc th, .doc td { text-align: left; vertical-align: top; padding: 0.55rem 0.7rem 0.55rem 0; border-bottom: 1px solid var(--rule); }
.doc th { font-family: var(--sans); font-size: 0.8rem; font-weight: 600; color: var(--muted); }
.doc .table { overflow-x: auto; }
.doc ul { padding-left: 1.2rem; }
.doc li + li { margin-top: 0.3rem; }
.fill { background: color-mix(in srgb, var(--amber) 18%, transparent); padding: 0 0.2em; border-radius: 3px; }
.summary { background: var(--page); border: 1px solid var(--rule); border-radius: 12px; padding: 1.2rem 1.4rem; margin: 1.6rem 0 0; }
.summary p:last-child, .summary ul:last-child { margin-bottom: 0; }

/* ── Authors' half of the site ──────────────────────────────────────── */
body.authors { --primary: var(--author); --on-primary: var(--on-author); }
.brand .sub { font-weight: 500; color: var(--muted); }
.nav-links a[aria-current="page"] { color: var(--ink); text-decoration: underline; text-decoration-color: var(--primary); text-decoration-thickness: 2px; text-underline-offset: 0.5em; }
.terminal .k { color: #f0a54a; }
.terminal .a { color: #8fa6ff; }
.terminal .s { color: #9ce0a8; }
pre.terminal { margin: 0; white-space: pre; }

.source-result { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 1.4rem; align-items: start; margin-top: clamp(2.5rem, 6vw, 4rem); }
@media (max-width: 900px) { .source-result { grid-template-columns: minmax(0, 1fr); } }
.source-result figure { margin: 0; display: grid; gap: 0.6rem; min-width: 0; }
.source-result figcaption { font-family: var(--sans); font-size: 0.8rem; color: var(--muted); }
.source-result .terminal { font-size: 0.7rem; line-height: 1.75; }
.source-result .result img { border-radius: 12px; box-shadow: 0 24px 40px -24px var(--shadow), 0 1px 3px var(--shadow); }

.goals { margin-top: 1.8rem; overflow-x: auto; }
.goals table { border-collapse: collapse; width: 100%; max-width: 52rem; font-size: 0.95rem; }
.goals th, .goals td { text-align: left; vertical-align: top; padding: 0.6rem 1rem 0.6rem 0; border-bottom: 1px solid var(--rule); }
.goals th { font-family: var(--sans); font-size: 0.78rem; font-weight: 600; color: var(--muted); }
.goals td:last-child { white-space: normal; }
.goals code { display: inline-block; margin: 0.1rem 0.15rem 0.1rem 0; }

.steps { list-style: none; counter-reset: step; margin: 2.2rem 0 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2rem 2.4rem; max-width: 56rem; }
@media (max-width: 560px) { .steps { grid-template-columns: minmax(0, 1fr); } }
.steps li { counter-increment: step; border-top: 2px solid var(--ink); padding-top: 0.9rem; display: grid; gap: 0.5rem; align-content: start; min-width: 0; }
.steps li::before { content: counter(step); font-family: var(--sans); font-weight: 700; font-size: 0.8rem; color: var(--primary); }
.steps p { margin: 0; color: var(--ink-2); font-size: 0.95rem; }
.steps .terminal { font-size: 0.75rem; padding: 0.8rem 1rem; line-height: 1.7; }

.split.top { align-items: start; }

.doclinks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.2rem; }
@media (max-width: 700px) { .doclinks { grid-template-columns: minmax(0, 1fr); } }
.doclink { display: grid; gap: 0.35rem; padding: 1.4rem 1.5rem; border: 1px solid var(--rule); border-radius: 12px; background: var(--page); color: var(--ink-2); text-decoration: none; min-width: 0; }
.doclink b { font-family: var(--sans); font-size: 1.2rem; color: var(--ink); }
.doclink .eyebrow { margin: 0; }
.doclink:hover { border-color: var(--primary); }

/* The small link from the learners' home page to the authors' pages */
.author-strip { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.3rem 1.5rem; border-radius: 12px; border: 1px dashed var(--rule); color: var(--ink); text-decoration: none; }
.author-strip > span:first-child { display: grid; gap: 0.2rem; }
.author-strip .eyebrow { margin: 0; color: var(--author); }
.author-strip b { font-family: var(--sans); font-weight: 600; }
.author-strip .go { font-family: var(--sans); font-size: 1.4rem; color: var(--author); }
.author-strip:hover { border-color: var(--author); border-style: solid; }

/* Generated documentation pages (guide, format) */
.docs { display: grid; grid-template-columns: 15rem minmax(0, 1fr); gap: 3rem; padding-block: 2rem 0; align-items: start; }
@media (max-width: 900px) { .docs { grid-template-columns: minmax(0, 1fr); gap: 1rem; } }
.docs-toc { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 1rem); max-height: calc(100vh - 2rem); overflow-y: auto; font-family: var(--sans); font-size: 0.85rem; }
@media (max-width: 900px) { .docs-toc { position: static; max-height: none; } }
.docs-toc-sm { display: none; font-family: var(--sans); font-size: 0.9rem; border: 1px solid var(--rule); border-radius: 10px; padding: 0.7rem 1rem; background: var(--page); }
@media (max-width: 900px) { .docs-toc { display: none; } .docs-toc-sm { display: block; } }
.toc-title, .docs-toc-sm summary { font-family: var(--sans); font-weight: 600; color: var(--muted); font-size: 0.75rem; letter-spacing: 0.1em; text-transform: uppercase; margin: 0 0 0.6rem; }
.docs-toc-sm summary { cursor: pointer; margin: 0; }
.docs-toc-sm[open] summary { margin-bottom: 0.6rem; }
:is(.docs-toc, .docs-toc-sm) ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.15rem; }
:is(.docs-toc, .docs-toc-sm) a { color: var(--ink-2); text-decoration: none; display: block; padding: 0.15rem 0; line-height: 1.35; }
:is(.docs-toc, .docs-toc-sm) a:hover { color: var(--primary); }
:is(.docs-toc, .docs-toc-sm) .d2 { font-weight: 600; margin-top: 0.45rem; }
:is(.docs-toc, .docs-toc-sm) .d2:first-child { margin-top: 0; }
:is(.docs-toc, .docs-toc-sm) .d3 { padding-left: 0.8rem; }
.docs-body { max-width: 46rem; min-width: 0; }
.docs-body h1 { font-size: clamp(2rem, 5vw, 2.8rem); margin-bottom: 1.2rem; }
.docs-body h2 { font-size: 1.45rem; margin-top: 2.8rem; scroll-margin-top: 1rem; }
.docs-body h3 { font-size: 1.1rem; margin-top: 2rem; scroll-margin-top: 1rem; }
.docs-body h4 { font-family: var(--sans); font-size: 1rem; margin: 1.6rem 0 0.4rem; scroll-margin-top: 1rem; }
.docs-body .anchor { float: left; margin-left: -1.1em; width: 1.1em; color: var(--muted); text-decoration: none; opacity: 0; font-weight: 400; }
.docs-body h2:hover .anchor, .docs-body h3:hover .anchor, .docs-body h4:hover .anchor, .docs-body .anchor:focus-visible { opacity: 1; }
.docs-body pre { background: var(--code-bg); border-radius: 10px; padding: 0.9rem 1.1rem; overflow-x: auto; font-size: 0.82rem; line-height: 1.6; margin: 0 0 1.2rem; }
.docs-body pre code { background: none; padding: 0; font-size: inherit; }
.docs-body .table { overflow-x: auto; margin: 0 0 1.2rem; }
.docs-body table { border-collapse: collapse; font-size: 0.9rem; width: 100%; }
.docs-body th, .docs-body td { text-align: left; vertical-align: top; padding: 0.5rem 0.8rem 0.5rem 0; border-bottom: 1px solid var(--rule); }
.docs-body th { font-family: var(--sans); font-size: 0.8rem; color: var(--muted); font-weight: 600; }
.docs-body hr { border: 0; border-top: 1px solid var(--rule); margin: 2.4rem 0; }
.docs-body details { border: 1px solid var(--rule); border-radius: 10px; padding: 0.8rem 1rem; margin: 0 0 1.2rem; background: var(--page); }
.docs-body summary { cursor: pointer; font-family: var(--sans); font-weight: 600; }
.docs-body blockquote { margin: 0 0 1.2rem; padding-left: 1rem; border-left: 3px solid var(--rule); color: var(--ink-2); }
.docs-body img { border-radius: 8px; }
