*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.55;
  /* Keep content clear of notches in landscape */
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
}

main {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: env(safe-area-inset-top, 0px) var(--gutter) calc(var(--dock-h) + 2rem);
}
body.has-mini-player main { padding-bottom: calc(var(--dock-h) + var(--dock-mini-h) + 2rem); }

h1, h2, h3 { font-family: var(--font-display); line-height: 1.12; margin: 0; }
h1 { font-size: 2rem; font-weight: 500; }
/* No one-word last lines: balance short headings, tidy the end of paragraphs */
h1, h2, h3 { text-wrap: balance; }
p, li { text-wrap: pretty; }
/* Section heads are sans and bold, like the Hearth design's section rows */
h2 { font-family: var(--font-body); font-size: 1.125rem; font-weight: 700; line-height: 1.25; margin: 1.75rem 0 0.75rem; }

/* Eyebrow micro-label */
.eyebrow {
  margin: 0; color: var(--muted);
  font-family: var(--font-body); font-size: 0.75rem; font-weight: 700; line-height: 1.4;
  letter-spacing: 0.16em; text-transform: uppercase;
}

a { color: inherit; }
p { margin: 0 0 1rem; }
img, svg { max-width: 100%; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}

[hidden] { display: none !important; }

/* Keyboard focus: one visible ring everywhere, 3:1 or more on every surface */
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
  border-radius: 6px;
}
:focus:not(:focus-visible) { outline: none; }

/* Buttons: pills. Hairline border on label-bearing pills, solid accent for primary */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  min-height: var(--tap); min-width: var(--tap);
  padding: 0 1.25rem;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-pill);
  background: var(--raised);
  color: var(--text);
  font: inherit; font-weight: 600;
  text-decoration: none; text-align: center;
  cursor: pointer;
}
.btn svg { width: 1.25em; height: 1.25em; fill: currentColor; flex: none; }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 750; }
.btn-lg { min-height: var(--tap-lg); min-width: var(--tap-lg); padding: 0 1.75rem; font-size: 1.0625rem; }
.btn-icon { padding: 0; }
/* On: tinted by the world accent with an accent edge (primary buttons stay solid) */
.btn[aria-pressed="true"], .btn[aria-current="true"] {
  background: color-mix(in srgb, var(--accent) 20%, var(--surface));
  color: var(--text); border-color: var(--accent);
}
.btn-primary[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.btn[disabled] { opacity: 0.6; cursor: default; }

.badge-new {
  display: inline-flex; align-items: center;
  padding: 0 0.55rem; min-height: 1.4rem;
  border-radius: var(--radius-pill);
  background: var(--accent); color: var(--accent-ink);
  font-family: var(--font-body); font-size: 0.75rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.04em;
}

.meta { color: var(--muted); font-size: var(--text-small); }

/* Covers: a soft gradient tile tinted by the series colour, with a glowing
   line icon in that colour. No illustrations: the icon is the art. */
.cover {
  display: flex; align-items: center; justify-content: center;
  color: var(--series);
  background:
    radial-gradient(circle at 50% 38%, color-mix(in srgb, var(--series) 32%, transparent), transparent 62%),
    linear-gradient(145deg, color-mix(in srgb, var(--series) 28%, var(--surface)), var(--raised));
  border-radius: var(--radius-sm);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--series) 18%, transparent);
  overflow: hidden;
}
.cover svg { width: 76%; height: auto; filter: drop-shadow(0 0 7px color-mix(in srgb, var(--series) 55%, transparent)); }
.icon-detail { fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; opacity: 0.85; }
.icon-main { fill: color-mix(in srgb, var(--series) 26%, transparent); stroke: currentColor; stroke-width: 5; stroke-linejoin: round; stroke-linecap: round; }

/* Thin progress bar (rows, the continue card, the reader) */
.bar { display: block; height: 4px; border-radius: 4px; background: var(--raised); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 4px; background: var(--accent); }

/* Honour reduced motion everywhere */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
