:root {
  color-scheme: light dark;
  /* novella_sepia - matches app ReadingThemePreset.novellaSepia */
  --bg: #f4efe6;
  --surface: #fbf8f2;
  --text: #332c25;
  --text-muted: #524a42;
  --border: #938e88;
  --accent: #7a3f30;
  --accent-soft: rgba(122, 63, 48, 0.14);
  --on-accent: #fbf8f2;
  --success: #8f4a38;
  --shadow: 0 18px 48px rgba(51, 44, 37, 0.1);
  --radius: 16px;
  --radius-sm: 10px;
  --max: 1080px;
  --font: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #080605;
    --surface: #1e1a17;
    --text: #e8e3db;
    --text-muted: #c4bdb4;
    --border: #7a7670;
    --accent: #e0a797;
    --accent-soft: rgba(224, 167, 151, 0.18);
    /* Dark enough for 4.5:1 on --accent filled buttons (WCAG AA) */
    --on-accent: #261812;
    --shadow: 0 18px 48px rgba(0, 0, 0, 0.4);
  }
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

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

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

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

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  padding: 0.75rem 1rem;
  background: var(--accent);
  color: var(--on-accent);
  text-decoration: none;
  border-radius: var(--radius-sm);
}

.skip-link:focus {
  left: 1rem;
  top: 1rem;
}

.container {
  width: min(100% - 2.5rem, var(--max));
  margin-inline: auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand img {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.nav {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav a:not(.btn) {
  text-decoration: none;
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 600;
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav a:not(.btn):hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.8rem 1.25rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.95rem;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn--primary {
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: 0 10px 24px color-mix(in srgb, var(--accent) 35%, transparent);
}

.btn--primary:hover {
  background: color-mix(in srgb, var(--accent) 88%, var(--text));
}

.btn--ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn--ghost:hover {
  background: var(--accent-soft);
  border-color: transparent;
}

.hero {
  padding: 3.5rem 0 2.5rem;
}

.hero__grid {
  display: grid;
  gap: 2.5rem;
  align-items: center;
}

@media (min-width: 860px) {
  .hero__grid {
    grid-template-columns: 1.1fr 0.9fr;
  }
}

.eyebrow {
  display: inline-block;
  margin: 0 0 0.75rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.hero h1 {
  margin: 0 0 1rem;
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1.12;
  letter-spacing: -0.03em;
}

.hero__lead {
  margin: 0 0 1.5rem;
  font-size: 1.12rem;
  color: var(--text-muted);
  max-width: 38ch;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.hero__note {
  margin: 0;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.hero .content-meta {
  margin: 0.75rem 0 0;
  font-size: 0.85rem;
}

.hero__card {
  background: var(--surface);
  border: 1px solid color-mix(in srgb, var(--border) 45%, transparent);
  border-radius: calc(var(--radius) + 4px);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

.hero__card-logo {
  display: block;
  width: min(220px, 70%);
  margin: 0 auto 1.25rem;
}

.stat-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.85rem;
}

.stat-list li {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--bg) 65%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--border) 35%, transparent);
}

.stat-list strong {
  display: block;
  font-size: 0.95rem;
}

.stat-list span {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.stat-icon {
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
}

.stat-icon svg {
  display: block;
}

.section {
  padding: 3.25rem 0;
}

.section--surface {
  background: var(--surface);
  border-block: 1px solid color-mix(in srgb, var(--border) 35%, transparent);
}

.section__head {
  max-width: 42rem;
  margin-bottom: 2rem;
}

.section__head h2 {
  margin: 0 0 0.65rem;
  font-size: clamp(1.5rem, 3vw, 2rem);
  letter-spacing: -0.02em;
}

.section__head p {
  margin: 0;
  color: var(--text-muted);
}

.feature-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.feature {
  padding: 1.25rem;
  border-radius: var(--radius);
  background: var(--bg);
  border: 1px solid color-mix(in srgb, var(--border) 40%, transparent);
}

.feature h3 {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
}

.feature p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.steps {
  display: grid;
  gap: 1rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

@media (min-width: 720px) {
  .steps {
    grid-template-columns: repeat(3, 1fr);
  }
}

.step {
  padding: 1.25rem;
  border-radius: var(--radius);
  border: 1px solid color-mix(in srgb, var(--border) 40%, transparent);
  background: var(--surface);
}

.step__num {
  display: inline-flex;
  width: 2rem;
  height: 2rem;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 800;
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
}

.download {
  text-align: center;
  padding: 3.5rem 0 4rem;
}

.download h2 {
  margin: 0 0 0.75rem;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
}

.download p {
  margin: 0 auto 1.5rem;
  max-width: 40ch;
  color: var(--text-muted);
}

.store-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  justify-content: center;
}

.store-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 210px;
  padding: 0.8rem 1.1rem;
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  border: 1px solid color-mix(in srgb, var(--border) 55%, transparent);
  text-decoration: none;
  font-weight: 700;
  transition: border-color 0.15s ease, background 0.15s ease;
}

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

.store-btn:not(.store-btn--disabled) {
  background: color-mix(in srgb, var(--text) 92%, var(--bg));
  color: var(--surface);
  border-color: transparent;
}

.store-btn__icon {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  opacity: 0.9;
}

.store-btn__text {
  font-size: 1.05rem;
  text-align: left;
  line-height: 1.2;
}

.store-btn__text small {
  display: block;
  font-weight: 600;
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}

.store-btn:not(.store-btn--disabled) .store-btn__text small {
  color: color-mix(in srgb, var(--surface) 75%, transparent);
}

.store-btn--disabled {
  pointer-events: none;
  cursor: default;
  border-style: dashed;
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
}

.store-btn--disabled .store-btn__icon {
  color: var(--accent);
}

.store-soon {
  margin: 0.85rem 0 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent);
}

.disclaimer {
  margin: 2rem auto 0;
  max-width: 52ch;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.site-footer {
  padding: 2rem 0 2.5rem;
  border-top: 1px solid color-mix(in srgb, var(--border) 35%, transparent);
  color: var(--text-muted);
  font-size: 0.9rem;
}

.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: space-between;
  align-items: center;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

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

.footer-links a:hover {
  color: var(--text);
}

/* Legal pages */
.legal-page {
  padding: 2rem 0 3rem;
}

.legal-page h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.75rem, 4vw, 2.25rem);
}

.legal-page .meta {
  color: var(--text-muted);
  margin: 0 0 2rem;
  font-size: 0.92rem;
}

.legal-page section {
  margin-bottom: 1.75rem;
}

.legal-page h2 {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
}

.legal-page p {
  margin: 0 0 0.75rem;
  color: var(--text-muted);
}

.legal-page ul {
  margin: 0 0 0.75rem;
  padding-left: 1.25rem;
  color: var(--text-muted);
}

.legal-page li {
  margin-bottom: 0.35rem;
}

.back-link {
  display: inline-flex;
  margin-bottom: 1.5rem;
  font-weight: 600;
  text-decoration: none;
}

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

#faq .section__head {
  margin-inline: auto;
  text-align: center;
}

.faq-list {
  display: grid;
  gap: 0.65rem;
  max-width: 42rem;
  margin-inline: auto;
}

.faq-list--seo {
  gap: 1.25rem;
}

.faq-entry {
  padding: 1rem 1.1rem;
  border: 1px solid color-mix(in srgb, var(--border) 40%, transparent);
  border-radius: var(--radius-sm);
  background: var(--surface);
  text-align: left;
}

.faq-entry h3 {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
  color: var(--text);
}

.faq-entry p {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.55;
}

.faq-item {
  border: 1px solid color-mix(in srgb, var(--border) 40%, transparent);
  border-radius: var(--radius-sm);
  background: var(--surface);
  overflow: hidden;
}

.faq-item summary {
  padding: 1rem 1.1rem;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::after {
  content: "+";
  float: right;
  color: var(--accent);
  font-weight: 800;
}

.faq-item[open] summary::after {
  content: "−";
}

.faq-item p {
  margin: 0;
  padding: 0 1.1rem 1rem;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.5rem;
  margin: 0 0 1.25rem;
  padding: 0;
  list-style: none;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.breadcrumb a {
  font-weight: 600;
  text-decoration: none;
}

.breadcrumb a:hover {
  text-decoration: underline;
}

.breadcrumb li + li::before {
  content: "/";
  margin-right: 0.5rem;
  color: var(--border);
}

.content-page {
  padding: 2rem 0 3.5rem;
}

.content-page h1 {
  margin: 0 0 1rem;
  font-size: clamp(1.75rem, 4vw, 2.35rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.content-lead {
  margin: 0 0 1.5rem;
  font-size: 1.1rem;
  color: var(--text-muted);
  max-width: 52ch;
}

.content-prose h2 {
  margin: 2rem 0 0.65rem;
  font-size: 1.2rem;
}

.content-prose p,
.content-prose li {
  color: var(--text-muted);
  line-height: 1.6;
}

.content-prose ul,
.content-prose ol {
  margin: 0 0 1rem;
  padding-left: 1.25rem;
}

.content-prose li {
  margin-bottom: 0.4rem;
}

.exam-topics {
  display: grid;
  gap: 0.85rem;
  margin: 0;
  padding: 0;
  list-style: none;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.exam-topics li {
  padding: 1rem 1.1rem;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid color-mix(in srgb, var(--border) 40%, transparent);
}

.exam-topics strong {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 1rem;
  color: var(--text);
}

.exam-topics span {
  display: block;
  font-size: 0.92rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.exam-topics a {
  color: var(--accent);
}

.section__foot {
  margin: 1.25rem 0 0;
  font-size: 0.95rem;
  color: var(--text-muted);
}

.trust-strip {
  margin: 0 0 1.75rem;
  padding: 0.65rem 1rem;
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
}

.download-bullets {
  max-width: 28rem;
  margin: 0 auto 1.5rem;
  padding: 0;
  list-style: none;
  text-align: left;
}

.download-bullets li {
  position: relative;
  padding-left: 1.35rem;
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
  color: var(--text-muted);
}

.download-bullets li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--accent);
  font-weight: 700;
}

.content-meta {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 1.5rem;
}

.download-prose {
  max-width: 40rem;
  margin: 0 auto 1.5rem;
  text-align: center;
}

.download-prose p {
  margin-bottom: 0.85rem;
}

.content-faq {
  margin-top: 2.5rem;
}

.content-faq h2 {
  margin-bottom: 1rem;
  font-size: 1.35rem;
}

.content-faq .faq-list {
  max-width: none;
  margin-inline: 0;
}

.topic-hub-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.topic-card {
  display: block;
  padding: 1.2rem;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid color-mix(in srgb, var(--border) 40%, transparent);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.topic-card:hover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent-soft) 50%, var(--surface));
}

.topic-card h2,
.topic-card h3 {
  margin: 0 0 0.45rem;
  font-size: 1.05rem;
  color: var(--text);
}

.topic-card p {
  margin: 0;
  font-size: 0.92rem;
  color: var(--text-muted);
}

.cta-banner {
  margin-top: 2.5rem;
  padding: 1.35rem 1.5rem;
  border-radius: var(--radius);
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  text-align: center;
}

.cta-banner h2 {
  margin: 0 0 0.5rem;
  font-size: 1.15rem;
}

.cta-banner p {
  margin: 0 0 1rem;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.related-topics {
  margin-top: 2.5rem;
  padding-top: 2rem;
  border-top: 1px solid color-mix(in srgb, var(--border) 35%, transparent);
}

.related-topics h2 {
  margin: 0 0 1rem;
  font-size: 1.1rem;
}

.related-topics ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.5rem;
}

.related-topics a {
  font-weight: 600;
}

.theory-section {
  margin-bottom: 3rem;
}

.theory-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.theory-grid--chapters {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.theory-card {
  display: flex;
  flex-direction: column;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid color-mix(in srgb, var(--border) 40%, transparent);
  overflow: hidden;
}

.theory-card--link {
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.theory-card--link:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.theory-card img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: contain;
  background: color-mix(in srgb, var(--bg) 80%, var(--surface));
  padding: 0.65rem;
}

.theory-card__body {
  padding: 1rem 1.1rem 1.15rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.theory-card h2,
.theory-card h3 {
  margin: 0 0 0.45rem;
  font-size: 1.02rem;
  line-height: 1.3;
  color: var(--text);
}

.theory-card p {
  margin: 0;
  flex: 1;
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.theory-card__link {
  margin-top: 0.75rem;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
}

.theory-card__link:hover {
  text-decoration: underline;
}

/* Stronger contrast when user or OS requests more contrast */
@media (prefers-contrast: more) {
  :root {
    --text-muted: #3d362f;
    --border: #6d6760;
    --accent: #6b3528;
  }

  @media (prefers-color-scheme: dark) {
    :root {
      --text-muted: #d8d2ca;
      --border: #9a9590;
      --accent: #ecb5a8;
      --on-accent: #1a100c;
    }
  }
}
