/* Night train: styles for the public pages. Backoffice layouts do not load this file. */
@font-face {
  font-family: "Barlow Condensed";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(/fonts/barlow-condensed-600.woff2) format("woff2");
}
@font-face {
  font-family: "Barlow Condensed";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(/fonts/barlow-condensed-700.woff2) format("woff2");
}
@font-face {
  font-family: "Barlow";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(/fonts/barlow-600.woff2) format("woff2");
}

html[data-theme="dark"] {
  --bg: #1a1c20;
  --panel: #24262b;
  --card: #101114;
  --hair: #33363d;
  --text: #f2efe8;
  --soft: #d5d2ca;
  --label: #b4b2ab;
  --accent: #f2b84b;
  --rail: #6d7079;
  --ghost: #7b7e87;
  --here: #ff8a80;
}
html[data-theme="light"] {
  --bg: #f4f2ec;
  --panel: #e4e0d6;
  --card: #ffffff;
  --hair: #cfcbc0;
  --text: #1a1c20;
  --soft: #3a3c40;
  --label: #55575c;
  --accent: #8a5200;
  --rail: #8b8e96;
  --ghost: #74777f;
  --here: #b02e25;
}

html[data-theme] body {
  background: var(--bg);
  color: var(--text);
}

/* Legacy tokens: pages not yet restyled still read --ink, --page, --paper, --muted and --line, so they follow the theme. */
html[data-theme="dark"],
html[data-theme="light"] {
  --ink: var(--text);
  --page: var(--bg);
  --paper: var(--panel);
  --muted: var(--label);
  --line: var(--hair);
}
/* The reader keeps its own look: it re-declares today's values and its own type size. */
.reader-shell {
  --ink: #24262b;
  --page: #f2f2f1;
  --paper: #f8f6f1;
  --muted: #676963;
  --line: #d9d8d2;
  font-size: 16px;
  line-height: normal;
}

/* Base type for the public pages. Nothing below reaches content inside .reader-shell. */
html[data-theme] body {
  font-family: "Barlow", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-weight: 400;
  font-size: 17px;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
html[data-theme] body > main { flex: 1 0 auto; }
html[data-theme] :is(h1, h2, h3):not(.reader-shell *) {
  font-family: "Barlow Condensed", "Arial Narrow", sans-serif;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
}
:where(html[data-theme]) a:where(:not(.reader-shell a)) { color: var(--accent); }
:where(html[data-theme]) :is(button, .button):where(:not(.red, .reader-shell *)) {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--rail);
}
html[data-theme] .red:not(.reader-shell *),
html[data-theme] .button.red:not(.reader-shell *) {
  background: #c8372d;
  color: #fff;
  border-color: #c8372d;
}
html[data-theme] .eyebrow:not(.reader-shell *) {
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}
html[data-theme] .display:not(.reader-shell *) {
  font-family: "Barlow Condensed", "Arial Narrow", sans-serif;
  font-weight: 700;
  text-transform: uppercase;
  line-height: 0.9;
}

/* Header and menu. */
.site-header { background: var(--bg); color: var(--text); border-bottom: 1px solid var(--hair); }
.header-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 18px 32px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.site-header .brand { display: flex; flex-direction: column; gap: 2px; text-decoration: none; color: var(--text); }
.brand small { font-size: 11px; padding-left: 9px; }
.brand strong { background: #c8372d; color: #fff; padding: 2px 9px 4px; font-weight: 700; font-size: 26px; line-height: 1.1; }
.brand strong span { font-weight: 300; }
.site-header nav { display: flex; flex-wrap: wrap; align-items: center; gap: 28px; font-weight: 600; font-size: 16px; }
.site-header nav a { color: var(--text); text-decoration: none; display: inline-flex; align-items: center; min-height: 48px; }
.site-header nav a:hover { text-decoration: underline; }
.site-header nav a.nav-cta { border: 1px solid var(--rail); padding: 10px 20px; }
.pref-row { display: flex; align-items: center; gap: 16px; }
.pref-row form { margin: 0; }
.pref-label { display: none; font-weight: 400; color: var(--label); }
.pref-row + .pref-row { margin-left: -16px; }
/* Language and theme switches: a 56×28 track drawn on ::before inside a 44px-tall button, a 22px thumb in the
   accent colour showing the current choice, and the other choice faded on the free side. */
html[data-theme] .site-header .switch {
  position: relative;
  display: inline-block;
  width: 56px;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--label);
  cursor: pointer;
}
.switch::before {
  content: "";
  position: absolute;
  inset: 50% 0 auto;
  height: 28px;
  margin-top: -14px;
  box-sizing: border-box;
  border: 1.5px solid var(--rail);
  border-radius: 999px;
}
html[data-theme="light"] .switch::before { border-color: #55575c; }
.switch:hover::before { border-color: var(--text); }
html[data-theme] .site-header .switch:focus-visible { outline: none; }
.switch:focus-visible::before { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch-thumb, .switch-side {
  position: absolute;
  top: 50%;
  left: 3px;
  width: 22px;
  height: 22px;
  margin-top: -11px;
  display: grid;
  place-items: center;
  border-radius: 50%;
}
.switch-thumb { background: var(--accent); color: var(--bg); transition: transform 0.2s ease; }
.switch-side { left: 31px; opacity: 0.5; }
.switch[data-on="right"] .switch-thumb { transform: translateX(28px); }
.switch[data-on="right"] .switch-side { left: 3px; }
.switch .glyph { display: grid; place-items: center; }
.switch .flag { display: block; width: 18px; height: 18px; clip-path: circle(50%); }
.switch .icon { display: block; width: 14px; height: 14px; }
.switch .flag-code { display: none; font-family: "Barlow Condensed", "Arial Narrow", sans-serif; font-size: 12px; font-weight: 600; line-height: 1; }
@media (prefers-reduced-motion: reduce) { .switch-thumb { transition: none; } }
/* High-contrast mode drops the flags' colours, so the letters stand in. */
@media (forced-colors: active) {
  .switch .flag { display: none; }
  .switch .flag-code { display: block; }
  .switch::before, html[data-theme="light"] .switch::before { border-color: ButtonText; }
  .switch-thumb { forced-color-adjust: none; background: Highlight; color: HighlightText; }
}
html[data-theme] .site-header .menu-toggle, html[data-theme] .site-header .menu-toggle[hidden] { display: none; }
.menu-icon { display: flex; flex-direction: column; gap: 5px; width: 20px; }
.menu-icon > span { height: 2px; background: currentColor; width: 20px; }
.menu-open .menu-icon > span:first-child { transform: translateY(7px) rotate(45deg); }
.menu-open .menu-icon > span:nth-child(2) { opacity: 0; }
.menu-open .menu-icon > span:last-child { transform: translateY(-7px) rotate(-45deg); }
@media (max-width: 760px) {
  .header-inner { padding: 12px 20px 16px; gap: 12px; }
  .brand strong { font-size: 22px; padding: 2px 8px 3px; }
  .brand small { font-size: 10px; padding-left: 8px; }
  .site-header nav { width: 100%; flex-direction: column; align-items: stretch; flex-wrap: nowrap; gap: 4px; font-size: 17px; }
  .site-header nav a { min-height: 48px; padding: 12px; }
  .site-header nav a.nav-cta { margin-top: 8px; justify-content: center; padding: 11px 12px; }
  .pref-row { justify-content: space-between; min-height: 48px; padding: 2px 12px; }
  .pref-row + .pref-row { margin-left: 0; }
  .pref-label { display: inline; }
  html[data-theme] .site-header.navigation-ready .menu-toggle {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    padding: 8px 16px;
    border: 1.5px solid var(--rail);
    border-radius: 999px;
    background: transparent;
    color: var(--text);
    font-size: 15px;
    font-weight: 400;
  }
  html[data-theme="light"] .site-header.navigation-ready .menu-toggle { border-color: #55575c; }
  .site-header.navigation-ready nav { display: none; }
  .site-header.navigation-ready.menu-open nav { display: flex; border-top: 1px solid var(--hair); padding-top: 12px; }
}

/* Footer. */
.site-footer { margin-top: auto; border-top: 1px solid var(--hair); color: var(--label); background: transparent; font-size: 15px; line-height: 1.5; }
.footer-inner { max-width: 1120px; margin: 0 auto; padding: 32px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 32px; }
.footer-line { margin: 0; flex: 1 1 300px; }
.footer-navigation { display: flex; flex-wrap: wrap; gap: 0 24px; flex: 0 1 auto; }
.site-footer .footer-share { flex: 0 0 auto; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 0 24px; }
.site-footer nav a { color: var(--soft); min-height: 48px; display: inline-flex; align-items: center; }
html[data-theme] .site-footer .footer-share { align-self: center; }
html[data-theme] .share-icon { color: var(--soft); border: 0; background: transparent; }
html[data-theme] .share-icon:hover { color: var(--text); background: var(--panel); }
html[data-theme] .share-manual { background: var(--card); color: var(--text); border: 1px solid var(--rail); }
@media (max-width: 760px) { .footer-inner { padding: 24px 20px; } }

/* Shelf. Every rule sits under html[data-theme], so the workspace shelf (no theme) keeps the rules in app.css. */
html[data-theme] .shelf { margin: 0 0 56px; }
html[data-theme] .shelf-heading { align-items: flex-end; margin-bottom: 20px; }
html[data-theme] .shelf-heading h2 { font-size: clamp(34px, 4vw, 52px); line-height: 0.95; margin: 4px 0 0; }
html[data-theme] .shelf-more { color: var(--accent); padding: 10px 0; }
html[data-theme] .shelf-back { background: var(--panel); border-radius: 0; padding: 20px 20px 0; box-shadow: inset 0 10px 18px -12px rgba(0, 0, 0, 0.5); }
html[data-theme] .shelf-row { box-sizing: border-box; height: 248px; gap: 4px; padding: 12px 0 0; }
html[data-theme] .shelf-board { height: 8px; margin-top: 0; border-radius: 0; background: var(--rail); box-shadow: 0 14px 20px rgba(0, 0, 0, 0.35); }
html[data-theme] .shelf-book:focus-visible { outline-color: var(--accent); }

/* A slot holds one book and its bookmark tabs; the whole slot lifts on hover. */
html[data-theme] .shelf-slot { position: relative; flex: none; display: flex; align-items: flex-end; height: var(--spine-height, auto); transition: transform 0.2s; }
html[data-theme] .shelf-slot:hover { transform: translateY(-10px); }
html[data-theme] .shelf-slot .shelf-book:hover { transform: none; }
html[data-theme] .shelf-slot:has(.is-out) .shelf-tab { opacity: 0; }

/* Spines: the full title, top to bottom, in as many lines as it needs. The step (spine-s1 to s4) sets type size and width. */
html[data-theme] .shelf-slot .shelf-spine {
  writing-mode: horizontal-tb;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 100%;
  padding: 14px 0;
  overflow: hidden;
  border-radius: 2px;
  /* A light hairline edge, so a spine as dark as the shelf (the #24262b colour) still reads. */
  box-shadow: inset 0 0 0 1px rgba(248, 243, 230, 0.28);
  color: #f8f3e6;
}
html[data-theme] .shelf-spine-title {
  height: 100%;
  min-height: 0;
  writing-mode: vertical-rl;
  text-align: center;
  text-wrap: balance;
  overflow: visible;
  overflow-wrap: anywhere;
  text-overflow: clip;
  white-space: normal;
  font-family: "Barlow Condensed", "Arial Narrow", sans-serif;
  font-weight: 700;
  font-size: 17px;
  line-height: 1.05;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
html[data-theme] .shelf-slot .spine-s1 { width: 46px; }
html[data-theme] .shelf-slot .spine-s2 { width: 52px; }
html[data-theme] .spine-s2 .shelf-spine-title { font-size: 15px; }
html[data-theme] .shelf-slot .spine-s3 { width: 56px; }
html[data-theme] .spine-s3 .shelf-spine-title { font-size: 13px; }
html[data-theme] .shelf-slot .spine-s4 { width: 72px; }
html[data-theme] .spine-s4 .shelf-spine-title { font-size: 13px; }
html[data-theme] .shelf-slot:has(.shelf-tab) .shelf-spine { padding-top: 40px; }
/* A face-out book keeps its Featured / New label clear of the tabs. */
html[data-theme] .shelf-slot:has(.shelf-tab) .shelf-face { padding-top: 40px; }

/* Bookmark tabs: red where the reader stopped, amber for a new chapter. They are links of their own, beside the spine link. */
html[data-theme] .shelf-tab { position: absolute; z-index: 2; top: 0; box-sizing: border-box; width: calc(50% - 5px); height: 30px; border-radius: 0 0 3px 3px; transition: opacity 0.2s; }
html[data-theme] .shelf-tab::after { content: ""; position: absolute; inset: 0 -2px -8px; }
html[data-theme] .shelf-tab-place { left: 3px; background: #c8372d; }
html[data-theme] .shelf-tab-new { right: 3px; background: #f2b84b; }
html[data-theme] .shelf-tab:focus-visible { outline: 3px solid var(--text); outline-offset: 1px; }

/* Books that face out: the red "Featured" or amber-outlined "New" label. */
html[data-theme] .shelf-face { height: 176px; font-family: "Barlow", system-ui, sans-serif; box-shadow: inset 0 0 0 1px rgba(248, 243, 230, 0.28), inset 5px 0 0 rgba(0, 0, 0, 0.18), 4px 4px 10px rgba(0, 0, 0, 0.3); }
html[data-theme] .shelf-slot:hover .shelf-face { box-shadow: inset 0 0 0 1px rgba(248, 243, 230, 0.28), inset 5px 0 0 rgba(0, 0, 0, 0.18), 4px 4px 14px rgba(0, 0, 0, 0.4); }
html[data-theme] .shelf-face strong { font-family: "Barlow Condensed", "Arial Narrow", sans-serif; font-weight: 700; font-size: 20px; line-height: 1.05; text-transform: uppercase; }
html[data-theme] .shelf-label { border-radius: 0; font-family: "Barlow", system-ui, sans-serif; font-weight: 600; font-size: 11px; }
html[data-theme] .shelf-label-featured { background: #c8372d; color: #fff; }
html[data-theme] .shelf-label-new { background: rgba(16, 17, 20, 0.85); color: #f2b84b; outline: 1px solid #f2b84b; }

/* Phantom books: dashed spines after the last book; one of them invites a storyteller. */
html[data-theme] .shelf-phantom { flex: none; box-sizing: border-box; width: 40px; height: 206px; border: 2px dashed var(--ghost); border-radius: 2px; }
html[data-theme] .shelf-slot + .shelf-phantom { margin-left: 28px; }
html[data-theme] span.shelf-phantom:nth-of-type(2) { width: 44px; height: 198px; }
html[data-theme] span.shelf-phantom:nth-of-type(3) { width: 38px; height: 216px; }
html[data-theme] span.shelf-phantom:nth-of-type(4) { width: 42px; height: 202px; }
html[data-theme] span.shelf-phantom:nth-of-type(5) { width: 48px; height: 218px; }
html[data-theme] span.shelf-phantom:nth-of-type(6) { width: 46px; height: 196px; }
html[data-theme] .shelf-phantom-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 224px;
  padding: 8px 0;
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
  writing-mode: vertical-rl;
  text-align: center;
  text-wrap: balance;
  overflow-wrap: anywhere;
  font-family: "Barlow Condensed", "Arial Narrow", sans-serif;
  font-weight: 700;
  font-size: 16px;
  line-height: 1.05;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
html[data-theme] .shelf-phantom-link:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* The book's window on the card colour, with a condensed title. */
html[data-theme] .shelf-window { color: var(--text); }
html[data-theme] .shelf-window::backdrop { background: rgba(10, 11, 13, 0.72); }
html[data-theme] .shelf-window-inner::before { background: var(--card); border: 1px solid var(--hair); border-radius: 0; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5); }
html[data-theme] .shelf-window-close { color: var(--label); }
html[data-theme] .shelf-window-title { font-size: 34px; line-height: 1; }
html[data-theme] .shelf-window-genre { color: var(--label); font-weight: 600; letter-spacing: 0.1em; }
html[data-theme] .shelf-window-blurb p { font-family: "Barlow", system-ui, sans-serif; font-size: 17px; line-height: 1.5; color: var(--soft); }
html[data-theme] .shelf-window-chapters progress { accent-color: #c8372d; }

@media (prefers-reduced-motion: reduce) {
  html[data-theme] .shelf-slot, html[data-theme] .shelf-tab { transition: none; }
}
@media (max-width: 760px) {
  /* The row runs edge to edge and scrolls sideways; spines keep their size. */
  html[data-theme] .catalogue .shelf-back { margin-inline: calc(max(8vw, 24px) * -1); }
  html[data-theme] .shelf-back { padding: 16px 0 0; }
  html[data-theme] .shelf-row { padding-inline: 20px; scroll-snap-type: x proximity; scroll-padding-inline: 20px; }
  html[data-theme] .shelf-slot, html[data-theme] .shelf-phantom { scroll-snap-align: start; }
  /* One tab at nearly the spine's width: where the reader stopped, else the new chapter. */
  html[data-theme] .shelf-tab { left: 3px; right: 3px; width: auto; height: 34px; }
  html[data-theme] .shelf-tab-place ~ .shelf-tab-new { display: none; }
  html[data-theme] .shelf-slot:has(.shelf-tab) .shelf-spine { padding-top: 44px; }
  html[data-theme] .shelf-slot:has(.shelf-tab) .shelf-face { padding-top: 44px; }
}

/* Landing page: hero with the timetable board, the shelf, three tickets and the account line. */
.landing-inner { max-width: 1120px; margin: 0 auto; padding: 0 32px; box-sizing: border-box; }
.landing-top { max-width: 1120px; margin: 0 auto; padding: 72px 32px 64px; box-sizing: border-box; display: flex; flex-wrap: wrap; align-items: center; gap: 48px 56px; }
.hero { flex: 1 1 440px; min-width: 0; display: flex; flex-direction: column; gap: 20px; align-items: flex-start; container-type: inline-size; }
.hero .eyebrow { margin: 0; font-size: 14px; }
/* The headline also shrinks until its longest word (--longest-word letters, set by Home.razor) fits the column;
   --cap-advance is the average width of one capital in Barlow Condensed 700 (measured: 0.44 to 0.51 for real words,
   0.55 for "MMMMMMMMM"). A word too long even at 48px hyphenates, or breaks at the edge where the browser has no
   hyphenation dictionary. */
.hero h1 {
  --cap-advance: 0.55;
  --fit: calc(100cqi / (var(--longest-word, 9) * var(--cap-advance)));
  margin: 0;
  max-width: 100%;
  font-size: max(48px, min(clamp(64px, 10vw, 132px), var(--fit)));
  line-height: 0.88;
  letter-spacing: -0.005em;
  overflow-wrap: break-word;
  hyphens: manual;
}
/* Only a word too long for the narrowest column at 48px may hyphenate (Home.razor sets the class); otherwise
   hyphens: auto would split words that fit, such as "UNTER-WEGS", at the end of a line. */
.hero h1.may-hyphenate { -webkit-hyphens: auto; hyphens: auto; }
.hero-lead { margin: 0; max-width: 440px; font-size: 19px; color: var(--soft); }
html[data-theme] .hero .button.red { font-size: 17px; font-weight: 700; padding: 15px 28px; border-radius: 0; }
html[data-theme] .hero .button.red:hover, html[data-theme] .account-line .button.red:hover { filter: none; background: #a82c23; }

/* The board keeps the dark colours in both themes, so it carries its own copy of the dark tokens. */
/* app.css uses .board for the studio columns (a grid); the landing board resets that. */
html[data-theme] .board {
  display: block; grid-template-columns: none; gap: 0; margin: 0;
  --bg: #1a1c20; --panel: #24262b; --card: #101114; --hair: #33363d; --text: #f2efe8; --soft: #d5d2ca; --label: #b4b2ab; --accent: #f2b84b;
  flex: 1 1 460px; min-width: 0; box-sizing: border-box; background: var(--card); color: var(--text); border: 1px solid var(--hair); padding: 24px 28px 12px;
}
.board-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding-bottom: 12px; }
html[data-theme] .board h2 { margin: 0; font-size: 30px; letter-spacing: 0.04em; color: var(--text); }
.board-head p { margin: 0; font-size: 14px; color: var(--label); }
.board ol { list-style: none; margin: 0; padding: 0; }
.board li { border-top: 1px solid var(--hair); }
.board li a {
  display: grid; grid-template-columns: 124px minmax(0, 1fr) auto; grid-template-areas: "at title when" "at chapter when"; column-gap: 16px; align-items: center;
  padding: 16px 0; color: var(--text); text-decoration: none;
}
.board li a:hover .board-title, .board li a:focus-visible .board-title { text-decoration: underline; }
.board li a:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
.board-at { grid-area: at; font-family: "Barlow Condensed", "Arial Narrow", sans-serif; font-weight: 600; font-size: 24px; line-height: 1.05; color: var(--accent); text-transform: uppercase; }
.board-at span { display: block; }
.board-title { grid-area: title; font-weight: 600; font-size: 19px; overflow-wrap: anywhere; }
.board-meta { display: contents; }
.board-chapter { grid-area: chapter; font-size: 15px; color: var(--label); }
.board-when { grid-area: when; font-size: 15px; color: var(--soft); }
.board-anytime .board-title { grid-row: 1 / span 2; }
@media (max-width: 760px) {
  .landing-top { padding: 0; gap: 0; flex-direction: column; align-items: stretch; }
  .hero { flex: none; padding: 40px 20px 36px; gap: 16px; }
  .hero .eyebrow { font-size: 13px; }
  .hero h1 { font-size: max(48px, min(76px, 17.5vw, var(--fit))); }
  .hero-lead { font-size: 17px; }
  .hero .button.red { align-self: stretch; justify-content: center; }
  html[data-theme] .board { flex: none; border-inline: 0; padding: 20px 20px 8px; }
  html[data-theme] .board h2 { font-size: 26px; }
  .board-head p { font-size: 13px; }
  .board li a { grid-template-columns: 108px minmax(0, 1fr); grid-template-areas: "at title" "at meta"; column-gap: 12px; padding: 14px 0; }
  .board-meta { display: block; grid-area: meta; font-size: 14px; color: var(--label); }
  .board-chapter, .board-when { font-size: 14px; color: var(--label); }
  .board-chapter + .board-when::before { content: " · "; }
  .board-at { font-size: 19px; overflow-wrap: anywhere; }
  .board-title { font-size: 17px; line-height: 1.25; }
  .board-anytime .board-title { grid-row: 1; }
}

.landing-shelf { padding: 0 0 72px; }
.landing-shelf .shelf { margin-bottom: 0; }
.tickets { border-top: 1px solid var(--hair); }
.tickets .landing-inner { padding-top: 64px; padding-bottom: 72px; display: flex; flex-direction: column; gap: 28px; }
html[data-theme] .tickets h2 { margin: 0; font-size: clamp(40px, 4vw, 52px); line-height: 0.95; }
.ticket-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); gap: 16px; }
.ticket { display: flex; flex-direction: column; gap: 4px; box-sizing: border-box; padding: 22px 24px; background: var(--text); color: var(--bg); text-decoration: none; }
.ticket p, .ticket span { margin: 0; }
.ticket > :last-child { margin-top: 6px; }
.ticket-kicker { font-size: 14px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; }
html[data-theme] .ticket h3 { margin: 0; font-size: 34px; line-height: 1; color: var(--bg); }
a.ticket:hover h3, a.ticket:focus-visible h3 { text-decoration: underline; }
a.ticket:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.account-line { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 28px; }
.account-line p { margin: 0; font-size: 15px; color: var(--label); }
html[data-theme] .account-line .button.red { font-size: 17px; font-weight: 700; padding: 14px 26px; border-radius: 0; }
@media (max-width: 760px) {
  .landing-inner { padding: 0 20px; }
  .landing-shelf { padding-bottom: 44px; }
  .landing-shelf .landing-inner > .shelf { margin-inline: 0; }
  .landing-shelf .shelf-back { margin-inline: -20px; }
  .tickets .landing-inner { padding-top: 40px; padding-bottom: 44px; gap: 20px; }
  html[data-theme] .tickets h2 { font-size: 40px; }
  .ticket-row { gap: 8px; }
  .ticket { padding: 14px 18px; }
  .ticket-kicker { font-size: 13px; }
  html[data-theme] .ticket h3 { font-size: 28px; line-height: 1.05; }
  .ticket > :last-child { margin-top: 2px; font-size: 16px; }
  .account-line { flex-direction: column; align-items: stretch; gap: 20px; }
  .account-line .button.red { justify-content: center; }
}

/* Books page: the heading, the promoted-book blocks and the chapter line they carry (also used by the reader's line). */
html[data-theme] .bookcase h1 { font-family: "Barlow Condensed", "Arial Narrow", sans-serif; font-weight: 700; font-size: clamp(64px, 9vw, 96px); line-height: 0.88; letter-spacing: 0; margin: 10px 0 40px; overflow-wrap: anywhere; }
html[data-theme] .promoted { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "cover head" "cover rest"; grid-template-rows: auto 1fr; align-items: start; gap: 12px 48px; border-block: 1px solid var(--hair); padding: 36px 0; margin: 0; }
html[data-theme] .promoted + .promoted { border-top: 0; }
html[data-theme] .promoted + .shelf { margin-top: 56px; }
html[data-theme] .promoted-cover { grid-area: cover; }
html[data-theme] .promoted-cover img, html[data-theme] .promoted-cover-blank { display: block; width: 190px; height: 304px; object-fit: cover; border-radius: 2px 4px 4px 2px; box-shadow: 12px 12px 30px rgba(0, 0, 0, 0.4); outline: 1px solid rgba(248, 243, 230, 0.28); outline-offset: -1px; }
html[data-theme] .promoted-head { grid-area: head; min-width: 0; display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
html[data-theme] .promoted-rest { grid-area: rest; min-width: 0; display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
html[data-theme] .promoted-head > *, html[data-theme] .promoted-rest > * { max-width: 100%; box-sizing: border-box; }
html[data-theme] .promoted-meta { margin: 0; display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; font-size: 14px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--label); }
html[data-theme] .promoted-label { padding: 3px 9px; }
html[data-theme] .promoted-label-featured { background: #c8372d; color: #fff; }
html[data-theme] .promoted-label-new { background: rgba(16, 17, 20, 0.85); color: #f2b84b; outline: 1px solid #f2b84b; }
html[data-theme] .promoted h2 { margin: 0; font-size: clamp(40px, 5vw, 56px); line-height: 0.95; overflow-wrap: anywhere; }
html[data-theme] .promoted h2 a { color: var(--text); text-decoration: none; }
html[data-theme] .promoted h2 a:hover, html[data-theme] .promoted h2 a:focus-visible { text-decoration: underline; }
html[data-theme] .promoted-blurb { margin: 0; max-width: 620px; color: var(--soft); }
html[data-theme] .promoted .button.red { margin-top: 12px; display: inline-flex; align-items: center; gap: 8px; font-size: 17px; font-weight: 700; padding: 13px 24px; border-radius: 0; text-decoration: none; }
html[data-theme] .promoted .button.red:hover { filter: none; background: #a82c23; }

/* The chapter line: a row of stops with a bar on top; the next chapter is dashed. */
html[data-theme] .line { list-style: none; margin: 8px 0 0; padding: 0; width: 100%; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(130px, 100%), 1fr)); }
html[data-theme] .line .stop { min-width: 0; border-top: 4px solid var(--accent); }
html[data-theme] .line .stop > a, html[data-theme] .line .stop-next { height: 100%; box-sizing: border-box; display: flex; flex-direction: column; gap: 4px; padding: 12px 12px 0 0; text-decoration: none; color: var(--text); }
html[data-theme] .line .stop > a:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
html[data-theme] .line .stop > a:hover .stop-title, html[data-theme] .line .stop > a:focus-visible .stop-title { text-decoration: underline; }
html[data-theme] .line .stop-number { font-family: "Barlow Condensed", "Arial Narrow", sans-serif; font-weight: 700; font-size: 26px; line-height: 1; color: var(--accent); }
html[data-theme] .line .stop-title { font-weight: 600; font-size: 16px; line-height: 1.25; overflow-wrap: anywhere; }
html[data-theme] .line .stop-note { font-size: 14px; color: var(--label); }
html[data-theme] .line .stop-next { border-top: 4px dashed var(--ghost); }
html[data-theme] .line .stop-next .stop-number { color: var(--label); }
html[data-theme] .line .stop-more { border-top-color: var(--rail); }
html[data-theme] .line .stop-more > a { justify-content: flex-end; font-weight: 600; font-size: 16px; color: var(--accent); }
html[data-theme] .line .stop-read { border-top-color: var(--rail); }
html[data-theme] .line .stop-here { border-top-color: var(--here); }
html[data-theme] .line .stop-here .stop-note { color: var(--here); font-weight: 600; }
html[data-theme] .line .stop-new .stop-note { color: var(--accent); font-weight: 600; }
@media (max-width: 760px) {
  html[data-theme] .bookcase h1 { margin-bottom: 28px; }
  html[data-theme] .promoted { grid-template-areas: "cover head" "rest rest"; grid-template-rows: auto; gap: 16px; padding: 24px 0 28px; }
  html[data-theme] .promoted + .shelf { margin-top: 40px; }
  html[data-theme] .promoted-head { align-self: end; gap: 8px; }
  html[data-theme] .promoted-head h2 { font-size: 34px; }
  html[data-theme] .promoted-meta { font-size: 13px; letter-spacing: 0.08em; }
  html[data-theme] .promoted-cover img, html[data-theme] .promoted-cover-blank { width: 116px; height: 186px; box-shadow: 8px 8px 20px rgba(0, 0, 0, 0.4); }
  html[data-theme] .promoted .button.red { align-self: stretch; justify-content: center; }
  /* A vertical list, one row per stop. */
  html[data-theme] .line { display: flex; flex-direction: column; margin-top: 0; }
  html[data-theme] .line .stop { border-top: 0; border-left: 4px solid var(--accent); }
  html[data-theme] .line .stop-next { border-left: 4px dashed var(--ghost); border-top: 0; }
  html[data-theme] .line .stop-more { border-left-color: var(--rail); }
  html[data-theme] .line .stop-read { border-left-color: var(--rail); }
  html[data-theme] .line .stop-here { border-left-color: var(--here); }
  html[data-theme] .line .stop > a, html[data-theme] .line .stop-next { flex-direction: row; align-items: baseline; gap: 12px; padding: 10px 0 10px 14px; }
  html[data-theme] .line .stop-number { flex: none; width: 28px; font-size: 24px; }
  html[data-theme] .line .stop-title { flex: 1 1 0; min-width: 0; }
  html[data-theme] .line .stop-note { flex: none; max-width: 40%; text-align: right; }
  html[data-theme] .line .stop-more > a { justify-content: flex-start; }
}

/* My reading: the desk (cards on a panel), the chapter lines of the books the reader follows, the own shelf, Discover. */
html[data-theme] .reading-page h1 { font-family: "Barlow Condensed", "Arial Narrow", sans-serif; font-weight: 700; font-size: clamp(56px, 7vw, 96px); line-height: 0.88; letter-spacing: 0; margin: 4px 0 24px; overflow-wrap: anywhere; }
html[data-theme] .reading-desk { margin: 0 0 64px; }
html[data-theme] .reading-page .desk-empty { margin: 0; color: var(--soft); }
html[data-theme] .reading-page .desk { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); gap: 20px; padding: 28px 24px 32px; background: var(--panel); box-shadow: inset 0 10px 18px -12px rgba(0, 0, 0, 0.5); }
html[data-theme] .reading-page .desk-more { margin-top: 16px; }
html[data-theme] .reading-page .desk-more summary { cursor: pointer; font-weight: 700; min-height: 44px; display: flex; align-items: center; color: var(--accent); }
html[data-theme] .desk-note { position: relative; box-sizing: border-box; display: flex; align-items: flex-start; gap: 16px; padding: 18px; background: var(--card); border: 1px solid var(--hair); border-top: 4px solid var(--accent); box-shadow: 0 10px 20px -10px rgba(0, 0, 0, 0.5); transform: rotate(var(--tilt, 0deg)); }
html[data-theme] .desk-note:nth-child(3n + 1) { --tilt: -0.8deg; }
html[data-theme] .desk-note:nth-child(3n + 2) { --tilt: 0.6deg; }
html[data-theme] .desk-note:nth-child(3n) { --tilt: -0.4deg; }
html[data-theme] .desk-note-continue { border-top-color: #c8372d; }
html[data-theme] .desk-note-coming { border-top: 4px dashed var(--ghost); }
html[data-theme] .desk-cover, html[data-theme] .desk-mini { flex: none; display: block; width: 60px; height: 96px; object-fit: cover; border-radius: 2px; }
html[data-theme] .desk-mini { background: var(--spine, #24262b); box-shadow: inset 4px 0 0 rgba(0, 0, 0, 0.2); }
html[data-theme] .desk-note-text { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
html[data-theme] .desk-note-text > * { margin: 0; }
html[data-theme] .desk-kind { font-size: 13px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); }
html[data-theme] .desk-note-continue .desk-kind { color: var(--here); }
html[data-theme] .desk-kind-quiet { color: var(--label); }
html[data-theme] .desk-note h3 { font-size: 26px; line-height: 1; overflow-wrap: anywhere; }
html[data-theme] .desk-note h3 a { color: var(--text); text-decoration: none; }
html[data-theme] .desk-note h3 a:hover, html[data-theme] .desk-note h3 a:focus-visible { text-decoration: underline; }
html[data-theme] .desk-chapter { font-size: 15px; overflow-wrap: anywhere; }
html[data-theme] .desk-when { font-size: 14px; color: var(--label); }
html[data-theme] .desk-note progress { display: block; width: 100%; height: 4px; margin: 6px 0; border: 0; background: var(--hair); accent-color: #e2574d; }
html[data-theme] .desk-note progress::-webkit-progress-bar { background: var(--hair); }
html[data-theme] .desk-note progress::-webkit-progress-value { background: #e2574d; }
html[data-theme] .desk-note progress::-moz-progress-bar { background: #e2574d; }
html[data-theme] .desk-action { margin-top: 6px; font-weight: 700; padding: 10px 0; text-decoration: none; }
html[data-theme] .desk-action.button.red { padding: 12px 22px; border-radius: 0; }
html[data-theme] .desk-note-new .desk-action { color: var(--accent); }

html[data-theme] .follow { margin: 0 0 64px; }
html[data-theme] .follow > h2 { font-size: 44px; line-height: 1; margin: 0 0 20px; }
html[data-theme] .follow-book { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 20px 40px; padding: 24px 0; border-bottom: 1px solid var(--hair); }
html[data-theme] .follow > h2 + .follow-book { border-top: 1px solid var(--hair); }
html[data-theme] .follow-head { flex: 0 1 260px; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
html[data-theme] .follow-head h3 { margin: 0; font-size: 30px; line-height: 1; overflow-wrap: anywhere; }
html[data-theme] .follow-head h3 a { color: var(--text); text-decoration: none; }
html[data-theme] .follow-head h3 a:hover, html[data-theme] .follow-head h3 a:focus-visible { text-decoration: underline; }
html[data-theme] .follow-head .shelf-unfollow { border: 0; background: transparent; text-decoration: underline; cursor: pointer; color: var(--label); font-size: 15px; font-weight: 600; min-height: 44px; padding: 10px 0; text-align: left; }
html[data-theme] .follow-book .line { flex: 1 1 520px; width: auto; margin: 0; }
/* A long window (six stops or more) gets the whole row under the title, so the stops stay in one row. */
html[data-theme] .follow-book:has(.line .stop:nth-child(6)) { flex-direction: column; flex-wrap: nowrap; gap: 8px; }
html[data-theme] .follow-book:has(.line .stop:nth-child(6)) .follow-head { flex: none; }
html[data-theme] .follow-book:has(.line .stop:nth-child(6)) .line { flex: none; width: 100%; grid-template-columns: repeat(auto-fit, minmax(min(110px, 100%), 1fr)); }
html[data-theme] .line .stop-read .stop-number, html[data-theme] .line .stop-read .stop-title { color: var(--label); }
html[data-theme] .line .stop-here .stop-number { color: var(--here); }
html[data-theme] .line .stop-new .stop-number { color: var(--accent); }
html[data-theme] .reading-discover { margin-top: 24px; }
html[data-theme] .reading-discover > .eyebrow { margin: 0 0 4px; }
@media (max-width: 760px) {
  html[data-theme] .reading-page h1 { font-size: 52px; margin-bottom: 18px; }
  html[data-theme] .reading-desk { margin-bottom: 40px; }
  html[data-theme] .reading-page .desk { grid-template-columns: 1fr; gap: 14px; padding: 20px 16px 24px; margin-inline: calc(max(8vw, 24px) * -1); }
  html[data-theme] .desk-note { transform: none; }
  html[data-theme] .desk-note-continue { flex-wrap: wrap; padding: 16px; gap: 12px 14px; }
  html[data-theme] .desk-note-continue .desk-cover, html[data-theme] .desk-note-continue .desk-mini { width: 56px; height: 90px; }
  html[data-theme] .desk-note-continue h3 { font-size: 24px; }
  html[data-theme] .desk-note-continue .desk-note-text { flex-basis: calc(100% - 70px); }
  html[data-theme] .desk-note-continue .desk-action.button.red { flex: 1 1 100%; text-align: center; justify-content: center; margin: 0; padding: 14px 20px; }
  /* New and Coming collapse to compact rows: no cover, a short title, the action on the right. */
  html[data-theme] .desk-note-new, html[data-theme] .desk-note-coming { padding: 14px 16px; gap: 0; }
  html[data-theme] .desk-note-new .desk-cover, html[data-theme] .desk-note-new .desk-mini, html[data-theme] .desk-note-coming .desk-cover, html[data-theme] .desk-note-coming .desk-mini { display: none; }
  html[data-theme] .desk-note-new h3, html[data-theme] .desk-note-coming h3 { order: 2; font-size: 17px; line-height: 1.25; text-transform: none; font-family: "Barlow", system-ui, sans-serif; font-weight: 400; color: var(--label); }
  html[data-theme] .desk-note-new .desk-chapter, html[data-theme] .desk-note-coming .desk-chapter { font-weight: 600; font-size: 16px; }
  html[data-theme] .desk-note-new .desk-when { display: none; }
  html[data-theme] .reading-page .desk .desk-note-new .desk-action { margin-top: 2px; padding: 8px 0; }
  html[data-theme] .follow > h2 { font-size: 36px; }
  html[data-theme] .follow-book { flex-direction: column; flex-wrap: nowrap; gap: 12px; padding: 18px 0; }
  html[data-theme] .follow-head { flex: none; width: 100%; }
  html[data-theme] .follow-head h3 { font-size: 26px; }
  html[data-theme] .follow-book .line { flex: none; width: 100%; }
}

/* The other public pages (book page, how it works, authors, information, imprint, privacy, error, account forms) keep their layouts;
   the colours that app.css hard-codes follow the theme here. */
html[data-theme="dark"] { --ok: #7bd08d; }
html[data-theme="light"] { --ok: #226043; }
html[data-theme] .author-studio-entry { background: var(--panel); }
html[data-theme] .access-free { color: var(--ok); }
html[data-theme] .access-paid { color: var(--here); }
html[data-theme] .chapter-row.readable:hover { background: var(--panel); }
html[data-theme] .button.button-outline:not(.reader-shell *):hover { background: var(--text); color: var(--bg); }
html[data-theme] :is(input:not([type="checkbox"], [type="radio"], [type="hidden"], [type="submit"], [type="button"], [type="range"], [type="file"], [type="color"]), select, textarea):not(.reader-shell *) {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--rail);
}
html[data-theme] :is(input, select, textarea, button, summary):not(.reader-shell *):focus-visible,
html[data-theme] .account-form a:not(.reader-shell *):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
html[data-theme] .account-form .password-toggle { color: var(--text); }
html[data-theme] .status-message { background: var(--panel); color: var(--text); border-left-color: var(--ok); }
html[data-theme] :is(.field-error, .validation-summary-errors) { color: var(--here); }
html[data-theme] .input-validation-error { border-color: var(--here) !important; }
html[data-theme] .password-rules .is-met { color: var(--ok); }
html[data-theme] :is(.chapter-number, .next-chapter-number, .next-chapter-day):not(.reader-shell *) { font-family: "Barlow Condensed", "Arial Narrow", sans-serif; font-weight: 700; }
html[data-theme] .chapter-number:not(.reader-shell *) { color: var(--here); }
/* Billing and payment result pages. */
html[data-theme] .billing-heading > p:last-child,
html[data-theme] .billing-price span,
html[data-theme] .billing-tax,
html[data-theme] :is(.billing-fine, .billing-help, .billing-register) { color: var(--label); }
html[data-theme] :is(.billing-test, .billing-notice) { background: var(--panel); border-left-color: var(--accent); color: var(--text); }
html[data-theme] .billing-test-label { color: var(--accent); }
html[data-theme] .billing-current { background: var(--panel); border-color: var(--hair); color: var(--text); }
html[data-theme] .billing-manage { color: var(--text); }
html[data-theme] .billing-plan { background: var(--panel); border-color: var(--hair); color: var(--text); }
html[data-theme] .billing-plan-featured { border-top-color: #c8372d; }
html[data-theme] .billing-plan h2 { font-size: 36px; line-height: 1.1; }
html[data-theme] .billing-history { border-top-color: var(--hair); }
html[data-theme] .checkout-symbol { background: var(--panel); color: var(--ok); border: 1px solid var(--ok); }
html[data-theme] :is(.series-card, .preference-state):not(.reader-shell *) { background: var(--panel); color: var(--text); }
