/* Illustrated books, using the current app's sky-blue navigation and real
   flashcard completion. Cover art and spines belong to the clickable book. */
#learn.topic-library, #learn.topic-detail { padding: 0 20px calc(105px + var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px))); background: var(--panel-2); }
#learn.topic-library { border-top-color: var(--brand); }
#learn.topic-detail { border-top-color: var(--panel-2); }
#learn.topic-library .linner, #learn.topic-detail .linner { max-width: 1020px; }
.bookshelf-header { position: sticky; top: 0; z-index: 4; margin: 0 -20px; padding: 23px 22px 19px; border-radius: 0 0 24px 24px; background: var(--brand); color: var(--on-brand); }
.bookshelf-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.bookshelf-eyebrow { display: block; font-size: 11px; line-height: 1.4; font-weight: 850; letter-spacing: 1.4px; color: var(--on-brand); opacity: .85; }
#learn.topic-library h1 { margin: 3px 0 0; font-size: 32px; font-weight: 950; line-height: 1.1; color: var(--on-brand); letter-spacing: -.6px; }
.topics-settings { width: 44px; height: 44px; display: grid; place-items: center; color: var(--on-brand); border: 1px solid #026aa23d; border-radius: 14px; }
.topics-settings svg { width: 25px; height: 25px; }
.bookshelf-progress-label { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-top: 17px; }
.bookshelf-progress-label strong { font-size: 17px; font-weight: 900; }
.bookshelf-progress-label span { font-size: 13px; font-weight: 700; color: var(--on-brand); opacity: .85; }
.bookshelf-progress { height: 6px; border-radius: 9px; background: #ffffff85; overflow: hidden; margin-top: 8px; }
.bookshelf-progress i { display: block; height: 100%; background: var(--on-brand); border-radius: inherit; }
.shelf-intro { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 22px 0 17px; }
.shelf-intro p { margin: 0; font-size: 15px; color: var(--ink-2); font-weight: 750; }
.shelf-intro > span { font-size: 12px; font-weight: 800; color: var(--ink-2); white-space: nowrap; }
/* A contents list, not a path. The path's coins are drawn for a snaking vertical
   journey; flattened into rows they became small blobs in white space under a
   72px banner, with the count printed twice. A list of eleven things you pick
   from wants to look like a list: full-width rows you can obviously tap, the
   section as a quiet label rather than a shout, and progress on every row.
   Colour is one accent per topic mixed into the theme's own surface, so both
   themes come from the same declarations. */
.topic-books { display: none; }

.topic-group { margin: 0 0 22px; }
.topic-group-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0 0 9px; padding-left: 11px; border-left: 3px solid var(--accent); font-size: 12px; font-weight: 900; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); }
.topic-group-head small { flex: none; font-size: 12px; font-weight: 800; color: var(--ink-3); font-variant-numeric: tabular-nums; letter-spacing: 0; }

.topic-group { --accent: var(--brand); }
.topic-group[data-section="uk"] { --accent: #22c55e; }
.topic-group[data-section="history"] { --accent: #ff9600; }
.topic-group[data-section="society"] { --accent: #ec4899; }
.topic-group[data-section="government"] { --accent: #a855f7; }

.topic-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }

.topic-row { display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 13px; width: 100%; padding: 11px 14px 11px 11px; border: 1.5px solid var(--line-2); border-radius: 14px; background: var(--paper); color: var(--ink); text-align: left; transition: transform .1s var(--ease), border-color .12s var(--ease); }
.topic-row:active { transform: scale(.99); }
.topic-row:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 3px; }
.topic-row.is-last { border-color: var(--accent); }
@media (hover: hover) { .topic-row:hover { border-color: var(--accent); } }

.topic-row-art { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: color-mix(in srgb, var(--accent) 16%, var(--paper)); overflow: hidden; }
.topic-row-art .book-art { width: 30px; height: 30px; object-fit: contain; }

.topic-row-main { min-width: 0; display: grid; gap: 7px; }
.topic-row-title { display: flex; align-items: center; gap: 7px; font-size: 14.5px; font-weight: 800; line-height: 1.25; letter-spacing: -.1px; }
.topic-row-title em { flex: none; padding: 2px 6px; border-radius: 999px; background: var(--accent); color: var(--brand-on); font-size: 9px; font-weight: 900; font-style: normal; letter-spacing: .05em; text-transform: uppercase; }
.topic-row-track { height: 5px; border-radius: 999px; background: color-mix(in srgb, var(--accent) 18%, var(--panel-2)); overflow: hidden; }
.topic-row-track i { display: block; height: 100%; border-radius: inherit; background: var(--accent); }

.topic-row-count { flex: none; font-size: 15px; font-weight: 900; color: var(--ink); font-variant-numeric: tabular-nums; }
.topic-row-count small { font-size: 11px; font-weight: 800; color: var(--ink-3); }
.topic-row-tick { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: var(--brand-on); font-size: 13px; }

@media (prefers-reduced-motion: reduce) { .topic-row { transition: none; } .topic-row:active { transform: none; } }
@media (min-width: 700px) { .topic-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.shelf-note { margin: 28px 0 18px; color: var(--ink-2); font-size: 14px; line-height: 1.5; text-align: center; }
#topicsHome { width: 100%; }

/* Opening a book keeps the cover identity beside its real revision notes. */
.topic-back { display: block; min-height: 58px; padding: 12px 0; color: var(--brand-ink); font-size: 16px; font-weight: 850; }
/* The notes header pinned its text column to 63% of the card and let a 512x512
   illustration sit loose beside it, so a 30px title broke to one word per line
   — "Values / & / Being / a / Citizen" — while the artwork was sliced through
   the corgi's face at the card edge. It also hardcoded its fill and both ink
   colours, so it was dark-broken like the cards were. Grid, so the title takes
   the room that is left, and the art is a contained square. */
/* Each topic takes its section's accent, so the notes header matches the row you
   tapped to get here and the section it belongs to. */
.topic-notes-header { --accent: var(--brand); }
.topic-notes-header[data-topic="places"] { --accent: #22c55e; }
.topic-notes-header[data-topic="dates"], .topic-notes-header[data-topic="people"] { --accent: #ff9600; }
.topic-notes-header[data-topic="writers"], .topic-notes-header[data-topic="science"],
.topic-notes-header[data-topic="music"], .topic-notes-header[data-topic="sport"],
.topic-notes-header[data-topic="art"], .topic-notes-header[data-topic="festivals"] { --accent: #ec4899; }
.topic-notes-header[data-topic="government"] { --accent: #a855f7; }

.topic-notes-header {
  display: grid;
  grid-template-columns: 1fr 76px;
  align-items: center;
  gap: 16px;
  padding: 18px 18px;
  border: 1.5px solid color-mix(in srgb, var(--accent, var(--brand)) 26%, var(--line-2));
  border-radius: 18px;
  background: color-mix(in srgb, var(--accent, var(--brand)) 10%, var(--paper));
  color: var(--ink);
}
.topic-notes-header > div { min-width: 0; }
.topic-notes-header h1 { margin: 6px 0 6px; font-size: clamp(21px, 6vw, 27px); line-height: 1.15; font-weight: 900; letter-spacing: -.4px; color: var(--ink); text-wrap: balance; }
.topic-notes-header .bookshelf-eyebrow { color: var(--ink-2); opacity: 1; }
.topic-notes-header p { margin: 0; font-size: 13px; color: var(--ink-2); font-weight: 750; }
.topic-notes-header .book-art { width: 76px; height: 76px; object-fit: contain; }
.topic-blurb { font-size: 17px; color: var(--ink-2); line-height: 1.5; margin: 22px 0 18px; }
.topic-study-action .big { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 14px 19px; font-size: 19px; }
.topic-study-action p { color: var(--ink-2); font-size: 14px; margin: 12px 0 24px; line-height: 1.5; }
.topic-fact { position: relative; display: flex; align-items: flex-start; gap: 13px; padding: 21px 0; border-top: 1px solid var(--line-2); }
.fact-number { flex: none; width: 25px; padding-top: 3px; color: var(--ink-2); font-size: 13px; font-weight: 850; }
.topic-fact h2 { font-size: 20px; font-weight: 900; line-height: 1.25; margin: 0 0 8px; }
.topic-fact p { margin: 0; color: var(--ink-2); font-size: 16px; line-height: 1.6; }
.fact-learned { flex: none; margin-left: auto; color: var(--brand-ink); font-weight: 950; }
#learn.topic-detail #lHome { width: 100%; margin-top: 20px; }

@media (max-width: 359px) {
  #learn.topic-library, #learn.topic-detail { padding-left: 15px; padding-right: 15px; }
  .bookshelf-header { margin-left: -15px; margin-right: -15px; padding-left: 18px; padding-right: 18px; }
  .topic-books { gap: 19px 15px; }
  .shelf-intro p { font-size: 13px; }
}
@media (min-width: 600px) {
  .topic-books { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 26px; }
}
@media (min-width: 960px) {
  #learn.topic-library, #learn.topic-detail { padding: 0 clamp(32px, 5vw, 66px) 48px; }
  .bookshelf-header { top: 0; margin: 0 -26px; padding: 29px 30px 24px; border-radius: 0 0 24px 24px; }
  .bookshelf-heading { gap: 26px; }
  #learn.topic-library h1 { font-size: 37px; }
  .bookshelf-progress-label { margin-top: 16px; }
  .bookshelf-progress-label strong { font-size: 19px; }
  .bookshelf-progress-label span { font-size: 15px; }
  .shelf-intro { margin-top: 29px; margin-bottom: 24px; }
  .shelf-intro p { font-size: 18px; }
  .shelf-intro > span { font-size: 14px; }
  .topic-books { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 30px; }

  .topic-study-action { max-width: 500px; }
}
