/* ==========================================================================
   SEOMathLab design system
   Corporate, restrained, fast. No frameworks.
   ========================================================================== */

:root {
    --blue: #2563eb;
    --blue-dark: #1d4ed8;
    --navy: #102a4c;
    --ink: #1a2332;
    --muted: #5b6b7f;
    --line: #e3e9f0;
    --bg: #ffffff;
    --bg-soft: #f6f8fb;
    --bg-card: #ffffff;
    --green: #15803d;
    --amber: #b45309;
    --red: #b91c1c;
    --radius: 10px;
    --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --font-display: 'Sora', 'Inter', system-ui, sans-serif;
    --wrap: 1200px;
    --wrap-narrow: 760px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

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

h1, h2, h3, h4 {
    font-family: var(--font-display);
    line-height: 1.25;
    color: var(--navy);
    margin: 0 0 0.6em;
    letter-spacing: -0.01em;
}

h1 { font-size: clamp(1.9rem, 4vw, 2.6rem); font-weight: 800; }
h2 { font-size: 1.45rem; font-weight: 700; }
h3 { font-size: 1.1rem; font-weight: 700; }

p { margin: 0 0 1em; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 24px; }
.page-narrow { max-width: var(--wrap-narrow); padding-top: 32px; padding-bottom: 64px; }

.lede { font-size: 1.15rem; color: var(--muted); max-width: 640px; }

/* --------------------------------------------------------------------------
   Brand wordmark
   -------------------------------------------------------------------------- */
.brand-word {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.45rem;
    letter-spacing: -0.02em;
    white-space: nowrap;
}
.brand-seo { color: var(--blue); }
.brand-math { color: var(--navy); }
.site-footer .brand-math { color: #ffffff; }

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */
.site-header {
    border-bottom: 1px solid var(--line);
    background: #fff;
    position: sticky;
    top: 0;
    z-index: 50;
}
.header-inner {
    display: flex;
    align-items: center;
    gap: 32px;
    height: 68px;
}
.site-nav { display: flex; gap: 24px; margin-left: auto; }
.site-nav a { color: var(--ink); font-weight: 500; font-size: 0.95rem; }
.site-nav a:hover { color: var(--blue); text-decoration: none; }
.nav-toggle { display: none; }

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */
.site-footer { background: var(--navy); color: #c4cfdd; margin-top: 80px; }
.site-footer .wrap { padding-top: 48px; padding-bottom: 24px; }
.footer-grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr 1fr 1fr;
    gap: 32px;
    margin-bottom: 32px;
}
.footer-brand p { font-size: 0.9rem; margin-top: 12px; max-width: 300px; }
.footer-nav h4 { color: #fff; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 12px; }
.footer-nav a { display: block; color: #c4cfdd; font-size: 0.92rem; margin-bottom: 8px; }
.footer-nav a:hover { color: #fff; }
.footer-base { border-top: 1px solid rgba(255,255,255,0.12); padding-top: 20px; font-size: 0.85rem; }

/* --------------------------------------------------------------------------
   Hero (homepage)
   -------------------------------------------------------------------------- */
.hero { background: var(--bg-soft); border-bottom: 1px solid var(--line); padding: 72px 0; }
.hero-kicker {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--blue);
    margin-bottom: 12px;
}
.hero h1 { margin-bottom: 16px; }
.hero-actions { display: flex; gap: 12px; margin-top: 28px; flex-wrap: wrap; }

.btn {
    display: inline-block;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    border: 1px solid transparent;
    cursor: pointer;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-dark); color: #fff; }
.btn-ghost { border-color: var(--line); color: var(--ink); background: #fff; }
.btn-ghost:hover { border-color: var(--blue); color: var(--blue); }

/* --------------------------------------------------------------------------
   Tool cards
   -------------------------------------------------------------------------- */
.home-tools { padding: 64px 0; }
.tool-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
    margin-top: 28px;
}
.tool-card {
    display: block;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 24px;
    background: var(--bg-card);
    transition: border-color 0.15s, box-shadow 0.15s;
}
.tool-card:hover { border-color: var(--blue); box-shadow: 0 4px 16px rgba(37,99,235,0.08); text-decoration: none; }
.tool-card h3 { font-size: 1.05rem; margin-bottom: 8px; }
.tool-card p { font-size: 0.9rem; color: var(--muted); margin-bottom: 12px; }
.tool-card-link { font-size: 0.9rem; font-weight: 600; color: var(--blue); }

.home-trust { background: var(--bg-soft); border-top: 1px solid var(--line); padding: 64px 0; }
.trust-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; margin-top: 28px; }
.trust-item h3 { font-size: 1.05rem; }
.trust-item p { color: var(--muted); font-size: 0.95rem; }

/* --------------------------------------------------------------------------
   Calculator page
   -------------------------------------------------------------------------- */
.breadcrumbs { font-size: 0.85rem; color: var(--muted); margin: 24px 0 8px; }
.breadcrumbs a { color: var(--muted); }

.calc-head { margin-bottom: 28px; }
.calc-head h1 { margin-bottom: 8px; }

.calc-shell {
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 2px 12px rgba(16,42,76,0.05);
    overflow: hidden;
    margin-bottom: 24px;
}
.calc-grid { display: grid; grid-template-columns: 1fr 1fr; }
.calc-inputs { padding: 28px; border-right: 1px solid var(--line); }
.calc-inputs-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}
.calc-inputs-head h2 { margin: 0; font-size: 1.1rem; }

.mode-toggle { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.mode-btn {
    border: 0;
    background: #fff;
    padding: 8px 18px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--muted);
    cursor: pointer;
}
.mode-btn.is-active { background: var(--blue); color: #fff; }

.field { margin-bottom: 18px; }
.field-pro { display: none; }
.calc-shell.mode-pro .field-pro { display: block; }
.field label { display: block; font-weight: 600; font-size: 0.9rem; margin-bottom: 6px; }
.field-help {
    display: inline-block;
    width: 18px; height: 18px;
    border-radius: 50%;
    background: var(--bg-soft);
    border: 1px solid var(--line);
    color: var(--muted);
    font-size: 0.7rem;
    font-weight: 700;
    text-align: center;
    line-height: 16px;
    cursor: help;
    margin-left: 6px;
}
.field-control { display: flex; align-items: center; gap: 0; }
.field-control .affix {
    padding: 10px 12px;
    background: var(--bg-soft);
    border: 1px solid var(--line);
    color: var(--muted);
    font-size: 0.9rem;
    white-space: nowrap;
}
.field-control .affix:first-child { border-radius: 8px 0 0 8px; border-right: 0; }
.field-control .affix:last-child { border-radius: 0 8px 8px 0; border-left: 0; }
.field-control input, .field select, .field input[type="number"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: 1rem;
    font-family: var(--font-body);
    color: var(--ink);
}
.field-control input { border-radius: 0; }
.field-control .affix:first-child + input { border-radius: 0 8px 8px 0; }
.field-control input:first-child { border-radius: 8px 0 0 8px; }
.field-control input:only-child { border-radius: 8px; }
.field input:focus, .field select:focus { outline: 2px solid var(--blue); outline-offset: -1px; border-color: var(--blue); }
.field-slider { width: 100%; margin-top: 8px; accent-color: var(--blue); }

.btn-reset {
    background: none;
    border: 0;
    color: var(--muted);
    font-size: 0.85rem;
    cursor: pointer;
    padding: 0;
    margin-top: 4px;
}
.btn-reset:hover { color: var(--blue); text-decoration: underline; }

.calc-results { padding: 28px; background: var(--bg-soft); }
.calc-results h2 { font-size: 1.1rem; margin-bottom: 16px; }
.results-empty { color: var(--muted); }
.metric { margin-bottom: 20px; }
.metric-label { font-size: 0.85rem; color: var(--muted); font-weight: 500; margin-bottom: 2px; }
.metric-value { font-family: var(--font-display); font-size: 2.2rem; font-weight: 800; color: var(--blue); line-height: 1.1; }
.metric-value.neutral { color: var(--navy); }
.metric-sub { font-size: 0.85rem; color: var(--muted); }
.metric-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; margin-top: 12px; }
.metric-table th, .metric-table td { text-align: left; padding: 8px 4px; border-bottom: 1px solid var(--line); }
.metric-table th { color: var(--muted); font-weight: 500; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; }
.confidence {
    display: inline-block;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 20px;
    margin-top: 8px;
}
.confidence-low { background: #fef3c7; color: var(--amber); }
.confidence-medium { background: #dbeafe; color: var(--blue-dark); }
.confidence-high { background: #dcfce7; color: var(--green); }

.chart-wrap { margin-top: 20px; }
.chart-wrap svg { width: 100%; height: auto; display: block; }
.chart-caption { font-size: 0.8rem; color: var(--muted); margin-top: 6px; }

/* Content sections below the calculator */
.calc-content { padding-bottom: 64px; }
.content-block { margin-top: 40px; }
.content-block table { width: 100%; border-collapse: collapse; margin: 16px 0; font-size: 0.95rem; }
.content-block th, .content-block td { border: 1px solid var(--line); padding: 10px 14px; text-align: left; }
.content-block th { background: var(--bg-soft); font-weight: 600; }
.prose ul, .content-block ul { padding-left: 20px; }
.prose li, .content-block li { margin-bottom: 6px; }

/* --------------------------------------------------------------------------
   Ad slots: fixed reserved dimensions, never shift layout
   -------------------------------------------------------------------------- */
.ad-slot {
    border: 1px dashed var(--line);
    background: var(--bg-soft);
    border-radius: 8px;
    min-height: 110px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    margin: 24px 0;
    overflow: hidden;
}
.ad-slot-label {
    position: absolute;
    top: 6px; left: 10px;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
}
.ad-mobile { display: none; }
@media (max-width: 900px) {
    .ad-desktop { display: none; }
    .ad-mobile { display: flex; }
}

/* --------------------------------------------------------------------------
   Articles, forms, notices
   -------------------------------------------------------------------------- */
.article-list { display: grid; gap: 16px; margin-top: 28px; }
.article-card { display: block; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 24px; }
.article-card:hover { border-color: var(--blue); text-decoration: none; }
.article-card h3 { margin-bottom: 6px; }
.article-card p { color: var(--muted); font-size: 0.95rem; margin: 0; }

.prose { font-size: 1.02rem; }
.page-updated { color: var(--muted); font-size: 0.85rem; margin-top: 32px; }

.form { max-width: 560px; margin-top: 24px; }
.form .field { margin-bottom: 16px; }
.form textarea {
    width: 100%; padding: 10px 12px;
    border: 1px solid var(--line); border-radius: 8px;
    font-family: var(--font-body); font-size: 1rem;
}
.field-error { color: var(--red); font-size: 0.85rem; margin-top: 4px; }
.notice { border-radius: 8px; padding: 16px 20px; margin: 24px 0; }
.notice-success { background: #dcfce7; color: #14532d; }

.error-page { text-align: center; padding: 80px 24px; }
.error-page .btn { margin: 8px 4px 0; }

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 900px) {
    .calc-grid { grid-template-columns: 1fr; }
    .calc-inputs { border-right: 0; border-bottom: 1px solid var(--line); }
    .trust-grid { grid-template-columns: 1fr; }
    .footer-grid { grid-template-columns: 1fr 1fr; }
    .site-nav {
        display: none;
        position: absolute;
        top: 68px; left: 0; right: 0;
        background: #fff;
        flex-direction: column;
        padding: 16px 24px 24px;
        border-bottom: 1px solid var(--line);
        gap: 12px;
    }
    .site-nav.is-open { display: flex; }
    .nav-toggle {
        display: flex;
        flex-direction: column;
        gap: 5px;
        background: none;
        border: 0;
        cursor: pointer;
        margin-left: auto;
        padding: 8px;
    }
    .nav-toggle span { width: 22px; height: 2px; background: var(--navy); display: block; }
}

@media (max-width: 560px) {
    .footer-grid { grid-template-columns: 1fr; }
    .hero { padding: 48px 0; }
    .metric-value { font-size: 1.8rem; }
}
