/* Band I: the pages the book's QR codes point to (/b1/…).
   Mobile first: the reader arrives from a phone camera. Self-hosted fonts, no external calls.
   Tokens follow the design system "Mattias Seger · Ledarskapsböcker" (lb-), as on index.html. */
@font-face{font-family:"Newsreader";font-style:normal;font-weight:200 800;font-display:swap;src:url(/assets/fonts/newsreader-var-normal.woff2) format("woff2")}
@font-face{font-family:"Newsreader";font-style:italic;font-weight:200 800;font-display:swap;src:url(/assets/fonts/newsreader-var-italic.woff2) format("woff2")}
@font-face{font-family:"IBM Plex Mono";font-style:normal;font-weight:400;font-display:swap;src:url(/assets/fonts/ibm-plex-mono-latin-400-normal.woff2) format("woff2")}
@font-face{font-family:"IBM Plex Mono";font-style:normal;font-weight:500;font-display:swap;src:url(/assets/fonts/ibm-plex-mono-latin-500-normal.woff2) format("woff2")}

:root {
  --bg: #F1EDE4;          /* lb-paper */
  --bg2: #E6E0D2;         /* lb-paper2 */
  --ink: #1B2320;         /* lb-ink */
  --soft: #4E5853;        /* lb-soft */
  --hair: #C9C2B2;        /* lb-hair */
  --copper: #8A4520;      /* lb-copperD: copper text on paper */
  --copper-line: #A65A2E; /* lb-copper */
  --forest: #183229;      /* lb-forest */
  --on-forest: #ECE7DC;   /* lb-onF */
  --on-forest-soft: #AFBBB3; /* lb-onFs */
  --line-forest: #3F6457; /* lb-lineF */
  --copper-light: #E0A57A;/* lb-copperL */
  /* figure line tones, as in the book's live figures (part III and IV) */
  --c3: #5E6E24; --e3: #52601F; --c4: #A65A2E; --e4: #8D4A25;
  --serif: "Newsreader", "Iowan Old Style", Georgia, serif;
  --mono: "IBM Plex Mono", Menlo, Consolas, monospace;
  --radius: 6px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #183229; --bg2: #22433A; --ink: #ECE7DC; --soft: #AFBBB3; --hair: #3F6457;
    --copper: #E0A57A; --copper-line: #E0A57A;
    --c3: #B7C77A; --e3: #C9D68F; --c4: #E0A57A; --e4: #E0A57A;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; min-width: 0; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--serif); font-size: 18px; line-height: 1.55;
  font-optical-sizing: auto; -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
a { color: inherit; text-underline-offset: 4px; text-decoration-color: var(--copper-line); }
p { margin: 0 0 1em; }
h1, h2 { margin: 0; font-weight: 330; line-height: 1.12; text-wrap: balance; }
:focus-visible { outline: 2px solid var(--copper-line); outline-offset: 3px; }
.top :focus-visible, .plate :focus-visible { outline-color: var(--copper-light); }

/* Language: the interface words follow the switch. Book text (class "bok") is Swedish and always shown. */
html[data-lang="en"] [lang="sv"]:not(.bok):not(html),
html[data-lang="sv"] [lang="en"]:not(.bok):not(html) { display: none !important; }
/* Boktext som finns på båda språken: den svenska bär .har-en, den engelska .en-bok. */
html[data-lang="en"] .har-en[lang="sv"],
html[data-lang="sv"] .en-bok[lang="en"] { display: none !important; }

.skip { position: absolute; left: -9999px; top: 8px; background: var(--forest); color: var(--on-forest); padding: 8px 14px; z-index: 40; border-radius: var(--radius); }
.skip:focus { left: 16px; }

/* top bar */
.top { background: var(--forest); color: var(--on-forest); padding-top: env(safe-area-inset-top, 0px); }
.top .wrap { display: flex; align-items: center; gap: 12px; min-height: 56px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; min-height: 44px; }
.brand img { width: 30px; height: 30px; }
.brand span { font: 500 12px/1 var(--mono); letter-spacing: .22em; text-transform: uppercase; color: var(--copper-light); }
.lang { margin-left: auto; display: flex; border: 1px solid var(--line-forest); border-radius: var(--radius); overflow: hidden; }
.lang button { font: 400 12px/1 var(--mono); letter-spacing: .12em; background: none; border: 0; color: var(--on-forest); padding: 0 14px; min-height: 44px; min-width: 44px; cursor: pointer; }
.lang button[aria-pressed="true"] { background: var(--copper-light); color: var(--forest); }

.wrap { width: 100%; max-width: 760px; margin: 0 auto; padding: 0 max(18px, env(safe-area-inset-left, 0px)); }
main .wrap { padding-top: 28px; padding-bottom: 40px; }
.wide .wrap { max-width: 1000px; }

.kicker { font: 500 12px/1.5 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--copper); margin: 0 0 10px; }
.kicker .sep { color: var(--copper-line); }
h1 { font-size: clamp(30px, 7vw, 46px); margin-bottom: 18px; }

/* poem: the glass plate from the part opening, in the part's colour */
.plate { border-radius: var(--radius); padding: 24px clamp(18px, 5vw, 44px); color: var(--on-forest); margin: 8px 0 22px; background: var(--forest); border: 1px solid rgba(225, 214, 196, .25); }
.plate p { margin: 0; font-style: italic; font-weight: 320; font-size: clamp(18px, 4.9vw, 28px); line-height: 1.6; }
.plate .rad { display: block; padding-left: 1.1em; text-indent: -1.1em; }

/* words of wisdom (/b1/vN): the saying in the book's quote style, then the text as quiet body copy */
h1.kapitel { font-size: clamp(22px, 5.4vw, 30px); margin-bottom: 14px; }
.plate.visdom { padding: 26px clamp(18px, 5vw, 44px); }
.plate.visdom blockquote { margin: 0; }
.plate.visdom blockquote p { font-size: clamp(21px, 5.6vw, 30px); line-height: 1.45; }
.visdomstext { max-width: 62ch; margin: 0 0 22px; }
.visdomstext p { margin: 0 0 1em; font-size: 18px; line-height: 1.65; hyphens: manual; }
.bara-sv { color: var(--soft); font-size: 15px; font-style: italic; margin: -6px 0 18px; }

/* audio: shown only when the recording exists */
.ljud { border-top: 1px solid var(--hair); padding-top: 16px; margin: 0 0 22px; }
.ljud[hidden] { display: none; }
.ljud .rubrik { font: 500 12px/1.5 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--copper); margin: 0 0 4px; }
.ljud p { margin: 0 0 10px; color: var(--soft); font-size: 16px; }
.ljud audio { width: 100%; }

.kalla { color: var(--soft); font-size: 16px; border-top: 1px solid var(--hair); padding-top: 16px; }
.vidare { display: flex; flex-wrap: wrap; gap: 4px 22px; margin: 6px 0 0; padding: 0; list-style: none; font: 400 14px/1.4 var(--mono); }
.vidare a { display: inline-flex; align-items: center; min-height: 44px; }

/* live figures */
.lead { font-style: italic; font-size: 20px; margin: 0 0 8px; }
.note { color: var(--soft); font-size: 16px; max-width: 62ch; }
.fig { position: relative; height: 340px; background: var(--bg2); margin: 16px 0 12px; border-radius: var(--radius); overflow: hidden; touch-action: manipulation; }
.fig.hog { height: 360px; }
.fig.lag { height: 300px; }
.fig > svg, .fig > canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.ctl { display: flex; flex-wrap: wrap; gap: 10px 20px; align-items: center; margin-bottom: 18px; }
.ctl label { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; font-size: 16px; }
.ctl input[type=range] { width: min(220px, 70vw); height: 44px; accent-color: var(--c3); touch-action: pan-y; }
.ctl button { font: 16px var(--serif); color: var(--ink); background: none; border: 1px solid var(--ink); border-radius: var(--radius); padding: 0 16px; min-height: 44px; cursor: pointer; }
.out { font: 500 13px/1.4 var(--mono); color: var(--soft); flex-basis: 100%; min-height: 1.4em; }
.lampa { cursor: pointer; outline: none; }
.lampa:focus-visible circle.ring { stroke: var(--copper-line); stroke-width: 3; }

/* index of the nine */
.lista { list-style: none; margin: 0 0 24px; padding: 0; border-top: 1px solid var(--hair); }
.lista li { border-bottom: 1px solid var(--hair); }
.lista a { display: flex; flex-wrap: wrap; gap: 2px 14px; align-items: baseline; padding: 12px 0; min-height: 48px; text-decoration: none; }
.lista .kod { font: 500 13px/1.4 var(--mono); color: var(--copper); min-width: 4.5em; }
.lista .namn { flex: 1 1 14em; }
.lista h2 { font-size: 22px; margin: 26px 0 8px; }

.footer { background: var(--forest); color: var(--on-forest-soft); font: 400 13px/1.7 var(--mono); letter-spacing: .03em; padding: 24px 0 calc(24px + env(safe-area-inset-bottom, 0px)); }
.footer p { margin: 0 0 6px; }
.footer a { color: var(--copper-light); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
