:root {
  --ink: #17365d;
  --text: #334155;
  --muted: #64748b;
  --paper: #ffffff;
  --canvas: #f3f6f9;
  --line: #d7e1eb;
  --teal: #0e7490;
  --teal-soft: #e5f5f7;
  --amber: #a86400;
  --amber-soft: #fff4db;
  --green: #166534;
  --radius: 12px;
  --shadow: 0 8px 24px rgb(23 54 93 / 8%);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 5.5rem; }
body {
  margin: 0; background: var(--canvas); color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 1rem; line-height: 1.65;
}
img { display: block; max-width: 100%; }
a { color: #155e75; text-underline-offset: .18em; }
a:focus-visible, button:focus-visible { outline: 3px solid #f2a93b; outline-offset: 3px; }
code { padding: .08rem .3rem; border-radius: 4px; background: #eaf0f5; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }

.skip-link { position: fixed; z-index: 1000; top: -5rem; left: 1rem; padding: .65rem 1rem; border-radius: 7px; background: white; color: var(--ink); }
.skip-link:focus { top: 1rem; }

.site-header { position: sticky; top: 0; z-index: 50; border-bottom: 1px solid var(--line); background: rgb(255 255 255 / 96%); backdrop-filter: blur(8px); }
.nav-wrap { max-width: 1160px; min-height: 4.7rem; margin: 0 auto; padding: .7rem 1.25rem; display: flex; align-items: center; gap: 1.5rem; }
.brand { display: inline-flex; min-width: 390px; align-items: center; gap: .65rem; color: var(--ink); font-size: .92rem; font-weight: 780; line-height: 1.08; text-decoration: none; }
.brand img { width: 38px; height: 38px; }
.brand small { display: block; margin-top: .15rem; color: var(--muted); font-size: .71rem; font-weight: 650; }
.site-nav { display: flex; margin-left: auto; align-items: center; gap: 1.3rem; }
.site-nav a { padding: .45rem 0; border-bottom: 2px solid transparent; color: var(--text); font-size: .92rem; font-weight: 750; text-decoration: none; white-space: nowrap; }
.site-nav a:hover, .site-nav a[aria-current="true"] { border-color: var(--teal); color: var(--teal); }

.hero { color: white; background: radial-gradient(circle at 85% 18%, rgb(131 216 229 / 30%), transparent 24rem), linear-gradient(135deg, #17365d, #155e75); }
.hero-grid { max-width: 1160px; margin: 0 auto; padding: 5rem 1.25rem 4.5rem; }
.eyebrow { margin: 0 0 .65rem; color: var(--teal); font-size: .76rem; font-weight: 850; letter-spacing: .12em; text-transform: uppercase; }
.hero .eyebrow { color: #aeeaf2; }
.hero h1 { max-width: 920px; margin: 0; font-size: clamp(2.35rem, 4.5vw, 4rem); line-height: 1.08; letter-spacing: -.035em; }
.hero .lead { max-width: 760px; margin: 1.35rem 0 0; color: #e4f5f8; font-size: clamp(1.05rem, 2vw, 1.28rem); }
.button { display: inline-flex; justify-content: center; padding: .68rem 1rem; border: 2px solid transparent; border-radius: 8px; background: white; color: var(--ink); font-weight: 780; text-decoration: none; }
.button.dark { background: var(--ink); color: white; }
.button:hover { background: #eaf8fa; color: var(--ink); }
.button.dark:hover { background: var(--teal); color: white; }

.section { max-width: 1160px; margin: 0 auto; padding: 4.8rem 1.25rem; }
.section.alternate { max-width: none; padding-right: max(1.25rem, calc((100% - 1160px) / 2 + 1.25rem)); padding-left: max(1.25rem, calc((100% - 1160px) / 2 + 1.25rem)); background: #eaf0f5; }
.section-head { max-width: 800px; margin-bottom: 2rem; }
.section-head h2 { margin: 0 0 .65rem; color: var(--ink); font-size: clamp(2rem, 3vw, 2.8rem); line-height: 1.12; }
.section-head p { margin: 0; color: var(--muted); font-size: 1.08rem; }
.subhead { margin: 2.3rem 0 .65rem; color: var(--ink); font-size: 1.35rem; }

.grid { display: grid; gap: 1rem; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card { padding: 1.25rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); box-shadow: 0 4px 16px rgb(23 54 93 / 5%); }
.card h3 { margin: 0 0 .45rem; color: var(--ink); font-size: 1.08rem; }
.card p:last-child, .card ul:last-child { margin-bottom: 0; }
.card ul { padding-left: 1.25rem; }

.note, .warning { margin: 1.2rem 0; padding: 1rem 1.15rem; border-left: 5px solid; border-radius: 0 9px 9px 0; }
.note { border-color: var(--teal); background: var(--teal-soft); }
.warning { border-color: #d58a00; background: var(--amber-soft); }
.note strong, .warning strong { color: var(--ink); }

.criteria-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .85rem; }
.criterion { display: grid; grid-template-columns: 2.5rem 1fr; gap: .8rem; padding: 1rem; border: 1px solid var(--line); border-radius: 10px; background: white; }
.criterion > span { display: grid; place-items: center; width: 2.35rem; height: 2.35rem; border-radius: 50%; background: var(--teal); color: white; font-weight: 850; }
.criterion h3 { margin: .1rem 0 .35rem; color: var(--ink); font-size: 1.02rem; }
.criterion h3 small, table small { display: block; margin-top: .15rem; color: var(--muted); font-size: .78rem; font-weight: 650; line-height: 1.35; }
.criterion p { margin: 0; font-size: .94rem; }

.data-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 9px; background: white; }
table.data { width: 100%; min-width: 650px; border-collapse: collapse; font-variant-numeric: tabular-nums; }
table.data th, table.data td { padding: .65rem .75rem; border-bottom: 1px solid var(--line); text-align: left; }
table.data th { background: var(--ink); color: white; font-size: .86rem; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr:nth-child(even) { background: #f7f9fb; }
table.data .num { text-align: right; }

.calculation-rules { display: grid; gap: 1rem; }
.calculation-prerequisite, .calculation-step { padding: 1.25rem; border: 1px solid var(--line); border-radius: 11px; background: white; }
.calculation-prerequisite { border-top: 5px solid var(--teal); }
.calculation-label, .calculation-step header p { margin: 0 0 .15rem; color: var(--teal-dark); font-size: .76rem; font-weight: 820; letter-spacing: .07em; text-transform: uppercase; }
.calculation-prerequisite h4, .calculation-step h4 { margin: 0; color: var(--ink); font-size: 1.2rem; }
.calculation-prerequisite > p:last-of-type { line-height: 1.65; }
.equal-weight-fallback { margin-top: 1rem; padding: 1rem; border-left: 5px solid #d58a00; border-radius: 0 8px 8px 0; background: var(--amber-soft); }
.equal-weight-fallback > strong { color: var(--ink); }
.equal-weight-fallback p { margin: .5rem 0 0; line-height: 1.58; }
.calculation-step header { display: grid; grid-template-columns: 2.45rem 1fr; gap: .7rem; align-items: center; margin-bottom: 1rem; }
.calculation-step header > span { display: grid; place-items: center; width: 2.3rem; height: 2.3rem; border-radius: 50%; background: var(--ink); color: white; font-weight: 850; }
.calculation-definitions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .7rem; }
.calculation-definitions > div { display: grid; grid-template-columns: 5.5rem 1fr; gap: .7rem; align-items: start; padding: .8rem; border-radius: 8px; background: #eef5f8; }
.calculation-definitions code { color: var(--teal-dark); font-size: 1rem; font-weight: 800; }
.calculation-definitions p { margin: 0; }
.calculation-table-wrap { border-radius: 8px; }
.indicator-table { min-width: 820px; }
.indicator-table th:first-child { width: 19%; }
.indicator-table th:nth-child(2) { width: 38%; }
.indicator-table code { color: var(--ink); font-size: .9em; white-space: normal; }
.worked-intro { margin: 0 0 1rem 3.15rem; line-height: 1.65; }
.worked-inputs { margin-left: 3.15rem; padding: 1rem; border-radius: 9px; background: #eef5f8; }
.worked-inputs h5, .worked-explanation h5 { margin: 0; color: var(--ink); font-size: 1rem; line-height: 1.4; }
.worked-inputs > p { margin: .45rem 0 .75rem; }
.assessment-groups { display: grid; gap: .5rem; margin: 0; padding: 0; list-style: none; }
.assessment-groups li { display: grid; grid-template-columns: 8rem 1fr; gap: .75rem; padding: .65rem .75rem; border-radius: 7px; background: white; }
.assessment-groups strong { color: var(--teal-dark); }
.worked-explanation { display: grid; gap: .75rem; margin: 1rem 0 0 3.15rem; padding: 0; list-style: none; counter-reset: worked-step; }
.worked-explanation li { counter-increment: worked-step; display: grid; grid-template-columns: 2.25rem 1fr; gap: .75rem; align-items: start; padding: .9rem; border: 1px solid var(--line); border-radius: 9px; background: #fbfcfd; }
.worked-explanation li::before { content: counter(worked-step); display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: 50%; background: var(--teal); color: white; font-weight: 850; }
.worked-explanation p { margin: .45rem 0; line-height: 1.55; }
.worked-explanation code { display: block; width: fit-content; max-width: 100%; overflow-x: auto; padding: .45rem .65rem; border-radius: 6px; background: var(--ink); color: white; }
.worked-explanation .worked-meaning { margin-bottom: 0; color: var(--text); }

.example-stages { display: grid; gap: 1.5rem; }
.example-stage { padding: 1.3rem; border: 1px solid var(--line); border-radius: 12px; background: white; box-shadow: 0 12px 28px rgba(22, 54, 84, .06); }
.example-stage-head { display: grid; grid-template-columns: 2.8rem 1fr; gap: .8rem; align-items: center; }
.example-stage-head > span { display: grid; place-items: center; width: 2.65rem; height: 2.65rem; border-radius: 50%; background: var(--teal); color: white; font-size: 1.15rem; font-weight: 850; }
.example-stage-head p { margin: 0 0 .1rem; color: var(--teal-dark); font-size: .76rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.example-stage-head h3 { margin: 0; color: var(--ink); font-size: 1.35rem; line-height: 1.25; }
.example-stage-copy { margin: .9rem 0 0 3.6rem; max-width: 960px; }
.example-stage-copy p { margin: 0; line-height: 1.65; }
.example-stage-copy p + p { margin-top: .65rem; }
.example-stage-figure { margin: 1rem 0 0; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: #eef2f5; }
.example-stage-figure a, .example-stage-figure img { display: block; width: 100%; }
.example-stage-results { margin: 1rem 0 0 3.6rem; }
.badge { display: inline-block; min-width: 4.7rem; padding: .18rem .55rem; border-radius: 999px; text-align: center; font-size: .77rem; font-weight: 850; }
.badge.high { background: #d9f4f2; color: #115e59; }
.badge.medium { background: #fff0c2; color: #8a5000; }
.badge.low { background: #e8edf2; color: #475569; }
.download-row { margin-top: 1.5rem; }

.footer { background: var(--ink); color: #dbeafe; }
.footer-inner { max-width: 1160px; margin: 0 auto; padding: 1.6rem 1.25rem; display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }

.modal[hidden] { display: none; }
.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 1.5rem; background: rgb(9 20 36 / 92%); }
.modal-dialog { position: relative; max-width: min(96vw, 1700px); max-height: 94vh; }
.modal img { max-width: 100%; max-height: 88vh; border-radius: 7px; box-shadow: 0 20px 60px #000; }
.modal-close { position: absolute; top: -2.75rem; right: 0; padding: .43rem .7rem; border: 1px solid white; border-radius: 7px; background: white; color: var(--ink); font-weight: 800; cursor: pointer; }
.no-scroll { overflow: hidden; }

@media (max-width: 850px) {
  .nav-wrap { align-items: flex-start; flex-direction: column; gap: .2rem; }
  .site-nav { margin-left: 0; gap: .9rem; }
  .hero-grid { padding-top: 3.8rem; }
  .criteria-grid { grid-template-columns: 1fr; }
  .calculation-definitions { grid-template-columns: 1fr; }
  .worked-intro, .worked-inputs, .worked-explanation { margin-left: 0; }
  .example-stage-copy, .example-stage-results { margin-left: 0; }
}

@media (max-width: 600px) {
  html { scroll-padding-top: 8rem; }
  .site-nav { flex-wrap: wrap; }
  .site-nav a { font-size: .82rem; }
  .grid.two { grid-template-columns: 1fr; }
  .section { padding-top: 3.4rem; padding-bottom: 3.4rem; }
  .calculation-definitions > div { grid-template-columns: 1fr; }
  .assessment-groups li { grid-template-columns: 1fr; }
}

@media print {
  @page { size: A4 landscape; margin: 14mm; }
  body { background: white; color: #111; font-size: 9.5pt; }
  .site-header, .skip-link, .footer, .modal, .download-row { display: none !important; }
  .hero { border-bottom: 2px solid var(--ink); background: white; color: #111; }
  .hero-grid { display: block; padding: 0 0 1rem; }
  .hero .eyebrow, .hero .lead { color: #111; }
  .section, .section.alternate { max-width: none; padding: 1.3rem 0; background: white; }
  .card, .criterion, .example-stage, .calculation-prerequisite, .calculation-step { break-inside: avoid; box-shadow: none; }
  .example-stage-figure a { text-decoration: none; }
  .example-stage-figure img { width: 100%; max-height: 145mm; object-fit: contain; }
  a { color: inherit; text-decoration: none; }
}
