/* AI Without Fear — calm, large-type, high-contrast school UI */

:root {
  --bg: #f7f4ef;
  --bg-card: #ffffff;
  --bg-soft: #efe9df;
  --ink: #1c1917;
  --ink-muted: #57534e;
  --accent: #1d5c4a;
  --accent-hover: #164839;
  --accent-soft: #dceee8;
  --border: #d6d0c6;
  --focus: #0f766e;
  --success: #166534;
  --warn-bg: #fef3c7;
  --warn-ink: #78350f;
  --danger-soft: #fee2e2;
  --header-bg: rgba(247, 244, 239, 0.92);
  --footer-bg: #f1ebe2;
  --glow-a: #e7f2ee;
  --glow-b: #f3e9d8;
  --card-hover: #fbfaf8;
  --on-accent: #ffffff;
  --logo-bg: #ffffff;
  --cta-grad-a: #1d5c4a;
  --cta-grad-b: #2a6f5c;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(28, 25, 23, 0.06), 0 8px 24px rgba(28, 25, 23, 0.06);
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
  --measure: 42rem;
  --space: clamp(1rem, 2vw, 1.5rem);
  color-scheme: light;
}

html[data-theme="dark"] {
  --bg: #12161a;
  --bg-card: #1c2229;
  --bg-soft: #262e37;
  --ink: #f0ebe3;
  --ink-muted: #b7b0a6;
  --accent: #5dba9e;
  --accent-hover: #7dcfb4;
  --accent-soft: #1a3d34;
  --border: #3a4450;
  --focus: #5dba9e;
  --success: #6ee7a8;
  --warn-bg: #3d2e12;
  --warn-ink: #fde68a;
  --danger-soft: #3f1d1d;
  --header-bg: rgba(18, 22, 26, 0.94);
  --footer-bg: #0e1216;
  --glow-a: #1a2e28;
  --glow-b: #2a2418;
  --card-hover: #232a32;
  --on-accent: #0c1210;
  --logo-bg: #ffffff;
  --cta-grad-a: #1f6b56;
  --cta-grad-b: #2f8570;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 10px 28px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

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

html {
  font-size: 112.5%; /* ~18px base for older eyes */
  scroll-behavior: smooth;
}

@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;
  }
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  line-height: 1.65;
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 10% -10%, var(--glow-a) 0%, transparent 55%),
    radial-gradient(900px 400px at 100% 0%, var(--glow-b) 0%, transparent 50%),
    var(--bg);
  transition: background-color 0.2s ease, color 0.2s ease;
}

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

a {
  color: var(--accent);
  text-underline-offset: 0.15em;
}

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

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

.skip-link {
  position: absolute;
  left: 1rem;
  top: -100px;
  z-index: 1000;
  background: var(--ink);
  color: var(--bg);
  padding: 0.75rem 1rem;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
}

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

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

.header-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 44px;
  min-width: 44px;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  border: 2px solid var(--border);
  background: var(--bg-card);
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  box-shadow: var(--shadow);
  flex-shrink: 0;
}

.theme-toggle:hover {
  background: var(--bg-soft);
  border-color: var(--accent);
}

.theme-toggle-icon {
  font-size: 1.1rem;
  line-height: 1;
}

.header-inner,
.footer-inner,
.container {
  width: min(1100px, calc(100% - 2rem));
  margin-inline: auto;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 0;
  flex-wrap: wrap;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: var(--ink);
  font-weight: 700;
  font-size: 1.1rem;
}

.brand-logo {
  width: 3rem;
  height: 3rem;
  object-fit: contain;
  border-radius: 12px;
  background: var(--logo-bg);
  box-shadow: var(--shadow);
  flex-shrink: 0;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  gap: 0.1rem;
}

.brand-text strong {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.brand-text span {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-muted);
}

.hero-logo {
  display: block;
  width: min(200px, 50vw);
  height: auto;
  margin: 0 0 1rem;
  border-radius: 20px;
  background: var(--logo-bg);
  box-shadow: var(--shadow);
  padding: 0.35rem;
}

@media (max-width: 859px) {
  .hero-logo {
    margin-inline: auto;
  }
}

.footer-logo {
  width: 3.5rem;
  height: 3.5rem;
  object-fit: contain;
  border-radius: 12px;
  background: var(--logo-bg);
  box-shadow: var(--shadow);
  margin-bottom: 0.5rem;
}

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

.nav a {
  text-decoration: none;
  color: var(--ink-muted);
  font-weight: 600;
  padding: 0.5rem 0.75rem;
  border-radius: 999px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.nav a:hover,
.nav a[aria-current="page"] {
  color: var(--ink);
  background: var(--bg-soft);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 48px;
  padding: 0.7rem 1.25rem;
  border-radius: 999px;
  border: 2px solid transparent;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.btn-primary {
  background: var(--accent);
  color: var(--on-accent);
}

.btn-primary:hover {
  background: var(--accent-hover);
  color: var(--on-accent);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--ink);
  border-color: var(--border);
}

.btn-secondary:hover {
  background: var(--bg-soft);
  color: var(--ink);
}

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

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

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

main {
  padding: 2rem 0 4rem;
}

.hero {
  display: grid;
  gap: 1.75rem;
  padding: 1.5rem 0 2.5rem;
}

@media (min-width: 860px) {
  .hero {
    grid-template-columns: 1.2fr 0.8fr;
    align-items: center;
    padding-top: 2.5rem;
  }
}

.eyebrow {
  display: inline-block;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  margin-bottom: 0.75rem;
}

h1,
h2,
h3 {
  line-height: 1.25;
  letter-spacing: -0.02em;
  margin: 0 0 0.75rem;
}

h1 {
  font-size: clamp(2rem, 4vw, 2.85rem);
}

h2 {
  font-size: clamp(1.45rem, 2.5vw, 1.85rem);
}

h3 {
  font-size: 1.2rem;
}

.lede {
  font-size: 1.15rem;
  color: var(--ink-muted);
  max-width: 38rem;
  margin: 0 0 1.5rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.trust-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1rem;
  color: var(--ink-muted);
  font-size: 0.98rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.trust-row li {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.trust-row li::before {
  content: "✓";
  color: var(--success);
  font-weight: 800;
}

.hero-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 4px);
  box-shadow: var(--shadow);
  padding: 1.35rem;
}

.hero-card h2 {
  font-size: 1.25rem;
}

.progress-meter {
  margin: 1rem 0 0.5rem;
}

.progress-track {
  height: 12px;
  background: var(--bg-soft);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), #3d8f78);
  border-radius: inherit;
  transition: width 0.35s ease;
}

.progress-label {
  margin-top: 0.45rem;
  color: var(--ink-muted);
  font-size: 0.95rem;
}

.section {
  padding: 1.5rem 0;
}

.section-header {
  margin-bottom: 1.25rem;
  max-width: 40rem;
}

.section-header p {
  color: var(--ink-muted);
  margin: 0;
  font-size: 1.05rem;
}

.grid-3 {
  display: grid;
  gap: 1rem;
}

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

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

.card p:last-child {
  margin-bottom: 0;
}

.card-icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 800;
  margin-bottom: 0.75rem;
}

.muted {
  color: var(--ink-muted);
}

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--footer-bg);
  padding: 2rem 0;
  color: var(--ink-muted);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: space-between;
  align-items: flex-start;
}

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

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

/* Course page */
.page-title {
  margin-bottom: 0.35rem;
}

.pathway-meta {
  color: var(--ink-muted);
  margin: 0 0 1.5rem;
}

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

.lesson-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.lesson-link {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 1rem;
  align-items: center;
  padding: 1rem 1.15rem;
  text-decoration: none;
  color: inherit;
  min-height: 72px;
}

.lesson-link:hover {
  background: var(--card-hover);
}

.lesson-num {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 800;
  background: var(--bg-soft);
  color: var(--ink);
  border: 2px solid var(--border);
}

.lesson-item.is-complete .lesson-num {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.lesson-title {
  font-weight: 700;
  font-size: 1.08rem;
  margin: 0 0 0.15rem;
}

.lesson-meta {
  margin: 0;
  color: var(--ink-muted);
  font-size: 0.95rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
  white-space: nowrap;
}

.badge-done {
  background: var(--accent-soft);
  color: var(--success);
}

.badge-todo {
  background: var(--bg-soft);
  color: var(--ink-muted);
}

/* Lesson reader */
.lesson-layout {
  display: grid;
  gap: 1.25rem;
}

@media (min-width: 960px) {
  .lesson-layout {
    grid-template-columns: minmax(0, 1fr) 16rem;
    align-items: start;
  }
}

.lesson-article {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 2px);
  box-shadow: var(--shadow);
  padding: clamp(1.25rem, 3vw, 2rem);
  max-width: calc(var(--measure) + 4rem);
}

.lesson-kicker {
  color: var(--ink-muted);
  font-weight: 600;
  margin: 0 0 0.5rem;
}

.lesson-article .content {
  max-width: var(--measure);
  font-size: 1.08rem;
}

.lesson-article .content p,
.lesson-article .content li {
  max-width: 65ch;
}

.lesson-article .content h2 {
  margin-top: 1.75rem;
}

.lesson-article .content ul {
  padding-left: 1.25rem;
}

.callout {
  background: var(--bg-soft);
  border-left: 4px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 1rem 1.1rem;
  margin: 1.25rem 0;
}

.callout.reassure {
  background: var(--accent-soft);
}

.callout.warn {
  background: var(--warn-bg);
  border-left-color: #d97706;
  color: var(--warn-ink);
}

.callout strong {
  display: block;
  margin-bottom: 0.25rem;
}

.lesson-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.sidebar {
  display: grid;
  gap: 1rem;
}

.side-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
}

.side-card h2 {
  font-size: 1rem;
  margin-bottom: 0.65rem;
}

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

.toc a {
  text-decoration: none;
  color: var(--ink-muted);
  font-weight: 600;
  display: block;
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  min-height: 44px;
}

.toc a:hover,
.toc a.is-active {
  background: var(--bg-soft);
  color: var(--ink);
}

.toc a.is-done::after {
  content: " ✓";
  color: var(--success);
}

/* Glossary */
.glossary-list {
  display: grid;
  gap: 0.85rem;
}

.glossary-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  box-shadow: var(--shadow);
}

.glossary-item dt {
  font-weight: 800;
  font-size: 1.1rem;
  margin-bottom: 0.35rem;
}

.glossary-item dd {
  margin: 0;
  color: var(--ink-muted);
}

.search-box {
  width: 100%;
  max-width: 28rem;
  min-height: 48px;
  padding: 0.7rem 1rem;
  border: 2px solid var(--border);
  border-radius: 12px;
  font: inherit;
  background: var(--bg-card);
  margin-bottom: 1.25rem;
}

.search-box:focus {
  border-color: var(--focus);
  outline: none;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.2);
}

/* Help page */
.help-list {
  display: grid;
  gap: 1rem;
}

.help-list details {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  box-shadow: var(--shadow);
}

.help-list summary {
  font-weight: 700;
  cursor: pointer;
  min-height: 44px;
  display: flex;
  align-items: center;
}

.help-list details p {
  color: var(--ink-muted);
  margin: 0.75rem 0 0.25rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.notice {
  background: var(--warn-bg);
  color: var(--warn-ink);
  border: 1px solid #fcd34d;
  border-radius: 12px;
  padding: 0.85rem 1rem;
  margin: 1rem 0;
}

.complete-banner {
  display: none;
  background: var(--accent-soft);
  color: var(--success);
  border: 1px solid #86c5b0;
  border-radius: 12px;
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
  font-weight: 700;
}

.complete-banner.show {
  display: block;
}

.cta-band {
  margin-top: 2rem;
  background: linear-gradient(135deg, var(--cta-grad-a), var(--cta-grad-b));
  color: #fff;
  border-radius: calc(var(--radius) + 4px);
  padding: clamp(1.25rem, 3vw, 2rem);
  box-shadow: var(--shadow);
}

.cta-band p {
  opacity: 0.95;
  max-width: 36rem;
}

.cta-band .btn-primary {
  background: #fff;
  color: #1d5c4a;
}

.cta-band .btn-primary:hover {
  background: #f0fdf9;
  color: #164839;
}

html[data-theme="dark"] .cta-band .btn-primary {
  color: #0c1210;
}

@media (max-width: 600px) {
  .lesson-link {
    grid-template-columns: auto 1fr;
  }

  .lesson-link .badge {
    grid-column: 2;
    justify-self: start;
  }
}

/* Save progress / email link */
.field-label {
  display: block;
  font-weight: 700;
  margin-bottom: 0.4rem;
}

.field-hint {
  margin: 0.35rem 0 0;
  font-size: 0.95rem;
}

.link-box {
  width: 100%;
  min-height: 5rem;
  padding: 0.75rem 1rem;
  border: 2px solid var(--border);
  border-radius: 12px;
  font: inherit;
  font-size: 0.95rem;
  line-height: 1.45;
  background: var(--bg-soft);
  color: var(--ink);
  resize: vertical;
  word-break: break-all;
}

.link-box:focus {
  border-color: var(--focus);
  outline: none;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.2);
}

.form-status {
  min-height: 1.4em;
  margin: 0.75rem 0 0;
  font-weight: 600;
  color: var(--accent);
}

.save-form .search-box {
  max-width: none;
}

/* Payment page */
.pay-grid {
  display: grid;
  gap: 1rem;
  margin: 1.25rem 0;
}

@media (min-width: 760px) {
  .pay-grid {
    grid-template-columns: 1fr 1fr;
    align-items: stretch;
  }
}

.pay-card {
  display: flex;
  flex-direction: column;
}

.pay-card .btn {
  margin-top: auto;
  align-self: flex-start;
}

.pay-card-featured {
  border-color: var(--accent);
  box-shadow: var(--shadow), 0 0 0 1px var(--accent-soft);
}

.price-tag {
  font-size: 2rem;
  font-weight: 800;
  margin: 0.25rem 0 0.35rem;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.pay-list {
  margin: 0.75rem 0 1.25rem;
  padding-left: 1.2rem;
  color: var(--ink-muted);
}

.pay-list li {
  margin-bottom: 0.35rem;
}

code {
  font-size: 0.9em;
  background: var(--bg-soft);
  padding: 0.1em 0.35em;
  border-radius: 6px;
  word-break: break-all;
}
