/* ExamMaster previous-year-paper archive.
   Tokens copy Brand.light / Brand.dark in lib/theme/brand.dart so these pages
   sit in the same catalogue as /explore rather than a third cream/teal identity.
   Phone and wide are different layouts; the split is BrandLayout.wide (900).
   Type is the app's bundled Lato, served from the Flutter asset tree (the
   same /assets/assets/fonts/ path vercel.json marks immutable); nothing is
   fetched from a third party. */

@font-face {
  font-family: "Lato";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/assets/fonts/Lato-Regular.ttf") format("truetype");
}
@font-face {
  font-family: "Lato";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/assets/fonts/Lato-Italic.ttf") format("truetype");
}
@font-face {
  font-family: "Lato";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/assets/assets/fonts/Lato-Bold.ttf") format("truetype");
}
@font-face {
  font-family: "Lato";
  font-style: normal;
  font-weight: 900;
  font-display: swap;
  src: url("/assets/assets/fonts/Lato-Black.ttf") format("truetype");
}

:root {
  --accent: #4338ca;
  --accent-deep: #312e81;
  --accent-soft: #eef0fe;
  --accent-line: #c9cdf6;
  --navy: #172849;
  --ground: #f5f6f8;
  --surface: #ffffff;
  --surface-alt: #f2f3f5;
  --hairline: #e4e6ea;
  --ink: #212427;
  --ink-soft: #4c5158;
  --ink-muted: #80858c;
  --on-accent: #ffffff;
  --shadow-lift: 0 1px 2px rgb(23 40 73 / 6%), 0 6px 18px -12px rgb(23 40 73 / 18%);
  --radius-chip: 6px;
  --radius-card: 10px;
  --radius-tile: 14px;
  --wrap: 1180px;
  --bar: 64px;
  --ease: 160ms cubic-bezier(0.2, 0, 0, 1);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --accent: #818cf8;
    --accent-deep: #a5b0ff;
    --accent-soft: #24263f;
    --accent-line: #3c3f6a;
    --ground: #131417;
    --surface: #1c1e22;
    --surface-alt: #26292e;
    --hairline: #33363b;
    --ink: #f2f3f5;
    --ink-soft: #c3c7cd;
    --ink-muted: #8e939a;
    --on-accent: #151534;
    --shadow-lift: 0 1px 2px rgb(0 0 0 / 30%), 0 6px 18px -12px rgb(0 0 0 / 50%);
  }
}

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

/* Buttons and rows below set their own display; the hidden attribute the
   filter script toggles must still win. */
[hidden] { display: none !important; }

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

body {
  margin: 0;
  min-height: 100%;
  background: var(--ground);
  color: var(--ink);
  font-family: "Lato", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
a:focus-visible,
button:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-chip);
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -48px;
  z-index: 20;
  padding: 8px 12px;
  border-radius: var(--radius-chip);
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
}
.skip-link:focus { top: 12px; }

.wrap {
  width: min(var(--wrap), 100%);
  margin: 0 auto;
  padding: 0 16px;
}

/* ---- Site chrome -------------------------------------------------------- */

.archive-bar {
  position: sticky;
  top: 0;
  z-index: 5;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--hairline);
}
.archive-bar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: var(--bar);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 17px;
  font-weight: 900;
  letter-spacing: -0.3px;
  text-decoration: none;
}
.brand:hover { text-decoration: none; }
.mark {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 14px;
  font-weight: 900;
  line-height: 1;
}
.archive-bar-links { display: none; }
.archive-bar-links a {
  position: relative;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 700;
  padding: 10px 12px;
  border-radius: var(--radius-chip);
  text-decoration: none;
  transition: color var(--ease), background-color var(--ease);
}
.archive-bar-links a:hover { color: var(--ink); background: var(--surface-alt); }
.archive-bar-links a[aria-current="page"] { color: var(--accent); }
.archive-bar-links a[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 4px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
}
.signup-nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 16px;
  border-radius: var(--radius-chip);
  background: var(--accent);
  color: var(--on-accent);
  font-size: 13.5px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color var(--ease), transform var(--ease);
}
.signup-nav:hover { text-decoration: none; background: var(--accent-deep); }
.signup-nav:active { transform: translateY(1px); }

/* ---- Breadcrumbs & hero ------------------------------------------------- */

.breadcrumbs { margin: 16px 0 0; }
.breadcrumbs ol {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 0;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-muted);
}
.breadcrumbs li { min-width: 0; overflow-wrap: anywhere; }
.breadcrumbs a {
  color: var(--ink-soft);
  font-weight: 700;
  border-radius: 4px;
  transition: color var(--ease);
}
.breadcrumbs a:hover { color: var(--accent); text-decoration: none; }
.breadcrumbs li:not(:last-child)::after {
  content: "/";
  margin: 0 8px;
  color: var(--hairline);
  font-weight: 700;
}
.breadcrumbs [aria-current="page"] { color: var(--ink-muted); }
@media (max-width: 899px) {
  /* The current crumb repeats the h1 directly below it; on a phone it
     takes one line and truncates rather than wrapping to three. */
  .breadcrumbs [aria-current="page"] {
    flex: 0 1 auto;
    max-width: 100%;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }
}

.page-hero { padding: 24px 0 8px; }
.kicker {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--accent);
}
.kicker::before {
  content: "";
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
}
.page-hero h1,
.paper-article > h1 {
  margin: 10px 0 0;
  font-size: clamp(28px, 5vw, 40px);
  font-weight: 900;
  letter-spacing: -1.2px;
  line-height: 1.1;
  text-wrap: balance;
}
.page-hero.display h1 { max-width: 16ch; }
.lede {
  margin: 12px 0 0;
  max-width: 58ch;
  color: var(--ink-soft);
  font-size: 16px;
  line-height: 1.55;
  text-wrap: pretty;
}
.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 28px;
  margin: 20px 0 0;
  padding: 16px 0;
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
  list-style: none;
}
.hero-stats li { flex: 0 1 auto; min-width: 0; }
.hero-stats b {
  display: block;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: -0.6px;
  line-height: 1.1;
  color: var(--accent-deep);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.hero-stats span {
  display: block;
  margin-top: 5px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  line-height: 1.3;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.source-note {
  margin: 12px 0 0;
  color: var(--ink-soft);
  font-size: 13.5px;
  line-height: 1.55;
}

/* ---- Hub: exam families ------------------------------------------------- */

.family { margin: 28px 0 0; }
.family-title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 12px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.family-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--hairline);
}
.exam-list,
.paper-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.exam-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 12px 14px 14px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-card);
  background: var(--surface);
  color: inherit;
  text-decoration: none;
  transition: border-color var(--ease), box-shadow var(--ease), transform var(--ease);
}
.exam-card:hover {
  text-decoration: none;
  border-color: var(--accent-line);
  box-shadow: var(--shadow-lift);
}
.exam-card:active { transform: translateY(1px); box-shadow: none; }
.exam-card:focus-visible { outline-offset: 3px; }
.exam-mark {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-chip);
  color: #fff;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.04em;
}
.exam-card-body { min-width: 0; flex: 1; }
.exam-card h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.2px;
  line-height: 1.25;
  transition: color var(--ease);
}
.exam-card:hover h3 { color: var(--accent); }
.exam-card p {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--ink-soft);
}
.exam-card-meta {
  margin: 4px 0 0;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}
.exam-card-action {
  display: none;
  margin-left: auto;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  transition: transform var(--ease);
}
.exam-card:hover .exam-card-action { transform: translateX(3px); }
.exam-card-chevron {
  flex: 0 0 auto;
  color: var(--ink-muted);
  font-size: 22px;
  line-height: 1;
  transition: color var(--ease), transform var(--ease);
}
.exam-card:hover .exam-card-chevron { color: var(--accent); transform: translateX(2px); }

/* ---- Exam hub: filters and paper rows ----------------------------------- */

.paper-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
  margin: 20px 0 8px;
  padding: 12px 14px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-card);
  background: var(--surface);
}
.paper-filters label {
  display: grid;
  gap: 6px;
  flex: 1 1 100%;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.paper-filters select {
  min-height: 40px;
  width: 100%;
  padding: 0 36px 0 12px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-chip);
  background-color: var(--surface-alt);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%2380858c' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  transition: border-color var(--ease), background-color var(--ease);
}
.paper-filters select:hover { border-color: var(--accent-line); background-color: var(--surface); }
.paper-filters-status {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1 0 100%;
  min-height: 24px;
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}
.paper-filters-reset {
  min-height: 28px;
  padding: 0 10px;
  background: transparent;
  border: 1px solid var(--hairline);
  color: var(--accent);
  font-size: 12.5px;
}
.paper-filters-reset:hover { background: var(--accent-soft); border-color: var(--accent-line); }
.paper-filters-empty {
  margin: 16px 0 0;
  padding: 28px 20px;
  border: 1px dashed var(--hairline);
  border-radius: var(--radius-card);
  color: var(--ink-soft);
  font-size: 14.5px;
  text-align: center;
}
.paper-filters-empty[hidden] { display: none; }

[data-paper-year-group] > h2 {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 32px 0 12px;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: -0.6px;
  color: var(--ink);
}
[data-paper-year-group] > h2::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--hairline);
  transform: translateY(-6px);
}
[data-paper-stage-group] > h3 {
  margin: 18px 0 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--ink-muted);
}
[data-paper-stage-group]:first-of-type > h3 { margin-top: 8px; }

.paper-row {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-card);
  background: var(--surface);
  transition: border-color var(--ease), box-shadow var(--ease);
}
.paper-row:hover {
  border-color: var(--accent-line);
  box-shadow: var(--shadow-lift);
}
.paper-row-main {
  display: block;
  color: inherit;
  text-decoration: none;
  min-width: 0;
  border-radius: 4px;
}
.paper-row-main:hover { text-decoration: none; }
.paper-row-main:hover h4 { color: var(--accent); }
.paper-row h4 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.15px;
  line-height: 1.3;
  color: var(--ink);
  transition: color var(--ease);
}
.paper-row-meta {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--ink-soft);
}

/* ---- Buttons ------------------------------------------------------------ */

.official-paper-link,
.paper-signup-button,
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border: 0;
  border-radius: var(--radius-chip);
  background: var(--accent);
  color: var(--on-accent);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--ease), color var(--ease), transform var(--ease), border-color var(--ease);
}
.official-paper-link:hover,
.paper-signup-button:hover,
button:hover {
  text-decoration: none;
  background: var(--accent-deep);
}
.official-paper-link:active,
.paper-signup-button:active,
button:active { transform: translateY(1px); }
.official-paper-link::before {
  content: "";
  flex: 0 0 auto;
  width: 15px;
  height: 15px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z'/%3E%3Cpath d='M14 3v5h5'/%3E%3Cpath d='M9 13h6M9 17h6'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z'/%3E%3Cpath d='M14 3v5h5'/%3E%3Cpath d='M9 13h6M9 17h6'/%3E%3C/svg%3E") center / contain no-repeat;
}
.paper-row .official-paper-link,
.paper-row .paper-card-pdf {
  width: 100%;
  background: var(--accent-soft);
  color: var(--accent-deep);
  border: 1px solid var(--accent-line);
}
.paper-row .official-paper-link:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

.back-to-exam-hub {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 8px 0 0;
  padding: 6px 10px 6px 8px;
  border-radius: var(--radius-chip);
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 700;
  transition: color var(--ease), background-color var(--ease);
}
.back-to-exam-hub:hover { text-decoration: none; color: var(--accent); background: var(--accent-soft); }

/* ---- Ads (scripts/adsense.py) -------------------------------------------- */
/* Distinct from content by spacing and label, never inside the paper. */
.ad-unit { margin: 28px 0 8px; padding-top: 12px; border-top: 1px solid var(--hairline); }
.ad-unit-label { display: block; margin-bottom: 6px; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-muted); }
.ad-unit .adsbygoogle { min-height: 100px; }

/* ---- Paper detail ------------------------------------------------------- */

.paper-layout {
  display: grid;
  gap: 16px;
  padding: 8px 0 40px;
}
.paper-layout > div > p:first-child { margin: 0; }
.paper-article > h1 {
  max-width: none;
  font-size: clamp(24px, 4vw, 34px);
  letter-spacing: -0.9px;
}
.paper-meta,
.paper-pdf,
.question,
.archive-cta,
.paper-related {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-card);
  padding: 16px;
}
.paper-meta { margin-top: 20px; }
.paper-meta h2,
.paper-pdf h2,
.archive-cta h2,
.paper-related h2,
.question h2 {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 900;
  letter-spacing: -0.2px;
}
.paper-related h2 {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.paper-meta dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px 20px;
  margin: 0;
}
.paper-meta dt {
  align-self: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.paper-meta dd { margin: 0; font-weight: 700; }
.source {
  margin: 14px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--hairline);
  overflow-wrap: anywhere;
  color: var(--ink-soft);
  font-size: 13.5px;
}
.paper-pdf { margin-top: 12px; }
.paper-pdf .official-paper-link { margin: 0 0 12px; }
/* The preview is capped and the locked panel fades in over its bottom. This
   is a tease: the real PDF link sits inside the panel and in the dialog. */
.paper-pdf-preview {
  position: relative;
  height: 420px;
  overflow: hidden;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-chip);
  background: var(--surface-alt);
}
.paper-pdf object {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: var(--surface-alt);
  color: var(--ink-soft);
}
.paper-pdf object > p {
  display: block;
  margin: 0;
  padding: 48px 24px 24px;
  text-align: center;
  font-size: 14.5px;
  line-height: 1.6;
}
.paper-pdf object > p a { font-weight: 700; }
.paper-pdf-gate {
  position: absolute;
  inset: auto 0 0;
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 96px 20px 22px;
  text-align: center;
  background: linear-gradient(
    to bottom,
    color-mix(in srgb, var(--surface) 0%, transparent) 0%,
    color-mix(in srgb, var(--surface) 88%, transparent) 38%,
    var(--surface) 62%
  );
}
.paper-pdf-gate-glyph {
  display: inline-grid;
  place-items: center;
  box-sizing: content-box;
  padding: 9px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
}
.paper-pdf-gate h3 {
  margin: 6px 0 0;
  font-size: 17px;
  font-weight: 900;
  letter-spacing: -0.4px;
  line-height: 1.25;
  text-wrap: balance;
}
.paper-pdf-gate p {
  margin: 0;
  max-width: 44ch;
  color: var(--ink-soft);
  font-size: 13.5px;
  line-height: 1.5;
}
.paper-pdf-gate .paper-signup-button { margin-top: 8px; min-width: 200px; }
.paper-pdf-continue {
  margin-top: 4px;
  padding: 6px 8px;
  border-radius: var(--radius-chip);
  color: var(--ink-muted);
  font-size: 13px;
  font-weight: 700;
  transition: color var(--ease);
}
.paper-pdf-continue:hover { color: var(--accent); text-decoration: none; }
.paper-pdf > p:last-child {
  margin: 12px 0 0;
  padding: 10px 12px;
  border-radius: var(--radius-chip);
  background: var(--surface-alt);
  color: var(--ink-soft);
  font-size: 13.5px;
}
.paper-pdf > p:last-child strong { color: var(--ink); font-weight: 700; }

/* Questions */
.question { margin-top: 12px; }
.question h2 {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}
.question > p { margin: 0; font-size: 16px; line-height: 1.6; }
.options {
  display: grid;
  gap: 8px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
  counter-reset: option;
}
.options li {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-chip);
  background: var(--surface-alt);
  font-size: 15px;
  line-height: 1.5;
  transition: border-color var(--ease), background-color var(--ease);
}
.options li::before {
  counter-increment: option;
  content: counter(option, upper-alpha);
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--hairline);
  color: var(--ink-soft);
  font-size: 12.5px;
  font-weight: 900;
  line-height: 1;
}
.question:has(details[open]) .options li[data-correct-answer="true"] {
  border-color: var(--accent-line);
  background: var(--accent-soft);
}
.question:has(details[open]) .options li[data-correct-answer="true"]::before {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}
.math code {
  color: inherit;
  background: var(--surface-alt);
  padding: 0.1rem 0.3rem;
  border-radius: 4px;
  font-size: 0.92em;
}
.options .math code { background: var(--surface); }
.math-display { display: block; overflow-x: auto; margin: 0.75rem 0; }

details {
  margin-top: 14px;
  border-top: 1px solid var(--hairline);
  padding-top: 12px;
}
summary {
  display: flex;
  align-items: center;
  gap: 8px;
  list-style: none;
  cursor: pointer;
  color: var(--accent);
  font-size: 14px;
  font-weight: 700;
  user-select: none;
}
summary::-webkit-details-marker { display: none; }
summary::before {
  content: "";
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  margin-left: 2px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform var(--ease);
}
details[open] > summary::before { transform: rotate(45deg); }
summary:hover { color: var(--accent-deep); }
details > p {
  margin: 12px 0 0;
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 1.6;
}
details > p strong { color: var(--ink); }

/* Sign-up panel */
.archive-cta {
  margin-top: 16px;
  border-color: var(--accent-line);
  background: var(--accent-soft);
}
.archive-cta h2 { color: var(--accent-deep); }
.archive-cta p { margin: 0 0 14px; color: var(--ink-soft); font-size: 14.5px; line-height: 1.55; }

/* Related aside */
.paper-related { margin: 0; padding: 12px 8px; }
.paper-related h2 { padding: 4px 8px 6px; margin: 0; }
.paper-related ul { margin: 0; padding: 0; list-style: none; }
.paper-related li + li { margin-top: 2px; }
.paper-related a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 8px;
  border-radius: var(--radius-chip);
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.35;
  transition: background-color var(--ease), color var(--ease);
}
.paper-related a::after {
  content: "›";
  flex: 0 0 auto;
  color: var(--ink-muted);
  font-size: 18px;
  line-height: 1;
}
.paper-related a:hover { text-decoration: none; background: var(--accent-soft); color: var(--accent); }
.paper-related a:hover::after { color: var(--accent); }

/* Modal */
.paper-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgb(23 40 73 / 48%);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
.paper-modal-backdrop[hidden] { display: none; }
.paper-modal {
  position: relative;
  width: min(30rem, 100%);
  border-radius: var(--radius-tile);
  padding: 28px 24px 24px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  box-shadow: 0 24px 60px -24px rgb(0 0 0 / 45%);
  animation: paper-modal-in 200ms cubic-bezier(0.2, 0, 0, 1);
}
@keyframes paper-modal-in {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
.paper-modal h2 {
  margin: 0 32px 0 0;
  font-size: 20px;
  font-weight: 900;
  letter-spacing: -0.5px;
}
.paper-modal p { margin: 10px 0 18px; color: var(--ink-soft); font-size: 14.5px; line-height: 1.55; }
.paper-modal .paper-signup-button { width: 100%; }
.paper-modal .paper-modal-alt {
  margin: 14px 0 0;
  text-align: center;
  color: var(--ink-muted);
  font-size: 13px;
}
.paper-modal-alt a { font-weight: 700; }
.paper-modal-close {
  position: absolute;
  top: 8px;
  right: 8px;
  min-width: 40px;
  min-height: 40px;
  padding: 0;
  background: transparent;
  color: var(--ink-soft);
  font-size: 22px;
  border-radius: 50%;
}
.paper-modal-close:hover { background: var(--surface-alt); color: var(--ink); }

/* ---- Footer ------------------------------------------------------------- */

.archive-footer {
  margin-top: 40px;
  padding: 24px 0 32px;
  border-top: 1px solid var(--hairline);
  color: var(--ink-muted);
  font-size: 13.5px;
  line-height: 1.6;
}
.archive-footer-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px 24px;
}
.archive-footer p { margin: 0; }
.archive-footer a { color: var(--ink-soft); font-weight: 700; margin-left: 16px; }
.archive-footer a:hover { color: var(--accent); text-decoration: none; }
.archive-footer a:first-child { margin-left: 0; }

/* ---- Wide (>= BrandLayout.wide) ----------------------------------------- */

@media (min-width: 900px) {
  .wrap { padding: 0 24px; }
  .archive-bar-links { display: flex; align-items: center; gap: 2px; }
  .breadcrumbs { margin-top: 20px; }
  .page-hero { padding: 32px 0 12px; }
  .page-hero h1,
  .paper-article > h1 { margin-top: 14px; }
  .lede { font-size: 17px; }
  .hero-stats {
    flex-wrap: nowrap;
    gap: 0;
    margin-top: 28px;
    padding: 20px 0;
  }
  .hero-stats li { padding-right: 32px; }
  .hero-stats li + li { padding-left: 32px; border-left: 1px solid var(--hairline); }
  .hero-stats b { font-size: 28px; letter-spacing: -0.9px; }
  .family { margin-top: 36px; }
  .exam-list { gap: 12px; }
  .exam-card {
    gap: 18px;
    padding: 18px 22px;
  }
  .exam-mark { width: 48px; height: 48px; font-size: 15px; border-radius: 8px; }
  .exam-card h3 { font-size: 18px; }
  .exam-card p { font-size: 14px; }
  .exam-card-meta { margin-top: 5px; font-size: 13px; }
  .exam-card-action { display: inline; }
  .exam-card-chevron { display: none; }

  .paper-filters {
    position: sticky;
    top: var(--bar);
    z-index: 4;
    align-items: center;
    gap: 16px;
    margin-top: 24px;
    padding: 12px 16px;
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    backdrop-filter: saturate(140%) blur(10px);
    -webkit-backdrop-filter: saturate(140%) blur(10px);
  }
  .paper-filters label {
    flex: 0 0 auto;
    grid-template-columns: auto auto;
    align-items: center;
    gap: 10px;
  }
  .paper-filters select { width: auto; min-width: 200px; }
  .paper-filters-status { flex: 1 1 auto; justify-content: flex-end; min-height: 0; }

  .paper-list { gap: 10px; }
  .paper-row {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
  }
  .paper-row h4 { font-size: 16px; }
  .paper-row .official-paper-link,
  .paper-row .paper-card-pdf {
    width: auto;
    min-height: 40px;
  }

  .paper-layout { padding-top: 12px; }
  .paper-layout.has-related {
    grid-template-columns: minmax(0, 1fr) 292px;
    align-items: start;
    gap: 28px;
  }
  .paper-related {
    position: sticky;
    top: calc(var(--bar) + 20px);
    max-height: calc(100vh - var(--bar) - 40px);
    overflow-y: auto;
  }
  .paper-meta,
  .paper-pdf,
  .question,
  .archive-cta { padding: 22px 24px; }
  .paper-meta dl { grid-template-columns: auto 1fr auto 1fr; gap: 12px 24px; }
  .paper-meta { margin-top: 24px; }
  .question > p { font-size: 16.5px; }
  .paper-pdf-preview { height: 560px; }
  .paper-pdf-gate { padding: 120px 32px 28px; }
  .paper-pdf-gate h3 { font-size: 19px; }
  .paper-modal { padding: 32px 28px 28px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
