/* IT Budgeting Academy — no external fonts or inline styles (see public/_headers CSP). */
:root {
  --bg: #f6f3ec;
  --surface: #fffdf8;
  --surface-2: #efeadf;
  --ink: #1d2523;
  --ink-2: #4a5552;
  --line: #d9d2c3;
  --accent: #0f5f5c;
  --accent-ink: #ffffff;
  --accent-soft: #dcebe8;
  --gold: #a26b12;
  --pos: #1f7a3d;
  --pos-soft: #e1f2e6;
  --neg: #b3261e;
  --neg-soft: #fbe5e2;
  --amber: #8a5a00;
  --amber-soft: #fbefd5;
  --focus: #2b6fd6;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(29, 37, 35, .06), 0 4px 16px rgba(29, 37, 35, .05);
  --serif: Charter, "Bitstream Charter", "Sitka Text", Cambria, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Consolas, "Liberation Mono", monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121615; --surface: #1a1f1e; --surface-2: #232a28; --ink: #e8ece9; --ink-2: #a8b3af;
    --line: #34403d; --accent: #5cc2b8; --accent-ink: #0b1514; --accent-soft: #1d3a37; --gold: #e0b25a;
    --pos: #6fd08f; --pos-soft: #183324; --neg: #ff8a80; --neg-soft: #3a1d1b; --amber: #f2c063; --amber-soft: #3a2f17;
    --focus: #8ab4ff; --shadow: none;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.6 var(--sans); }
h1, h2, h3, h4 { font-family: var(--serif); line-height: 1.25; margin: 1.6em 0 .5em; }
h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); margin-top: .2em; letter-spacing: -.01em; }
h2 { font-size: 1.45rem; }
h3 { font-size: 1.15rem; }
h4 { font-size: 1rem; }
p, ul, ol, dl { margin: 0 0 1em; }
a { color: var(--accent); text-underline-offset: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--ink-2); }
.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; }
.skip { position: absolute; left: -9999px; top: 8px; background: var(--accent); color: var(--accent-ink); padding: 8px 12px; z-index: 10; border-radius: 6px; }
.skip:focus { left: 8px; }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .78rem; font-weight: 600; color: var(--gold); margin: 0 0 .4em; }
.lede { font-size: 1.15rem; color: var(--ink-2); max-width: 46em; }

/* Header */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--serif); font-weight: 700; font-size: 1.15rem; color: var(--ink); text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); font-size: 1.2rem; }
#site-nav { display: flex; gap: 4px; }
#site-nav a { padding: 8px 12px; border-radius: 8px; color: var(--ink); text-decoration: none; font-weight: 500; }
#site-nav a:hover { background: var(--surface-2); }
#site-nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.nav-toggle { display: none; }
.progress-row { display: flex; align-items: center; gap: 12px; padding-bottom: 10px; font-size: .85rem; flex-wrap: wrap; }
.progress-row label { font-weight: 600; }
progress { appearance: none; width: 180px; height: 8px; border: 0; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
progress::-webkit-progress-bar { background: var(--surface-2); border-radius: 99px; }
progress::-webkit-progress-value { background: var(--accent); border-radius: 99px; }
progress::-moz-progress-bar { background: var(--accent); border-radius: 99px; }

@media (max-width: 720px) {
  .nav-toggle { display: inline-block; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink); border-radius: 8px; padding: 6px 12px; font: inherit; }
  #site-nav { display: none; position: absolute; top: 60px; left: 0; right: 0; flex-direction: column; background: var(--surface); border-bottom: 1px solid var(--line); padding: 8px 16px 12px; }
  #site-nav.open { display: flex; }
  progress { width: 120px; }
}

main { padding-top: 28px; padding-bottom: 64px; min-height: 70vh; }
main:focus { outline: none; }
.site-footer { border-top: 1px solid var(--line); color: var(--ink-2); font-size: .85rem; padding: 20px 0; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 10px 16px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: 600 .95rem/1.2 var(--sans); cursor: pointer; text-decoration: none; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.small { padding: 6px 10px; font-size: .85rem; }
.btn.danger { border-color: var(--neg); color: var(--neg); }
.btn[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 1em 0; }
.file-btn { position: relative; }

/* Layout pieces */
.hero { padding: 12px 0 8px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 24px 0; }
@media (max-width: 720px) { .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); } }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); margin: 0 0 16px; }
.panel h2:first-child, .panel h3:first-child { margin-top: 0; }
.about .panel h2 { font-size: 1.05rem; margin: 0 0 .3em; }
.about .panel p { margin: 0; color: var(--ink-2); }
.outcomes { columns: 2; column-gap: 32px; }
.outcomes li { break-inside: avoid; margin-bottom: .4em; }
@media (max-width: 720px) { .outcomes { columns: 1; } }
fieldset.panel { min-width: 0; }
fieldset.panel legend { font-weight: 700; padding: 0 4px; }

.cards { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.card a { display: flex; flex-direction: column; gap: 6px; height: 100%; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); text-decoration: none; box-shadow: var(--shadow); }
.card a:hover { border-color: var(--accent); }
.card-num { font-size: .8rem; color: var(--gold); font-weight: 600; }
.card-title { font-family: var(--serif); font-weight: 700; font-size: 1.1rem; }
.card-sum { color: var(--ink-2); font-size: .92rem; flex: 1; }
.capstone-card a { background: var(--accent-soft); border-color: var(--accent); }
.status { display: inline-block; align-self: flex-start; font-size: .78rem; font-weight: 600; padding: 3px 9px; border-radius: 99px; background: var(--surface-2); color: var(--ink-2); }
.status.passed { background: var(--pos-soft); color: var(--pos); }
.status.progress { background: var(--amber-soft); color: var(--amber); }

.crumbs { font-size: .88rem; color: var(--ink-2); margin-bottom: 8px; }
.page-head { margin-bottom: 20px; }
.layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 32px; align-items: start; }
.toc { position: sticky; top: 120px; font-size: .9rem; }
.toc-title { font-weight: 700; margin-bottom: .4em; }
.toc ol { padding-left: 1.1em; }
.toc a { color: var(--ink-2); text-decoration: none; }
.toc a:hover { color: var(--accent); text-decoration: underline; }
@media (max-width: 900px) { .layout { grid-template-columns: minmax(0, 1fr); } .toc { position: static; } }
.content { max-width: 760px; }
.lesson { margin-bottom: 8px; }
.lesson h2 { border-top: 1px solid var(--line); padding-top: 1em; }

.callout { background: var(--accent-soft); border-left: 4px solid var(--accent); padding: 12px 16px; border-radius: 0 8px 8px 0; margin: 1em 0; }
.callout.warn { background: var(--amber-soft); border-left-color: var(--amber); }
.callout.ok { background: var(--pos-soft); border-left-color: var(--pos); }
.callout p { margin: 0; }
.example { background: var(--surface-2); padding: 12px 16px; border-radius: 8px; font-style: italic; }
.formula { font-family: var(--mono); font-size: .92rem; background: var(--surface-2); border: 1px dashed var(--line); padding: 10px 14px; border-radius: 8px; margin: 1em 0; overflow-x: auto; }
ol.steps li { margin-bottom: .45em; }

/* Tables */
.table-wrap { overflow-x: auto; margin: 0 0 1em; -webkit-overflow-scrolling: touch; }
table.data { width: 100%; border-collapse: collapse; font-size: .93rem; font-variant-numeric: tabular-nums; background: var(--surface); }
table.data th, table.data td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data thead th { background: var(--surface-2); font-weight: 700; font-size: .85rem; }
table.data td { white-space: nowrap; }
table.data tr.total th, table.data tr.total td { font-weight: 700; border-top: 2px solid var(--ink-2); }
table.data .hl { background: var(--accent-soft); }
table.data tr.material { background: var(--amber-soft); }
.lesson table.data td { white-space: normal; }
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.tag { display: inline-block; font-size: .8rem; font-weight: 700; padding: 2px 7px; border-radius: 6px; }
.tag.fav { background: var(--pos-soft); color: var(--pos); }
.tag.adv { background: var(--neg-soft); color: var(--neg); }

/* Forms */
.field { display: flex; flex-direction: column; gap: 4px; margin: 0 0 12px; font-size: .92rem; }
.field > span { font-weight: 600; }
.field small { color: var(--ink-2); }
input[type="number"], input[type="text"], input[type="search"], select, textarea {
  font: inherit; font-size: .95rem; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; width: 100%; }
textarea { resize: vertical; line-height: 1.5; }
input[type="range"] { width: 100%; accent-color: var(--accent); }
table input[type="number"] { min-width: 120px; }
table select { min-width: 110px; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 600; margin: 1em 0; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }

/* Widgets */
.widget { border-top: 4px solid var(--accent); }
.widget-intro { color: var(--ink-2); }
.out { margin-top: 8px; }
.result { font-size: 1.02rem; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 8px 0 16px; }
.kpi { background: var(--surface-2); border-radius: 8px; padding: 10px 12px; }
.kpi span { display: block; font-size: .78rem; color: var(--ink-2); font-weight: 600; }
.kpi strong { font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.sorter { list-style: none; padding: 0; }
.sorter li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; padding: 10px 0; border-bottom: 1px solid var(--line); align-items: center; }
.sorter-btns { display: flex; gap: 6px; }
.sorter-fb { grid-column: 1 / -1; font-size: .88rem; }
.sorter-fb:empty { display: none; }
.sorter-fb.ok { color: var(--pos); }
.sorter-fb.bad { color: var(--neg); }
.widget-score { font-weight: 700; margin-top: 10px; }

/* Quiz */
.q { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px 8px; margin: 0 0 14px; background: var(--surface); min-width: 0; }
.q legend { font-weight: 600; padding: 0 4px; }
.qn { display: block; font-size: .78rem; color: var(--gold); text-transform: uppercase; letter-spacing: .06em; }
.opt { display: flex; gap: 10px; padding: 6px 4px; border-radius: 6px; cursor: pointer; align-items: flex-start; }
.opt:hover { background: var(--surface-2); }
.opt input { margin-top: 5px; accent-color: var(--accent); }
.q.correct { border-color: var(--pos); }
.q.incorrect { border-color: var(--neg); }
.q-feedback { font-size: .9rem; margin: 6px 0 4px; }
.q.correct .q-feedback strong { color: var(--pos); }
.q.incorrect .q-feedback strong { color: var(--neg); }

.pager { display: flex; justify-content: space-between; gap: 12px; margin-top: 28px; flex-wrap: wrap; }

/* Capstone */
.tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 2px solid var(--line); margin-bottom: 20px; scrollbar-width: thin; }
.tabs [role="tab"] { flex: 0 0 auto; border: 0; background: none; padding: 10px 14px; font: 600 .92rem var(--sans); color: var(--ink-2); cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -2px; }
.tabs [role="tab"][aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }
.cap-panel:focus { outline: none; }
.line-name { font-weight: 600; display: block; }
.budget-table details { font-weight: 400; font-size: .85rem; color: var(--ink-2); margin-top: 4px; }
.budget-table details ul { padding-left: 1.1em; margin: 6px 0 0; white-space: normal; min-width: 260px; }
.budget-table summary, details > summary { cursor: pointer; color: var(--accent); font-weight: 600; }
.chk small { display: block; color: var(--ink-2); margin-top: 3px; }
.rag { display: inline-block; font-size: .8rem; font-weight: 700; padding: 3px 8px; border-radius: 6px; white-space: normal; }
.rag-g { background: var(--pos-soft); color: var(--pos); }
.rag-a { background: var(--amber-soft); color: var(--amber); }
.rag-r { background: var(--neg-soft); color: var(--neg); }
.rag-na { background: var(--surface-2); color: var(--ink-2); }
.var-item legend { font-family: var(--serif); }
.checklist { list-style: none; padding: 0; }
.checklist li { padding: 6px 0; border-bottom: 1px solid var(--line); }
.checklist li.ok span[aria-hidden] { color: var(--pos); font-weight: 700; }
.checklist li.todo { color: var(--ink-2); }
.danger-zone { margin-top: 28px; }
.glossary .g-item { padding: 10px 0; border-bottom: 1px solid var(--line); }
.glossary dt { font-weight: 700; font-family: var(--serif); }
.glossary dd { margin: 2px 0 0; color: var(--ink-2); }

/* Print: only the generated report or certificate is printed */
#print-area { display: none; }
@media print {
  body.printing > *:not(#print-area) { display: none !important; }
  body.printing #print-area { display: block; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .report h1 { font-size: 20pt; }
  .report h2 { font-size: 14pt; border-bottom: 1px solid #999; padding-bottom: 2pt; break-after: avoid; }
  .report table.data { background: #fff; }
  .report table.data th, .report table.data td { border-bottom: 1px solid #ccc; color: #000; }
  .report .eyebrow { color: #555; }
  .certificate { border: 6px double #0f5f5c; padding: 48pt 40pt; text-align: center; margin-top: 40pt; font-family: Georgia, serif; }
  .cert-label { font-size: 26pt; margin: 6pt 0 20pt; }
  .cert-intro { font-style: italic; margin: 4pt 0; }
  .cert-name { font-size: 30pt; font-weight: 700; margin: 6pt 0 14pt; }
  .cert-course { font-size: 18pt; font-weight: 700; margin: 4pt 0 14pt; }
  .cert-date { margin-top: 30pt; }
  @page { margin: 16mm; }
}

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