/* PlatformEngr learn: shared theme. Matches platformengr.com (Astra): blue #3d69ff, navy #212d45,
   Montserrat headings, Open Sans body. Light by default, dark via [data-theme=dark] or the OS setting.
   Token NAMES are the ones the workshop page already uses, so existing component CSS keeps working. */
:root {
  --bg: #ffffff; --surface: #f2f5f7; --surface-2: #e8edf3; --card: #ffffff;
  --text: #4b4f58; --heading: #212d45; --muted: #6b7280;
  --accent: #2555f7; --accent-2: #8a3ab9; --accent-soft: #e9eeff; --on-accent: #ffffff;
  --ok: #0f9d6b; --warn: #b7791f; --danger: #d64545;
  --line: #dfe5ec; --radius: 14px; --shadow: 0 1px 2px rgba(33,45,69,.06), 0 8px 24px rgba(33,45,69,.06);
  --font: "Open Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-head: "Montserrat", "Open Sans", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --code-bg: #212d45; --code-fg: #e6ebf5; --code-comment: #8fa0c2;
  --header-bg: rgba(255,255,255,.92);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1626; --surface: #151e33; --surface-2: #1c2742; --card: #151e33;
    --text: #c6cedd; --heading: #eef2fa; --muted: #93a0bb;
    --accent: #7c9bff; --accent-2: #c28bf0; --accent-soft: #1d2a52; --on-accent: #0b1020;
    --ok: #34d399; --warn: #fbbf24; --danger: #f87171;
    --line: #26324f; --shadow: 0 8px 24px rgba(0,0,0,.35);
    --code-bg: #0a1020; --header-bg: rgba(15,22,38,.92); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1626; --surface: #151e33; --surface-2: #1c2742; --card: #151e33;
  --text: #c6cedd; --heading: #eef2fa; --muted: #93a0bb;
  --accent: #7c9bff; --accent-2: #c28bf0; --accent-soft: #1d2a52; --on-accent: #0b1020;
  --ok: #34d399; --warn: #fbbf24; --danger: #f87171;
  --line: #26324f; --shadow: 0 8px 24px rgba(0,0,0,.35);
  --code-bg: #0a1020; --header-bg: rgba(15,22,38,.92); color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 16px/1.65 var(--font); }
h1, h2, h3, h4 { font-family: var(--font-head); color: var(--heading); line-height: 1.25; font-weight: 700; margin: 1.6em 0 .5em; }
h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); margin-top: 0; }
h2 { font-size: 1.5rem; } h3 { font-size: 1.15rem; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
img, svg { max-width: 100%; }
code { font-family: var(--mono); font-size: .88em; background: var(--surface-2); color: var(--heading); padding: .1em .4em; border-radius: 6px; overflow-wrap: anywhere; }
pre { margin: 0; }
pre code { background: none; padding: 0; color: inherit; font-size: inherit; overflow-wrap: normal; }
.wrap { width: min(1120px, 100% - 32px); margin-inline: auto; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--accent); color: var(--on-accent); padding: 8px 14px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 11px 20px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--card); color: var(--heading); font: 600 15px var(--font-head); text-decoration: none; cursor: pointer; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { filter: brightness(1.08); }

/* Site header: one slim bar. Logo (-> main site), course name, theme toggle. Site navigation lives in the footer. */
.pe-header { position: sticky; top: 0; z-index: 50; background: var(--header-bg); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.pe-header .wrap { display: flex; align-items: center; gap: 16px; min-height: 52px; }
.pe-brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--heading); font: 700 17px var(--font-head); }
.pe-brand img { width: 28px; height: 28px; }
.pe-brand sup { font-size: .5em; }
.pe-learn { margin-right: auto; padding: 6px 12px; border-left: 1px solid var(--line); color: var(--muted); text-decoration: none; font: 600 14px var(--font-head); }
.pe-learn:hover { color: var(--heading); }
body[data-section="landing"] .pe-learn { display: none; }
body[data-section="landing"] .pe-theme { margin-left: auto; }
.pe-account { padding: 6px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--heading); text-decoration: none; font: 600 13px var(--font-head); white-space: nowrap; max-width: 46vw; overflow: hidden; text-overflow: ellipsis; }
.pe-account:hover { border-color: var(--accent); }
.pe-account[hidden] { display: none; }
.pe-account .short { display: none; }
.pe-account.in { color: var(--muted); }
body[data-section="landing"] .pe-account { margin-left: auto; }
body[data-section="landing"] .pe-account:not([hidden]) + .pe-theme { margin-left: 0; }
.pe-theme { width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--heading); cursor: pointer; display: grid; place-items: center; padding: 0; }

/* Site footer */
.pe-footer { margin-top: 64px; background: #212d45; color: #c6cedd; font-size: 14px; }
.pe-footer .wrap { padding: 36px 0; display: grid; gap: 24px; grid-template-columns: 1.4fr 1fr 1fr; }
.pe-footer a { color: #e6ebf5; }
.pe-footer h4 { color: #fff; font-size: 14px; margin: 0 0 8px; }
.pe-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.pe-footer .legal { grid-column: 1 / -1; border-top: 1px solid rgba(255,255,255,.12); padding-top: 16px; color: #93a0bb; }
@media (max-width: 720px) {
  .pe-learn { padding-inline: 8px; font-size: 13px; }
  .pe-account .long { display: none; }
  .pe-account .short { display: inline; }
  .pe-footer .wrap { grid-template-columns: 1fr; }
}

/* Rendered course pages */
.prose { max-width: 800px; margin: 40px auto 0; }
.prose h2 { margin-top: 2.2em; padding-top: .4em; border-top: 1px solid var(--line); }
.prose table { width: 100%; border-collapse: collapse; font-size: 15px; display: block; overflow-x: auto; }
.prose th, .prose td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.prose th { color: var(--heading); font-family: var(--font-head); font-size: 13px; }
.prose pre { background: var(--code-bg); color: var(--code-fg); border-radius: 12px; padding: 14px 16px; overflow-x: auto; font: 13.5px/1.6 var(--mono); margin: 14px 0; }
.prose blockquote { margin: 18px 0; padding: 12px 18px; border-left: 4px solid var(--accent); background: var(--accent-soft); border-radius: 0 10px 10px 0; color: var(--heading); }
.prose blockquote p { margin: .4em 0; }
.prose details { border: 1px solid var(--line); border-radius: 12px; padding: 10px 16px; margin: 14px 0; background: var(--card); }
.prose summary { cursor: pointer; font-weight: 600; color: var(--heading); }
.pager { display: flex; justify-content: space-between; gap: 12px; margin: 48px 0 0; flex-wrap: wrap; }
.pager a { flex: 1 1 240px; border: 1px solid var(--line); border-radius: 12px; padding: 14px 18px; text-decoration: none; background: var(--card); color: var(--heading); font-weight: 600; }
.pager a small { display: block; color: var(--muted); font-weight: 400; }
.pager a:hover { border-color: var(--accent); }
.pager .next { text-align: right; }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }

.report { margin: 24px 0 0; font-size: 14px; }
.report a { color: var(--muted); }
.report a:hover { color: var(--accent); }
