/* Praeclaris site styles.
   Color is a signal, not decoration. Each accent has one job, everywhere:
     Blue (--accent)   = interactive: links, buttons, focus, "you can click this"
     Gold (--gold-*)   = earned: XP, ranks, badges, highlights, the brand
     Green (--ok)      = correct, done, fact
     Red (--bad)       = wrong, myth
     Amber (--warn)    = protect, caution
     Cyan / Violet / Magenta (--lvl-1..3) = Beginner / Intermediate / Advanced
   Light theme is the default (vivid accents on a warm off-white, so it's never pure-white glare).
   Every text pair meets WCAG AA (4.5:1) or better; see the contrast notes in README.md. */
:root {
  --bg: #faf8f3;
  --bg-2: #f1ece1;
  --panel: #ffffff;
  --panel-2: #f7f3ea;
  --line: #d9d1c1;
  --line-strong: #8f836b;
  --text: #1a1712;
  --muted: #4a443a;

  --accent: #1d4ed8;
  --accent-strong: #1e3a8a;
  --accent-soft: #dbe6ff;
  --on-accent: #ffffff;

  --gold: #8a5a00;
  --gold-fill: #f5b800;
  --gold-soft: #fff1c2;
  --gold-line: #a87700;
  --on-gold: #1a1406;

  --ok: #03684b;  --ok-soft: #d6f5e6;
  --bad: #b91c1c; --bad-soft: #fde2e2;
  --warn: #8a4200; --warn-soft: #ffedc7;

  --lvl-1: #0b6680; --lvl-1-soft: #d7f4fa;
  --lvl-2: #6d28d9; --lvl-2-soft: #ece4ff;
  --lvl-3: #a21caf; --lvl-3-soft: #f9e3fc;

  --hero-1: rgba(245,184,0,.16);
  --hero-2: rgba(29,78,216,.08);
  --shadow: 0 1px 2px rgba(26,23,18,.06), 0 6px 20px -12px rgba(26,23,18,.18);
  --radius: 14px;
  --serif: "Cinzel", "Trajan Pro", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --max: 1120px;
  color-scheme: light;
}

/* Dark theme, chosen with the header toggle. */
:root[data-theme="dark"] {
  --bg: #0f1014;
  --bg-2: #16171d;
  --panel: #1b1d24;
  --panel-2: #22242d;
  --line: #343744;
  --line-strong: #7a7f92;
  --text: #f1efe9;
  --muted: #c4c1b8;
  --accent: #7aa7ff;
  --accent-strong: #a9c5ff;
  --accent-soft: #1f2d52;
  --on-accent: #0b1020;
  --gold: #f5c84c;
  --gold-fill: #f5b800;
  --gold-soft: #3a2f10;
  --gold-line: #c9962a;
  --ok: #4fd1a1;  --ok-soft: #12352a;
  --bad: #ff8a8a; --bad-soft: #3d1a1a;
  --warn: #ffb547; --warn-soft: #3a2a10;
  --lvl-1: #4fd6f0; --lvl-1-soft: #0e3440;
  --lvl-2: #b9a2ff; --lvl-2-soft: #2a1f4d;
  --lvl-3: #f08cff; --lvl-3-soft: #3b1640;
  --hero-1: rgba(245,184,0,.12);
  --hero-2: rgba(122,167,255,.08);
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px -16px rgba(0,0,0,.6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 17px/1.65 var(--sans); -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent-strong); text-decoration-thickness: 2px; }
h1, h2 { font-family: var(--serif); font-weight: 700; letter-spacing: .01em; line-height: 1.18; margin: 0 0 .5em; }
h3, h4 { font-family: var(--sans); font-weight: 700; letter-spacing: -.005em; line-height: 1.3; margin: 0 0 .45em; }
h1 { font-size: clamp(2rem, 5vw, 3.3rem); }
h2 { font-size: clamp(1.5rem, 3.2vw, 2.1rem); }
h3 { font-size: 1.14rem; }
p { margin: 0 0 1em; max-width: 72ch; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); }
.gold { color: var(--gold); }
.ok-text { color: var(--ok); } .bad-text { color: var(--bad); } .warn-text { color: var(--warn); }
.eyebrow { display: inline-block; font: 700 .76rem/1 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--gold); background: var(--gold-soft); border-radius: 999px; padding: 6px 12px; margin-bottom: 14px; }
.skip { position: absolute; left: -999px; } .skip:focus { left: 12px; top: 12px; background: var(--accent); color: var(--on-accent); padding: 8px 12px; z-index: 99; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* Header */
.site-header { position: sticky; top: 0; z-index: 50; background: var(--panel); background: color-mix(in srgb, var(--panel) 92%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: 68px; gap: 14px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-family: var(--serif); font-weight: 700; font-size: 1.12rem; letter-spacing: .12em; text-decoration: none; }
.brand:hover { color: var(--text); text-decoration: none; }
.brand img { width: 40px; height: 40px; border-radius: 9px; }
.nav { display: flex; gap: 2px; align-items: center; }
.nav a { color: var(--text); padding: 8px 12px; border-radius: 9px; font-size: .95rem; font-weight: 500; text-decoration: none; }
.nav a:hover { background: var(--accent-soft); color: var(--accent-strong); }
.nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent-strong); font-weight: 700; box-shadow: inset 0 -3px 0 var(--accent); }
.nav .btn { margin-left: 6px; }
.theme-btn { background: var(--panel); border: 1px solid var(--line-strong); color: var(--text); border-radius: 9px; padding: 7px 10px; font: 600 .85rem/1 var(--sans); cursor: pointer; margin-left: 6px; }
.theme-btn:hover { border-color: var(--accent); color: var(--accent); }
.menu-btn { display: none; background: var(--panel); border: 1px solid var(--line-strong); color: var(--text); border-radius: 9px; padding: 8px 12px; font: 600 .95rem var(--sans); }
@media (max-width: 900px) {
  .menu-btn { display: block; }
  .nav { display: none; position: absolute; top: 68px; left: 0; right: 0; flex-direction: column; align-items: stretch; background: var(--panel); border-bottom: 1px solid var(--line); padding: 10px 16px 16px; box-shadow: var(--shadow); }
  .nav.open { display: flex; }
  .nav .btn, .theme-btn { margin: 8px 0 0; text-align: center; }
}

/* Buttons: blue = action. Gold buttons are reserved for rewards (certificate). */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 20px; border-radius: 10px; font: 700 .95rem/1 var(--sans); border: 2px solid var(--accent); color: var(--accent); background: var(--panel); cursor: pointer; text-decoration: none; transition: transform .12s, background .15s, color .15s; }
.btn:hover { text-decoration: none; background: var(--accent-soft); color: var(--accent-strong); transform: translateY(-1px); }
.btn.primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); box-shadow: 0 6px 16px -8px var(--accent); }
.btn.primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); color: var(--on-accent); }
.btn.reward { background: var(--gold-fill); color: var(--on-gold); border-color: var(--gold-fill); }
.btn.reward:hover { filter: brightness(1.05); color: var(--on-gold); }
.btn.small { padding: 8px 14px; font-size: .86rem; }
.btn[disabled] { opacity: 1; background: var(--bg-2); border-color: var(--line); color: var(--muted); box-shadow: none; cursor: not-allowed; transform: none; }

/* Sections */
section { padding: 70px 0; }
section.tight { padding: 44px 0; }
section.alt { background: var(--panel-2); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.hero { padding: 84px 0 64px; background: radial-gradient(900px 420px at 80% -10%, var(--hero-1), transparent 70%), radial-gradient(700px 360px at 0% 40%, var(--hero-2), transparent 70%), var(--bg); border-bottom: 1px solid var(--line); }
.hero .lead { font-size: 1.18rem; color: var(--muted); max-width: 640px; }
.hero .actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 26px; }
.hero-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 40px; align-items: center; }
.hero-logo { border-radius: 24px; box-shadow: 0 30px 70px -30px rgba(26,23,18,.55), 0 0 0 6px var(--gold-soft); }
@media (max-width: 860px) { .hero-grid { grid-template-columns: 1fr; } .hero-logo { max-width: 240px; } }

.grid { display: grid; gap: 18px; }
.g2 { grid-template-columns: repeat(2, 1fr); }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 960px) { .g4 { grid-template-columns: repeat(2, 1fr); } .g3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) { .g2, .g3, .g4 { grid-template-columns: 1fr; } }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.card p:last-child { margin-bottom: 0; }
.card.link { display: block; color: var(--text); text-decoration: none; transition: border-color .15s, transform .15s, box-shadow .15s; }
.card.link:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow); }
.card .go { display: inline-block; margin-top: 4px; color: var(--accent); font-weight: 700; }
.card.link:hover .go { text-decoration: underline; }
.card h3 { margin-bottom: .35em; }
.tag { display: inline-block; font: 700 .72rem/1.2 var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--gold); background: var(--gold-soft); border-radius: 999px; padding: 5px 11px; margin-bottom: 12px; }
.tag.ok { color: var(--ok); background: var(--ok-soft); }
.tag.info { color: var(--accent-strong); background: var(--accent-soft); }
.tag.muted { color: var(--muted); background: var(--bg-2); }
.tag.lvl-1 { color: var(--lvl-1); background: var(--lvl-1-soft); }
.tag.lvl-2 { color: var(--lvl-2); background: var(--lvl-2-soft); }
.tag.lvl-3 { color: var(--lvl-3); background: var(--lvl-3-soft); }
.feature { border-top: 4px solid var(--gold-fill); }
.feature.lvl-1 { border-top-color: var(--lvl-1); } .feature.lvl-2 { border-top-color: var(--lvl-2); } .feature.lvl-3 { border-top-color: var(--lvl-3); }

/* Numbered 4-step rows (path, how a mission works) */
.path { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; counter-reset: lvl; }
.path .card { position: relative; padding-top: 58px; }
.path .card::before { counter-increment: lvl; content: counter(lvl); position: absolute; top: 18px; left: 22px; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font: 700 .95rem var(--sans); color: #fff; background: var(--accent); }
.path.levels .card:nth-child(1)::before { background: var(--lvl-1); }
.path.levels .card:nth-child(2)::before { background: var(--lvl-2); }
.path.levels .card:nth-child(3)::before { background: var(--lvl-3); }
.path.levels .card:nth-child(4)::before { background: var(--gold-fill); color: var(--on-gold); }
@media (max-width: 860px) { .path { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .path { grid-template-columns: 1fr; } }

.price { font-family: var(--serif); font-weight: 700; font-size: 1.6rem; color: var(--text); margin: 6px 0 10px; }
.list { list-style: none; padding: 0; margin: 0 0 18px; }
.list li { padding: 6px 0 6px 28px; position: relative; color: var(--muted); }
.list li::before { content: "✓"; position: absolute; left: 2px; top: 6px; color: var(--ok); font-weight: 800; }
.list li b { color: var(--text); }

.notice { border: 1px solid var(--line); border-left: 5px solid var(--ok); background: var(--ok-soft); border-radius: 12px; padding: 14px 18px; color: var(--text); font-size: .97rem; max-width: none; }
.notice.info { border-left-color: var(--accent); background: var(--accent-soft); }
.notice.warn { border-left-color: var(--warn); background: var(--warn-soft); }
.notice.earned { border-left-color: var(--gold-fill); background: var(--gold-soft); }
.disclaimer { font-size: .88rem; color: var(--muted); }

/* Footer */
.site-footer { border-top: 1px solid var(--line); padding: 40px 0; color: var(--muted); font-size: .93rem; background: var(--bg-2); }
.site-footer .cols { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 24px; }
.site-footer a { color: var(--accent); }
.site-footer h4 { font-size: .95rem; color: var(--text); }
@media (max-width: 720px) { .site-footer .cols { grid-template-columns: 1fr; } }

/* Forms */
input, select, textarea { width: 100%; background: var(--panel); color: var(--text); border: 2px solid var(--line-strong); border-radius: 10px; padding: 10px 13px; font: inherit; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
label { display: block; font-size: .92rem; color: var(--muted); margin-bottom: 6px; }

/* Library */
.filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 22px; }
.filters input { flex: 1 1 260px; }
.filters select { flex: 0 1 220px; }
.lesson { margin-bottom: 12px; padding: 0; overflow: hidden; border-left: 5px solid var(--line-strong); }
.lesson.lv1 { border-left-color: var(--lvl-1); } .lesson.lv2 { border-left-color: var(--lvl-2); } .lesson.lv3 { border-left-color: var(--lvl-3); } .lesson.lv4 { border-left-color: var(--gold-fill); }
.lesson summary { cursor: pointer; list-style: none; display: flex; gap: 14px; align-items: baseline; padding: 18px 20px; }
.lesson summary:hover { background: var(--accent-soft); }
.lesson summary:hover h3 { color: var(--accent-strong); }
.lesson summary::-webkit-details-marker { display: none; }
.lesson .wk { font: 700 .95rem var(--sans); color: var(--muted); min-width: 70px; }
.lesson .meta { font-size: .82rem; color: var(--muted); }
.lesson[open] summary { background: var(--panel-2); border-bottom: 1px solid var(--line); }
.lesson .body { padding: 18px 20px 20px; }
.lesson ol { padding-left: 22px; }
.lesson ol li { margin-bottom: 4px; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 8px 14px; font-size: .96rem; margin: 14px 0 0; }
.kv dt { font-weight: 700; }
.kv dd { margin: 0; color: var(--text); }
.kv .k-term { color: var(--accent-strong); } .kv .k-myth { color: var(--bad); } .kv .k-protect { color: var(--warn); } .kv .k-challenge { color: var(--lvl-3); } .kv .k-take { color: var(--ok); } .kv .k-reflect { color: var(--muted); }
@media (max-width: 520px) { .kv { grid-template-columns: 1fr; } .kv dd { margin-bottom: 6px; } }
.src { font-size: .87rem; color: var(--muted); }
[id] { scroll-margin-top: 88px; }
