/* Tomebound's site. One stylesheet, no build step, no scripts.
   The accent is the app's own: #7A4FC2 light, #B69CF2 dark (AccentColor.colorset). */

:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --text: #1d1b22;
  --muted: #5b5766;
  --rule: #e6e2ec;
  --accent: #7a4fc2;
  --accent-soft: #f1ebfa;
  --on-accent: #ffffff;
  --shot: #efeaf6;
  --chip: #efecf3;
  --chip-pressed: #e4dfec;
  --measure: 40rem;
  --wide: 72rem;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141218;
    --surface: #1c1a21;
    --text: #edeaf2;
    --muted: #a9a3b5;
    --rule: #2e2a36;
    --accent: #b69cf2;
    --accent-soft: #241e31;
    --shot: #221d2c;
    --chip: #26222e;
    --chip-pressed: #322c3d;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 1.0625rem/1.6 system-ui, -apple-system, "Segoe UI", sans-serif;
}

h1, h2, h3 {
  font-family: ui-serif, "New York", Georgia, serif;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

a { color: var(--accent); text-underline-offset: 0.15em; }

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

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.prose { max-width: var(--measure); }

/* Header and footer */

.site-header { border-bottom: 1px solid var(--rule); }
.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding-top: 0.875rem;
  padding-bottom: 0.875rem;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  font-size: 1.125rem;
}
.brand img { width: 32px; height: 32px; border-radius: 7px; }
.site-header nav { display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; }
.site-header nav a { color: var(--muted); text-decoration: none; }
.site-header nav a:hover,
.site-header nav a[aria-current="page"] { color: var(--text); }

.site-footer {
  margin-top: 5rem;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 0.9375rem;
}
.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding-top: 1.5rem;
  padding-bottom: 2rem;
}
.site-footer nav { display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; }
.site-footer a { color: var(--muted); }

/* Home */

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

.hero {
  display: grid;
  justify-items: center;
  text-align: center;
  padding: 4rem 0 4.5rem;
}
.hero .icon { width: 96px; height: 96px; border-radius: 22px; box-shadow: 0 8px 24px rgb(40 20 80 / 0.18); }
.hero h1 {
  font-size: clamp(2.25rem, 6.5vw, 4rem);
  line-height: 1.08;
  letter-spacing: -0.02em;
  margin: 1.75rem 0 1rem;
  max-width: 17ch;
  text-wrap: balance;
}
.hero .lede { color: var(--muted); font-size: clamp(1.125rem, 2.2vw, 1.3125rem); max-width: 36rem; margin: 0; text-wrap: pretty; }

.cta {
  display: inline-block;
  margin-top: 2rem;
  padding: 0.75rem 1.5rem;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  text-decoration: none;
  font-weight: 600;
}
@media (prefers-color-scheme: dark) {
  /* White on the dark accent is 2.33:1, so a filled button keeps the light violet. */
  .cta { background: #7a4fc2; }
}
.hero .cta-note {
  margin: 1.75rem 0 0;
  padding: 0.375rem 1rem;
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--text);
  font-size: 0.9375rem;
}
.hero .shot { width: 100%; margin-top: 3.5rem; }

/* A screenshot slot, the 11-inch iPad Pro's landscape screen. Tools/site-screenshots.sh makes
   the images; see Website/README.md. */
.shot {
  margin: 0;
  aspect-ratio: 2420 / 1668;
  border-radius: 16px;
  border: 1px solid var(--rule);
  background: var(--shot);
  overflow: hidden;
  box-shadow: 0 1px 2px rgb(40 20 80 / 0.06), 0 18px 48px -12px rgb(40 20 80 / 0.22);
}
@media (prefers-color-scheme: dark) {
  .shot { box-shadow: 0 18px 48px -12px rgb(0 0 0 / 0.6); }
}
/* A `<picture>`, so a dark-mode visitor gets the dark shot and loads only that one. */
.shot picture { display: block; height: 100%; }
.shot img { display: block; width: 100%; height: 100%; object-fit: cover; }

/* Every section of the home page: a rule above, and room for the page's hotbar when a chip
   lands on it. */
.feature, .ledger {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.75rem;
  padding: 3.5rem 0;
  border-top: 1px solid var(--rule);
  scroll-margin-top: 0.5rem;
}
.ledger.first { border-top: 0; padding-top: 0; }
.feature h2, .ledger h2 { font-size: clamp(1.625rem, 3.4vw, 2.125rem); margin: 0 0 0.75rem; text-wrap: balance; }
.feature .copy p, .ledger .head p { margin: 0 0 0.75rem; color: var(--muted); font-size: 1.125rem; }
.feature .copy, .ledger .head { max-width: 34rem; }

/* What a section lists: a name and a sentence, in as many columns as fit. */
.feature dl, .ledger dl {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 1.5rem 2.5rem;
  align-content: start;
}
.feature dt, .ledger dt { font-weight: 600; }
.feature dd, .ledger dd { margin: 0.125rem 0 0; color: var(--muted); }
.feature dl.more { padding-top: 0.5rem; }

kbd {
  display: inline-block;
  min-width: 1.75em;
  padding: 0.05em 0.4em;
  border: 1px solid var(--rule);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font: 0.875em/1.5 system-ui, -apple-system, sans-serif;
  text-align: center;
  white-space: nowrap;
}
.ledger dl.keys { grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: 1.25rem 2.5rem; }
.ledger dl.keys dt { font-weight: 400; }
.ledger dl.keys dd { margin-top: 0.375rem; }

@media (min-width: 56rem) {
  .feature { grid-template-columns: 4fr 7fr; column-gap: 3.5rem; align-items: center; }
  .feature.flip { grid-template-columns: 7fr 4fr; }
  .feature.flip .copy { order: 2; }
  .feature dl.more { grid-column: 1 / -1; }
  .ledger { grid-template-columns: 4fr 7fr; column-gap: 3.5rem; }
  .ledger.first { padding-top: 0; }
  .ledger dl { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ledger dl.keys { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* The page's own hotbar. It is the last thing in <main>, so it rides the bottom of the window
   for as long as <main> is on screen and rests above the footer. Chips scroll sideways when the
   width runs out, as the app's do. */
.pagebar {
  position: sticky;
  bottom: 0;
  z-index: 1;
  margin-top: 3rem;
  border-top: 1px solid var(--rule);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: saturate(1.6) blur(18px);
  backdrop-filter: saturate(1.6) blur(18px);
}
.pagebar .wrap {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  scrollbar-width: none;
  padding-top: 0.625rem;
  padding-bottom: calc(0.625rem + env(safe-area-inset-bottom));
}
.pagebar .wrap::-webkit-scrollbar { display: none; }
.pagebar a {
  flex: none;
  padding: 0.5rem 0.875rem;
  border-radius: 12px;
  background: var(--chip);
  color: var(--text);
  text-decoration: none;
  font-size: 0.9375rem;
  font-weight: 500;
  white-space: nowrap;
}
.pagebar a:hover { background: var(--chip-pressed); }
/* The chip whose section the address names is pressed, as the app's is. */
main:has(#hotbar:target) .pagebar a[href="#hotbar"],
main:has(#projects:target) .pagebar a[href="#projects"],
main:has(#groups:target) .pagebar a[href="#groups"],
main:has(#return:target) .pagebar a[href="#return"],
main:has(#find:target) .pagebar a[href="#find"],
main:has(#mark-up:target) .pagebar a[href="#mark-up"],
main:has(#gamebooks:target) .pagebar a[href="#gamebooks"],
main:has(#editions:target) .pagebar a[href="#editions"],
main:has(#sync:target) .pagebar a[href="#sync"],
main:has(#price:target) .pagebar a[href="#price"] {
  background: var(--accent-soft);
  color: var(--accent);
}

/* The SRD's attribution, which CC-BY-4.0 asks for wherever the screenshots are shown. */
.credit {
  max-width: var(--measure);
  margin: 0;
  padding-top: 2rem;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 0.8125rem;
  overflow-wrap: anywhere;
}
.credit a { color: var(--muted); }

/* Text pages */

.page { padding-top: 3rem; }
.page h1 { font-size: clamp(2rem, 5vw, 2.5rem); margin: 0 0 0.5rem; }
.page h2 { font-size: 1.375rem; margin: 2.5rem 0 0.5rem; }
.page h3 { font-size: 1.125rem; margin: 1.75rem 0 0.25rem; }
.page .lede { color: var(--muted); font-size: 1.1875rem; margin-top: 0; }
.page .updated { color: var(--muted); font-size: 0.9375rem; }

.contact {
  margin: 2rem 0;
  padding: 1.25rem 1.5rem;
  border-radius: 12px;
  background: var(--accent-soft);
}
.contact p { margin: 0.25rem 0; }

details {
  border-top: 1px solid var(--rule);
  padding: 0.875rem 0;
}
details:last-of-type { border-bottom: 1px solid var(--rule); }
summary {
  cursor: pointer;
  font-weight: 600;
}
details p, details ul { margin: 0.625rem 0 0; }

/* The home page's bar already rules off the footer. */
main:has(.pagebar) + .site-footer { margin-top: 0; border-top: 0; }
