/* Viastory — styles
   Dator: en hero med böckerna som föremål, sedan en fast scen bredvid en lugn läskolumn.
   Mobil (≤ 860px): en kolumn i standardordning – rubrik, bild, text, knapp. */

:root {
  --bg: #FFFFFF;
  --hero: #F2F2F0;
  --paper: #FFFFFF;
  --ink: #1A1816;
  --ink-soft: #3A3531;
  --muted: #615B55;
  --accent: #D03E1C;
  --accent-strong: #B0331A;
  --coral: #F2542D;
  --teal: #0B4F6C;
  --plum: #5C1240;
  --navy: #173B5F;
  --foot: #1A1816;
  --foot-ink: #F2F2F0;
  --foot-muted: #A6A6A0;
  --line: #E2E1DD;
  --bar-h: 4.75rem;

  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;

  --step-small: 0.9375rem;
  --step-body: clamp(1.0625rem, 1rem + 0.2vw, 1.1875rem);
  --step-head: clamp(2.5rem, 1.5rem + 2.9vw, 4.25rem);
  --step-display: clamp(3rem, 1.1rem + 5.2vw, 6.25rem);

  --margin: clamp(1.25rem, 4.4vw, 4rem);
  --edge: max(var(--margin), calc((100vw - 1560px) / 2 + var(--margin)));
  --gap: clamp(1rem, 2vw, 1.75rem);
  --section: clamp(5.5rem, 9vw, 8.5rem);

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.76, 0, 0.24, 1);
  --t-press: 140ms;
  --t-hover: 180ms;
  --t-ui: 240ms;
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans); font-size: var(--step-body); line-height: 1.65; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; overflow-x: clip; }
h1, h2, h3, p, figure, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img, svg { display: block; max-width: 100%; }
img { height: auto; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; -webkit-tap-highlight-color: transparent; }
:target, section[id] { scroll-margin-top: var(--bar-h); }
/* anchors whose heading sits right at their top edge get breathing room under the bar */
[id].chapter__part, #larande-roman { scroll-margin-top: calc(var(--bar-h) + clamp(2.5rem, 5vw, 4rem)); }
::selection { background: var(--coral); color: var(--ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.wrap { width: 100%; max-width: 1560px; margin-inline: auto; padding-inline: var(--margin); }

/* ---------- type ---------- */
h1, h2, h3 { font-family: var(--serif); font-weight: 400; text-wrap: balance; }
.display { font-size: var(--step-display); line-height: 1; letter-spacing: -0.032em; }
.head { font-size: var(--step-head); line-height: 1.04; letter-spacing: -0.028em; }
p { max-width: 62ch; text-wrap: pretty; }
b { font-weight: 600; }

/* ---------- controls ---------- */
.button {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 3.125rem; padding: 0 1.6rem; border-radius: 3px;
  background: var(--accent); color: #fff;
  font-size: var(--step-small); font-weight: 500; letter-spacing: 0.005em; text-decoration: none; white-space: nowrap;
  transition: transform var(--t-press) var(--ease-out), background-color var(--t-hover) ease;
}
.button:active { transform: scale(0.97); }
.button--ink { background: var(--ink); }
.text-link { font-size: var(--step-small); font-weight: 500; text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 0.3em; text-decoration-color: rgb(26 24 22 / 0.35); transition: text-decoration-color var(--t-hover) ease; }
.link { text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 0.3em; text-decoration-thickness: 1.5px; transition: text-decoration-color var(--t-hover) ease, color var(--t-hover) ease; }
.link[aria-current="page"] { text-decoration-color: var(--coral); }
.back .order__link, .order__link { font-family: var(--sans); font-size: var(--step-small); font-weight: 500; color: var(--accent); text-decoration: underline; text-underline-offset: 0.3em; text-decoration-thickness: 1.5px; }
@media (hover: hover) and (pointer: fine) {
  .button:hover { background: var(--accent-strong); }
  .button--ink:hover { background: var(--ink-soft); }
  .text-link:hover, .link:hover { text-decoration-color: currentColor; }
  .order__link:hover { color: var(--accent-strong); }
}

/* ---------- the book, as an object ---------- */
.book3d { --d: 26px; width: var(--w); position: relative; perspective: 1800px; }
.book3d__body { position: relative; aspect-ratio: var(--ratio); transform-style: preserve-3d; transform: rotateY(var(--ry, 24deg)); }
.book3d__body > * { position: absolute; backface-visibility: hidden; }
.book3d__front { inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 0 2px 2px 0; transform: translateZ(calc(var(--d) / 2)); }
.book3d__hinge { top: 0; bottom: 0; left: 4px; width: 3px; background: rgb(0 0 0 / 0.2); transform: translateZ(calc(var(--d) / 2 + 0.5px)); }
.book3d__hinge::after { content: ""; position: absolute; top: 0; bottom: 0; left: 4px; width: 2px; background: rgb(255 255 255 / 0.22); }
.book3d__spine { top: 0; left: 0; width: var(--d); height: 100%; background: var(--spine); transform: translateX(calc(var(--d) / -2)) rotateY(-90deg); }
.book3d__pages { top: 3px; right: 0; width: var(--d); height: calc(100% - 6px); background: #F6F2EA; transform: translateX(calc(var(--d) / 2)) rotateY(90deg); }
.book3d__back { inset: 0; background: var(--spine); transform: translateZ(calc(var(--d) / -2)) rotateY(180deg); }
.book3d__floor { position: absolute; left: 2%; right: -8%; bottom: -16px; height: 24px; border-radius: 50%; background: rgb(40 30 20 / 0.3); filter: blur(14px); z-index: -1; }
.book3d--laddad { --ratio: 427 / 641; --spine: #0A4660; }
.book3d--leda { --ratio: 480 / 587; --spine: #4E0D36; }

/* ---------- header ---------- */
main { position: relative; }
.bar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 2rem; height: var(--bar-h); background: #fff; border-bottom: 1px solid var(--line); padding-inline: var(--edge); }
.brand { display: block; color: var(--coral); }
.logo { width: clamp(180px, 15vw, 224px); height: auto; fill: currentColor; }
.nav { display: flex; align-items: center; gap: clamp(1.1rem, 2vw, 2.1rem); font-size: var(--step-small); font-weight: 500; color: var(--ink); }
.bar__cta { min-height: 2.75rem; padding: 0 1.25rem; margin-left: 0.5rem; }
.menu { display: none; }

/* ---------- hero (first section of the reading column) ---------- */
.read > .hero { max-width: none; padding: 0; }
.hero__side { display: flex; flex-direction: column; min-height: calc(100svh - var(--bar-h)); max-height: 1000px; padding: 3rem 0 clamp(2rem, 4svh, 2.75rem); container-type: inline-size; }
.hero__copy { margin-block: auto; }
.hero h1 .line > span { white-space: nowrap; }
.hero h1 { font-size: min(6rem, 14.2cqi); }
.hero__text { margin-top: 1.75rem; max-width: 40ch; font-size: clamp(1.0625rem, 0.95rem + 0.35vw, 1.25rem); line-height: 1.6; }
.hero__actions { display: flex; align-items: center; gap: 1.75rem; margin-top: 2.5rem; }
.byline { display: flex; align-items: center; gap: 0.9rem; margin-top: 3rem; }
.byline__face { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; object-position: 50% 22%; }
.byline p { display: flex; flex-direction: column; font-size: var(--step-small); line-height: 1.4; }
.byline span { color: var(--muted); }

/* ---------- the split: reading column left, sticky stage right ---------- */
.split { display: grid; grid-template-columns: 1fr 1fr; }
.read { min-width: 0; padding-left: var(--edge); padding-right: clamp(2rem, 6vw, 6rem); }
.read > section { padding-block: var(--section); max-width: 36rem; }
.read > section + section { padding-top: 0; }
.read > .book-sec { min-height: 100svh; display: flex; flex-direction: column; justify-content: center; padding-block: calc(var(--section) * 0.6); }
.read > .book-sec + .book-sec { padding-top: calc(var(--section) * 0.6); }
.stage { position: sticky; top: var(--bar-h); height: calc(100svh - var(--bar-h)); overflow: hidden; --horizon: 76%; }

/* the shelf: one stage, the same two books move between states.
   The colour fades on its own layer: the light, table and grain above it are never repainted. */
.stage::before { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--stage-bg, var(--coral)); transition: background-color 1000ms var(--ease-in-out); will-change: transform; }
.stage--shelf[data-state="laddad"] { --stage-bg: var(--teal); }
.stage--shelf[data-state="leda"] { --stage-bg: var(--plum); }
.stage__surface { position: absolute; inset: calc(var(--horizon) - 8%) 0 0 0; z-index: 0; background: linear-gradient(to bottom, rgb(0 0 0 / 0.17), rgb(0 0 0 / 0.08) 45%, rgb(0 0 0 / 0.15)); }
.stage__light { position: absolute; inset: 0; z-index: 0; pointer-events: none; background:
  radial-gradient(ellipse 60% 50% at 52% 42%, rgb(255 255 255 / 0.14), rgb(255 255 255 / 0) 70%),
  radial-gradient(ellipse 130% 100% at 50% 45%, rgb(0 0 0 / 0) 60%, rgb(0 0 0 / 0.16) 100%); }
.stage__grain { position: absolute; inset: 0; z-index: 2; pointer-events: none; opacity: 0.12; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.5  0 0 0 0 0.5  0 0 0 0 0.5  0 0 0 1 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }

/* The books change size with `scale`, never `width`: a width transition re-lays out and repaints every
   face on every frame, which reads as flicker. Each book is laid out at its largest size and scaled down
   by --s; depth and perspective are divided by --s. --s never animates (Safari will not transition a
   custom property): each property that reads it transitions on its own, with the same timing. */
.shelf { position: absolute; inset: 0; z-index: 1; --move: 1100ms var(--ease-in-out); }
.shelf .book3d { position: absolute; left: 50%; bottom: calc(100% - var(--horizon)); transform-origin: 50% 100%; scale: var(--s); perspective: calc(1800px / var(--s)); --d: calc(26px / var(--s)); transition: translate var(--move), scale var(--move), perspective var(--move), opacity 700ms ease; }
.shelf .book3d__body > *, .shelf .book3d__body { transition: transform var(--move); }
.shelf .book3d__spine, .shelf .book3d__pages { width: 26px; }
.shelf .book3d__spine { transform: translateX(-13px) rotateY(-90deg) scaleX(calc(1 / var(--s))); }
.shelf .book3d__pages { transform: translateX(13px) rotateY(90deg) scaleX(calc(1 / var(--s))); }
.shelf .book3d__hinge { transform-origin: -4px 50%; transform: translateZ(calc(var(--d) / 2 + 0.5px)) scaleX(calc(1 / var(--s))); }
.shelf__leda { --w: clamp(165px, 18.9vw, 316px); --s: 0.846561; --ry: 24deg; z-index: 1; }
.shelf__laddad { --w: clamp(168px, 19.6vw, 325px); --s: 0.892857; --ry: 20deg; z-index: 2; }
.shelf .book3d__floor { background: rgb(0 0 0 / 0.42); bottom: -22px; left: 0; right: -6%; height: 30px; filter: blur(18px); transform-origin: 50% 8px; scale: 1 calc(1 / var(--s)); transition: scale var(--move); }
/* hero: overlapping, Att leda behind */
[data-state="hero"] .shelf__leda { translate: calc(-50% - 6.5vw) -1.2222%; --s: 0.814815; }
[data-state="hero"] .shelf__laddad { translate: calc(-50% + 5vw) 0; }
/* Laddad alone */
[data-state="laddad"] .shelf__leda { translate: calc(-50% - 34vw) 0; opacity: 0; }
[data-state="laddad"] .shelf__laddad { translate: -50% 0; --s: 1; }
[data-state="laddad"] .shelf__laddad .book3d__body { transform: rotateY(14deg); }
/* Att leda alone */
[data-state="leda"] .shelf__leda { translate: -50% 0; --s: 1; z-index: 3; }
[data-state="leda"] .shelf__leda .book3d__body { transform: rotateY(14deg); }
[data-state="leda"] .shelf__laddad { translate: calc(-50% + 34vw) 0; opacity: 0; }
/* both, side by side */
[data-state="desk"] .shelf__leda { translate: calc(-50% - 8.5vw) 0; }
[data-state="desk"] .shelf__laddad { translate: calc(-50% + 8vw) 0; }


/* ---------- book sections: read like the back of the book ---------- */
.m-fig, .m-photo, .kicker { display: none; }
.back { margin-top: 2rem; font-family: var(--serif); font-size: clamp(1.1875rem, 1.05rem + 0.35vw, 1.375rem); line-height: 1.55; }
.back p { max-width: 34em; }
.back p + p { margin-top: 0.85em; }
.order { margin-top: 2.25rem; }

/* ---------- process ---------- */
.process { background: var(--hero); padding-block: var(--section); }
.process__grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gap); align-items: start; }
.process__copy { grid-column: 1 / span 5; }
.steps { grid-column: 7 / span 6; margin: 0; display: grid; gap: 1.1rem; }
.steps li { max-width: 34em; }
.steps b { font-weight: 600; color: var(--accent); }
.process__order { grid-column: 7 / span 6; margin-top: 2.5rem; font-family: var(--serif); font-size: clamp(1.1875rem, 1.05rem + 0.35vw, 1.375rem); }
.process__order .order__link { font-family: var(--sans); margin-left: 0.4rem; }

/* ---------- act two: one chapter, a small picture keeps you company ---------- */
.chapter { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gap); padding-block: var(--section); }
.chapter__aside { grid-column: 1 / span 4; }
.mini-stage { position: sticky; top: calc(var(--bar-h) + 10svh); width: min(100%, 320px); aspect-ratio: 4 / 5; overflow: hidden; background: var(--hero); }
.mini-stage .scene { position: absolute; inset: 0; opacity: 0; visibility: hidden; transition: opacity 700ms ease, visibility 0s linear 700ms; }
.mini-stage .scene.is-on { opacity: 1; visibility: visible; transition: opacity 700ms ease, visibility 0s; }
.mini-stage img { width: 100%; height: 100%; object-fit: cover; transform: scale(1.06); transition: transform 1400ms var(--ease-out); }
.mini-stage .scene.is-on img { transform: none; }
.mini-stage [data-scene-id="om"] img { object-position: 54% 35%; }
.mini-stage [data-scene-id="talks"] img { object-position: 50% 20%; }
.mini-stage__cap { position: sticky; top: calc(var(--bar-h) + 10svh + min(100%, 320px) * 1.25 + 0.9rem); margin-top: 0.9rem; font-size: var(--step-small); color: var(--muted); display: grid; }
.mini-stage__cap span { grid-area: 1 / 1; opacity: 0; transition: opacity 500ms ease; }
.chapter[data-state="om"] [data-cap="om"], .chapter[data-state="talks"] [data-cap="talks"] { opacity: 1; }
.chapter__main { grid-column: 6 / span 7; }
.chapter__main > .chapter__part > * { max-width: 36rem; }
.chapter__main > .chapter__part > .talks { max-width: none; }
.chapter__main > .chapter__part > .back { max-width: none; font-size: clamp(1.1875rem, 0.9rem + 0.75vw, 1.5rem); }
.chapter__main .back p { max-width: none; }
.chapter__part + .chapter__part { margin-top: calc(var(--section) * 1.1); }
.letter__body p + p { margin-top: 1em; }

/* talks: a table of contents with the description under each title */
.talks { margin-top: 2.5rem; border-bottom: 1px solid var(--line); }
.talk { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 2rem; padding-block: 1.6rem 1.75rem; border-top: 1px solid var(--line); }
.talk__name { font-size: clamp(1.375rem, 1.15rem + 0.6vw, 1.75rem); line-height: 1.2; letter-spacing: -0.01em; }
.talk__len { grid-column: 2; grid-row: 1; padding-top: 0.35em; font-size: var(--step-small); color: var(--muted); white-space: nowrap; }
.talk__text { grid-column: 1 / -1; margin-top: 0.75rem; max-width: 38em; font-family: var(--serif); font-size: clamp(1.0625rem, 0.98rem + 0.3vw, 1.1875rem); line-height: 1.55; color: var(--ink-soft); }
.talk__book { grid-column: 1 / -1; justify-self: start; display: inline-block; margin-top: 1rem; font-size: var(--step-small); font-weight: 500; color: var(--accent); text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 0.3em; text-decoration-thickness: 1.5px; transition: text-decoration-color var(--t-hover) ease; }
.talk__book span { display: inline-block; margin-left: 0.4em; transition: transform var(--t-ui) var(--ease-out); }
@media (hover: hover) and (pointer: fine) {
  .talk__book:hover { text-decoration-color: currentColor; }
  .talk__book:hover span { transform: translateX(3px); }
}

/* ---------- Skönlitteratur: a plain page, the newest book, then a grid of all of them ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.fiction-head { padding-block: clamp(3.5rem, 7vw, 6rem) 0; }
.fiction-head__text { margin-top: 1.25rem; max-width: 46ch; font-size: clamp(1.0625rem, 0.95rem + 0.35vw, 1.25rem); line-height: 1.6; color: var(--muted); }
.books { padding-block: clamp(2.5rem, 5vw, 4rem) var(--section); }
.shelf-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(2.5rem, 4vw, 3.5rem) var(--gap); }
.shelf-item__open { display: block; color: inherit; text-decoration: none; -webkit-tap-highlight-color: transparent; }
.shelf-item__art { position: relative; display: block; overflow: hidden; background: var(--hero); }
.shelf-item__cover { width: 100%; aspect-ratio: 1; object-fit: cover; transition: transform 600ms var(--ease-out); }
.shelf-item__body { display: block; }
.shelf-item__title { display: block; margin-top: 1rem; font-family: var(--serif); font-size: clamp(1.25rem, 1.1rem + 0.4vw, 1.5rem); line-height: 1.2; letter-spacing: -0.01em; text-wrap: balance; }
.shelf-item__meta { display: block; margin-top: 0.3rem; font-size: 0.875rem; line-height: 1.45; color: var(--muted); }
/* the same quiet "Läs mer →" as "Boka föreläsningen →" on the start page, so the card reads as a link */
.shelf-item__more { display: inline-block; margin-top: 0.75rem; font-size: var(--step-small); font-weight: 500; color: var(--accent); text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 0.3em; text-decoration-thickness: 1.5px; transition: text-decoration-color var(--t-hover) ease; }
.shelf-item__more span { display: inline-block; margin-left: 0.4em; transition: transform var(--t-ui) var(--ease-out); }
.shelf-item__open { cursor: pointer; }
@media (hover: hover) and (pointer: fine) {
  .shelf-item__open:hover .shelf-item__cover { transform: scale(1.03); }
  .shelf-item__open:hover .shelf-item__more { text-decoration-color: currentColor; }
  .shelf-item__open:hover .shelf-item__more span { transform: translateX(3px); }
}
.shelf-item__open:focus-visible { outline: none; }
.shelf-item__open:focus-visible .shelf-item__art { outline: 2px solid var(--accent); outline-offset: 3px; }
.badge { position: absolute; z-index: 1; top: 0.75rem; left: 0.75rem; padding: 0.3rem 0.6rem; border-radius: 3px; background: var(--coral); color: #fff; font-size: 0.75rem; font-weight: 600; line-height: 1.2; letter-spacing: 0.02em; box-shadow: 0 2px 8px rgb(0 0 0 / 0.18); }

/* ---------- a book's own page ---------- */
.book { padding-block: clamp(1.75rem, 3vw, 2.5rem) var(--section); }
.crumbs a { display: inline-flex; align-items: center; gap: 0.5em; min-height: 2.75rem; font-size: var(--step-small); font-weight: 500; color: var(--muted); text-decoration: none; transition: color var(--t-hover) ease; }
@media (hover: hover) and (pointer: fine) { .crumbs a:hover { color: var(--ink); } }
.book__grid { margin-top: clamp(1.5rem, 3vw, 2.5rem); display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gap); align-items: start; }
.book__cover { grid-column: 1 / span 5; position: sticky; top: calc(var(--bar-h) + 2.5rem); }
.book__cover img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 2px; box-shadow: 0 1px 2px rgb(26 24 22 / 0.08), 0 24px 48px -24px rgb(26 24 22 / 0.35); }
.book__cover .badge { top: 1rem; left: 1rem; }
.book__main { grid-column: 7 / span 6; }
.book__series { font-size: var(--step-small); font-weight: 500; color: var(--muted); }
.book__title { margin-top: 0.75rem; font-size: clamp(2.75rem, 1.6rem + 3.6vw, 5rem); line-height: 1; letter-spacing: -0.03em; }
.book__by { margin-top: 0.9rem; font-size: var(--step-small); color: var(--muted); }
.book__soon { margin-top: 1.25rem; display: inline-flex; align-items: center; gap: 0.55rem; font-size: var(--step-small); font-weight: 500; color: var(--accent); }
.book__soon::before { content: ""; width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--coral); }
.listen { margin-top: 2.25rem; }
.listen__label { font-size: var(--step-small); font-weight: 600; }
.listen__links { margin-top: 0.75rem; display: flex; flex-wrap: wrap; gap: 0.6rem; }
.listen__link { display: inline-flex; align-items: center; gap: 0.6rem; min-height: 3rem; padding: 0 1.15rem 0 1.25rem; border: 1px solid rgb(26 24 22 / 0.18); border-radius: 999px; font-size: var(--step-small); font-weight: 500; color: var(--ink); text-decoration: none; transition: border-color var(--t-hover) ease, background-color var(--t-hover) ease, color var(--t-hover) ease; }
.listen__arrow { color: var(--accent); transition: transform var(--t-ui) var(--ease-out); }
@media (hover: hover) and (pointer: fine) {
  .listen__link:hover { border-color: var(--ink); background: var(--ink); color: #fff; }
  .listen__link:hover .listen__arrow { color: #fff; transform: translate(2px, -2px); }
}
.listen__link:active { transform: scale(0.98); }
.book__text { margin-top: 2.75rem; padding-top: 2.25rem; border-top: 1px solid var(--line); }
.book__facts { margin: 2.75rem 0 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem var(--gap); padding-top: 2rem; border-top: 1px solid var(--line); }
.book__facts dt { font-size: 0.8125rem; color: var(--muted); }
.book__facts dd { margin: 0.2rem 0 0; font-size: var(--step-small); line-height: 1.5; }
.more { padding-block: var(--section); border-top: 1px solid var(--line); }
.more__head .order__link { white-space: nowrap; }
.more__head { display: flex; align-items: baseline; justify-content: space-between; gap: 1.5rem; margin-bottom: clamp(2rem, 4vw, 3rem); }
.more .shelf-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.books__all { margin-top: clamp(2.5rem, 4vw, 3.5rem); font-family: var(--serif); font-size: clamp(1.1875rem, 1.05rem + 0.35vw, 1.375rem); max-width: none; }
.books__all .order__link { font-family: var(--sans); }
.crosslink { padding-block: var(--section); border-top: 1px solid var(--line); }
.crosslink .back p { max-width: 40em; }
.crosslink .order__link { white-space: nowrap; }
@media (max-width: 1100px) { .shelf-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* ---------- integritetspolicy: one readable column ---------- */
.legal { padding-block: clamp(3.5rem, 7vw, 6rem) var(--section); }
.legal__updated { margin-top: 1rem; font-size: var(--step-small); color: var(--muted); }
.legal__body { margin-top: clamp(2rem, 4vw, 3rem); max-width: 40rem; }
.legal__lead { font-size: 1.15em; }
.legal__body h2 { margin-top: 2.5rem; font-size: clamp(1.375rem, 1.2rem + 0.5vw, 1.75rem); line-height: 1.2; letter-spacing: -0.01em; }
.legal__body h2 + p { margin-top: 0.6em; }

/* ---------- contact ---------- */
.contact { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gap); align-items: end; padding-block: var(--section); }
.contact__lead { grid-column: 1 / span 6; }
.contact__links { grid-column: 7 / span 6; display: flex; flex-direction: column; align-items: flex-start; gap: 1rem; }
.contact__mail { font-family: var(--serif); font-size: clamp(1.5rem, 1.1rem + 1.2vw, 2.25rem); text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 0.2em; text-decoration-color: var(--accent); }

/* ---------- footer ---------- */
.foot { background: var(--foot); color: var(--foot-ink); font-size: var(--step-small); overflow: hidden; }
.foot__top { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gap); row-gap: 2rem; padding-block: clamp(4rem, 7vw, 6rem) 2.5rem; }
.foot__about { grid-column: 1 / span 4; color: var(--foot-muted); max-width: 34ch; }
.foot__nav { grid-column: 7 / span 3; display: flex; flex-direction: column; align-items: flex-start; gap: 0.35rem; }
.foot__contact { grid-column: 10 / span 3; display: flex; flex-direction: column; align-items: flex-start; gap: 0.35rem; }
.foot__legal { grid-column: 1 / span 4; grid-row: 2; color: var(--foot-muted); align-self: end; }
.foot a { color: var(--foot-ink); }
.foot__mark { color: var(--coral); fill: currentColor; overflow: hidden; margin-top: clamp(1rem, 3vw, 2.5rem); }
/* cut the bottom ~40% of the wordmark at every width (logo height = 19.33% of its width) */
.foot__mark svg { display: block; width: 100%; height: auto; margin-bottom: -7.7%; }

/* ---------- motion: one entrance for the whole site ----------
   Everything arrives the same way: a short fade with a few pixels of rise, never more.
   [data-rise]    on load (the first screen)        [data-reveal]  when scrolled into view
   [data-stagger] its children, one after another   --i            the order within a group */
:root { --rise: 10px; --t-in: 700ms; --ease-in-view: cubic-bezier(0.22, 1, 0.36, 1); --step-in: 60ms; }
.lines .line, .lines [data-line] { display: block; }
@media (prefers-reduced-motion: no-preference) {
  .js [data-rise], .js .lines [data-line] { opacity: 0; transform: translateY(var(--rise)); animation: rise var(--t-in) var(--ease-in-view) forwards; animation-delay: calc(var(--i, 0) * var(--step-in) + 80ms); }
  .js [data-reveal], .js [data-stagger] > * { opacity: 0; transform: translateY(var(--rise)); transition: opacity var(--t-in) var(--ease-in-view), transform var(--t-in) var(--ease-in-view); transition-delay: calc(min(var(--i, 0), 8) * var(--step-in)); }
  .js [data-reveal].is-in, .js [data-stagger].is-in > * { opacity: 1; transform: none; }
  .js .bar > * { animation: fade 500ms ease both; }
  /* the books on the stage: the same rise, a little slower, because they are objects */
  .js .shelf .book3d, .js .m-fig--hero .book3d { animation: book-in 1000ms var(--ease-in-view) 200ms backwards; }
  .js .shelf__laddad, .js .m-hero__laddad { animation-delay: 280ms; }
  .js .foot__mark svg { opacity: 0; transform: translateY(calc(var(--rise) * 2)); transition: opacity 900ms ease, transform 1000ms var(--ease-in-view); }
  .js .foot__mark.is-in svg { opacity: 1; transform: none; }
}
@keyframes rise { to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } }
@keyframes book-in { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

/* ---------- menu (small screens): a hamburger, and a sheet under the bar ---------- */
.menu summary { list-style: none; cursor: pointer; display: grid; place-items: center; width: 2.75rem; height: 2.75rem; margin-right: -0.6rem; border-radius: 3px; color: var(--ink); -webkit-tap-highlight-color: transparent; user-select: none; }
.menu summary::-webkit-details-marker { display: none; }
.menu__icon { position: relative; width: 22px; height: 14px; }
.menu__icon::before, .menu__icon::after { content: ""; position: absolute; left: 0; right: 0; height: 2px; border-radius: 1px; background: currentColor; transition: transform var(--t-ui) var(--ease-out), top var(--t-ui) var(--ease-out); }
.menu__icon::before { top: 2px; }
.menu__icon::after { top: 10px; }
.menu[open] .menu__icon::before { top: 6px; transform: rotate(45deg); }
.menu[open] .menu__icon::after { top: 6px; transform: rotate(-45deg); }
.menu__panel { position: fixed; inset: var(--bar-h) 0 0; z-index: 5; display: flex; flex-direction: column; overflow-y: auto; overscroll-behavior: contain; padding: 0.5rem var(--margin) max(1.5rem, env(safe-area-inset-bottom)); background: var(--bg); }
.menu__panel > a { display: flex; align-items: center; min-height: 3.75rem; border-bottom: 1px solid var(--line); font-family: var(--serif); font-size: 1.75rem; line-height: 1.1; letter-spacing: -0.015em; text-decoration: none; }
.menu__panel > a[aria-current="page"] { color: var(--accent); }
.menu__panel > a:active { color: var(--accent); }
.menu__foot { margin-top: auto; padding-top: 2rem; display: grid; gap: 0.75rem; justify-items: center; }
.menu__foot .button { width: 100%; }
.menu__mail { font-size: var(--step-small); color: var(--muted); text-decoration: none; padding-block: 0.5rem; }
html.menu-open { overflow: hidden; }
@media (prefers-reduced-motion: no-preference) {
  .menu[open] .menu__panel { animation: menu-in 260ms var(--ease-out); }
  .menu[open] .menu__panel > a { animation: menu-link 460ms var(--ease-out) backwards; }
  .menu[open] .menu__panel > a:nth-child(2) { animation-delay: 30ms; }
  .menu[open] .menu__panel > a:nth-child(3) { animation-delay: 60ms; }
  .menu[open] .menu__panel > a:nth-child(4) { animation-delay: 90ms; }
  .menu[open] .menu__panel > a:nth-child(5) { animation-delay: 120ms; }
}
@keyframes menu-in { from { opacity: 0; } }
@keyframes menu-link { from { opacity: 0; transform: translateY(8px); } }

/* ---------- tablet: the menu replaces the nav ---------- */
@media (max-width: 1100px) {
  .nav { display: none; }
  .menu { display: block; }
}

/* ======================================================================
   Phone and narrow tablet: one column, standard order.
   Every section: picture (full width), title, text, then one clear button.
   ====================================================================== */
@media (max-width: 860px) {
  :root { --bar-h: 3.75rem; --section: 4rem; --margin: 1.25rem; --step-head: clamp(2.125rem, 8.5vw, 2.75rem); }
  body { font-size: 1.0625rem; }
  .bar { padding-inline: var(--margin); gap: 1rem; }
  .logo { width: 136px; }

  /* no sticky stages: each section brings its own picture */
  .split { display: block; }
  .stage, .chapter__aside { display: none; }
  .read { padding-inline: var(--margin); }
  .read > section, .read > .book-sec { max-width: none; min-height: 0; display: block; padding-block: var(--section) 0; }
  .read > .book-sec + .book-sec, .read > section + section { padding-top: var(--section); }
  .read > .intro { padding-bottom: var(--section); }

  /* shared mobile picture band: full width, the book's colour, a 3D book on a table */
  .m-fig { --horizon: 80%; position: relative; display: block; overflow: hidden; margin-inline: calc(var(--margin) * -1); background: var(--band, var(--coral)); }
  .m-fig::before { content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none; background: radial-gradient(ellipse 75% 55% at 50% 38%, rgb(255 255 255 / 0.16), rgb(255 255 255 / 0) 70%), radial-gradient(ellipse 130% 100% at 50% 42%, rgb(0 0 0 / 0) 55%, rgb(0 0 0 / 0.22) 100%); }
  .m-fig::after { content: ""; position: absolute; inset: var(--horizon) 0 0; z-index: 0; background: linear-gradient(to bottom, rgb(0 0 0 / 0.18), rgb(0 0 0 / 0.07) 35%, rgb(0 0 0 / 0.16)); }
  .m-fig .book3d { --d: 16px; position: absolute; z-index: 1; left: 50%; bottom: calc(100% - var(--horizon)); translate: -50% 0; }
  .m-fig .book3d__floor { background: rgb(0 0 0 / 0.45); bottom: -12px; filter: blur(10px); }

  /* hero: words first, then the two books */
  .read > .hero { padding: 0; }
  .hero__side { min-height: 0; max-height: none; padding: 2.25rem 0 0; }
  .hero h1 { font-size: min(3.5rem, 13.4cqi); }
  .hero__text { margin-top: 1rem; font-size: 1.0625rem; }
  .hero__actions { flex-direction: column; align-items: stretch; gap: 0.25rem; margin-top: 1.75rem; }
  .hero__actions .text-link { align-self: center; padding-block: 0.85rem; }
  .byline { margin-top: 1.25rem; }
  .byline__face { width: 44px; height: 44px; }
  .m-fig--hero { display: none; } /* hidden on request: the two books under the hero */
  .m-fig .m-hero__leda { --w: min(31vw, 150px); --ry: 22deg; translate: calc(-50% - 14vw) -1%; }
  .m-fig .m-hero__laddad { --w: min(32vw, 156px); --ry: 18deg; translate: calc(-50% + 12vw) 0; z-index: 2; }

  /* book sections */
  .m-fig--book { height: min(84vw, 380px); margin-bottom: 1.75rem; }
  #laddad .m-fig { --band: var(--teal); }
  #att-leda .m-fig { --band: var(--plum); }
  .m-fig--book .book3d--laddad { --w: min(36vw, 172px); --ry: 16deg; }
  .m-fig--book .book3d--leda { --w: min(42vw, 200px); --ry: 16deg; }
  @media (prefers-reduced-motion: no-preference) {
    .js .m-fig--book .book3d { opacity: 0; translate: -50% 16px; transition: opacity var(--t-in) ease, translate 1000ms var(--ease-in-view); }
    .js .m-fig--book .book3d__body { transform: rotateY(calc(var(--ry) + 10deg)); transition: transform 1000ms var(--ease-in-view); }
    .js .m-fig--book.is-in .book3d { opacity: 1; translate: -50% 0; }
    .js .m-fig--book.is-in .book3d__body { transform: rotateY(var(--ry)); }
  }
  .kicker { display: block; margin-bottom: 0.35rem; font-size: 0.8125rem; font-weight: 500; color: var(--muted); }
  .back { margin-top: 1.25rem; font-size: 1.1875rem; line-height: 1.58; }
  .back p { max-width: 36em; }
  .order { margin-top: 1.75rem; }

  /* one clear button per section */
  .book-sec .order__link, #forelasningar > .order .order__link { display: flex; align-items: center; justify-content: center; min-height: 3.25rem; padding: 0 1.25rem; border-radius: 3px; background: var(--accent); color: #fff; text-decoration: none; transition: transform var(--t-press) var(--ease-out); }
  .book-sec .order__link:active, #forelasningar > .order .order__link:active { transform: scale(0.98); }

  /* process */
  .process__grid { display: block; }
  .steps { margin-top: 1.5rem; gap: 1rem; }
  .process__order { margin-top: 1.75rem; font-size: 1.1875rem; }
  .process__order .order__link { display: inline-flex; align-items: center; min-height: 2.75rem; margin-left: 0; }

  /* Torbjörn and the talks: a photo in the flow */
  .chapter { display: block; }
  .chapter__part + .chapter__part { margin-top: var(--section); }
  .chapter__main > .chapter__part > .back { font-size: 1.1875rem; }
  .chapter__main > .chapter__part > .m-photo { display: block; max-width: none; margin: 1.5rem calc(var(--margin) * -1) 0; overflow: hidden; background: var(--hero); }
  .m-photo img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
  .m-photo--om img { object-position: 54% 30%; }
  .m-photo--talks img { aspect-ratio: 1 / 1; object-position: 50% 18%; }

  .talks { margin-top: 1.75rem; }
  .talk { column-gap: 1rem; padding-block: 1.35rem 1.25rem; }
  .talk__name { font-size: 1.375rem; }
  .talk__len { padding-top: 0.3em; font-size: 0.875rem; }
  .talk__text { margin-top: 0.6rem; font-size: 1.0625rem; }
  .talk__book { padding-block: 0.55rem; margin-top: 0.35rem; text-decoration-color: rgb(208 62 28 / 0.4); }

  /* Skönlitteratur */
  .fiction-head { padding-top: 2.25rem; }
  /* phones: the grid becomes a list – small cover left, words right, a chevron says it opens */
  .books { padding-top: 1.75rem; }
  .shelf-grid { grid-template-columns: minmax(0, 1fr); gap: 0; border-bottom: 1px solid var(--line); }
  .shelf-item__open { display: grid; grid-template-columns: 6.75rem minmax(0, 1fr); column-gap: 1rem; align-items: center; padding-block: 1rem; border-top: 1px solid var(--line); }
  .shelf-item__title { margin-top: 0; font-size: 1.25rem; }
  .shelf-item__meta { font-size: 0.8125rem; }
  .shelf-item .badge { top: 0.4rem; left: 0.4rem; padding: 0.2rem 0.4rem; font-size: 0.625rem; }
  .shelf-item__open { grid-template-columns: 6.75rem minmax(0, 1fr) auto; }
  .shelf-item__more { display: none; }
  .shelf-item__open::after { content: ""; width: 0.5rem; height: 0.5rem; margin-right: 0.25rem; border-top: 1.5px solid var(--muted); border-right: 1.5px solid var(--muted); transform: rotate(45deg); }

  /* a book's own page: cover first, then the words */
  .book { padding-top: 0.5rem; }
  .book__grid { display: block; margin-top: 0.75rem; }
  .book__cover { position: static; width: min(78%, 340px); margin-inline: auto; }
  .book__main { margin-top: 2rem; }
  .book__title { font-size: clamp(2.5rem, 11vw, 3.25rem); }
  .listen { margin-top: 1.75rem; }
  .listen__links { flex-direction: column; gap: 0.5rem; }
  .listen__link { display: flex; width: 100%; justify-content: space-between; min-height: 3.25rem; padding-inline: 1.25rem; }
  .book__text { margin-top: 2.25rem; padding-top: 1.75rem; }
  .book__facts { margin-top: 2.25rem; gap: 1.25rem 1rem; }
  .more__head { margin-bottom: 1.5rem; }
  .more .shelf-grid { grid-template-columns: minmax(0, 1fr); }

  /* contact */
  .contact { display: block; }
  .contact__links { margin-top: 1.5rem; gap: 0.5rem; }
  .contact__mail { font-size: clamp(1.25rem, 5.6vw, 1.625rem); overflow-wrap: anywhere; }
  .contact__links .order__link { display: inline-flex; align-items: center; min-height: 2.75rem; }

  /* footer */
  .foot__top { display: flex; flex-direction: column; gap: 2rem; padding-block: 3.5rem 2rem; }
  .foot__nav { display: grid; grid-template-columns: 1fr 1fr; column-gap: var(--gap); }
  .foot__nav a, .foot__contact a { padding-block: 0.5rem; }
  .foot__contact { gap: 0; }
  .foot__legal { align-self: stretch; padding-top: 1.5rem; border-top: 1px solid rgb(255 255 255 / 0.12); }
}

/* narrow tablets: keep a reading measure, let buttons size to their label */
@media (min-width: 600px) and (max-width: 860px) {
  :root { --margin: 2rem; }
  .hero__copy, .byline, .read > section > :not(.m-fig), .chapter__part > :not(.m-photo), .process__grid > *, .contact > *, .crosslink > * { max-width: 38rem; }
  .hero__actions { flex-direction: row; align-items: center; gap: 1.75rem; }
  .book-sec .order__link, #forelasningar > .order .order__link { display: inline-flex; }
  .m-fig--hero, .m-fig--book { height: 460px; }
  .shelf-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 2rem; }
  .m-photo img, .m-photo--talks img { aspect-ratio: 16 / 9; }
}
