:root {
  color-scheme: light;
  --cream: #faf7ee;
  --paper: #fffdf8;
  --navy: #17272c;
  --gold: #d8ae52;
  --gold-dark: #a77b25;
  --lavender: #eee8f3;
  --lavender-dark: #9b83af;
  --muted: #5f686a;
  --line: #c9c4b7;
  --danger: #9b2f2f;
  --shadow: 0 16px 45px rgba(23, 39, 44, 0.09);
  font-family: "Manrope", system-ui, sans-serif;
  color: var(--navy);
  background: var(--cream);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; background: var(--cream); }
button, input { font: inherit; }
button { cursor: pointer; }
h1, h2, h3 { margin: 0; font-family: "Cormorant Garamond", Georgia, serif; line-height: 1.02; }
h1 { font-size: clamp(2.7rem, 8vw, 5.8rem); letter-spacing: -0.04em; }
h2 { font-size: clamp(2rem, 5vw, 3.3rem); letter-spacing: -0.025em; }
h3 { font-size: 1.75rem; }
p { line-height: 1.7; }

.offline-banner { position: fixed; inset: 0 0 auto; z-index: 20; padding: 0.65rem 1rem; color: white; background: var(--gold-dark); text-align: center; font-size: 0.9rem; }
.site-header { position: sticky; top: 0; z-index: 10; display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 1rem clamp(1rem, 5vw, 4rem); border-bottom: 1px solid var(--line); background: rgba(250, 247, 238, 0.96); backdrop-filter: blur(12px); }
.brand { display: flex; align-items: center; gap: 0.8rem; color: var(--navy); text-decoration: none; font-family: "Cormorant Garamond", serif; font-size: 1.05rem; font-weight: 700; line-height: 0.98; }
.brand-mark { display: grid; place-items: center; width: 2.75rem; height: 2.75rem; border: 1px solid var(--navy); background: var(--gold); font: 700 0.8rem "Manrope", sans-serif; }
.header-actions, .hero-actions, .filter-row { display: flex; gap: 0.7rem; align-items: center; flex-wrap: wrap; }
.icon-button, .filter-button, .auth-tab, .text-button { border: 0; color: var(--navy); background: transparent; }
.icon-button { min-height: 44px; padding: 0.5rem; font-weight: 700; }

main { min-height: calc(100vh - 150px); }
.view { display: none; width: min(1180px, 100%); margin: 0 auto; padding: clamp(2rem, 6vw, 5rem) clamp(1rem, 5vw, 3rem) 7rem; }
.view.active { display: block; animation: reveal 0.28s ease-out; }
@keyframes reveal { from { opacity: 0; transform: translateY(8px); } }
.hero { position: relative; overflow: hidden; padding: clamp(2rem, 7vw, 6rem); border: 1px solid var(--navy); background: var(--paper); box-shadow: var(--shadow); }
.hero::after { content: ""; position: absolute; right: -5rem; bottom: -8rem; width: 24rem; height: 24rem; border: 4rem solid var(--lavender); border-radius: 50%; opacity: 0.75; }
.hero > * { position: relative; z-index: 1; }
.hero h1 { max-width: 850px; }
.hero-copy { max-width: 680px; margin: 1.5rem 0 2rem; font-size: clamp(1rem, 2vw, 1.2rem); }
.eyebrow { margin: 0 0 0.8rem; color: var(--gold-dark); font-size: 0.78rem; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; }
.button { display: inline-flex; min-height: 46px; align-items: center; justify-content: center; padding: 0.75rem 1.1rem; border: 1px solid var(--navy); border-radius: 0; font-weight: 800; }
.button-primary { color: white; background: var(--navy); }
.button-primary:hover { background: #273b41; }
.button-secondary { color: var(--navy); background: var(--paper); }
.button-ghost { border-color: transparent; color: var(--navy); background: transparent; text-decoration: underline; text-underline-offset: 0.3rem; }
.button.full { width: 100%; }

.section-block { margin-top: clamp(3rem, 7vw, 6rem); padding: clamp(1.2rem, 4vw, 3rem); border: 1px solid var(--line); background: var(--paper); }
.section-block.lavender { background: var(--lavender); }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 1rem; margin-bottom: 1.5rem; }
.progress-label { font-size: 0.85rem; font-weight: 700; }
.progress-track { width: 100%; height: 6px; margin-bottom: 1.5rem; background: #e4dfd3; }
.progress-track span { display: block; width: 0; height: 100%; background: var(--gold-dark); transition: width 0.3s ease; }
.continue-card { display: flex; justify-content: space-between; align-items: center; gap: 2rem; padding: clamp(1rem, 3vw, 2rem); border: 1px solid var(--navy); }
.continue-card p { max-width: 650px; margin-bottom: 0; color: var(--muted); }
.module-badge { display: inline-block; margin-bottom: 1rem; padding: 0.3rem 0.55rem; border: 1px solid currentColor; font-size: 0.72rem; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; }
.module-badge.free { color: #2d6d4c; }
.module-badge.premium { color: var(--gold-dark); }
.module-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.module-grid.wide { margin-top: 2rem; }
.module-card { display: flex; min-height: 310px; flex-direction: column; padding: 1.5rem; border: 1px solid var(--navy); background: var(--paper); }
.module-card p { color: var(--muted); }
.module-card footer { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: auto; padding-top: 1rem; border-top: 1px solid var(--line); }
.module-meta { font-size: 0.78rem; font-weight: 700; }
.boundary-note { margin: clamp(3rem, 7vw, 6rem) 0 0; padding: clamp(1.5rem, 4vw, 3rem); border-left: 8px solid var(--gold); background: var(--navy); color: white; }
.boundary-note h2 { font-size: 2.2rem; }
.boundary-note p { max-width: 760px; margin-bottom: 0; }

.page-intro { max-width: 850px; }
.page-intro p:last-child { max-width: 720px; font-size: 1.1rem; }
.filter-row { margin-top: 2rem; }
.filter-button { min-height: 42px; padding: 0.55rem 1rem; border: 1px solid var(--navy); font-weight: 700; }
.filter-button.active { color: white; background: var(--navy); }
.back-button { margin-bottom: 2rem; padding: 0; font-weight: 800; text-decoration: underline; text-underline-offset: 0.3rem; }
.module-hero { display: grid; grid-template-columns: 1fr 0.55fr; border: 1px solid var(--navy); background: var(--paper); }
.module-hero-copy { padding: clamp(1.5rem, 5vw, 4rem); }
.module-summary { display: grid; align-content: center; gap: 1rem; padding: clamp(1.5rem, 4vw, 3rem); border-left: 1px solid var(--navy); background: var(--lavender); }
.summary-item span { display: block; color: var(--muted); font-size: 0.72rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.lesson-list { margin-top: 2rem; border: 1px solid var(--navy); background: var(--paper); }
.lesson { display: grid; grid-template-columns: auto 1fr auto; gap: 1rem; align-items: center; padding: 1.25rem; border-bottom: 1px solid var(--line); }
.lesson:last-child { border-bottom: 0; }
.lesson-number { display: grid; place-items: center; width: 2.2rem; height: 2.2rem; border: 1px solid var(--navy); font-weight: 800; }
.lesson h3 { font-size: 1.35rem; }
.lesson p { margin: 0.2rem 0 0; color: var(--muted); font-size: 0.9rem; }
.lesson-complete { min-width: 44px; min-height: 44px; border: 1px solid var(--navy); background: var(--paper); }
.lesson-complete.done { color: white; background: #2d6d4c; }
.locked-note { margin-top: 2rem; padding: 1.5rem; border: 1px solid var(--gold-dark); background: #fff8e7; }

.principles-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-top: 3rem; }
.principles-grid article { min-height: 300px; padding: 2rem; border: 1px solid var(--navy); background: var(--paper); }
.principles-grid article span { color: var(--gold-dark); font-weight: 800; }
.principles-grid h2 { margin-top: 3rem; }
.auth-layout { display: grid; grid-template-columns: 1fr minmax(320px, 480px); gap: clamp(2rem, 8vw, 7rem); align-items: start; }
.auth-card { padding: clamp(1.5rem, 4vw, 2.5rem); border: 1px solid var(--navy); background: var(--paper); box-shadow: var(--shadow); }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; margin-bottom: 1.5rem; border: 1px solid var(--navy); }
.auth-tab { min-height: 46px; font-weight: 800; }
.auth-tab.active { color: white; background: var(--navy); }
label { display: grid; gap: 0.45rem; margin-bottom: 1rem; font-size: 0.9rem; font-weight: 800; }
input { min-height: 48px; width: 100%; padding: 0.7rem; border: 1px solid var(--navy); border-radius: 0; background: white; color: var(--navy); }
.form-help { margin: -0.3rem 0 1rem; color: var(--muted); font-size: 0.78rem; }
.form-message { min-height: 1.5rem; margin-bottom: 0; color: var(--danger); font-size: 0.85rem; }
#reset-password { margin-top: 1rem; text-decoration: underline; }

.bottom-nav { position: fixed; z-index: 12; inset: auto 0 0; display: none; grid-template-columns: repeat(4, 1fr); padding-bottom: env(safe-area-inset-bottom); border-top: 1px solid var(--line); background: var(--paper); }
.nav-item { min-height: 62px; border: 0; color: var(--muted); background: transparent; font-size: 0.72rem; font-weight: 800; }
.nav-item span { display: block; margin-bottom: 0.2rem; font-size: 1.1rem; }
.nav-item.active { color: var(--navy); background: var(--lavender); }
dialog { width: min(520px, calc(100% - 2rem)); padding: 2rem; border: 1px solid var(--navy); border-radius: 0; background: var(--paper); color: var(--navy); }
dialog::backdrop { background: rgba(23, 39, 44, 0.72); }
.dialog-close { float: right; border: 0; background: transparent; font-size: 1.8rem; }

@media (max-width: 820px) {
  .site-header { padding: 0.75rem 1rem; }
  .brand { font-size: 0.92rem; }
  .brand-mark { width: 2.35rem; height: 2.35rem; }
  .header-actions .button { display: none; }
  .view { padding-top: 2rem; padding-bottom: 7rem; }
  .hero { padding: 2rem 1.25rem 5rem; }
  .hero::after { right: -10rem; bottom: -14rem; }
  .module-grid, .principles-grid, .auth-layout, .module-hero { grid-template-columns: 1fr; }
  .continue-card { align-items: stretch; flex-direction: column; }
  .module-summary { border-top: 1px solid var(--navy); border-left: 0; }
  .bottom-nav { display: grid; }
}

@media (max-width: 520px) {
  h1 { font-size: 2.8rem; }
  .section-heading { align-items: start; flex-direction: column; }
  .lesson { grid-template-columns: auto 1fr; }
  .lesson-complete { grid-column: 1 / -1; width: 100%; }
}

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