/* Orion — base styles. Placeholder look until the official design arrives. */
:root {
  /* Brand palette */
  --navy: #101d38;       /* Midnight Navy: primary (headings, logo, header/footer) */
  --white: #ffffff;      /* Pure White: page backgrounds */
  --ice: #a9d6f5;        /* Ice Blue: highlights and accents on navy */
  --steel: #477faf;      /* Steel Blue: subheadings, icons, links */
  --mist: #dce6f0;       /* Mist Grey: cards, lines, sections */

  --bg: var(--white);
  --surface: #f1f5fa;    /* a lighter Mist Grey, so cards stand off the white page */
  --surface-2: var(--mist);
  --text: var(--navy);
  --muted: #56627a;      /* navy, softened for secondary text */
  --accent: var(--steel);
  --accent-text: var(--white);
  --primary: var(--navy);
  --primary-text: var(--white);
  --border: var(--mist);
  --shadow: rgba(16, 29, 56, 0.18);
  --radius: 10px;
  --max-width: 960px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --sidebar-w: 220px;
  /* Highlighter colours */
  --hl-yellow: #ffe14d;
  --hl-green: #7ee08a;
  --hl-blue: #7cc0ff;
  --hl-pink: #ff8fc8;
  color-scheme: light;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  line-height: 1.6;
  background: var(--bg);
  color: var(--text);
}

a { color: var(--accent); }

/* Header */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
  border-bottom: 3px solid var(--steel);
  background: var(--white);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--white);
  text-decoration: none;
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: 0.04em;
}

.brand-logo { display: block; height: 30px; width: auto; }

.site-nav { display: flex; gap: 20px; }
.site-nav a { color: var(--muted); text-decoration: none; }
.site-nav a:hover,
.site-nav a[aria-current="page"] { color: var(--navy); }
.site-nav a[aria-current="page"] { box-shadow: 0 2px 0 var(--steel); }

/* Main content */
main { max-width: var(--max-width); margin: 0 auto; padding: 0 20px; }

.hero { padding: 50px 0; text-align: center; }
.eyebrow {
  margin: 0;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-size: 0.85rem;
}
.hero h1 {
  margin: 8px 0 16px;
  font-size: clamp(3rem, 12vw, 6rem);
  line-height: 1;
  letter-spacing: 0.06em;
}
.hero .hero-logo { margin-bottom: 40px; }
.hero-logo img { display: block; width: min(440px, 80vw); height: auto; margin: 16px auto 0; }
.lede {
  max-width: 560px;
  margin: 0 auto 32px;
  color: var(--muted);
  font-size: 1.15rem;
}
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* "Continue reading" card, shown once someone has read past the cover */
.continue-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  max-width: 480px;
  margin: 40px auto 0;
  padding: 16px 20px;
  text-align: left;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.continue-card[hidden] { display: none; }
.continue-card > div { flex: 1; min-width: 200px; }
.continue-card .eyebrow { font-size: 0.75rem; }
.continue-title { margin: 2px 0 8px; font-weight: 600; }
.progress { height: 4px; border-radius: 2px; background: var(--surface-2); overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--accent); }
.continue-card .muted { margin: 6px 0 0; font-size: 0.85rem; }

.section { padding: 50px 0; border-top: 1px solid var(--border); }
.section h2 { margin-top: 0; }
.muted { color: var(--muted); }

.topic-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.topic-list li {
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
}

.issue-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.issue-card h3 { margin: 0; }
.issue-card p { margin: 4px 0 0; }
.issue-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* Latest issue on the homepage (filled from archive.json) */
.latest-card { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.latest-card .issue-cover { width: 110px; }
.latest-card > div { flex: 1; min-width: 220px; }
.latest-card .eyebrow { font-size: 0.75rem; }
.latest-card h3 { margin: 4px 0 0; }
.latest-card .issue-actions { margin-top: 14px; }

/* Archive page */
.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.archive-head { padding: 50px 0 30px; }
.archive-head h1 { margin: 6px 0 20px; font-size: clamp(2rem, 6vw, 3rem); line-height: 1.1; }
.archive-search input {
  width: 100%;
  max-width: 420px;
  padding: 10px 14px;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.archive-search input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.archive-status { padding: 20px 0 60px; }
.archive-year { padding: 30px 0; border-top: 1px solid var(--border); }
.archive-year[hidden], .archive-issue[hidden] { display: none; }
.archive-year h2 { margin: 0 0 20px; }
.archive-issue {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  padding: 20px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.archive-issue-body { flex: 1; min-width: 0; }
.archive-issue .eyebrow { font-size: 0.75rem; }
.archive-issue h3 { margin: 4px 0 0; font-size: 1.3rem; }
.archive-issue-body > .muted { margin: 6px 0 0; }
.archive-saved { margin: 6px 0 0; font-size: 0.85rem; color: var(--accent); }
.archive-issue .issue-actions { margin-top: 16px; }

/* Cover: A4 proportions, with a placeholder when the image is missing */
.issue-cover {
  flex: none;
  width: 140px;
  aspect-ratio: 1 / 1.414;
  border-radius: 6px;
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--border);
  transition: transform 0.15s ease;
}
.issue-cover:hover { transform: translateY(-2px); }
.issue-cover img { display: block; width: 100%; height: 100%; object-fit: cover; }
.issue-cover.is-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 1.6rem;
  font-weight: 700;
  text-decoration: none;
}

/* Contents, grouped by topic */
.issue-contents { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 12px; }
.issue-contents summary { cursor: pointer; color: var(--muted); font-weight: 600; width: fit-content; }
.issue-contents summary:hover { color: var(--text); }
.topic-group[hidden], .article-list li[hidden] { display: none; }
.topic-group h4 {
  margin: 14px 0 4px;
  color: var(--accent);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.article-list { list-style: none; margin: 0; padding: 0; }
.article-link {
  display: flex;
  align-items: baseline;
  gap: 4px 12px;
  flex-wrap: wrap;
  padding: 6px 8px;
  margin: 0 -8px;
  border-radius: 6px;
  color: var(--text);
  text-decoration: none;
}
.article-link:hover { background: var(--surface-2); }
.article-title { font-weight: 600; }
.article-author { color: var(--muted); font-size: 0.9rem; }
.article-page { margin-left: auto; color: var(--muted); font-size: 0.85rem; font-variant-numeric: tabular-nums; }

@media (max-width: 600px) {
  .archive-issue { flex-direction: column; gap: 16px; padding: 16px; }
  .archive-issue .issue-cover { width: 120px; }
}
@media (prefers-reduced-motion: reduce) {
  .issue-cover { transition: none; }
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 10px 20px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-family: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.btn-primary { background: var(--primary); color: var(--primary-text); }
.btn-primary:hover { background: var(--steel); }
.btn-ghost { border-color: var(--border); background: transparent; color: var(--text); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-small { padding: 6px 12px; font-size: 0.9rem; }

/* Footer */
.site-footer {
  padding: 32px 20px;
  text-align: center;
  color: var(--mist);
  background: var(--navy);
  border-top: 3px solid var(--steel);
  font-size: 0.9rem;
}
.site-footer p { margin: 0; }
.site-footer p + p { margin-top: 12px; }
.footer-social {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--white);
  text-decoration: none;
  font-weight: 600;
}
.footer-social:hover { color: var(--ice); }

/* Reader */
.reader-page { background: var(--mist); }
.reader-page .site-header { position: static; }
.reader-top {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
}
.is-fullscreen .site-header { display: none; }

/* Pages button on the left, the other controls centred */
.toolbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--white);
  border-bottom: 1px solid var(--mist);
}
.toolbar-start { justify-self: start; }
.toolbar-main {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px 24px;
}
.toolbar-group { display: flex; align-items: center; gap: 6px; }
.toolbar button {
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}
.toolbar button:hover { border-color: var(--accent); }
.toolbar button[aria-pressed="true"],
.toolbar button[aria-expanded="true"] { border-color: var(--accent); color: var(--accent); }
#prev, #next, #zoom-in, #zoom-out { font-size: 1.1rem; }
.toolbar .zoom-label { min-width: 64px; }

/* Read / Notes switch: a pill that slides to the selected side */
.mode-toggle {
  position: relative;
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
}
.mode-toggle::before {
  content: "";
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 3px;
  width: calc(50% - 3px);
  border-radius: 999px;
  background: var(--primary);
  transition: transform 0.25s ease;
}
.mode-toggle[data-mode="notes"]::before { transform: translateX(100%); }
.toolbar .mode-toggle button {
  position: relative;
  z-index: 1;
  height: 30px;
  min-width: 64px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--muted);
  font-weight: 600;
  transition: color 0.25s ease;
}
.toolbar .mode-toggle button:hover { color: var(--text); }
.toolbar .mode-toggle button[aria-pressed="true"] { color: var(--accent-text); }
.toolbar .mode-toggle button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  .mode-toggle::before, .toolbar .mode-toggle button { transition: none; }
}
.page-indicator { color: var(--muted); font-variant-numeric: tabular-nums; }
#page-input {
  width: 3.5em;
  height: 36px;
  padding: 0 6px;
  text-align: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  -moz-appearance: textfield; /* no up/down arrows */
  appearance: textfield;
}
#page-input::-webkit-inner-spin-button,
#page-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

/* Pages */
.reader-page main.viewer {
  max-width: none;
  padding: 24px 16px 64px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 16px;
  overflow-x: auto;
}
.viewer-status { color: var(--muted); margin-inline: auto; }

.pdf-page {
  position: relative;
  flex-shrink: 0;
  margin-inline: auto; /* centres, but stays scrollable when zoomed wider than the screen */
  background: #fff;
  box-shadow: 0 4px 24px var(--shadow);
  scroll-margin-top: calc(var(--reader-top-h, 110px) + 16px);
}
.pdf-page canvas { display: block; }

/* PDF.js text layer: invisible text on top of the page for selecting and searching */
.textLayer {
  position: absolute;
  inset: 0;
  overflow: hidden;
  line-height: 1;
  text-align: initial;
  text-size-adjust: none;
  -webkit-text-size-adjust: none;
  forced-color-adjust: none;
  transform-origin: 0 0;
  z-index: 2;
}
.textLayer :is(span, br) {
  color: transparent;
  position: absolute;
  white-space: pre;
  cursor: text;
  transform-origin: 0 0;
}
.textLayer span.markedContent { top: 0; height: 0; }
.textLayer ::selection { background: rgba(71, 127, 175, 0.35); }
.textLayer br::selection { background: transparent; }
.textLayer .endOfContent {
  display: block;
  position: absolute;
  inset: 100% 0 0;
  z-index: -1;
  cursor: default;
  user-select: none;
}
.textLayer .endOfContent.active { top: 0; }

/* Highlights: under the (invisible) text layer, multiplied onto the page like a real highlighter */
.hlLayer { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.hl {
  position: absolute;
  border-radius: 2px;
  background: var(--c);
  opacity: 0.6;
  mix-blend-mode: multiply;
}
.hl.is-flash { animation: hl-flash 0.6s ease 2; }
@keyframes hl-flash { 50% { opacity: 1; box-shadow: 0 0 0 4px var(--c); } }
.hl-mark {
  position: absolute;
  width: 10px;
  height: 10px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--c);
  box-shadow: 0 0 0 1px var(--shadow);
}
.hl-yellow { --c: var(--hl-yellow); }
.hl-green { --c: var(--hl-green); }
.hl-blue { --c: var(--hl-blue); }
.hl-pink { --c: var(--hl-pink); }

/* Popover for new and existing highlights */
.hl-popover {
  position: fixed;
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: max-content;
  max-width: calc(100vw - 16px);
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  box-shadow: 0 8px 30px var(--shadow);
}
.hl-popover[hidden] { display: none; }
.hl-row { display: flex; align-items: center; gap: 6px; }
.hl-edit-actions { justify-content: space-between; }
.hl-row[hidden] { display: none; }
.swatch {
  width: 26px;
  height: 26px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 50%;
  background: var(--c);
  cursor: pointer;
  transition: transform 0.15s ease;
}
.swatch:hover { transform: scale(1.12); }
.swatch[aria-pressed="true"] { border-color: var(--text); box-shadow: 0 0 0 2px var(--surface-2) inset; }
.swatch-yellow { --c: var(--hl-yellow); }
.swatch-green { --c: var(--hl-green); }
.swatch-blue { --c: var(--hl-blue); }
.swatch-pink { --c: var(--hl-pink); }
.hl-btn, .side-btn {
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}
.hl-btn:hover, .side-btn:hover { border-color: var(--accent); }
.hl-btn-danger { color: #b3261e; }
.hl-btn-danger:hover { border-color: #b3261e; }
#hl-note, .note-text {
  display: block;
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  line-height: 1.4;
  resize: vertical;
}
#hl-note { width: 260px; max-width: 100%; min-height: 72px; }
#hl-note[hidden] { display: none; }
#hl-note:focus, .note-text:focus { outline: none; border-color: var(--accent); }

/* "Continue from page X?" */
.resume-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 30;
  transform: translateX(-50%);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: max-content;
  max-width: calc(100vw - 32px);
  padding: 10px 12px 10px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  box-shadow: 0 8px 30px var(--shadow);
}
.resume-toast[hidden] { display: none; }

.linkLayer { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.linkLayer a { position: absolute; display: block; pointer-events: auto; border-radius: 2px; }
.linkLayer a:hover { background: rgba(255, 220, 0, 0.2); }

/* Flip view (StPageFlip) */
.reader-page main.viewer.is-flip {
  justify-content: center;
  min-height: calc(100vh - var(--reader-top-h, 110px));
  /* Padding matches the 48px left free in baseScale(), so the book fits the window exactly
     and the page never becomes scrollable. */
  padding-block: 24px;
  /* A curling page sticks out past the book; clip it instead of letting a scrollbar
     flash in and out (which would narrow the area and make the book jump). */
  overflow-y: hidden;
}
.book {
  margin-inline: auto;
  flex-shrink: 0;
  transition: transform 0.8s ease; /* matches the page-turn time, for centring lone covers */
}
@media (prefers-reduced-motion: reduce) {
  .book { transition: none; }
}
.book-page { background: #fff; }
.book .pdf-page { margin: 0; box-shadow: none; }
.book .stf__item { box-shadow: 0 6px 30px var(--shadow); }

/* StPageFlip's base styles (the library doesn't ship them in its JS) */
.stf__parent {
  position: relative;
  display: block;
  box-sizing: border-box;
  transform: translateZ(0);
  touch-action: pan-y;
}
.stf__wrapper { position: relative; width: 100%; box-sizing: border-box; }
.stf__parent canvas { position: absolute; width: 100%; height: 100%; left: 0; top: 0; }
.stf__block {
  position: absolute;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  perspective: 2000px;
}
.stf__item { display: none; position: absolute; transform-style: preserve-3d; }
.stf__outerShadow,
.stf__innerShadow,
.stf__hardShadow,
.stf__hardInnerShadow { position: absolute; left: 0; top: 0; }

/* Sidebar: contents + thumbnails */
.sidebar {
  position: fixed;
  top: var(--reader-top-h, 110px);
  bottom: 0;
  left: 0;
  z-index: 15;
  width: var(--sidebar-w);
  overflow-y: auto;
  padding: 16px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  scrollbar-width: thin;
  scrollbar-color: #b7c7d8 transparent;
}
.sidebar::-webkit-scrollbar { width: 8px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: #b7c7d8; border-radius: 4px; }
.sidebar[hidden] { display: none; }
@media (min-width: 900px) {
  .sidebar-open main.viewer { margin-left: var(--sidebar-w); }
}
@media (max-width: 899px) {
  .sidebar { box-shadow: 8px 0 32px var(--shadow); }
}

.sidebar [role="tabpanel"][hidden] { display: none; }
.sidebar-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
  padding: 3px;
  border-radius: 8px;
  background: var(--bg);
}
.sidebar-tabs button {
  flex: 1;
  height: 30px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}
.sidebar-tabs button:hover { color: var(--text); }
.sidebar-tabs button[aria-selected="true"] { background: var(--surface-2); color: var(--text); }
.sidebar-tabs .count {
  display: inline-block;
  min-width: 18px;
  margin-left: 6px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 0.7rem;
  line-height: 18px;
  vertical-align: 1px;
}
.sidebar-tabs .count:empty { display: none; }

/* Notes tab */
.notes-add { width: 100%; margin-bottom: 12px; }
.notes-empty, .notes-hint, .notes-status { margin: 8px 0 0; font-size: 0.8rem; color: var(--muted); line-height: 1.45; }
.notes-empty[hidden], .notes-warning[hidden] { display: none; }
.notes-status:empty { display: none; }
.notes-warning {
  margin-bottom: 12px;
  padding: 8px 10px;
  border: 1px solid #d9a521;
  border-radius: 8px;
  background: #fff7e0;
  font-size: 0.8rem;
  line-height: 1.45;
}
.notes-warning p { margin: 0 0 8px; }
.notes-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.note-item {
  position: relative;
  padding: 8px 8px 8px 10px;
  border-left: 4px solid var(--c, var(--border));
  border-radius: 8px;
  background: var(--surface-2);
}
.note-item[data-color="yellow"] { --c: var(--hl-yellow); }
.note-item[data-color="green"] { --c: var(--hl-green); }
.note-item[data-color="blue"] { --c: var(--hl-blue); }
.note-item[data-color="pink"] { --c: var(--hl-pink); }
.note-jump {
  display: block;
  width: 100%;
  padding: 0 20px 0 0;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.note-page { display: block; font-size: 0.7rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.note-jump:hover .note-page { color: var(--accent); }
.note-text { margin-top: 6px; resize: none; overflow: hidden; }
/* Fade the last line of a cut-off note */
.note-item.is-clamped .note-text {
  -webkit-mask-image: linear-gradient(to bottom, #000 65%, transparent);
  mask-image: linear-gradient(to bottom, #000 65%, transparent);
}
.note-more {
  margin-top: 4px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}
.note-more:hover { text-decoration: underline; }
.note-more[hidden] { display: none; }
.note-delete {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 4px;
  background: none;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}
.note-delete:hover { color: #ff8a8a; background: var(--surface); }
.notes-footer { display: grid; gap: 8px; margin-top: 16px; }
.notes-footer .side-btn { width: 100%; }

.outline { margin-bottom: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.outline h2 {
  margin: 0 0 8px;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}
.outline h3 {
  margin: 12px 0 2px;
  color: var(--accent);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.outline ol { list-style: none; margin: 0; padding: 0; }
.outline button {
  display: grid;
  grid-template-columns: 1fr auto;
  column-gap: 8px;
  width: 100%;
  padding: 5px 6px;
  margin: 0 -6px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  line-height: 1.3;
  text-align: left;
  cursor: pointer;
}
.outline button:hover { background: var(--surface-2); }
.outline-title { font-weight: 600; }
.outline-author { grid-column: 1; color: var(--muted); font-size: 0.78rem; }
.outline-page { grid-column: 2; grid-row: 1; color: var(--muted); font-size: 0.78rem; font-variant-numeric: tabular-nums; }

.thumbs { list-style: none; margin: 0; padding: 0; display: grid; justify-items: stretch; }
.thumbs li {
  display: flex;
  justify-content: center;
  padding: 6px 0;
  transition: background-color 0.25s ease, box-shadow 0.25s ease;
}
/* Pages on screen: one outline around the group (both pages of a spread).
   Drawn with inset shadows rather than borders so nothing moves when the highlight changes. */
.thumbs li.is-shown {
  --line: var(--accent);
  background: rgba(169, 214, 245, 0.35);
  box-shadow: inset 2px 0 var(--line), inset -2px 0 var(--line);
}
.thumbs li.is-shown.is-group-start {
  border-radius: 8px 8px 0 0;
  box-shadow: inset 2px 0 var(--line), inset -2px 0 var(--line), inset 0 2px var(--line);
}
.thumbs li.is-shown.is-group-end {
  border-radius: 0 0 8px 8px;
  box-shadow: inset 2px 0 var(--line), inset -2px 0 var(--line), inset 0 -2px var(--line);
}
.thumbs li.is-shown.is-group-start.is-group-end {
  border-radius: 8px;
  box-shadow: inset 0 0 0 2px var(--line);
}
.thumb {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 2px solid transparent;
  border-radius: 6px;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
}
.thumb canvas { display: block; background: #fff; }
.thumb:hover { border-color: var(--border); }
.thumb[aria-current="page"] { color: var(--text); }

@media (max-width: 700px) {
  .toolbar { display: flex; }
  .toolbar-main { flex: 1; }
}

@media (max-width: 600px) {
  .hero { padding: 64px 0 48px; }
  .toolbar { gap: 8px; padding: 8px; }
  .toolbar-main { gap: 8px 12px; }
  .zoom-controls { display: none; } /* phones pinch-zoom instead */
  .toolbar #fullscreen { display: none; } /* iPhones don't support it; saves a row */
  .toolbar .mode-toggle button { min-width: 0; padding: 0 12px; }
}
