:root {
    --ink: #15232d;
    --muted: #5a6871;
    --navy: #102b3f;
    --navy-2: #173e58;
    --teal: #087f7b;
    --teal-dark: #04615e;
    --copper: #bb6d3d;
    --cream: #f7f3ea;
    --paper: #fffdf8;
    --line: #d7ddd9;
    --pale: #edf4f2;
    --danger: #9d2f2f;
    --danger-pale: #fff1f0;
    --warning: #7b4d12;
    --shadow: 0 18px 45px rgba(16, 43, 63, 0.11);
    --radius: 18px;
    --small-radius: 10px;
    --shell: 1180px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    color: var(--ink);
    background: var(--paper);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.58;
}
a { color: var(--teal-dark); text-underline-offset: 0.18em; }
a:hover { color: var(--navy); }
button, input, select { font: inherit; }
img { max-width: 100%; }
.shell { width: min(calc(100% - 36px), var(--shell)); margin-inline: auto; }
.narrow { max-width: 790px; }
.skip-link { position: absolute; left: -9999px; top: 0; background: white; padding: 10px 14px; z-index: 100; }
.skip-link:focus { left: 12px; top: 12px; }

.site-header { background: var(--navy); color: white; border-bottom: 1px solid rgba(255,255,255,.14); }
.header-inner { min-height: 74px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: white; text-decoration: none; font-weight: 800; letter-spacing: -0.02em; font-size: 1.12rem; }
.brand:hover { color: white; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--copper); font-family: Georgia, serif; font-size: 1.45rem; }
.main-nav { display: flex; align-items: center; gap: 25px; }
.main-nav a { color: #eef7f7; text-decoration: none; font-size: .94rem; }
.main-nav a:hover { color: white; text-decoration: underline; }

.hero { background: linear-gradient(130deg, var(--navy) 0%, var(--navy-2) 62%, #145e67 100%); color: white; padding: 76px 0 82px; }
.hero-grid { display: grid; grid-template-columns: 1.35fr .85fr; gap: 72px; align-items: center; }
.hero h1, .page-hero h1 { margin: .12em 0 .28em; font-size: clamp(2.55rem, 6vw, 5.25rem); line-height: .98; letter-spacing: -0.055em; }
.hero-copy { max-width: 720px; color: #dbe9ec; font-size: clamp(1.08rem, 2vw, 1.32rem); }
.eyebrow { margin: 0 0 7px; color: var(--copper); font-weight: 800; font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; }
.finder-card { padding: 28px; border-radius: var(--radius); background: var(--paper); color: var(--ink); box-shadow: var(--shadow); }
.finder-card h2 { margin: 0 0 18px; }
label { display: block; font-weight: 700; }
select, input[type="number"] { width: 100%; border: 1px solid #bac6c4; border-radius: 9px; background: white; color: var(--ink); padding: 11px 12px; }
select:focus, input:focus, button:focus, a:focus { outline: 3px solid rgba(8,127,123,.28); outline-offset: 2px; }
.finder-card select { margin: 5px 0 15px; }
.form-note, .field-help, .result-note, .source-line { color: var(--muted); font-size: .92rem; }

.button { display: inline-flex; justify-content: center; align-items: center; border: 0; border-radius: 10px; padding: 11px 17px; font-weight: 800; text-decoration: none; cursor: pointer; }
.button.primary { color: white; background: var(--teal); }
.button.primary:hover { color: white; background: var(--teal-dark); }
.button.secondary { color: var(--navy); background: #e5eceb; }
.button.secondary:hover { color: var(--navy); background: #d5dfdd; }
.button.large { min-height: 52px; padding-inline: 25px; }
.button-row { display: flex; gap: 12px; flex-wrap: wrap; }
.finder-card .button { width: 100%; margin-top: 5px; }
.text-link { font-weight: 800; }

.section { padding-block: 68px; }
.section-tint { background: var(--pale); }
.section-heading { max-width: 760px; margin-bottom: 28px; }
.section-heading h2 { margin: 0 0 8px; font-size: clamp(1.7rem, 3vw, 2.5rem); letter-spacing: -.035em; }
.card-grid { display: grid; gap: 18px; }
.popular-grid { grid-template-columns: repeat(4, 1fr); }
.subject-card { min-height: 142px; padding: 22px; border: 1px solid var(--line); border-radius: var(--radius); background: white; color: var(--ink); text-decoration: none; box-shadow: 0 7px 24px rgba(16,43,63,.05); transition: transform .15s ease, border-color .15s ease; }
.subject-card:hover { transform: translateY(-3px); border-color: var(--teal); color: var(--ink); }
.subject-card strong { display: block; margin: 12px 0 2px; font-size: 1.2rem; }
.card-kicker, .card-code { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; }
.three-up { display: grid; grid-template-columns: repeat(3, 1fr); gap: 34px; }
.three-up h2 { margin: 13px 0 7px; font-size: 1.25rem; }
.step-number { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: var(--navy); color: white; font-weight: 900; }
.prose h2 { margin-top: 1.7em; font-size: 1.55rem; letter-spacing: -.02em; }
.prose h2:first-child { margin-top: 0; }
.prose p, .prose li { font-size: 1.03rem; }
.formula { padding: 16px 18px; border-left: 4px solid var(--copper); background: var(--cream); border-radius: 0 var(--small-radius) var(--small-radius) 0; }
.formula code { font-size: 1rem; }

.page-hero { padding: 54px 0 58px; background: var(--navy); color: white; }
.page-hero.compact h1 { font-size: clamp(2.2rem, 5vw, 4.2rem); }
.page-hero p { max-width: 820px; color: #dbe7ea; font-size: 1.08rem; }
.breadcrumbs { display: flex; gap: 9px; flex-wrap: wrap; margin-bottom: 28px; color: #cbdadd; font-size: .86rem; }
.breadcrumbs a { color: #e9f2f3; }
.pill-nav { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 28px; }
.pill-nav a { border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px; background: white; text-decoration: none; font-weight: 750; }
.qualification-grid { grid-template-columns: repeat(3, 1fr); }
.qualification-card { display: flex; flex-direction: column; padding: 24px; border: 1px solid var(--line); border-radius: var(--radius); background: white; }
.qualification-card h2 { margin: 14px 0 8px; font-size: 1.25rem; }
.qualification-card h2 a { color: var(--ink); text-decoration: none; }
.qualification-card p { flex: 1; color: var(--muted); }
.card-topline { display: flex; justify-content: space-between; color: var(--muted); font-size: .78rem; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }

.calculator-layout { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 30px; align-items: start; }
.calculator-column { min-width: 0; }
.option-picker { margin-bottom: 18px; padding: 18px; border: 1px solid var(--line); border-radius: var(--small-radius); background: var(--pale); }
.inline-control { display: flex; gap: 10px; margin-top: 7px; }
.inline-control select { flex: 1; }
.calculator-card { border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(22px, 4vw, 38px); background: white; box-shadow: var(--shadow); }
.calculator-heading { display: flex; justify-content: space-between; gap: 18px; align-items: start; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.calculator-heading h2 { margin: 0; font-size: 1.75rem; }
.total-badge { white-space: nowrap; border-radius: 999px; background: var(--cream); padding: 7px 11px; color: var(--navy); font-size: .86rem; font-weight: 800; }
fieldset { border: 0; padding: 25px 0; margin: 0; border-bottom: 1px solid var(--line); }
legend { padding: 0; margin-bottom: 15px; font-size: 1.08rem; font-weight: 900; }
.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.choice-card { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: 12px; padding: 15px; cursor: pointer; }
.choice-card:has(input:checked) { border-color: var(--teal); background: #eff9f7; box-shadow: inset 0 0 0 1px var(--teal); }
.choice-card input { margin-top: 5px; }
.choice-card span { display: block; }
.choice-card small { display: block; margin-top: 3px; color: var(--muted); font-weight: 500; }
.exact-year { max-width: 260px; margin-top: 14px; }
.exact-year select { margin-top: 5px; }
.is-hidden { display: none !important; }
.marks-grid { display: grid; gap: 12px; }
.mark-field { display: grid; grid-template-columns: minmax(0, 1fr) 165px; align-items: center; gap: 16px; border: 1px solid var(--line); border-radius: 11px; padding: 13px 15px; }
.mark-input-wrap { display: flex; align-items: center; gap: 7px; color: var(--muted); white-space: nowrap; }
.mark-input-wrap input { min-width: 0; }
.calculator-card > .button { margin-top: 24px; }
.alert { margin: 20px 0 0; border-radius: 10px; padding: 15px 17px; }
.alert.error { color: var(--danger); background: var(--danger-pale); border: 1px solid #efc7c3; }
.alert ul { margin: 6px 0 0; padding-left: 20px; }
.calculator-aside { display: grid; gap: 16px; position: sticky; top: 18px; }
.aside-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 21px; background: white; }
.aside-card h2 { margin: 0 0 10px; font-size: 1.15rem; }
.aside-card ol { margin: 0; padding-left: 21px; }
.aside-card li + li { margin-top: 7px; }
.small-copy { color: var(--muted); font-size: .92rem; }

.result-card { margin-top: 22px; border: 2px solid var(--teal); border-radius: var(--radius); overflow: hidden; background: white; }
.result-heading { padding: 25px 28px 18px; background: #eff9f7; }
.result-heading h2 { margin: 0; }
.result-heading p:last-child { margin-bottom: 0; }
.result-summary, .big-result { padding: 27px 28px; }
.grade-chips { display: flex; flex-wrap: wrap; gap: 11px; margin-top: 15px; }
.grade-chips span { min-width: 78px; padding: 11px; border-radius: 10px; background: var(--cream); text-align: center; }
.grade-chips b, .grade-chips small { display: block; }
.grade-chips b { font-size: 1.35rem; }
.grade-chips small { color: var(--muted); }
.big-result-value { display: block; color: var(--navy); font-weight: 900; font-size: clamp(2rem, 5vw, 3.5rem); line-height: 1.1; letter-spacing: -.045em; }
.big-result.success { background: #eff9f7; }
.big-result.warning { background: #fff8e8; }
.result-note { padding: 0 28px 22px; }
.result-table { margin: 0; border: 0; }
.result-table th small, .boundary-table th small { display: block; color: var(--muted); font-weight: 500; }
.focus-row { background: #eff9f7; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: white; }
table { width: 100%; border-collapse: collapse; font-size: .94rem; }
th, td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
thead th { background: var(--navy); color: white; white-space: nowrap; }
tbody tr:last-child > * { border-bottom: 0; }
.total-row { background: var(--pale); }
.boundary-table td:not(:first-child), .boundary-table thead th:not(:first-child) { text-align: center; }
.boundary-table td:last-child { text-align: left; white-space: nowrap; }
.boundary-group + .boundary-group { margin-top: 45px; }
.link-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.link-list a { display: flex; justify-content: space-between; gap: 15px; padding: 13px 15px; border: 1px solid var(--line); border-radius: 9px; background: white; text-decoration: none; font-weight: 700; }
.link-list small { color: var(--muted); }

.site-footer { padding: 44px 0 25px; background: #0a202f; color: #d3e0e3; }
.footer-grid { display: grid; grid-template-columns: 1fr auto; gap: 40px; }
.footer-grid p { max-width: 560px; }
.footer-grid nav { display: grid; grid-template-columns: 1fr 1fr; gap: 9px 20px; }
.footer-grid a { color: #e7f1f2; }
.footer-small { margin-top: 28px; padding-top: 18px; border-top: 1px solid rgba(255,255,255,.12); color: #9fb2b7; font-size: .84rem; }

@media (max-width: 920px) {
    .hero-grid, .calculator-layout { grid-template-columns: 1fr; }
    .hero-grid { gap: 40px; }
    .calculator-aside { grid-template-columns: 1fr 1fr; position: static; }
    .popular-grid, .qualification-grid { grid-template-columns: repeat(2, 1fr); }
    .link-list { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 680px) {
    .header-inner { align-items: flex-start; flex-direction: column; padding-block: 16px; }
    .main-nav { width: 100%; gap: 14px; overflow-x: auto; padding-bottom: 2px; }
    .hero { padding-block: 54px; }
    .popular-grid, .qualification-grid, .three-up, .choice-grid, .calculator-aside, .link-list { grid-template-columns: 1fr; }
    .calculator-heading { display: block; }
    .total-badge { display: inline-block; margin-top: 12px; }
    .mark-field { grid-template-columns: 1fr; gap: 8px; }
    .inline-control { align-items: stretch; flex-direction: column; }
    .footer-grid { grid-template-columns: 1fr; }
    .footer-grid nav { grid-template-columns: 1fr 1fr; }
    .section { padding-block: 50px; }
}

/* v1.1 visual calculator */
.depth-switch { display: inline-grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-top: 22px; padding: 4px; border-radius: 12px; background: var(--pale); }
.depth-switch label { cursor: pointer; }
.depth-switch input { position: absolute; opacity: 0; pointer-events: none; }
.depth-switch span { display: block; min-width: 100px; padding: 9px 14px; border-radius: 9px; text-align: center; font-weight: 850; }
.depth-switch input:checked + span { background: white; color: var(--navy); box-shadow: 0 2px 9px rgba(16,43,63,.12); }
.is-simple .detail-only, .is-simple .detail-number { display: none !important; }
.is-detailed .simple-intro { display: none; }
.marker-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.choice-card.compact { min-height: 86px; }
.uncertainty-note { margin-top: 12px; padding: 10px 12px; border-radius: 9px; background: #fff8e8; color: var(--ink) !important; font-size: .93rem !important; }
.visual-result { display: grid; grid-template-columns: 150px minmax(0,1fr); gap: 28px; align-items: center; padding: 30px 28px; }
.grade-orb { display: grid; place-items: center; align-content: center; width: 132px; height: 132px; border-radius: 50%; background: var(--navy); color: white; box-shadow: inset 0 0 0 9px rgba(255,255,255,.13), 0 10px 28px rgba(16,43,63,.17); }
.grade-orb span { text-transform: uppercase; font-size: .75rem; letter-spacing: .13em; }
.grade-orb strong { font-size: 3.4rem; line-height: 1; }
.grade-progress-copy h3 { margin: 0 0 8px; font-size: clamp(1.45rem, 3vw, 2.15rem); letter-spacing: -.03em; }
.grade-progress-copy p { margin: 0 0 14px; }
.grade-band, .remaining-bar { height: 16px; overflow: hidden; border-radius: 999px; background: #dce6e5; box-shadow: inset 0 1px 2px rgba(16,43,63,.13); }
.grade-band span, .remaining-bar span { display: block; height: 100%; min-width: 2px; border-radius: inherit; background: linear-gradient(90deg, var(--teal), var(--copper)); }
.grade-band-labels { display: flex; justify-content: space-between; gap: 12px; margin-top: 7px; color: var(--muted); font-size: .8rem; }
.target-ring { --ring-value: 0; display: grid; place-items: center; align-content: center; width: 140px; height: 140px; border-radius: 50%; background: radial-gradient(circle closest-side, white 72%, transparent 73% 99%), conic-gradient(var(--teal) calc(var(--ring-value) * 1%), #dce6e5 0); box-shadow: 0 8px 24px rgba(16,43,63,.12); }
.target-ring span { font-size: 2.4rem; font-weight: 950; line-height: 1; color: var(--navy); }
.target-ring small { max-width: 75px; margin-top: 5px; text-align: center; color: var(--muted); line-height: 1.1; }
.caution-strip { margin: 0 28px 24px; padding: 13px 16px; border-left: 4px solid var(--copper); border-radius: 0 9px 9px 0; background: #fff8e8; }
.grade-ladder { padding: 6px 28px 28px; }
.grade-ladder h3 { margin: 12px 0 14px; }
.grade-ladder-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(95px, 1fr)); gap: 8px; }
.grade-rung { padding: 12px 8px; border: 1px solid var(--line); border-radius: 10px; text-align: center; background: var(--pale); }
.grade-rung strong, .grade-rung span, .grade-rung small { display: block; }
.grade-rung strong { font-size: 1.35rem; color: var(--navy); }
.grade-rung span { margin: 2px 0; font-size: .8rem; font-weight: 800; }
.grade-rung small { color: var(--muted); font-size: .72rem; }
.grade-rung.target { border-color: var(--teal); background: #eff9f7; box-shadow: inset 0 0 0 1px var(--teal); }
.trend-chart-wrap { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; background: white; box-shadow: 0 8px 26px rgba(16,43,63,.06); }
.trend-chart { display: block; width: 100%; height: auto; overflow: visible; }
.chart-gridline { stroke: #dbe4e4; stroke-width: 1; }
.chart-year-line { stroke: #edf1f1; stroke-width: 1; }
.chart-year-line.transitional { stroke: var(--copper); stroke-dasharray: 5 5; opacity: .75; }
.chart-axis-label, .chart-gap-label { fill: var(--muted); font-size: 12px; font-family: inherit; }
.chart-gap-label { font-size: 11px; font-weight: 750; }
.trend-line { fill: none; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.trend-point { stroke: white; stroke-width: 2; }
.trend-line.line-1, .trend-point.line-1 { stroke: #117a72; fill: #117a72; }
.trend-line.line-2, .trend-point.line-2 { stroke: #a45f28; fill: #a45f28; }
.trend-line.line-3, .trend-point.line-3 { stroke: #355c8a; fill: #355c8a; }
.trend-line.line-4, .trend-point.line-4 { stroke: #7a4f83; fill: #7a4f83; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 10px 18px; padding: 5px 10px 0; font-size: .86rem; font-weight: 750; }
.chart-legend span::before { content: ''; display: inline-block; width: 14px; height: 3px; margin: 0 7px 3px 0; border-radius: 9px; background: currentColor; }
.legend-1 { color: #117a72; } .legend-2 { color: #a45f28; } .legend-3 { color: #355c8a; } .legend-4 { color: #7a4f83; }
.legend-transition { color: var(--copper); }
.legend-transition::before { height: 0 !important; border-top: 2px dashed currentColor; background: transparent !important; }
.pandemic-note { margin-top: 18px; padding: 19px 21px; border-radius: 12px; background: var(--cream); }
.pandemic-note h3 { margin: 0 0 6px; font-size: 1.05rem; }
.pandemic-note p { margin: 0; }
@media (max-width: 760px) {
    .marker-grid { grid-template-columns: 1fr; }
    .visual-result { grid-template-columns: 1fr; text-align: center; }
    .grade-orb, .target-ring { margin-inline: auto; }
    .grade-band-labels { text-align: left; }
}
