:root {
  --accent: #287A64;
  --accent-rgb: 40, 122, 100;
  --accent-dark: #173D36;
  --accent-warm: #F4A261;
  --accent-warm-rgb: 244, 162, 97;
  --text: #26332F;
  --text-muted: #5c6f68;
  --border: #173D36;
  --bg: #FFF9F1;
  --bg-rgb: 169, 205, 191;
  --card-bg: #ffffff;
  --header-bg: #FFF9F1;
  --radius: 10px;
  --radius-lg: 18px;
  --shadow-card: 0 1px 2px rgba(23, 61, 54, 0.06), 0 10px 24px rgba(23, 61, 54, 0.07);
  --shadow-card-hover: 0 4px 10px rgba(23, 61, 54, 0.08), 0 18px 34px rgba(23, 61, 54, 0.13);
}

* { box-sizing: border-box; }

html {
  overflow-x: hidden;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.45;
}

.wrap {
  max-width: none;
  margin: 0;
  padding: 0 24px;
}

/* Header */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--accent-dark);
  padding: 12px 0;
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo-btn {
  display: inline-flex;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
}

.site-header .logo {
  height: 46px;
  width: auto;
  flex: none;
  display: block;
}

/* .header-btn-solid — the "popped out" white button: strong emphasis */
.header-btn-solid {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  background: var(--header-bg);
  color: var(--accent-dark);
  font-weight: 700;
  font-size: 0.9rem;
  padding: 9px 22px;
  border: 2px solid var(--accent-dark);
  border-radius: 999px;
  text-decoration: none;
  box-shadow: -2px 2px 0 rgba(var(--bg-rgb), 0.9);
  transition: transform 0.12s ease;
  cursor: pointer;
}

.header-btn-solid.hidden { display: none; }

.header-btn-solid:hover {
  transform: translate(-1px, 1px);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-auth {
  display: flex;
  align-items: center;
}

/* .header-btn-subtle — the outlined-on-dark button: quieter emphasis */
.header-btn-subtle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  background: transparent;
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
  padding: 9px 18px;
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-radius: 999px;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease;
}

.header-btn-subtle:hover {
  border-color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.header-account {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-account.hidden { display: none; }
.header-auth.hidden { display: none; }

/* The Subscribe button reuses .header-btn-solid's colours but sits inline
   among smaller text (email, logout link), so it needs a tighter size than
   the full header-level button it's borrowed from. */
.header-account .header-btn-solid {
  padding: 5px 14px;
  font-size: 0.8rem;
}

.header-account-email {
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-account-logout {
  background: transparent;
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.82rem;
  font-weight: 600;
  border: none;
  padding: 4px 2px;
  cursor: pointer;
  text-decoration: underline;
}

.header-account-logout:hover { color: #fff; }

/* Auth modal */

.auth-modal-panel {
  position: relative;
  width: 100%;
  max-width: 380px;
  background: #fff;
  border-radius: 12px;
  padding: 32px 28px 28px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
}

.auth-modal-title {
  font-size: 1.3rem;
  color: var(--accent-dark);
  margin: 0 0 6px;
}

.auth-modal-sub {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0 0 20px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.auth-form label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.auth-form input[type="email"] {
  width: 100%;
  font-size: 0.95rem;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-family: inherit;
  box-sizing: border-box;
}

.auth-form input[type="email"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.12);
}

.auth-submit-btn {
  margin-top: 6px;
  background: var(--accent-dark);
  color: #fff;
  font-weight: 700;
  font-size: 0.92rem;
  padding: 11px 18px;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  transition: opacity 0.12s ease;
}

.auth-submit-btn:hover { opacity: 0.9; }
.auth-submit-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.auth-status {
  margin: 14px 0 0;
  font-size: 0.85rem;
  color: var(--text-muted);
  min-height: 1.2em;
}

.auth-status.is-error { color: #b3331f; }
.auth-status.is-success { color: var(--accent); }

/* Site intro (H1 + description) — real visible content for both visitors
   landing on a specific topic/unit and search engines indexing the page;
   kept compact since the filters below are the actual point of the page. */

.site-intro {
  margin: 28px 0 0;
}

.site-intro h1 {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text);
  margin: 0 0 6px;
}

.site-intro p {
  font-size: 0.92rem;
  color: var(--text-muted);
  margin: 0;
  max-width: 760px;
}

/* Filters */

.filters {
  position: relative;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 22px;
  margin: 22px 0;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.filter-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.filter-row {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 12px;
  align-items: start;
}

.filter-row-unit {
  margin-top: 10px;
}

select, .combobox input[type="text"] {
  width: 100%;
  font-size: 0.95rem;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-family: inherit;
}

select:focus, .combobox input[type="text"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.12);
}

.filter-actions {
  margin-top: 14px;
  text-align: right;
}

.btn-text {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 0.88rem;
  cursor: pointer;
  padding: 4px;
}

.btn-text:hover { text-decoration: underline; }

/* Combobox */

.combobox {
  position: relative;
}

.combobox input[type="text"] {
  padding-right: 34px;
}

.combobox-clear {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: none;
  color: var(--text-muted);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
}

.combobox-clear:hover { color: var(--text); }

.combobox-list {
  position: absolute;
  z-index: 20;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 280px;
  overflow-y: auto;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(20, 24, 33, 0.12);
}

.combobox-list.hidden { display: none; }

.combobox-list li {
  border-radius: 6px;
  font-size: 0.92rem;
}

.combobox-list li.active,
.combobox-list li:hover {
  background: rgba(var(--accent-rgb), 0.09);
}

.combobox-list li label {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  cursor: pointer;
}

.combobox-list li input[type="checkbox"] {
  flex: none;
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
  cursor: pointer;
}

.combobox-list li.all-option {
  font-weight: 600;
  color: var(--accent);
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  margin-bottom: 4px;
  cursor: pointer;
  padding: 9px 10px 10px;
}

.combobox-list .no-match {
  color: var(--text-muted);
  cursor: default;
  padding: 10px;
}

.combobox-list .no-match:hover { background: none; }

/* Selected topic chips */

.topic-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.topic-chips[hidden] { display: none; }

.topic-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--accent-dark);
  background: rgba(var(--accent-rgb), 0.09);
  border: 1px solid rgba(var(--accent-rgb), 0.22);
  border-radius: 999px;
  padding: 4px 6px 4px 12px;
}

.topic-chip button {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border: none;
  border-radius: 50%;
  background: none;
  color: inherit;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}

.topic-chip button:hover { background: rgba(var(--accent-rgb), 0.18); }

/* Results */

.results-count {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin: 0 0 14px;
}

.results-list {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  padding-bottom: 40px;
}

@media (max-width: 1500px) {
  .results-list { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 1150px) {
  .results-list { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 860px) {
  .results-list { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
  .results-list { grid-template-columns: 1fr; }
}

.status {
  color: var(--text-muted);
  padding: 30px 0;
  text-align: center;
  grid-column: 1 / -1;
}

.load-more-btn {
  display: flex;
  margin: 8px auto 40px;
  background: var(--card-bg);
  color: var(--accent-dark);
  font-weight: 700;
  font-size: 0.9rem;
  padding: 11px 28px;
  border: 2px solid var(--accent-dark);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.load-more-btn:hover { background: var(--accent-dark); color: #fff; }
.load-more-btn:disabled { opacity: 0.6; cursor: default; }
.load-more-btn[hidden] { display: none; }

/* Tile */

.tile {
  display: flex;
  flex-direction: column;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.tile:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-card-hover);
  border-color: var(--border);
}

.tile-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
}

.tile-qnum {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
}

.tile-marks {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--accent-dark);
  background: rgba(var(--accent-rgb), 0.12);
  border-radius: 999px;
  padding: 2px 9px;
}

.tile-thumb {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  height: 190px;
  overflow: hidden;
  padding: 12px;
  background: #fff;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  cursor: zoom-in;
}

.tile-thumb img {
  display: block;
  width: 100%;
  height: auto;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.tile-thumb img.loaded {
  opacity: 1;
}

.tile-zoom-hint {
  position: absolute;
  bottom: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.76rem;
  color: #fff;
  background: rgba(20, 24, 33, 0.55);
  border-radius: 6px;
  pointer-events: none;
}

/* Locked (paywalled, not-yet-subscribed) tile — no hover lift, since
   there's nothing to click into. */
.tile-locked:hover {
  transform: none;
  box-shadow: var(--shadow-card);
}

.tile-thumb-locked {
  position: relative;
  height: 190px;
  overflow: hidden;
  background: var(--bg);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  cursor: default;
}

/* The image itself is already server-side blurred (see
   upload_paywalled_batch.py) — this isn't where the "can't read it"
   protection comes from, just a touch of extra softening + the dimming
   below so the overlay text stays legible over a busy diagram. */
.tile-thumb-locked img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
  filter: blur(1.5px);
  opacity: 0.8;
}

.tile-lock-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: rgba(var(--bg-rgb), 0.3);
}

.tile-lock-icon {
  font-size: 1.6rem;
  line-height: 1;
  opacity: 0.75;
}

.tile-lock-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent-dark);
  background: rgba(255, 255, 255, 0.8);
  padding: 3px 10px;
  border-radius: 999px;
}

.tile-meta {
  padding: 10px 12px 12px;
}

.tile-info {
  font-size: 0.74rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 6px;
}

.tile-unit {
  position: absolute;
  bottom: 8px;
  left: 8px;
  z-index: 1;
  font-family: inherit;
  font-size: 0.7rem;
  font-weight: 700;
  color: #fff;
  background: var(--accent-dark);
  border: none;
  border-radius: 999px;
  padding: 3px 9px;
  line-height: 1.3;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s ease;
}

.tile-unit:hover,
.tile-unit:focus-visible {
  background: #0d2521;
}

.tile-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 10px;
}

.tag-chip {
  font-family: inherit;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--accent-dark);
  background: rgba(var(--accent-rgb), 0.1);
  border: 1px solid rgba(var(--accent-rgb), 0.18);
  border-radius: 999px;
  padding: 2px 9px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.tag-chip:hover,
.tag-chip:focus-visible {
  background: rgba(var(--accent-rgb), 0.22);
  border-color: rgba(var(--accent-rgb), 0.35);
}

/* Practice view (lightbox with Question / Mark Scheme / Video tabs) */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(10, 12, 16, 0.92);
}

.lightbox.hidden { display: none; }

.practice-panel {
  position: relative;
  width: 96vw;
  height: 94vh;
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
}

.practice-nav-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
}

.practice-position {
  font-size: 0.82rem;
  color: var(--text-muted);
  white-space: nowrap;
  min-width: 4.5em;
  text-align: center;
}

.practice-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: #fff;
}

.practice-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

.practice-print-btn {
  flex: none;
  height: 34px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.practice-print-btn[hidden] { display: none; }

/* Private review mode only (see isAdminMode in app.js) */

.practice-flag-btn {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.practice-flag-btn[hidden] { display: none; }

.practice-flag-btn:hover {
  border-color: var(--accent-warm);
  color: var(--accent-warm);
}

.practice-flag-btn.is-flagged {
  background: var(--accent-warm);
  border-color: var(--accent-warm);
  color: #fff;
}

.admin-flagged-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--text-muted);
  cursor: pointer;
  margin-right: 14px;
}

.admin-flagged-toggle[hidden] { display: none; }

.admin-flagged-toggle input {
  accent-color: var(--accent-warm);
  cursor: pointer;
}

.practice-print-btn:hover {
  background: var(--bg);
  border-color: var(--accent);
  color: var(--accent);
}

.practice-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: none;
}

.practice-tab {
  font-size: 0.92rem;
  font-weight: 600;
  white-space: nowrap;
  padding: 9px 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}

.practice-tab:hover { color: var(--text); background: var(--bg); }

.practice-tab.active {
  color: var(--accent);
  background: rgba(var(--accent-rgb), 0.1);
  border-color: rgba(var(--accent-rgb), 0.22);
}

.lightbox-close {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: var(--bg);
  color: var(--text);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.lightbox-close:hover { background: #eaecf0; }

.practice-nav-btn {
  flex: none;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  font-size: 0.9rem;
  cursor: pointer;
}

.practice-nav-btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--bg);
}

.practice-nav-btn:disabled {
  opacity: 0.3;
  cursor: default;
}

.practice-meta {
  flex: none;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.practice-meta.has-tags {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}

.practice-meta .tile-tags {
  margin-bottom: 0;
}

.practice-info {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-left: auto;
}

.info-chip {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--accent-dark);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 9px;
  white-space: nowrap;
}

.info-chip-unit,
.info-chip-paper {
  font-family: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.info-chip-unit:hover,
.info-chip-unit:focus-visible,
.info-chip-paper:hover,
.info-chip-paper:focus-visible {
  background: rgba(var(--accent-rgb), 0.14);
  border-color: rgba(var(--accent-rgb), 0.4);
}

.lightbox-body {
  flex: 1;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background: #fff;
}

.lightbox-body.align-top {
  align-items: flex-start;
}

.lightbox-body img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  border-radius: 4px;
  background: #fff;
  transition: transform 0.15s ease;
}

.zoom-controls {
  flex: none;
  display: flex;
  align-items: center;
  gap: 4px;
}

.zoom-controls[hidden] {
  display: none;
}

.zoom-btn {
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.zoom-btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--bg);
}

.zoom-btn:disabled {
  opacity: 0.3;
  cursor: default;
}

.zoom-level {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  min-width: 3.2em;
  text-align: center;
}

.video-tab-content {
  width: 100%;
  margin: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.video-embed {
  position: relative;
  width: min(92vw, 44vh, 420px);
  aspect-ratio: 9 / 16;
  border-radius: 6px;
  overflow: hidden;
  background: #000;
  margin: 0 auto;
}

.video-embed iframe,
.video-embed video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* "Coming soon" states + promo CTA */

.coming-soon-cta {
  max-width: 560px;
  margin: auto;
  text-align: center;
  padding: 10px 16px;
}

.coming-soon-cta strong {
  display: block;
  color: var(--text);
  font-size: 1.15rem;
  margin-bottom: 8px;
}

.coming-soon-cta p {
  margin: 0 0 20px;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.cta-strip {
  width: 100%;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  text-align: center;
}

.cta-strip p {
  margin: 0 0 14px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.cta-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.cta-btn {
  display: inline-block;
  font-size: 0.88rem;
  font-weight: 700;
  padding: 11px 18px;
  border-radius: 8px;
  text-decoration: none;
  color: #fff;
}

.resource-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-bottom: 14px;
}

.resource-card {
  display: flex;
  flex-direction: column;
  width: 220px;
  border-radius: 10px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  background: #fff;
  border: 1px solid var(--border);
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.resource-card:hover {
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.14);
  transform: translateY(-2px);
}

.resource-card-thumb {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--accent-dark);
  overflow: hidden;
}

.resource-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.resource-card-play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* A text-glyph triangle (&#9658;) renders at an inconsistent, often
   squashed aspect ratio across system fonts — draw an actual equilateral
   triangle instead so it looks the same everywhere. */
.resource-card-play::after {
  content: "";
  width: 0;
  height: 0;
  margin-left: 3px;
  border-top: 9px solid transparent;
  border-bottom: 9px solid transparent;
  border-left: 15px solid #fff;
}

.resource-card-label {
  display: block;
  padding: 8px 10px;
  font-size: 0.78rem;
  font-weight: 700;
  text-align: center;
  background: var(--accent);
  color: #fff;
}

.resource-card.cta-unit-video .resource-card-label {
  background: var(--accent-dark);
}

/* Unit has no worksheet/video thumbnail yet — collapse to a plain pill
   button rather than showing an empty image box. */
.resource-card.no-thumb {
  width: auto;
  flex-direction: row;
}

.resource-card.no-thumb .resource-card-thumb {
  display: none;
}

.resource-card.no-thumb .resource-card-label {
  border-radius: 999px;
  padding: 11px 18px;
}

.cta-youtube { background: #c81e1e; }
.cta-youtube:hover { background: #a01717; }

.cta-live { background: var(--accent-warm); }
.cta-live:hover { background: #e08b3f; }

@media (max-width: 640px) {
  .practice-panel { width: 100vw; height: 100vh; border-radius: 0; }
  .practice-tab { padding: 8px 10px; font-size: 0.82rem; }
  .practice-position { display: none; }
  .zoom-controls { display: none !important; }
}

/* Footer */

.site-footer {
  background: var(--accent-dark);
  padding: 40px 0 24px;
  margin-top: 20px;
}

.footer-top {
  padding-bottom: 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

.footer-top h2 {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.55);
  margin: 0 0 14px;
}

.footer-links ul {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.footer-links a {
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
}

.footer-links a:hover {
  color: #fff;
  text-decoration: underline;
}

.footer-bottom {
  padding-top: 18px;
}

.footer-bottom p {
  margin: 0;
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.75rem;
  text-align: center;
  line-height: 1.5;
}


/* Responsive */

@media (max-width: 640px) {
  .filter-row {
    grid-template-columns: 1fr;
  }
  .filters { padding: 16px; }
  .tile-thumb { height: 140px; }
}

/* Print — just the question/mark-scheme image, no chrome, no background.
   Note: the browser paginates the tall image at plain fixed-height
   intervals; it has no way to know where the original source PDF's page
   boundaries fell inside a stitched multi-page question, since that
   position isn't recorded anywhere in the crop pipeline today. */

@page {
  margin: 15mm;
}

@media print {
  html, body {
    background: #fff !important;
  }

  .site-header,
  main,
  .site-footer {
    display: none !important;
  }

  .lightbox {
    position: static;
    background: #fff;
    padding: 0;
  }

  .practice-panel {
    position: static;
    width: auto;
    height: auto;
    max-width: none;
    box-shadow: none;
    border-radius: 0;
    overflow: visible;
  }

  .practice-head,
  .practice-meta {
    display: none !important;
  }

  .lightbox-body {
    position: static;
    display: block;
    padding: 0;
    overflow: visible;
    background: #fff;
  }

  .lightbox-body img {
    max-width: 100%;
    width: auto;
    height: auto;
  }

  .video-embed,
  .coming-soon-cta,
  .cta-strip {
    display: none !important;
  }
}
