/* ──────────────────────────────────────────────────────────────────────────
   AI Safety Resources — site styles
   Theming is driven by CSS custom properties; [data-theme="dark"] on <html>
   switches the palette (set pre-paint by theme-init.js).
   ────────────────────────────────────────────────────────────────────────── */

:root {
  color-scheme: light;
  --bg: #f4f1ea;
  --bg-ombre: linear-gradient(180deg, rgba(64, 157, 105, 0.16) 0%, rgba(64, 157, 105, 0.06) 28%, rgba(244, 241, 234, 0) 62%);
  --surface: #ffffff;
  --surface-soft: #f9f7f1;
  --surface-raised: #fbf9f5;
  --text: #382110;
  --muted: #6f6659;
  --border: #e6ddce;
  --border-strong: #d5cab7;
  /* Dark enough for ≥4.5:1 contrast with white text (WCAG AA). */
  --accent: #2f7a52;
  --accent-hover: #25603f;
  --on-accent: #ffffff;
  --accent-soft: #eef8f1;
  --accent-soft-border: #b5d6bf;
  --accent-text: #2f7a52;
  --link: #166b4c;
  --input-bg: #ffffff;
  --header-bg: rgba(249, 247, 241, 0.92);
  --saved-bg: #f8fdf9;
  --cover-bg-start: #f7f3ea;
  --cover-bg-end: #eee6d8;
  --progress-track: #e9dfd0;
  --shadow: 0 10px 25px rgba(56, 33, 16, 0.09);
  --shadow-soft: 0 4px 14px rgba(56, 33, 16, 0.07);
  --focus-ring: rgba(64, 157, 105, 0.35);
  --header-height: 64px;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #15110d;
  --bg-ombre: linear-gradient(180deg, rgba(79, 184, 126, 0.2) 0%, rgba(79, 184, 126, 0.08) 30%, rgba(21, 17, 13, 0) 64%);
  --surface: #1f1913;
  --surface-soft: #251e17;
  --surface-raised: #2a221a;
  --text: #ede4d3;
  --muted: #a99b85;
  --border: #3b3128;
  --border-strong: #4d4034;
  --accent: #4fb87e;
  --accent-hover: #63c98f;
  --on-accent: #0e231a;
  --accent-soft: rgba(79, 184, 126, 0.14);
  --accent-soft-border: rgba(79, 184, 126, 0.42);
  --accent-text: #7fd2a4;
  --link: #7fd2a4;
  --input-bg: #2a221a;
  --header-bg: rgba(26, 21, 16, 0.92);
  --saved-bg: rgba(79, 184, 126, 0.07);
  --cover-bg-start: #2c241c;
  --cover-bg-end: #241d16;
  --progress-track: #3b3128;
  --shadow: 0 10px 25px rgba(0, 0, 0, 0.45);
  --shadow-soft: 0 4px 14px rgba(0, 0, 0, 0.35);
  --focus-ring: rgba(79, 184, 126, 0.45);
}

/* ── Base ──────────────────────────────────────────────────────────────── */

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

html {
  scroll-behavior: smooth;
}

body.site-body {
  margin: 0;
  font-family: "Sora", "Open Sans", sans-serif;
  background: var(--bg);
  background-image: var(--bg-ombre);
  background-attachment: fixed;
  background-repeat: no-repeat;
  color: var(--text);
  transition: background 0.25s ease, color 0.25s ease;
}

[hidden] {
  display: none !important;
}

::selection {
  background: rgba(64, 157, 105, 0.28);
}

button,
input,
select,
textarea {
  font-family: inherit;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Visually hidden but available to assistive tech (screen-reader-only text). */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: fixed;
  top: 0.6rem;
  left: 0.6rem;
  z-index: 100;
  padding: 0.55rem 0.9rem;
  border-radius: 8px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
  font-size: 0.88rem;
  text-decoration: none;
  transform: translateY(-220%);
  transition: transform 0.15s ease;
}

.skip-link:focus {
  transform: none;
}

.noscript-note {
  margin: 0;
  padding: 0.8rem 1rem;
  background: var(--accent-soft);
  border-bottom: 1px solid var(--accent-soft-border);
  color: var(--accent-text);
  font-size: 0.9rem;
  text-align: center;
}

.page {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 1rem 2.5rem;
}

/* ── Header ────────────────────────────────────────────────────────────── */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.site-nav {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0.6rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
}

.brand {
  display: flex;
  align-items: center;
  text-decoration: none;
}

.nav-logo {
  display: block;
  height: 36px;
  width: auto;
  filter: invert(14%) sepia(17%) saturate(996%) hue-rotate(356deg) brightness(95%) contrast(88%);
}

[data-theme="dark"] .nav-logo {
  filter: invert(90%) sepia(12%) saturate(280%) hue-rotate(357deg) brightness(101%) contrast(90%);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.theme-toggle:hover {
  background: var(--surface-soft);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
}

.theme-icon-sun {
  display: none;
}

[data-theme="dark"] .theme-icon-sun {
  display: block;
}

[data-theme="dark"] .theme-icon-moon {
  display: none;
}

.contact-button {
  border-radius: 999px;
  padding: 0.5rem 1rem;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--on-accent);
  background: var(--accent);
  text-decoration: none;
  transition: transform 0.2s ease, background 0.2s ease;
}

.contact-button:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.surprise-me-button {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  height: 38px;
  padding: 0 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.surprise-me-button:hover {
  background: var(--surface-soft);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.surprise-me-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

@media (max-width: 560px) {
  .surprise-me-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .surprise-me-button {
    width: 38px;
    padding: 0;
    justify-content: center;
  }
}

/* ── Hero ──────────────────────────────────────────────────────────────── */

.hero {
  padding: 2.3rem 0 0.4rem;
  text-align: center;
}

.hero-title {
  margin: 0;
  font-family: "Hahmlet", Georgia, serif;
  font-size: clamp(1.9rem, 4.2vw, 2.6rem);
  font-weight: 700;
  line-height: 1.15;
  color: var(--text);
}

.hero-subtitle {
  margin: 0.5rem 0 0;
  color: var(--muted);
  font-size: 0.97rem;
  font-style: italic;
}

.hero-copy {
  max-width: 40rem;
  margin: 0.75rem auto 0;
  color: var(--muted);
  font-size: 0.96rem;
  line-height: 1.55;
}

.hero-meta {
  display: inline-block;
  margin: 0.9rem auto 0;
  padding: 0.28rem 0.75rem;
  border: 1px solid var(--accent-soft-border);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: 0.78rem;
  font-weight: 600;
}

.featured-banner {
  display: flex;
  align-items: center;
  gap: 1rem;
  max-width: 42rem;
  margin: 1.4rem auto 0;
  padding: 1rem 1.25rem;
  border-radius: 1rem;
  background: linear-gradient(135deg, #2f7a52, #1f5238);
  color: #ffffff;
  text-align: left;
  text-decoration: none;
  box-shadow: 0 8px 24px rgba(47, 122, 82, 0.28);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.featured-banner:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(47, 122, 82, 0.36);
}

.featured-banner-tag {
  flex-shrink: 0;
  align-self: flex-start;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.featured-banner-body {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  flex: 1;
}

.featured-banner-title {
  font-family: "Hahmlet", Georgia, serif;
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.2;
}

.featured-banner-copy {
  font-size: 0.85rem;
  opacity: 0.92;
}

.featured-banner-cta {
  flex-shrink: 0;
  font-weight: 700;
  white-space: nowrap;
}

/* ── Library layout ────────────────────────────────────────────────────── */

.library-layout {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  gap: 1.4rem;
  align-items: start;
  margin-top: 1.8rem;
}

.library-sidebar {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  min-width: 0;
}

.library-content {
  min-width: 0;
  scroll-margin-top: calc(var(--header-height) + 8px);
}

@media (min-width: 768px) {
  .library-sidebar {
    position: sticky;
    top: calc(var(--header-height) + 12px);
    max-height: calc(100vh - var(--header-height) - 24px);
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    padding-right: 2px;
  }
}

/* ── Category tabs ─────────────────────────────────────────────────────── */

.gauntlet-tabs-menu {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.gauntlet-tab {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  width: 100%;
  padding: 0.68rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-soft);
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.gauntlet-tab:hover {
  background: var(--surface);
  border-color: var(--border-strong);
}

.gauntlet-tab.w--current {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

.gauntlet-tab-label {
  min-width: 0;
}

.gauntlet-tab-count {
  flex-shrink: 0;
  min-width: 2em;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.72rem;
  font-weight: 700;
  text-align: center;
}

.gauntlet-tab-count:empty {
  visibility: hidden;
}

.gauntlet-tab.w--current .gauntlet-tab-count {
  background: rgba(255, 255, 255, 0.22);
  border-color: transparent;
  color: inherit;
}

[data-theme="dark"] .gauntlet-tab.w--current .gauntlet-tab-count {
  background: rgba(0, 0, 0, 0.16);
}

/* ── Tab panes ─────────────────────────────────────────────────────────── */

.w-tab-pane {
  display: none;
}

.w-tab-pane.w--tab-active {
  display: block;
  animation: pane-fade-in 0.28s ease both;
}

@keyframes pane-fade-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

/* ── Controls bar (search / sort / filters) ────────────────────────────── */

.category-controls {
  display: grid;
  grid-template-columns: minmax(200px, 1.7fr) repeat(4, minmax(110px, 1fr)) auto;
  align-items: end;
  gap: 0.65rem 0.7rem;
  margin-bottom: 0.9rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}

.category-control-label {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.3rem;
  min-width: 0;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 600;
}

.category-control-input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.38rem 0.7rem;
  font-size: 0.88rem;
  color: var(--text);
  background: var(--input-bg);
  transition: border-color 0.15s ease;
}

.category-control-input:focus {
  outline: 2px solid var(--focus-ring);
  border-color: var(--accent);
}

.search-input-wrap {
  position: relative;
  display: block;
}

.search-icon {
  position: absolute;
  top: 50%;
  left: 0.65rem;
  width: 14px;
  height: 14px;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.search-input-wrap .category-control-input {
  padding-left: 2rem;
  padding-right: 1.9rem;
}

.search-input-wrap input[type="search"]::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
}

.search-clear {
  position: absolute;
  top: 50%;
  right: 0.4rem;
  transform: translateY(-50%);
  width: 1.45rem;
  height: 1.45rem;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.search-clear:hover {
  background: var(--surface-soft);
  color: var(--text);
}

.search-shortcut-hint {
  position: absolute;
  top: 50%;
  right: 0.5rem;
  transform: translateY(-50%);
  min-width: 1.1rem;
  padding: 0.05rem 0.35rem;
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  background: var(--surface-soft);
  color: var(--muted);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.72rem;
  line-height: 1.3;
  text-align: center;
  pointer-events: none;
}

@media (max-width: 520px) {
  .search-shortcut-hint {
    display: none;
  }
}

.category-filter-reset {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.46rem 0.85rem;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.category-filter-reset:hover {
  background: var(--surface);
  border-color: var(--border-strong);
}

.category-results-note {
  margin: -0.2rem 0 0.8rem;
  padding: 0 0.2rem;
  color: var(--accent-text);
  font-size: 0.84rem;
  font-weight: 600;
}

/* ── Category intro ────────────────────────────────────────────────────── */

.category-intro {
  margin-bottom: 0.9rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-soft);
}

.category-intro-title {
  margin: 0 0 0.35rem;
  font-family: "Hahmlet", Georgia, serif;
  font-size: 1.06rem;
  color: var(--text);
}

.category-intro-summary {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

/* ── Resource cards ────────────────────────────────────────────────────── */

.gauntlet-wrapper {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.8rem;
}

.hypothesis.book {
  display: flex;
  align-items: center;
  gap: 0.95rem;
  width: 100%;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  text-decoration: none;
  color: var(--text);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.hypothesis.book:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--border-strong);
}

.resource-card {
  cursor: default;
}

.resource-card.is-saved {
  border-color: var(--accent-soft-border);
  background: var(--saved-bg);
}

.book-rank {
  min-width: 2.2rem;
  text-align: center;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.85rem;
  color: var(--muted);
}

.book-cover {
  width: 54px;
  height: 80px;
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0;
  border: 1px solid var(--border-strong);
  background: linear-gradient(145deg, var(--cover-bg-start), var(--cover-bg-end));
}

.resource-cover-link {
  display: block;
  text-decoration: none;
}

.book-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.book-image.is-logo {
  object-fit: contain;
  padding: 6px;
  background: #fff;
}

.youtube-cover {
  position: relative;
  width: 142px;
  height: 80px;
  cursor: pointer;
}

.youtube-play-badge {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.28);
  color: #fff;
  transition: background 0.15s ease;
}

.youtube-cover:hover .youtube-play-badge,
.youtube-cover:focus-visible .youtube-play-badge {
  background: rgba(0, 0, 0, 0.42);
}

/* Expanded inline player: the card wraps and the player takes a full-width
   16:9 row beneath the usual card content. */
.resource-card.is-playing {
  flex-wrap: wrap;
}

.resource-card.is-playing .youtube-play-badge {
  display: none;
}

.youtube-player-region {
  flex-basis: 100%;
  width: 100%;
  min-width: 0;
  margin-top: 0.35rem;
}

.youtube-player-frame {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  background: #000;
}

.youtube-player-frame iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.youtube-player-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-top: 0.55rem;
}

.youtube-player-close {
  cursor: pointer;
}

.cover-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(
    150deg,
    hsl(var(--cover-hue, 32) 36% 88%),
    hsl(calc(var(--cover-hue, 32) + 26) 42% 76%)
  );
  color: #4a3f2f;
  font-family: "Hahmlet", Georgia, serif;
  font-size: 1.2rem;
  text-align: center;
}

[data-theme="dark"] .cover-fallback {
  background: linear-gradient(
    150deg,
    hsl(var(--cover-hue, 32) 20% 28%),
    hsl(calc(var(--cover-hue, 32) + 26) 24% 18%)
  );
  color: #e7dcc8;
}

.cover-fallback-initials {
  font-weight: 700;
  letter-spacing: 0.04em;
}

.book-main {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.idea-header.book {
  margin: 0;
  font-family: "Hahmlet", Georgia, serif;
  font-size: 1.04rem;
  font-weight: 700;
  line-height: 1.3;
}

.resource-title-link {
  color: inherit;
  text-decoration: none;
}

.resource-title-link:hover .idea-header.book {
  text-decoration: underline;
}

.author {
  color: var(--muted);
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.resource-summary {
  margin: 0;
  color: var(--muted);
  font-size: 0.83rem;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.book-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.film-scores {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
}

.film-score {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
}

a.film-score {
  cursor: pointer;
  transition: opacity 0.15s ease;
}

a.film-score:hover {
  opacity: 0.7;
}

a.film-score:hover .film-score-value {
  text-decoration: underline;
}

.film-score-logo {
  width: 22px;
  height: 22px;
  object-fit: contain;
  flex-shrink: 0;
}

.film-score-label,
.film-score-value {
  font-size: 0.8rem;
}

.book-scores .film-score-logo {
  width: 20px;
  height: 20px;
}

.resource-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
}

.resource-save-button,
.resource-progress-select {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--input-bg);
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.28rem 0.6rem;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.resource-save-button {
  cursor: pointer;
}

.resource-save-button:hover {
  border-color: var(--accent);
  color: var(--accent-text);
}

.resource-save-button.is-saved {
  border-color: var(--accent-soft-border);
  background: var(--accent-soft);
  color: var(--accent-text);
}

.resource-share-button.is-copied {
  border-color: var(--accent-soft-border);
  background: var(--accent-soft);
  color: var(--accent-text);
}

.star-rating {
  display: inline-flex;
  align-items: center;
  gap: 0.05rem;
  margin-right: 0.15rem;
}

.star-button {
  border: none;
  background: none;
  padding: 0 0.06rem;
  font-size: 1.05rem;
  line-height: 1;
  color: var(--border);
  cursor: pointer;
  transition: color 0.15s ease, transform 0.1s ease;
}

.star-button.is-active {
  color: #f2a91e;
}

/* Hover preview: light up every star from the first through the hovered one. */
.star-rating:hover .star-button {
  color: #f2a91e;
}

.star-rating:hover .star-button:hover ~ .star-button {
  color: var(--border);
}

.star-button:hover {
  transform: scale(1.2);
}

.star-button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-radius: 4px;
}

.resource-card.is-spotlighted {
  outline: 3px solid var(--accent);
  outline-offset: 4px;
  animation: spotlight-pulse 2s ease-out;
}

@keyframes spotlight-pulse {
  0% {
    box-shadow: 0 0 0 6px var(--accent-soft);
  }
  100% {
    box-shadow: 0 0 0 0 transparent;
  }
}

.source-pill,
.page-pill {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-soft);
  padding: 0.2rem 0.55rem;
  font-size: 0.74rem;
  color: var(--muted);
}

.status-pill {
  border-color: var(--accent-soft-border);
  background: var(--accent-soft);
  color: var(--accent-text);
}

.page-pill.is-hidden,
.year-pill.is-hidden {
  display: none;
}

.open-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--accent-text);
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
  text-decoration: none;
}

.open-link:hover {
  text-decoration: underline;
}

.open-link-arrow {
  font-size: 0.9em;
}

.resource-open-link {
  margin-left: auto;
}

.hypothesis.book.suggestion-card {
  border-style: dashed;
  border-color: var(--accent-soft-border);
  background: var(--saved-bg);
}

.resource-empty-state {
  border: 1px dashed var(--border-strong);
  border-radius: 12px;
  background: var(--surface-soft);
  padding: 0.9rem 1rem;
  margin-bottom: 0.75rem;
}

.resource-empty-state-title {
  margin: 0 0 0.35rem;
  font-family: "Hahmlet", Georgia, serif;
  font-size: 0.98rem;
  color: var(--text);
}

.resource-empty-state-copy {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.4;
}

.library-empty-state {
  text-align: center;
  padding: 1.6rem 1.2rem;
}

.library-empty-state .resource-empty-state-copy {
  margin-bottom: 0.85rem;
}

.library-empty-state .resource-save-button {
  cursor: pointer;
}

/* ── Reading dashboard ─────────────────────────────────────────────────── */

.reading-dashboard {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
  /* The sidebar is a height-constrained flex column (sticky, overflow-y:auto).
     Without this, the box is a shrinkable flex child and collapses to a thin
     clipped stripe on shorter screens; keep its natural height and let the
     sidebar scroll instead. */
  flex-shrink: 0;
}

.reading-dashboard-collapsible {
  display: block;
}

.reading-dashboard-toggle {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.35rem 0.75rem;
  cursor: pointer;
  list-style: none;
  padding: 0.8rem 0.9rem;
  background: var(--surface-soft);
  border-bottom: 1px solid var(--border);
}

.reading-dashboard-toggle::-webkit-details-marker {
  display: none;
}

.reading-dashboard-toggle::after {
  content: "▾";
  color: var(--muted);
  font-size: 0.85rem;
  transition: transform 0.2s ease;
  margin-left: auto;
}

.reading-dashboard-collapsible:not([open]) .reading-dashboard-toggle::after {
  transform: rotate(-90deg);
}

.reading-dashboard-body {
  padding: 0.75rem 0.8rem 0.85rem;
}

.reading-dashboard-title {
  margin: 0;
  font-family: "Hahmlet", Georgia, serif;
  font-size: 0.98rem;
}

.reading-dashboard-summary {
  margin: 0;
  color: var(--muted);
  font-size: 0.79rem;
}

.track-progress-bar {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: var(--progress-track);
  overflow: hidden;
}

.track-progress-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.reading-list-preview {
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.reading-section {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-raised);
  overflow: hidden;
}

.reading-section-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  cursor: pointer;
  list-style: none;
  padding: 0.45rem 0.6rem;
  font-size: 0.79rem;
  color: var(--text);
  font-weight: 600;
}

.reading-section-summary::-webkit-details-marker {
  display: none;
}

.reading-section-summary::after {
  content: "▾";
  color: var(--muted);
  font-size: 0.76rem;
  margin-left: auto;
  transition: transform 0.2s ease;
}

.reading-section:not([open]) .reading-section-summary::after {
  transform: rotate(-90deg);
}

.reading-section-name {
  min-width: 0;
}

.reading-section-count {
  color: var(--muted);
  font-size: 0.74rem;
}

.reading-section-progress {
  padding: 0 0.6rem 0.45rem;
}

.reading-list-items {
  list-style: none;
  margin: 0;
  padding: 0 0.5rem 0.55rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.reading-section-empty {
  margin: 0.15rem 0.6rem 0.55rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.reading-list-empty {
  color: var(--muted);
  font-size: 0.8rem;
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 0.45rem 0.55rem;
  background: var(--surface-raised);
}

.reading-list-io {
  display: flex;
  gap: 0.45rem;
  margin-top: 0.7rem;
}

.reading-list-io-button {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--input-bg);
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.32rem 0.6rem;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.reading-list-io-button:hover {
  border-color: var(--accent);
  color: var(--accent-text);
}

.reading-list-io-feedback {
  margin: 0.5rem 0 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.reading-list-item {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.55rem 0.65rem;
  background: var(--surface-soft);
}

.reading-list-item-main {
  min-width: 0;
}

.reading-list-item-link {
  display: block;
  color: var(--link);
  font-weight: 600;
  text-decoration: none;
  font-size: 0.85rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reading-list-item-link:hover {
  text-decoration: underline;
}

.reading-list-item-meta {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  margin-top: 0.1rem;
}

.reading-list-item-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
}

.reading-list-status-select,
.reading-list-remove {
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.76rem;
  padding: 0.23rem 0.55rem;
  background: var(--input-bg);
  color: var(--text);
}

.reading-list-status-select {
  min-width: 0;
}

.reading-list-remove {
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

.reading-list-remove:hover {
  border-color: var(--border-strong);
}

/* ── Suggestion form ───────────────────────────────────────────────────── */

.suggestion-section {
  margin-top: 2rem;
  scroll-margin-top: calc(var(--header-height) + 8px);
}

.suggestion-shell {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-soft);
  padding: 1.2rem;
}

.suggestion-title {
  margin: 0;
  font-family: "Hahmlet", Georgia, serif;
  font-size: 1.5rem;
}

.suggestion-copy {
  margin: 0.35rem 0 1rem;
  color: var(--muted);
}

.suggestion-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.field-label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--muted);
}

.field-label input,
.field-label select,
.field-label textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.6rem 0.7rem;
  background: var(--input-bg);
  color: var(--text);
  font-size: 0.95rem;
}

.field-label input:focus,
.field-label select:focus,
.field-label textarea:focus {
  outline: 2px solid var(--focus-ring);
  border-color: var(--accent);
}

.suggestion-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 0.85rem;
}

.suggestion-submit {
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 0.55rem 1.05rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--on-accent);
  background: var(--accent);
  transition: background 0.2s ease, transform 0.2s ease;
}

.suggestion-submit:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.suggestion-submit:disabled {
  opacity: 0.75;
  cursor: not-allowed;
  transform: none;
}

.suggestion-feedback {
  min-height: 1.2rem;
  margin: 0.65rem 0 0;
  font-size: 0.88rem;
  color: var(--muted);
}

.suggestion-feedback.is-error {
  color: #b3261e;
}

[data-theme="dark"] .suggestion-feedback.is-error {
  color: #ff8a80;
}

.suggestion-feedback.is-success {
  color: var(--accent-text);
}

/* ── Footer ────────────────────────────────────────────────────────────── */

.site-footer {
  margin-top: 2.5rem;
  border-top: 1px solid var(--border);
  background: var(--surface-soft);
}

.site-footer-inner {
  max-width: 1160px;
  margin: 0 auto;
  padding: 1.6rem 1rem 1.1rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1.2rem 2.5rem;
}

.site-footer-title {
  margin: 0;
  font-family: "Hahmlet", Georgia, serif;
  font-size: 1.05rem;
  font-weight: 700;
}

.site-footer-copy {
  margin: 0.35rem 0 0;
  max-width: 26rem;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.5;
}

.site-footer-links {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  font-size: 0.88rem;
}

.site-footer-links a {
  color: var(--link);
  font-weight: 600;
  text-decoration: none;
}

.site-footer-links a:hover {
  text-decoration: underline;
}

.site-footer-fineprint {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 1rem 1.4rem;
  color: var(--muted);
  font-size: 0.76rem;
}

/* ── Back to top ───────────────────────────────────────────────────────── */

.back-to-top {
  position: fixed;
  right: 1.1rem;
  bottom: 1.1rem;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: var(--shadow);
  cursor: pointer;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease, background 0.2s ease;
}

.back-to-top.is-visible {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

.back-to-top:hover {
  background: var(--accent-hover);
}

.back-to-top svg {
  width: 20px;
  height: 20px;
}

/* ── Responsive ────────────────────────────────────────────────────────── */

@media (max-width: 1020px) {
  .category-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .category-control-search {
    grid-column: 1 / -1;
  }
}

@media (max-width: 900px) {
  .suggestion-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 767px) {
  :root {
    --header-height: 56px;
  }

  /* Safety net: clip (not hidden, so sticky still works) any stray horizontal
     overflow so the page can never render wider than the phone screen. */
  .page {
    overflow-x: clip;
  }

  .library-layout {
    grid-template-columns: 1fr;
    gap: 0.9rem;
    margin-top: 1.3rem;
  }

  .hero {
    padding-top: 1.7rem;
  }

  .featured-banner {
    flex-direction: column;
    align-items: flex-start;
  }

  /* Horizontal, swipeable category pills instead of six stacked blocks.
     Kept within the content box (no negative-margin bleed) so the row can
     never push the page wider than the viewport. */
  .gauntlet-tabs-menu {
    position: relative;
    flex-direction: row;
    flex-wrap: nowrap;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    margin: 0;
    padding: 0.15rem 0 0.35rem;
  }

  .gauntlet-tabs-menu::-webkit-scrollbar {
    display: none;
  }

  /* Hints that more category pills are scrollable offscreen. */
  .gauntlet-tabs-menu::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0.35rem;
    width: 28px;
    background: linear-gradient(to right, transparent, var(--bg) 80%);
    pointer-events: none;
  }

  .gauntlet-tab {
    flex: 0 0 auto;
    width: auto;
    white-space: nowrap;
    border-radius: 999px;
    padding: 0.5rem 0.8rem;
    font-size: 0.85rem;
  }

  .category-filter-reset {
    grid-column: 1 / -1;
    width: 100%;
  }

  .hypothesis.book {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .book-rank {
    min-width: auto;
  }

  .open-link {
    margin-left: 0;
  }

  .resource-open-link {
    margin-left: auto;
  }

  .resource-actions {
    width: 100%;
  }

  .resource-actions .resource-progress-select {
    flex: 1;
    min-width: 0;
  }

  .youtube-cover {
    width: 108px;
    height: 60px;
  }

  .reading-list-item-actions {
    width: 100%;
  }

  .reading-list-item-actions .reading-list-status-select {
    flex: 1;
    min-width: 0;
  }

  /* On mobile, cards are full-width and narrow, so the desktop 3-line clamp
     hides too much and there's no hover tooltip. Use a uniform 4-line clamp
     and let a tap expand to the full text. */
  .resource-summary {
    -webkit-line-clamp: 4;
    cursor: pointer;
  }

  .resource-summary.is-expanded {
    -webkit-line-clamp: none;
    display: block;
    overflow: visible;
  }

  .site-footer-inner {
    flex-direction: column;
  }

  .back-to-top {
    right: 0.85rem;
    bottom: 0.85rem;
  }
}

/* ── Server-rendered resource cards (SEO + no-JS fallback) ──────────────────
   On the homepage these are injected into each category pane and replaced by
   the interactive cards once script.js runs. On the per-category static pages
   (/films/, /podcasts/, …) they are the primary, JS-free content. */
.ssr-card {
  display: block;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}
.ssr-card-heading {
  margin: 0;
  font: inherit;
}
.ssr-card-link {
  display: inline-block;
  font-family: "Hahmlet", Georgia, serif;
  font-weight: 600;
  font-size: 1.02rem;
  color: var(--text);
  text-decoration: none;
}
.ssr-card-link:hover {
  color: var(--link);
  text-decoration: underline;
}
.ssr-card-author {
  display: block;
  margin-top: 0.15rem;
  color: var(--muted);
  font-size: 0.88rem;
}
.ssr-card-summary {
  margin: 0.45rem 0 0;
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.45;
}
.ssr-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.55rem;
}
.ssr-card-pill {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-soft);
  padding: 0.18rem 0.55rem;
  font-size: 0.74rem;
  color: var(--muted);
}
.ssr-card-pill-level,
.level-pill {
  border-color: var(--accent-soft-border);
  background: var(--accent-soft);
  color: var(--accent-text);
}

/* Per-category static pages */
.category-page {
  max-width: 820px;
  margin: 0 auto;
  padding: 1.5rem 1.1rem 4rem;
}
.category-page-breadcrumb {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.75rem;
}
.category-page-breadcrumb a {
  color: var(--link);
}
.category-page-cta {
  margin: 0.5rem 0 1.5rem;
}
.category-page-cta a {
  color: var(--link);
  font-weight: 600;
}
.category-page .ssr-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.8rem;
}

/* ── Cross-category search view ─────────────────────────────────────────────
   While a text query is active, show every non-empty category pane stacked
   (each pane's .category-intro acts as the section header) and hide the panes
   that have no matches. */
.library-content.is-searching .w-tab-pane {
  display: block;
  animation: none;
}
.library-content.is-searching .w-tab-pane[data-empty="true"] {
  display: none;
}

/* ── Topic chips ────────────────────────────────────────────────────────── */
.topic-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  margin-top: 1rem;
}
.topic-chips-label {
  font-size: 0.85rem;
  color: var(--muted);
  margin-right: 0.2rem;
}
.topic-chip {
  font: inherit;
  font-size: 0.82rem;
  display: inline-block;
  padding: 0.32rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.topic-chip-all {
  font-weight: 600;
  color: var(--accent-text);
  border-style: dashed;
}
.topic-chip:hover {
  border-color: var(--accent);
  color: var(--accent-text);
  background: var(--accent-soft);
}
.topic-chip.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}
.topic-chip:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

/* ── "Start here" on-ramp ──────────────────────────────────────────────────*/
.starter-section {
  margin: 1.5rem auto 0;
  max-width: 1100px;
  padding: 1.25rem 1.1rem 0;
}
.starter-title {
  font-family: "Hahmlet", Georgia, serif;
  font-size: 1.25rem;
  margin: 0 0 0.25rem;
  color: var(--text);
}
.starter-copy {
  color: var(--muted);
  margin: 0 0 1rem;
  font-size: 0.95rem;
}

/* ── "Where do I start?" path chooser (homepage) ───────────────────────────*/
.paths-section {
  margin: 1.75rem auto 0;
  max-width: 1100px;
  padding: 0 1.1rem;
}
.paths-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.75rem;
}
.path-card {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.85rem 0.95rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  text-decoration: none;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.path-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: var(--shadow);
}
.path-card-kind {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent-text);
  font-weight: 700;
}
.path-card-title {
  font-family: "Hahmlet", Georgia, serif;
  font-weight: 600;
  color: var(--text);
}
.path-card-why {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.4;
}

/* ── Accounts: bar, local-only warning, and auth modal ───────────────────── */

.account-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 0.75rem;
  margin: 0 0 0.7rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-soft);
}

.account-prompt {
  font-size: 0.82rem;
  color: var(--muted);
}

.account-actions {
  display: inline-flex;
  gap: 0.4rem;
}

.account-identity {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.account-email {
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 16rem;
}

.account-sync {
  font-size: 0.72rem;
  color: var(--accent-text);
}

.account-sync.is-error {
  color: #b4452f;
}

[data-theme="dark"] .account-sync.is-error {
  color: #f0917c;
}

.account-button {
  appearance: none;
  cursor: pointer;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.4rem 0.7rem;
  transition: background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

.account-button:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.account-button:disabled,
.account-button.is-loading {
  opacity: 0.6;
  cursor: default;
}

.account-button-secondary {
  background: transparent;
  color: var(--accent-text);
  border-color: var(--accent-soft-border);
}

.account-button-secondary:hover {
  background: var(--accent-soft);
  border-color: var(--accent-soft-border);
}

.reading-list-warning {
  margin: 0 0 0.7rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--accent-soft-border);
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--text);
  font-size: 0.8rem;
  line-height: 1.45;
}

.reading-list-warning-cta {
  appearance: none;
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-weight: 600;
  color: var(--link);
  text-decoration: underline;
  cursor: pointer;
}

/* Modal */
.account-modal[hidden] {
  display: none;
}

.account-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.account-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 14, 8, 0.55);
}

.account-modal-dialog {
  position: relative;
  width: 100%;
  max-width: 22rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 1.4rem 1.3rem 1.2rem;
}

.account-modal-close {
  position: absolute;
  top: 0.5rem;
  right: 0.6rem;
  appearance: none;
  background: none;
  border: none;
  font-size: 1.4rem;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
}

.account-modal-title {
  margin: 0 0 0.25rem;
  font-family: "Hahmlet", Georgia, serif;
  font-size: 1.2rem;
}

.account-modal-subtitle {
  margin: 0 0 1rem;
  font-size: 0.83rem;
  color: var(--muted);
  line-height: 1.45;
}

.account-form {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.account-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
}

.account-field input {
  font: inherit;
  font-weight: 400;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--text);
}

.account-field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.account-form-error {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 500;
  color: #b4452f;
}

[data-theme="dark"] .account-form-error {
  color: #f0917c;
}

.account-form-error[hidden] {
  display: none;
}

.account-form-submit {
  margin-top: 0.2rem;
  padding: 0.55rem 0.7rem;
  font-size: 0.86rem;
}

.account-modal-switch {
  margin: 0.9rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
}

.account-link {
  appearance: none;
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-weight: 600;
  color: var(--link);
  cursor: pointer;
  text-decoration: underline;
}

body.account-modal-open {
  overflow: hidden;
}

/* Contact modal reuses the account modal styles; these cover its extras. */
.account-field textarea {
  font: inherit;
  font-weight: 400;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--text);
  resize: vertical;
  min-height: 6rem;
}

.account-field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.account-form-success {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--accent-text);
}

.account-form-success[hidden] {
  display: none;
}

/* Spam honeypot: visually gone but still submitted by naive bots. */
.honeypot-field {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  border: 0;
  padding: 0;
  margin: -1px;
}

/* ── "Recommended for you" cards (homepage) ────────────────────────────────
   Deliberately distinct from .path-card: accent-tinted, left-rule cards with
   a format pill and an italic "why" footnote, so personalized picks don't
   read as a second row of static paths. */
.recs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 0.75rem;
}
.rec-card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.9rem 1rem 0.95rem;
  border: 1px solid var(--accent-soft-border);
  border-left: 4px solid var(--accent);
  border-radius: 6px 14px 14px 6px;
  background: linear-gradient(135deg, var(--accent-soft), var(--surface) 75%);
  text-decoration: none;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.rec-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: var(--shadow);
}
.rec-card:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}
.rec-card-kind {
  align-self: flex-start;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
  color: var(--accent-text);
  background: var(--surface);
  border: 1px solid var(--accent-soft-border);
  border-radius: 999px;
  padding: 0.16rem 0.55rem;
}
.rec-card-title {
  font-family: "Hahmlet", Georgia, serif;
  font-weight: 600;
  color: var(--text);
}
.rec-card-author {
  font-size: 0.82rem;
  color: var(--muted);
}
.rec-card-why {
  margin-top: auto;
  padding-top: 0.3rem;
  font-size: 0.82rem;
  font-style: italic;
  color: var(--muted);
  line-height: 1.4;
}
.rec-card-why::before {
  content: "✦ ";
  font-style: normal;
  color: var(--accent-text);
}

/* ── Hub pages (/topics/, /paths/) ─────────────────────────────────────────*/
.hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.8rem;
  margin-top: 0.5rem;
}
.hub-card {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 1rem 1.05rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  text-decoration: none;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.hub-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: var(--shadow);
}
.hub-card-kind {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent-text);
  font-weight: 700;
}
.hub-card-title {
  font-family: "Hahmlet", Georgia, serif;
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--text);
}
.hub-card-meta {
  font-size: 0.78rem;
  color: var(--muted);
}
.hub-card-desc {
  font-size: 0.87rem;
  color: var(--muted);
  line-height: 1.45;
}

/* ── Learning-path page (ordered steps) ────────────────────────────────────*/
.path-steps {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.8rem;
}
.path-step {
  display: flex;
  gap: 0.85rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}
.path-step-num {
  flex: 0 0 auto;
  width: 1.75rem;
  height: 1.75rem;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
  font-size: 0.9rem;
}
.path-step-body {
  min-width: 0;
}
.path-step-link {
  font-family: "Hahmlet", Georgia, serif;
  font-weight: 600;
  font-size: 1.02rem;
  color: var(--text);
  text-decoration: none;
}
.path-step-link:hover {
  color: var(--link);
  text-decoration: underline;
}
.path-step-kind {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.2rem;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent-text);
  font-weight: 700;
}
.path-step-why {
  margin: 0.4rem 0 0;
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.45;
}
