/* ==========================================================================
   FenceCalc — design tokens
   ========================================================================== */

:root {
    --brand: #2163e8;
    --brand-700: #1a4fbd;
    --brand-soft: #eef5ff;
    --brand-soft-2: #e2ecfd;
    --ink: #0d1b2a;
    --ink-2: #46586e;
    --ink-3: #7b8b9e;
    --line: #e4eaf2;
    --line-strong: #d3dce8;
    --bg: #f4f7fb;
    --surface: #ffffff;
    --surface-2: #fafcfe;
    --ok: #0f9d76;
    --warn: #8a5b0c;
    --warn-soft: #fdf4e3;
    --danger: #bf3b2c;
    --danger-soft: #fdeeeb;
    --radius: 16px;
    --radius-sm: 10px;
    --pill: 999px;
    --shadow-sm: 0 1px 2px rgba(15, 34, 58, .06);
    --shadow: 0 18px 40px -28px rgba(15, 34, 58, .45);
    --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
    --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--sans);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -.02em; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
svg { display: block; }
summary { list-style: none; cursor: pointer; }
summary::-webkit-details-marker { display: none; }
button { font-family: inherit; }

.shell {
    width: 100%;
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 20px;
}

.skip-link {
    position: absolute;
    left: -9999px;
    top: 8px;
    background: #fff;
    padding: 8px 14px;
    border-radius: var(--pill);
    z-index: 100;
}
.skip-link:focus { left: 16px; }

/* ==========================================================================
   Header
   ========================================================================== */

.site-header {
    position: sticky;
    top: 0;
    z-index: 40;
    background: rgba(244, 247, 251, .86);
    backdrop-filter: saturate(160%) blur(14px);
    border-bottom: 1px solid var(--line);
}

.header-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    height: 62px;
}

.brand { display: flex; align-items: center; gap: 10px; }

.brand-mark {
    width: 34px;
    height: 34px;
    flex: none;
    display: grid;
    place-items: center;
    border-radius: 11px;
    background: var(--brand);
    color: #fff;
    box-shadow: 0 6px 14px -8px rgba(33, 99, 232, .8);
}
.brand-mark svg { width: 19px; height: 19px; }

.brand-copy { display: flex; flex-direction: column; line-height: 1.15; }
.brand-copy strong { font-size: 15px; letter-spacing: -.02em; }
.brand-copy small { font-size: 10.5px; color: var(--ink-3); }

.nav { display: flex; gap: 2px; margin-left: 12px; }

.nav-link {
    padding: 6px 12px;
    border-radius: var(--pill);
    font-size: 12.5px;
    font-weight: 500;
    color: var(--ink-2);
    transition: background .15s, color .15s;
}
.nav-link:hover { background: rgba(33, 99, 232, .07); color: var(--brand); }
.nav-link.is-active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }

.tools { display: flex; align-items: center; gap: 8px; margin-left: auto; }

.chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 34px;
    padding: 0 10px;
    border: 1px solid var(--line-strong);
    border-radius: var(--pill);
    background: var(--surface);
    font-size: 12px;
    font-weight: 500;
    color: var(--ink-2);
    transition: border-color .15s, background .15s;
}
.chip:hover { border-color: #bccbdd; background: #fff; }
.chip-code {
    font-size: 9.5px;
    font-weight: 800;
    letter-spacing: .05em;
    padding: 2px 5px;
    border-radius: 5px;
    background: var(--brand-soft);
    color: var(--brand);
}
.chip .globe { width: 15px; height: 15px; color: var(--ink-3); }
.chev { width: 13px; height: 13px; color: var(--ink-3); transition: transform .2s; }
.picker[open] .chev { transform: rotate(180deg); }

.picker { position: relative; }

.picker-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    display: none;
    min-width: 236px;
    padding: 8px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: 0 24px 48px -26px rgba(13, 27, 42, .5);
    z-index: 60;
}
.picker[open] .picker-menu { display: block; }
.picker-title {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--ink-3);
    padding: 4px 8px 6px;
    font-weight: 700;
}

.picker-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 9px;
    border-radius: 9px;
    font-size: 12.5px;
    color: var(--ink-2);
    transition: background .12s, color .12s;
}
.picker-item:hover { background: #f3f7ff; color: var(--ink); }
.picker-item.is-active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.picker-name { flex: 1; }
.picker-meta { font-size: 10.5px; color: var(--ink-3); }
.picker-item.is-active .picker-meta { color: var(--brand); opacity: .8; }

/* ==========================================================================
   Hero
   ========================================================================== */

.hero { padding: 38px 0 22px; }

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 5px 12px 5px 9px;
    border-radius: var(--pill);
    background: var(--surface);
    border: 1px solid var(--line);
    font-size: 11px;
    font-weight: 500;
    color: var(--ink-2);
}
.eyebrow-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }

.hero-title {
    margin-top: 14px;
    font-size: clamp(30px, 4.6vw, 44px);
    line-height: 1.04;
    letter-spacing: -.035em;
}

.hero-lede {
    margin-top: 12px;
    max-width: 640px;
    font-size: 14.5px;
    line-height: 1.6;
    color: var(--ink-2);
}

.preset {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
    font-size: 11.5px;
    color: var(--ink-3);
}
.preset-code {
    font-size: 9.5px;
    font-weight: 800;
    letter-spacing: .05em;
    padding: 2px 5px;
    border-radius: 5px;
    background: #e9eff8;
    color: var(--ink-2);
}

/* ==========================================================================
   Layout
   ========================================================================== */

.calculator { padding-bottom: 8px; }

.calc-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.18fr) minmax(0, .82fr);
    gap: 18px;
    align-items: start;
}

.form-panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px;
}

.form-head { margin-bottom: 18px; }
.form-title { font-size: 15px; }
.form-sub { margin-top: 4px; font-size: 11.5px; color: var(--ink-3); line-height: 1.5; }

/* ==========================================================================
   Fieldset / groups
   ========================================================================== */

.group {
    border: 0;
    padding: 0;
    margin: 0 0 20px;
}
.group:last-of-type { margin-bottom: 8px; }

.group-title {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0;
    margin-bottom: 12px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--ink-3);
}
.group-index {
    font-size: 9.5px;
    padding: 2px 6px;
    border-radius: 5px;
    background: var(--brand-soft);
    color: var(--brand);
    letter-spacing: .04em;
}
.group-tag {
    margin-left: auto;
    font-size: 9.5px;
    font-weight: 700;
    color: var(--ink-3);
    letter-spacing: .06em;
}

.grid { display: grid; gap: 11px; }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-label { font-size: 12px; font-weight: 600; color: var(--ink-2); }

.control {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 40px;
    padding: 0 10px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    transition: border-color .15s, background .15s, box-shadow .15s;
}
.control:focus-within {
    border-color: var(--brand);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(33, 99, 232, .12);
}
.control input {
    flex: 1;
    min-width: 0;
    border: 0;
    background: transparent;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    color: var(--ink);
    outline: none;
    padding: 0;
}
.control .suffix,
.control .prefix {
    font-size: 11px;
    font-weight: 600;
    color: var(--ink-3);
    flex: none;
}
.control--price { height: 36px; }
.control--price .prefix { margin-right: -2px; }

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }

.field--price .field-label { font-size: 11px; }
.price-grid { gap: 9px; }

.hint { font-size: 10.5px; line-height: 1.45; color: var(--ink-3); }
.hint--block { margin-top: 10px; }

.is-muted { opacity: .5; }

/* ==========================================================================
   Segmented pills
   ========================================================================== */

.seg {
    display: flex;
    gap: 4px;
    padding: 4px;
    background: #edf2f9;
    border-radius: var(--pill);
}
.seg-item { flex: 1 1 0; min-width: 0; }
.seg-item input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}
.seg-item span {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 32px;
    padding: 0 6px;
    border-radius: var(--pill);
    font-size: 12px;
    font-weight: 600;
    color: var(--ink-2);
    white-space: nowrap;
    transition: background .15s, color .15s, box-shadow .15s;
}
.seg-item span:hover { background: rgba(255, 255, 255, .65); }
.seg-item input:checked + span {
    background: #fff;
    color: var(--brand);
    box-shadow: 0 1px 3px rgba(15, 34, 58, .14);
}
.seg-item input:focus-visible + span { box-shadow: 0 0 0 3px rgba(33, 99, 232, .18); }
.seg--compact .seg-item span { height: 32px; }

/* ==========================================================================
   Style switch
   ========================================================================== */

.style-switch {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
    margin-bottom: 12px;
}
.style-option { display: block; cursor: pointer; position: relative; }
.style-option input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}
.style-body {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    height: 100%;
    padding: 11px 12px;
    border: 1px solid var(--line-strong);
    border-radius: 12px;
    background: var(--surface-2);
    transition: border-color .15s, background .15s;
}
.style-option:hover .style-body { border-color: #c2d0e2; }
.style-option input:checked + .style-body {
    border-color: rgba(33, 99, 232, .42);
    background: var(--brand-soft);
}
.style-option input:focus-visible + .style-body { box-shadow: 0 0 0 3px rgba(33, 99, 232, .16); }

.style-art { width: 36px; flex: none; color: var(--ink-3); }
.style-option input:checked + .style-body .style-art { color: var(--brand); }
.style-art svg { width: 100%; height: auto; }

.style-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.style-text strong { font-size: 12.5px; letter-spacing: -.01em; }
.style-text small { font-size: 10.5px; color: var(--ink-3); line-height: 1.4; }

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 40px;
    padding: 0 18px;
    border: 1px solid transparent;
    border-radius: var(--pill);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, border-color .15s, color .15s;
}
.btn--primary { background: var(--brand); color: #fff; }
.btn--primary:hover { background: var(--brand-700); }
.btn--soft { background: var(--brand-soft); color: var(--brand); }
.btn--soft:hover { background: var(--brand-soft-2); }
.btn--ghost { background: #fff; border-color: var(--line-strong); color: var(--ink-2); }
.btn--ghost:hover { background: #f6f9fe; border-color: #c2d0e2; }

.form-actions { display: flex; gap: 9px; margin-top: 4px; }
html[data-live="1"] .form-actions [data-submit] { display: none; }

/* ==========================================================================
   Results panel
   ========================================================================== */

.result-panel {
    position: sticky;
    top: 78px;
    max-height: calc(100vh - 96px);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 16px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.result-panel::-webkit-scrollbar { width: 8px; }
.result-panel::-webkit-scrollbar-thumb { background: #dbe4ef; border-radius: var(--pill); }

.total-card {
    padding: 14px 15px;
    border-radius: 14px;
    background: linear-gradient(178deg, #f4f9ff 0%, #edf4ff 100%);
    border: 1px solid #dce8fb;
}
.total-main { display: flex; flex-direction: column; gap: 3px; }
.total-label {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: var(--ink-3);
}
.total-value {
    font-size: 32px;
    line-height: 1.05;
    letter-spacing: -.035em;
    font-variant-numeric: tabular-nums;
}
.total-meta { margin-top: 5px; font-size: 11.5px; color: var(--ink-2); }

.metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 10px;
}
.metric {
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding: 9px 11px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface-2);
}
.metric-label {
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--ink-3);
}
.metric-value {
    font-size: 21px;
    line-height: 1.15;
    letter-spacing: -.03em;
    font-variant-numeric: tabular-nums;
}
.metric-hint { font-size: 10px; line-height: 1.35; color: var(--ink-3); }

.specs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
    margin: 10px 0 0;
}
.spec {
    padding: 7px 9px;
    border-radius: 10px;
    background: #f6f9fd;
}
.spec dt {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--ink-3);
}
.spec dd { margin: 2px 0 0; font-size: 12px; font-weight: 600; }

.warnings {
    display: grid;
    gap: 6px;
    margin: 10px 0 0;
    padding: 0;
    list-style: none;
}
.warnings li {
    position: relative;
    padding: 8px 10px 8px 26px;
    border-radius: 10px;
    background: var(--warn-soft);
    color: var(--warn);
    font-size: 11px;
    line-height: 1.45;
}
.warnings li::before {
    content: "!";
    position: absolute;
    left: 9px;
    top: 8px;
    width: 12px;
    height: 12px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #e9c98a;
    color: #6c4304;
    font-size: 9px;
    font-weight: 800;
}

.bom { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }

.bom-head {
    display: grid;
    grid-template-columns: 1fr 42px 76px;
    padding-bottom: 4px;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--ink-3);
}
.bom-head span:nth-child(2),
.bom-head span:nth-child(3) { text-align: right; }

.bom-row {
    display: grid;
    grid-template-columns: 1fr 42px 76px;
    align-items: center;
    padding: 7px 0;
    border-bottom: 1px dashed var(--line);
}
.bom-name { font-size: 12.5px; font-weight: 600; }
.bom-name small {
    display: block;
    font-size: 10px;
    font-weight: 400;
    color: var(--ink-3);
}
.bom-qty,
.bom-amount {
    text-align: right;
    font-size: 12.5px;
    font-variant-numeric: tabular-nums;
}
.bom-amount { font-weight: 700; }
.bom-note { margin-top: 9px; font-size: 10px; line-height: 1.5; color: var(--ink-3); }

.result-actions { display: flex; gap: 7px; margin-top: 12px; }
.result-actions .btn { flex: 1; height: 34px; font-size: 11.5px; padding: 0 10px; }

.result-error {
    display: flex;
    gap: 10px;
    padding: 14px;
    border-radius: 12px;
    background: var(--danger-soft);
    color: #7d2a1e;
}
.result-error-icon { width: 20px; flex: none; color: var(--danger); }
.result-error strong { display: block; font-size: 12.5px; }
.result-error p { margin: 3px 0 0; font-size: 11.5px; line-height: 1.5; }

/* ==========================================================================
   Diagram
   ========================================================================== */

.layout-section { margin-top: 18px; }

.diagram-card {
    padding: 16px 18px 12px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}
.diagram-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.diagram-title { font-size: 13.5px; }
.diagram-legend { display: flex; gap: 14px; }
.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 10.5px;
    color: var(--ink-3);
}
.legend-swatch { width: 10px; height: 10px; border-radius: 3px; }
.legend-swatch--post { background: #33475f; }
.legend-swatch--bay { background: #dce7f6; border: 1px solid #b9cfe8; }
.legend-swatch--gate { background: #ffe9c9; border: 1px solid #e8c88f; }

.diagram-canvas { margin: 6px -4px 0; }
.diagram-canvas svg { width: 100%; height: auto; max-height: 240px; }

.dg-ground { stroke: #cbd6e4; stroke-width: 2; }
.dg-bay { fill: #dce7f6; }
.dg-slat { stroke: #b3c8e4; stroke-width: 1; }
.dg-post { fill: #33475f; }
.dg-gate { fill: #ffe9c9; stroke: #e8c88f; stroke-width: 1; }
.dg-gate-brace { stroke: #dcb377; stroke-width: 1.2; }
.dg-dim { stroke: #c3cfdf; stroke-width: 1; stroke-dasharray: 4 4; }
.dg-label { font-size: 12px; font-weight: 700; fill: #7b8b9e; }

.diagram-caption { margin-top: 4px; font-size: 10.5px; color: var(--ink-3); }

/* ==========================================================================
   Notes
   ========================================================================== */

.notes-section { margin-top: 28px; }

.section-title { font-size: 17px; letter-spacing: -.02em; margin-bottom: 12px; }

.note-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 9px;
}
.note {
    padding: 13px 14px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
}
.note-title { font-size: 12px; margin-bottom: 4px; }
.note-body { font-size: 11px; line-height: 1.55; color: var(--ink-2); }

/* ==========================================================================
   Method / FAQ
   ========================================================================== */

.section { margin-top: 36px; }
.section-head { margin-bottom: 14px; }
.section-lede { margin-top: 6px; max-width: 620px; font-size: 12.5px; color: var(--ink-2); line-height: 1.6; }

.steps {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
    margin: 0;
    padding: 0;
    list-style: none;
}
.step {
    display: flex;
    gap: 11px;
    padding: 13px 14px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
}
.step-index {
    width: 22px;
    height: 22px;
    flex: none;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--brand-soft);
    color: var(--brand);
    font-size: 10.5px;
    font-weight: 800;
}
.step-body h3 { font-size: 12.5px; margin-bottom: 3px; }
.step-body p { font-size: 11.5px; line-height: 1.55; color: var(--ink-2); margin-bottom: 7px; }
.step-body code {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 6px;
    background: #f1f5fb;
    color: var(--brand-700);
    font-family: var(--mono);
    font-size: 10.5px;
}

.faq-list { display: grid; gap: 7px; }
.faq-item {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    transition: border-color .15s;
}
.faq-item[open] { border-color: #cfdcf0; }
.faq-item summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 13px 15px;
    font-size: 12.5px;
    font-weight: 600;
}
.faq-item[open] summary { color: var(--brand); }
.faq-chev { width: 14px; height: 14px; flex: none; color: var(--ink-3); transition: transform .2s; }
.faq-item[open] .faq-chev { transform: rotate(180deg); }
.faq-item p {
    padding: 0 15px 14px;
    font-size: 11.5px;
    line-height: 1.65;
    color: var(--ink-2);
}

/* ==========================================================================
   Footer
   ========================================================================== */

.site-footer {
    margin-top: 44px;
    padding: 26px 0 22px;
    background: var(--surface);
    border-top: 1px solid var(--line);
}
.footer-inner { display: grid; gap: 12px; }
.footer-brand { display: flex; gap: 10px; align-items: flex-start; }
.footer-brand strong { font-size: 13px; }
.footer-brand p { margin-top: 3px; max-width: 620px; font-size: 11px; line-height: 1.55; color: var(--ink-3); }
.footer-links { display: flex; flex-wrap: wrap; gap: 6px; }
.footer-link {
    padding: 4px 10px;
    border-radius: var(--pill);
    background: #f3f7fc;
    font-size: 10.5px;
    color: var(--ink-2);
    transition: background .15s, color .15s;
}
.footer-link:hover { background: var(--brand-soft); color: var(--brand); }
.footer-disclaimer,
.footer-legal { font-size: 10.5px; color: var(--ink-3); line-height: 1.55; }

/* ==========================================================================
   404
   ========================================================================== */

.not-found { padding: 80px 20px; text-align: center; }
.not-found-code { font-size: 48px; font-weight: 800; color: var(--brand-soft-2); letter-spacing: -.04em; }
.not-found p { margin: 8px 0 18px; color: var(--ink-2); }

/* ==========================================================================
   Editorial pages (guide, about, contact, privacy, terms)
   ========================================================================== */

.page-hero {
    padding: 26px 0 20px;
    background: linear-gradient(180deg, #ffffff 0%, rgba(255, 255, 255, 0) 100%);
    border-bottom: 1px solid var(--line);
}

.crumbs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--ink-3);
}
.crumbs a { color: var(--ink-2); transition: color .15s; }
.crumbs a:hover { color: var(--brand); }
.crumbs-sep { color: var(--line-strong); }

.page-title {
    margin-top: 11px;
    max-width: 760px;
    font-size: clamp(24px, 3.4vw, 33px);
    line-height: 1.12;
    letter-spacing: -.03em;
}

.page-lede {
    margin-top: 9px;
    max-width: 680px;
    font-size: 13px;
    line-height: 1.65;
    color: var(--ink-2);
}

.page-meta {
    margin-top: 10px;
    font-size: 10.5px;
    color: var(--ink-3);
}

.page-section { margin-top: 26px; }

.page-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 248px;
    gap: 22px;
    align-items: start;
}

.prose { display: grid; gap: 12px; min-width: 0; }

.prose-block {
    padding: 16px 18px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    scroll-margin-top: 78px;
}
.prose-block h2 {
    margin-bottom: 6px;
    font-size: 15px;
    letter-spacing: -.02em;
}
.prose-block p {
    font-size: 12.5px;
    line-height: 1.72;
    color: var(--ink-2);
}
.prose-block p + p { margin-top: 8px; }

.toc {
    position: sticky;
    top: 78px;
    padding: 13px 14px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
}
.toc-title {
    margin-bottom: 7px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--ink-3);
}
.toc-list { display: grid; gap: 1px; margin: 0; padding: 0; list-style: none; }
.toc-list a {
    display: block;
    padding: 5px 8px;
    border-radius: 8px;
    font-size: 11.5px;
    line-height: 1.45;
    color: var(--ink-2);
    transition: background .15s, color .15s;
}
.toc-list a:hover { background: var(--brand-soft); color: var(--brand); }

.page-cta { display: flex; padding-top: 2px; }
.page-cta .btn { height: 38px; }

.guide-teaser {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-top: 26px;
    padding: 16px 18px;
    background: var(--brand-soft);
    border: 1px solid var(--brand-soft-2);
    border-radius: 14px;
}
.guide-teaser .section-title { margin-bottom: 0; }
.guide-teaser .section-lede { margin-top: 4px; max-width: 640px; }

.contact-card {
    display: grid;
    gap: 3px;
    padding: 18px;
    background: var(--brand-soft);
    border: 1px solid var(--brand-soft-2);
    border-radius: 14px;
}
.contact-label {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--brand);
}
.contact-mail {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -.02em;
    color: var(--brand-700);
    word-break: break-word;
}
.contact-mail:hover { text-decoration: underline; text-underline-offset: 3px; }
.contact-note { margin-top: 2px; font-size: 11.5px; line-height: 1.6; color: var(--ink-2); }

.btn--sm { height: 32px; padding: 0 14px; font-size: 11.5px; }

/* ==========================================================================
   Ad slots
   ========================================================================== */

.ad-section { margin-top: 26px; }

.ad-slot {
    padding: 10px;
    background: var(--surface-2);
    border: 1px dashed var(--line-strong);
    border-radius: 12px;
    text-align: center;
}
.ad-label {
    display: block;
    margin-bottom: 6px;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--ink-3);
}
.ad-slot .adsbygoogle { display: block; min-height: 62px; }

/* ==========================================================================
   Consent banner
   ========================================================================== */

.consent {
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: 16px;
    z-index: 60;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    max-width: 720px;
    margin: 0 auto;
    padding: 12px 16px;
    border-radius: 14px;
    background: rgba(13, 27, 42, .94);
    color: #eaf1fb;
    box-shadow: 0 18px 40px -18px rgba(13, 27, 42, .7);
    backdrop-filter: blur(8px);
}
.consent[hidden] { display: none; }
.consent-text { flex: 1 1 320px; font-size: 11.5px; line-height: 1.55; color: #c9d6e6; }
.consent-actions { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.consent-link {
    font-size: 11px;
    color: #9dbdf5;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.consent-link:hover { color: #fff; }

/* ==========================================================================
   Footer extras
   ========================================================================== */

.footer-links--pages { padding-top: 10px; border-top: 1px dashed var(--line); }
.footer-link.is-active { background: var(--brand-soft); color: var(--brand); }

@media (max-width: 900px) {
    .page-grid { grid-template-columns: 1fr; gap: 14px; }
    .toc { position: static; order: -1; }
}

@media (max-width: 680px) {
    .page-hero { padding: 20px 0 16px; }
    .prose-block { padding: 14px; }
    .consent { left: 10px; right: 10px; bottom: 10px; padding: 12px; }
    .consent-actions { width: 100%; justify-content: space-between; margin-left: 0; }
}

/* ==========================================================================
   Articles
   ========================================================================== */

.article-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.article-list--compact { grid-template-columns: minmax(0, 1fr); }

.article-card {
    display: grid;
    gap: 8px;
    align-content: start;
    padding: 18px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.article-card:hover {
    border-color: var(--line-strong);
    box-shadow: var(--shadow);
    transform: translateY(-1px);
}

.article-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 2px;
}

.article-tag {
    display: inline-flex;
    align-items: center;
    padding: 2px 9px;
    border-radius: var(--pill);
    background: var(--brand-soft);
    color: var(--brand-700);
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: .01em;
}

.article-tag--soft {
    background: var(--surface-2);
    color: var(--ink-3);
    border: 1px solid var(--line);
}

.article-card-title {
    margin: 0;
    font-size: 17.5px;
    line-height: 1.32;
    letter-spacing: -.012em;
}

.article-card-title a {
    color: var(--ink);
    text-decoration: none;
}

.article-card-title a:hover { color: var(--brand-700); }

.article-card-excerpt {
    margin: 0;
    color: var(--ink-2);
    font-size: 13.5px;
    line-height: 1.6;
}

.article-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    color: var(--ink-3);
    font-size: 12px;
    margin-top: 4px;
}

.article-meta-dot { opacity: .6; }

.article-empty {
    display: grid;
    justify-items: start;
    gap: 12px;
    padding: 24px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    color: var(--ink-2);
}

.article-empty p { margin: 0; }

.page-hero .article-tags { margin-bottom: 10px; }

.article-faq {
    display: grid;
    gap: 0;
    margin-top: 6px;
}

.article-faq-item {
    padding: 14px 0;
    border-top: 1px solid var(--line);
}

.article-faq-item:first-child { border-top: 0; padding-top: 4px; }

.article-faq-item h3 {
    margin: 0 0 5px;
    font-size: 15.5px;
    line-height: 1.35;
}

.article-faq-item p {
    margin: 0;
    color: var(--ink-2);
}

.article-related { margin-top: 28px; }

.article-related .section-title { margin-bottom: 12px; }

.page-cta--box {
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
    margin-top: 26px;
    padding: 18px 20px;
    background: var(--brand-soft);
    border: 1px solid var(--brand-soft-2);
    border-radius: 14px;
}

.page-cta-title {
    margin: 0 0 4px;
    font-size: 16px;
    line-height: 1.35;
}

.page-cta-body {
    margin: 0;
    color: var(--ink-2);
    font-size: 13px;
    max-width: 60ch;
}

.toc-cta {
    width: 100%;
    margin-top: 12px;
}

@media (max-width: 900px) {
    .article-list { grid-template-columns: minmax(0, 1fr); }
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 1000px) {
    .calc-grid { grid-template-columns: 1fr; }
    .result-panel { position: static; max-height: none; overflow: visible; }
    .note-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .steps { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
    .nav { display: none; }
    .brand-copy small { display: none; }
}

@media (max-width: 680px) {
    .header-bar { height: auto; flex-wrap: wrap; padding: 10px 0; gap: 8px; }
    .tools { width: 100%; margin-left: 0; }
    .tools .picker { flex: 1 1 0; min-width: 0; }
    .chip { width: 100%; justify-content: space-between; }
    .picker-menu { left: 0; right: auto; min-width: 100%; }
    .hero { padding: 26px 0 16px; }
    .grid--2, .grid--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid--3 { grid-template-columns: 1fr 1fr; }
    .style-switch { grid-template-columns: 1fr; }
    .note-grid { grid-template-columns: 1fr; }
    .specs { grid-template-columns: 1fr 1fr; }
    .total-value { font-size: 28px; }
    .form-panel, .result-panel { padding: 15px; border-radius: 14px; }
}

@media (max-width: 420px) {
    .grid--2, .grid--3 { grid-template-columns: 1fr; }
}

/* ==========================================================================
   Print
   ========================================================================== */

@media print {
    .site-header,
    .hero,
    .form-panel,
    .layout-section,
    .notes-section,
    .section,
    .site-footer,
    .result-actions,
    .skip-link { display: none !important; }

    body { background: #fff; }
    .result-panel {
        position: static;
        max-height: none;
        overflow: visible;
        border: 0;
        box-shadow: none;
        padding: 0;
    }
    .metric, .total-card, .spec { break-inside: avoid; }
}
