/* ==========================================================================
   HomeMathLab — public site styles
   Design language adapted from the Viora template:
   primary deep green #10483D, secondary mint #C3EFE6,
   "Plus Jakarta Sans" (body) + "Instrument Sans" (headings), with strong
   system fallbacks. Font files are self-hosted (see @font-face below);
   no external requests are made by this stylesheet.
   ========================================================================== */

/* ------------------------------------------------------- self-hosted fonts
   Latin subset, static per-weight instances of the Google Fonts variable
   fonts, stored in ../fonts/ relative to this stylesheet. */
@font-face {
    font-family: "Plus Jakarta Sans";
    src: url("../fonts/plus-jakarta-sans-400.woff2") format("woff2");
    font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
    font-family: "Plus Jakarta Sans";
    src: url("../fonts/plus-jakarta-sans-500.woff2") format("woff2");
    font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
    font-family: "Plus Jakarta Sans";
    src: url("../fonts/plus-jakarta-sans-600.woff2") format("woff2");
    font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
    font-family: "Plus Jakarta Sans";
    src: url("../fonts/plus-jakarta-sans-700.woff2") format("woff2");
    font-weight: 700; font-style: normal; font-display: swap;
}
@font-face {
    font-family: "Plus Jakarta Sans";
    src: url("../fonts/plus-jakarta-sans-800.woff2") format("woff2");
    font-weight: 800; font-style: normal; font-display: swap;
}
@font-face {
    font-family: "Instrument Sans";
    src: url("../fonts/instrument-sans-400.woff2") format("woff2");
    font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
    font-family: "Instrument Sans";
    src: url("../fonts/instrument-sans-500.woff2") format("woff2");
    font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
    font-family: "Instrument Sans";
    src: url("../fonts/instrument-sans-600.woff2") format("woff2");
    font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
    font-family: "Instrument Sans";
    src: url("../fonts/instrument-sans-700.woff2") format("woff2");
    font-weight: 700; font-style: normal; font-display: swap;
}

:root {
    --primary: #10483D;
    --primary-dark: #0B352C;
    --secondary: #C3EFE6;
    --ink: #14211C;
    --text: #26362F;
    --text-muted: #5C6F67;
    --bg: #F5F8F6;
    --bg-alt: #EDF3F0;
    --card: #FFFFFF;
    --border: #D9E5DF;
    --border-strong: #BFD3C9;
    --danger: #9C2B2B;
    --radius: 14px;
    --font-body: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-head: "Instrument Sans", "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: var(--font-body);
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
    font-size: 16.5px;
}

h1, h2, h3, h4 {
    font-family: var(--font-head);
    color: var(--primary);
    line-height: 1.18;
    margin: 0 0 .55em;
    font-weight: 600;
    letter-spacing: -0.01em;
}
h1 { font-size: clamp(2rem, 4.5vw, 3.1rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); }
h3 { font-size: 1.18rem; }

p { margin: 0 0 1em; }
a { color: var(--primary); }
ul, ol { margin: 0 0 1em; padding-left: 1.3em; }
li { margin-bottom: .35em; }

.wrap { max-width: 1160px; margin: 0 auto; padding: 0 20px; }
.sr-only {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap;
}
.lede { font-size: 1.14rem; color: var(--text-muted); max-width: 46em; }
.section-kicker {
    text-transform: uppercase; letter-spacing: .14em; font-size: .78rem;
    font-weight: 700; color: var(--primary); margin: 0 0 .6em;
}
.section-kicker-light { color: var(--secondary); }
.section-lede { color: var(--text-muted); max-width: 52em; }
.section { padding: 64px 0; }
.section-alt { background: var(--bg-alt); }

/* ---------------------------------------------------------------- buttons */
.btn {
    display: inline-block; padding: .78em 1.5em; border-radius: 999px;
    font-weight: 700; font-size: 1rem; text-decoration: none; cursor: pointer;
    border: 2px solid transparent; transition: background .15s, color .15s, border-color .15s;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--secondary); color: var(--primary); }
.btn-secondary:hover { background: #AEE6D9; }
.btn-ghost { background: transparent; color: var(--primary); border-color: var(--border-strong); }
.btn-ghost:hover { border-color: var(--primary); }
.btn-reset {
    background: none; border: none; color: var(--text-muted); cursor: pointer;
    font: inherit; font-size: .9rem; text-decoration: underline; padding: 0;
}

/* ----------------------------------------------------------------- header */
.site-header {
    position: sticky; top: 0; z-index: 50;
    background: rgba(255,255,255,.96); border-bottom: 1px solid var(--border);
    backdrop-filter: blur(6px);
}
.header-inner { display: flex; align-items: center; gap: 28px; min-height: 68px; }
.brand { text-decoration: none; margin-right: auto; }
.brand-word { font-family: var(--font-head); font-weight: 700; font-size: 1.45rem; letter-spacing: -0.02em; }
.brand-home { color: var(--primary); }
.brand-math { color: var(--ink); }
.site-nav { display: flex; gap: 26px; }
.site-nav a { color: var(--ink); text-decoration: none; font-weight: 600; font-size: .98rem; }
.site-nav a:hover { color: var(--primary); }
.nav-toggle {
    display: none; background: none; border: 0; cursor: pointer; padding: 8px;
}
.nav-toggle span { display: block; width: 24px; height: 2px; background: var(--ink); margin: 5px 0; }

/* ------------------------------------------------------------------- hero */
.hero {
    background: linear-gradient(180deg, #FFFFFF 0%, var(--bg) 100%);
    padding: 64px 0 40px;
    border-bottom: 1px solid var(--border);
}
.hero-grid { display: grid; grid-template-columns: 1.55fr 1fr; gap: 40px; align-items: start; }
.hero-kicker {
    text-transform: uppercase; letter-spacing: .14em; font-size: .8rem;
    font-weight: 700; color: var(--primary); margin-bottom: 14px;
}
.hero h1 { color: var(--ink); }
.hero-accent { color: var(--primary); }
.hero-search { display: flex; gap: 10px; margin: 26px 0 8px; max-width: 560px; position: relative; }
.hero-search input, .index-search input {
    flex: 1; padding: .8em 1em; font: inherit; border: 1.5px solid var(--border-strong);
    border-radius: 999px; background: #fff; min-width: 0;
}
.hero-search input:focus, .index-search input:focus { outline: 2px solid var(--secondary); border-color: var(--primary); }
.search-results {
    max-width: 560px; background: #fff; border: 1px solid var(--border);
    border-radius: var(--radius); margin-bottom: 10px; overflow: hidden;
}
.search-results a {
    display: flex; justify-content: space-between; gap: 12px;
    padding: 10px 16px; text-decoration: none; color: var(--ink);
    border-bottom: 1px solid var(--bg-alt); font-weight: 600;
}
.search-results a:last-child { border-bottom: 0; }
.search-results a:hover { background: var(--bg-alt); }
.search-results .sr-cluster { color: var(--text-muted); font-weight: 500; font-size: .88rem; }
.hero-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.chip {
    background: #fff; border: 1px solid var(--border-strong); color: var(--primary);
    padding: .38em .95em; border-radius: 999px; text-decoration: none;
    font-size: .88rem; font-weight: 600;
}
.chip:hover { background: var(--secondary); border-color: var(--secondary); }
.hero-card {
    background: var(--primary); color: #EAF5F1; border-radius: 18px; padding: 28px;
}
.hero-card h2 { color: #fff; font-size: 1.35rem; }
.hero-card p { color: #CFE8DF; }
.hero-card .btn { margin: 6px 0 16px; }
.hero-card-list { list-style: none; padding: 0; margin: 0; }
.hero-card-list li { padding-left: 1.4em; position: relative; margin-bottom: .5em; color: #EAF5F1; }
.hero-card-list li::before { content: "✓"; position: absolute; left: 0; color: var(--secondary); font-weight: 700; }
.hero-media { margin: 38px 0 0; }
.hero-media img {
    display: block; width: 100%; height: auto;
    border-radius: 18px; border: 1px solid var(--border);
}
.counter-band {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px;
    margin: 44px 0 8px; padding: 22px 0 6px; border-top: 1px solid var(--border);
}
.counter { text-align: left; }
.counter dt { font-family: var(--font-head); font-size: 2rem; font-weight: 700; color: var(--primary); line-height: 1; }
.counter dd { margin: 6px 0 0; color: var(--text-muted); font-size: .92rem; }

/* ------------------------------------------------------------------ cards */
.tool-grid, .guide-grid {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 22px;
}
.tool-card, .guide-card {
    display: block; background: var(--card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 22px; text-decoration: none; color: var(--text);
    transition: border-color .15s, transform .15s, box-shadow .15s;
}
a.tool-card:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: 0 8px 24px rgba(16,72,61,.08); }
.tool-card h3, .guide-card h3 { margin-bottom: .35em; }
.tool-card p, .guide-card p { color: var(--text-muted); font-size: .96rem; margin-bottom: .8em; }
.tool-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.tool-card-link { color: var(--primary); font-weight: 700; font-size: .93rem; }
.tool-card-formula {
    display: block; background: var(--bg-alt); border-radius: 8px; padding: 8px 12px;
    font-size: .85rem; color: var(--primary-dark); margin-bottom: .9em;
}
.badge {
    display: inline-block; font-size: .7rem; font-weight: 800; letter-spacing: .06em;
    text-transform: uppercase; padding: .28em .7em; border-radius: 999px; white-space: nowrap;
}
.badge-live { background: var(--secondary); color: var(--primary-dark); }
.badge-phase { background: #F3E3C2; color: #6B4E12; }

/* ------------------------------------------------------------------- tabs */
.tabs { margin-top: 26px; }
.tab-list { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.tab-btn {
    font: inherit; font-weight: 700; font-size: .95rem; cursor: pointer;
    background: #fff; color: var(--primary); border: 1.5px solid var(--border-strong);
    padding: .55em 1.1em; border-radius: 999px;
}
.tab-btn:hover { border-color: var(--primary); }
.tab-btn.is-active { background: var(--primary); color: #fff; border-color: var(--primary); }
.tab-panel { padding-top: 12px; }
.cluster-blurb { color: var(--text-muted); max-width: 52em; }

/* --------------------------------------------------------------- why band */
.why-band { background: var(--primary); color: #EAF5F1; }
.why-band h2 { color: #fff; }
.why-grid { display: grid; grid-template-columns: 1.15fr 1fr; gap: 44px; }
.why-copy p { color: #CFE8DF; }
.steps { list-style: none; padding: 0; margin: 22px 0 0; counter-reset: step; }
.steps li {
    padding: 12px 0 12px 52px; position: relative; border-top: 1px solid rgba(195,239,230,.25);
    color: #CFE8DF;
}
.steps li strong { color: #fff; }
.steps li::before {
    counter-increment: step; content: counter(step);
    position: absolute; left: 0; top: 12px; width: 34px; height: 34px;
    border-radius: 50%; background: var(--secondary); color: var(--primary-dark);
    font-weight: 800; display: flex; align-items: center; justify-content: center;
    font-family: var(--font-head);
}
.why-points { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-content: start; }
.why-point {
    background: rgba(255,255,255,.06); border: 1px solid rgba(195,239,230,.3);
    border-radius: var(--radius); padding: 20px;
}
.why-point h3 { color: var(--secondary); font-size: 1.05rem; }
.why-point p { color: #CFE8DF; font-size: .95rem; margin: 0; }

/* -------------------------------------------------------------- accordion */
.accordion { border-top: 1px solid var(--border); margin-top: 10px; }
.accordion-item { border-bottom: 1px solid var(--border); }
.accordion-item h3 { margin: 0; }
.accordion-btn {
    width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 14px;
    background: none; border: 0; cursor: pointer; font: inherit; font-weight: 700;
    color: var(--primary); text-align: left; padding: 16px 4px; font-size: 1.02rem;
}
.accordion-icon { font-size: 1.3rem; font-weight: 400; color: var(--primary); transition: transform .15s; }
.accordion-btn[aria-expanded="true"] .accordion-icon { transform: rotate(45deg); }
.accordion-panel { padding: 0 4px 18px; color: var(--text-muted); max-width: 52em; }
.accordion-panel p { margin: 0; }

/* -------------------------------------------------------------------- cta */
.cta-band { background: var(--primary-dark); padding: 56px 0; }
.cta-inner { text-align: center; }
.cta-inner h2 { color: #fff; }
.cta-inner p { color: #CFE8DF; }

/* ------------------------------------------------------------------ footer */
.site-footer { background: var(--primary); color: #CFE8DF; padding: 56px 0 0; margin-top: 0; }
.footer-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 32px; }
.site-footer .brand-home { color: var(--secondary); }
.site-footer .brand-math { color: #fff; }
.footer-brand p { color: #CFE8DF; font-size: .95rem; margin-top: 12px; max-width: 30em; }
.footer-nav h4 { color: #fff; font-size: .95rem; margin-bottom: 12px; }
.footer-nav a { display: block; color: #CFE8DF; text-decoration: none; padding: 3px 0; font-size: .95rem; }
.footer-nav a:hover { color: #fff; text-decoration: underline; }
.footer-base { border-top: 1px solid rgba(195,239,230,.3); margin-top: 36px; padding: 18px 0 22px; }
.footer-base p { margin: 0; font-size: .88rem; color: #A9CFC2; }

/* ------------------------------------------------------------ breadcrumbs */
.breadcrumbs { font-size: .9rem; color: var(--text-muted); padding: 22px 0 10px; }
.breadcrumbs a { color: var(--primary); text-decoration: none; }
.breadcrumbs a:hover { text-decoration: underline; }

/* ------------------------------------------------------------- calculator */
.calc-head { padding: 8px 0 20px; }
.calc-shell {
    background: var(--card); border: 1px solid var(--border); border-radius: 18px;
    padding: 26px; margin-bottom: 10px;
}
.calc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 34px; }
.calc-inputs h2, .calc-results h2 { font-size: 1.25rem; }
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 700; color: var(--ink); margin-bottom: 6px; font-size: .96rem; }
.field-help {
    display: inline-flex; align-items: center; justify-content: center;
    width: 17px; height: 17px; border-radius: 50%; background: var(--bg-alt);
    color: var(--primary); font-size: .72rem; cursor: help; vertical-align: middle;
}
.field select, .field input[type="number"] {
    width: 100%; font: inherit; padding: .62em .8em; border: 1.5px solid var(--border-strong);
    border-radius: 10px; background: #fff;
}
.field select:focus, .field input[type="number"]:focus { outline: 2px solid var(--secondary); border-color: var(--primary); }
.field-control { display: flex; align-items: stretch; }
.field-control .affix {
    display: inline-flex; align-items: center; padding: 0 .6em;
    background: var(--bg-alt); border: 1.5px solid var(--border-strong); color: var(--text-muted);
    font-size: .9rem;
}
.field-control .affix:first-child { border-radius: 10px 0 0 10px; border-right: 0; }
.field-control .affix:last-child { border-radius: 0 10px 10px 0; border-left: 0; }
.field-control input { border-radius: 0; }
.field-control input:first-child { border-radius: 10px 0 0 10px; }
.field-control input:last-child { border-radius: 0 10px 10px 0; }
.field-control input:only-child { border-radius: 10px; }
.calc-results { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; align-self: start; }
.results-empty { color: var(--text-muted); margin: 0; }
.result-primary { margin-bottom: 14px; }
.result-primary .result-label { display: block; font-size: .82rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); }
.result-primary .result-value { font-family: var(--font-head); font-size: 2.3rem; font-weight: 700; color: var(--primary); line-height: 1.1; }
.result-primary .result-unit { font-size: 1.05rem; color: var(--text-muted); font-weight: 600; }
.result-list { list-style: none; padding: 0; margin: 0; }
.result-list li {
    display: flex; justify-content: space-between; gap: 14px;
    padding: 9px 0; border-top: 1px solid var(--border); margin: 0;
}
.result-list li span { color: var(--text-muted); }
.result-list li strong { color: var(--ink); white-space: nowrap; }
.result-note { font-size: .88rem; color: var(--text-muted); margin-top: 12px; }
.notice-band {
    background: #FBF3DC; border: 1px solid #EAD9A0; color: #57460F;
    border-radius: var(--radius); padding: 18px 22px; margin-bottom: 10px;
}
.notice-band a { color: #57460F; font-weight: 700; }
.calc-content { padding-top: 26px; padding-bottom: 56px; }
.content-block { margin-bottom: 30px; max-width: 56em; }
.content-block p, .content-block li { color: var(--text); }
.formula-line {
    background: var(--bg-alt); border-left: 4px solid var(--primary);
    padding: 14px 18px; border-radius: 0 10px 10px 0; font-weight: 600; color: var(--primary-dark);
}

/* ------------------------------------------------------------ prose pages */
.page-narrow { max-width: 820px; padding-bottom: 60px; }
.page-narrow-left { max-width: 820px; }
.prose h2 { margin-top: 1.2em; font-size: 1.45rem; }
.prose a { font-weight: 600; }
.page-updated { color: var(--text-muted); font-size: .9rem; margin-top: 34px; }
.cluster-block { padding: 26px 0 6px; }
.cluster-block > h2 { margin-bottom: .2em; }
.index-search { max-width: 560px; margin: 6px 0 10px; display: flex; }
.search-empty { color: var(--danger); font-weight: 600; }
.programme-title { margin-top: 34px; }
.error-page { padding-top: 30px; }

/* ------------------------------------------------------------ cost guides */
.guide-media { margin: 30px 0 0; }
.guide-media img {
    display: block; width: 100%; height: auto;
    border-radius: 18px; border: 1px solid var(--border);
}
.guide-media figcaption { color: var(--text-muted); font-size: .9rem; margin-top: 10px; }
.cost-band-note { color: var(--text-muted); font-size: .95rem; margin: 14px 0 0; max-width: 56em; }
.table-scroll { overflow-x: auto; margin: 18px 0 8px; }
.cost-table {
    width: 100%; border-collapse: collapse; font-size: .97rem;
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
}
.cost-table th, .cost-table td {
    padding: 11px 14px; text-align: right; border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.cost-table thead th {
    background: var(--bg-alt); color: var(--primary-dark); font-family: var(--font-head);
    font-size: .85rem; text-transform: uppercase; letter-spacing: .04em;
}
.cost-table tbody th { text-align: left; font-weight: 600; white-space: normal; min-width: 180px; }
.cost-table tbody td { font-variant-numeric: tabular-nums; }
.cost-table .cost-detail {
    display: block; font-weight: 400; color: var(--text-muted); font-size: .88rem; margin-top: 2px;
}
.cost-table tr.cost-total th, .cost-table tr.cost-total td {
    font-weight: 800; color: var(--primary-dark); background: var(--secondary);
    border-bottom: none;
}
.split-lists { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; }
.split-lists h3 { margin-top: 0; }
.check-list, .cross-list { list-style: none; padding: 0; margin: 0; }
.check-list li, .cross-list li { padding-left: 1.5em; position: relative; margin-bottom: .55em; }
.check-list li::before { content: "✓"; position: absolute; left: 0; color: var(--primary); font-weight: 700; }
.cross-list li::before { content: "—"; position: absolute; left: 0; color: var(--danger); font-weight: 700; }
.factor-list li { margin-bottom: .6em; }
.cluster-media { margin: 0 0 18px; }
.cluster-media img {
    display: block; width: 100%; height: auto; max-height: 300px; object-fit: cover;
    border-radius: var(--radius); border: 1px solid var(--border);
}

/* -------------------------------------------------------------- responsive */
@media (max-width: 960px) {
    .hero-grid, .why-grid { grid-template-columns: 1fr; }
    .tool-grid, .guide-grid { grid-template-columns: repeat(2, 1fr); }
    .footer-grid { grid-template-columns: 1fr 1fr; }
    .counter-band { grid-template-columns: repeat(2, 1fr); }
    .calc-grid { grid-template-columns: 1fr; }
    .split-lists { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
    .site-nav {
        display: none; position: absolute; top: 68px; left: 0; right: 0;
        background: #fff; border-bottom: 1px solid var(--border);
        flex-direction: column; padding: 14px 20px 20px; gap: 12px;
    }
    .site-nav.is-open { display: flex; }
    .nav-toggle { display: block; }
    .tool-grid, .guide-grid, .why-points { grid-template-columns: 1fr; }
    .hero-search { flex-direction: column; }
    .hero-search .btn { width: 100%; }
    .section { padding: 44px 0; }
    body { font-size: 16px; }
}
