/* somalc brand books: shared base. Each book defines its tokens and its own look on top. */
/* Tokens every book must define on :root:
   --ground --ground-2 --surface --text --text-2 --line --accent --accent-ink --focus --radius */
*, *::before, *::after { box-sizing: border-box; }
html { color-scheme: dark; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--text);
  font-family: 'Figtree', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img, svg, canvas, video { display: block; max-width: 100%; }
a { color: inherit; }
p { margin: 0; }
h1, h2, h3, h4 { margin: 0; font-weight: 900; line-height: 1; letter-spacing: -0.04em; text-wrap: balance; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 4px; }
::selection { background: var(--accent); color: var(--accent-ink); }

.wrap { width: 100%; max-width: 1320px; margin-inline: auto; padding-inline: clamp(16px, 4vw, 48px); }
.bk { padding-block: clamp(64px, 9vw, 128px); }
.bk-head { display: grid; gap: 14px; margin-bottom: clamp(32px, 4vw, 56px); max-width: 60ch; }
.bk-head h2 { font-size: clamp(38px, 5.4vw, 72px); }
.bk-head p { color: var(--text-2); font-size: clamp(17px, 1.4vw, 19px); }
.tnum { font-variant-numeric: tabular-nums; }

/* Shared book bar: same markup in all four books */
.bookbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 50;
  background: color-mix(in srgb, var(--ground) 86%, transparent);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.bookbar .wrap { display: flex; align-items: center; gap: 20px; min-height: 56px; flex-wrap: wrap; }
.bookbar .home { font-weight: 800; letter-spacing: -0.02em; text-decoration: none; white-space: nowrap; }
.bookbar nav { display: flex; gap: 4px 18px; flex-wrap: wrap; margin-left: auto; font-size: 15px; }
.bookbar nav a { text-decoration: none; color: var(--text-2); padding-block: 6px; }
.bookbar nav a:hover { color: var(--text); }
.bookbar nav a[aria-current="page"] { color: var(--text); font-weight: 800; }
@media (max-width: 560px) { .bookbar nav { margin-left: 0; width: 100%; padding-bottom: 8px; } }

/* WebGL hosts */
[data-gl] { position: relative; overflow: hidden; }
[data-gl] > canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
[data-gl].no-gl > canvas { display: none; }

/* Fixed-width mock frames scaled to their container (see Book.fit) */
.fit { position: relative; width: 100%; overflow: hidden; aspect-ratio: var(--ar, 16 / 10); }
.fit > * { position: absolute; top: 0; left: 0; transform-origin: 0 0; }

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