/* Shared styles for lesson pages and the lesson overview.
   Same palette/typography as the main site. Theme-aware. */
:root {
  font-size: 17px;
  --ink: #0F2137; --bg: #FBFCFD; --surface: #FFFFFF; --surface-2: #F1F5F8;
  --text: #1A2433; --muted: #5C6B7A; --hairline: #DCE6EC;
  --teal: #0F7079; --teal-soft: #E1F0F1; --amber: #C77E06; --amber-soft: #FBEFD6;
  --lvl1: #2C7A55; --lvl2: #0F7079; --lvl3: #7A4FB0;
  --p1: #0F7079; --p2: #7A4FB0; --closing: #C77E06;
  --serif: Charter, "Iowan Old Style", Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", "SFMono-Regular", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #E7EEF4; --bg: #0B1626; --surface: #101F33; --surface-2: #16283F;
    --text: #DCE6EC; --muted: #93A6B7; --hairline: #24384F;
    --teal: #2BB6C0; --teal-soft: #123038; --amber: #E8A417; --amber-soft: #33280F;
    --lvl1: #5FBE8E; --lvl2: #2BB6C0; --lvl3: #B79BE6;
    --p1: #2BB6C0; --p2: #B79BE6; --closing: #E8A417;
  }
}
:root[data-theme="dark"] {
  --ink: #E7EEF4; --bg: #0B1626; --surface: #101F33; --surface-2: #16283F;
  --text: #DCE6EC; --muted: #93A6B7; --hairline: #24384F;
  --teal: #2BB6C0; --teal-soft: #123038; --amber: #E8A417; --amber-soft: #33280F;
  --lvl1: #5FBE8E; --lvl2: #2BB6C0; --lvl3: #B79BE6;
  --p1: #2BB6C0; --p2: #B79BE6; --closing: #E8A417;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--sans); line-height: 1.65; -webkit-font-smoothing: antialiased; }
@media (max-width: 640px) { :root { font-size: 18px; } }
.wrap { max-width: 48rem; margin: 0 auto; padding: 0 1.4rem; }
a { color: var(--teal); }
h1, h2, h3, h4 { font-family: var(--serif); color: var(--ink); font-weight: 600; text-wrap: balance; line-height: 1.2; }

/* top bar */
header.top { border-bottom: 1px solid var(--hairline); background: var(--surface); position: sticky; top: 0; z-index: 20; }
.top-inner { max-width: 60rem; margin: 0 auto; padding: 0.75rem 1.4rem; display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.top a { font-family: var(--mono); font-size: 0.82rem; text-decoration: none; color: var(--teal); }
.top a:hover { text-decoration: underline; }
.top .home { margin-right: auto; font-weight: 600; }
.top .brand { color: var(--muted); }

/* lesson header */
.lead { padding: 2.4rem 0 0.6rem; }
.eyebrow { font-family: var(--mono); font-size: 0.76rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--teal); margin: 0 0 0.5rem; }
h1.title { font-size: clamp(1.8rem, 4.5vw, 2.5rem); margin: 0 0 0.5rem; }
.ziel { font-size: 1.14rem; color: var(--muted); margin: 0; max-width: 42ch; }

/* level quick-nav */
.levelnav { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 1.4rem 0 0; }
.levelnav a { font-family: var(--mono); font-size: 0.8rem; text-decoration: none; color: var(--ink); background: var(--surface-2); border: 1px solid var(--hairline); border-radius: 2rem; padding: 0.3rem 0.75rem; }
.levelnav a:hover { border-color: var(--teal); color: var(--teal); }

/* article body */
article { padding: 1.2rem 0 2rem; font-size: 1.06rem; }
article p { margin: 0.8rem 0; }
article h2 { font-size: 1.5rem; margin: 1.8rem 0 0.4rem; }
article h3 { font-size: 1.15rem; margin: 1.4rem 0 0.3rem; }
article ul, article ol { padding-left: 1.3rem; }
article li { margin: 0.35rem 0; }
article strong { color: var(--ink); }
hr { border: 0; border-top: 1px solid var(--hairline); margin: 2rem 0; }

/* the three levels: distinct colored dividers */
h2.stufe { margin-top: 2.4rem; padding-top: 1.1rem; border-top: 2px solid var(--hairline); font-size: 1.55rem; scroll-margin-top: 4rem; }
h2.stufe .kicker { display: block; font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.12em; text-transform: uppercase; margin-bottom: 0.2rem; }
h2.stufe.g { color: var(--lvl1); } h2.stufe.g .kicker { color: var(--lvl1); }
h2.stufe.s { color: var(--lvl2); } h2.stufe.s .kicker { color: var(--lvl2); }
h2.stufe.u { color: var(--lvl3); } h2.stufe.u .kicker { color: var(--lvl3); }

/* agent-prompt blockquotes */
blockquote { margin: 0.6rem 0; padding: 0.7rem 1rem; background: var(--teal-soft); border-left: 3px solid var(--teal); border-radius: 0.4rem; color: var(--ink); }
blockquote p { margin: 0.3rem 0; }

/* code */
pre { background: var(--surface-2); border: 1px solid var(--hairline); border-radius: 0.5rem; padding: 0.9rem 1rem; overflow-x: auto; }
pre code { font-family: var(--mono); font-size: 0.9rem; color: var(--ink); white-space: pre; background: none; padding: 0; }
code { font-family: var(--mono); font-size: 0.9em; background: var(--surface-2); border: 1px solid var(--hairline); border-radius: 0.3rem; padding: 0.05rem 0.32rem; }
pre.mermaid { background: transparent; border: 0; text-align: center; }

/* tables */
.tablewrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 0.98rem; margin: 0.6rem 0; }
th, td { text-align: left; padding: 0.5rem 0.7rem; border-bottom: 1px solid var(--hairline); vertical-align: top; }
thead th { background: var(--surface-2); font-family: var(--mono); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }

/* self-check */
details { background: var(--surface); border: 1px solid var(--hairline); border-radius: 0.6rem; padding: 0.6rem 1rem; margin: 0.8rem 0; }
details summary { cursor: pointer; font-weight: 600; color: var(--teal); font-family: var(--sans); }
details[open] summary { margin-bottom: 0.4rem; }

/* prev/next */
.pager { display: flex; justify-content: space-between; gap: 1rem; margin: 2.2rem 0 0; border-top: 1px solid var(--hairline); padding-top: 1.2rem; }
.pager a { flex: 1; text-decoration: none; border: 1px solid var(--hairline); border-radius: 0.6rem; padding: 0.8rem 1rem; background: var(--surface); color: var(--ink); }
.pager a:hover { border-color: var(--teal); }
.pager a.next { text-align: right; }
.pager .k { display: block; font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.pager .t { font-weight: 600; }
.pager .spacer { flex: 1; }

footer.site { border-top: 1px solid var(--hairline); padding: 1.8rem 0 3rem; color: var(--muted); font-size: 0.9rem; }
footer.site a { color: var(--teal); }

/* overview page */
.phase-head { display: flex; align-items: baseline; gap: 0.7rem; margin: 2rem 0 0.6rem; flex-wrap: wrap; }
.phase-tag { font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; padding: 0.24rem 0.6rem; border-radius: 0.4rem; color: #fff; }
.phase-tag.p1 { background: var(--p1); } .phase-tag.p2 { background: var(--p2); } .phase-tag.cl { background: var(--closing); }
ol.lektionen { list-style: none; margin: 0; padding: 0; }
ol.lektionen li { border-top: 1px solid var(--hairline); }
ol.lektionen li:first-child { border-top: 0; }
ol.lektionen a { display: grid; grid-template-columns: 2.4rem 1fr; gap: 0.2rem 1rem; align-items: baseline; padding: 0.75rem 0.2rem; text-decoration: none; }
ol.lektionen a:hover .lt { color: var(--teal); }
.lnum { font-family: var(--mono); color: var(--muted); font-variant-numeric: tabular-nums; }
.lt { font-weight: 600; color: var(--ink); font-size: 1.05rem; }
.ld { grid-column: 2; color: var(--muted); font-size: 0.95rem; }
