/* BiCalc Phase 4 modern design system */
:root {
    color-scheme: light;
    --bg: #f6f9fc;
    --bg-strong: #eef6ff;
    --surface: #ffffff;
    --surface-soft: #f8fbff;
    --surface-muted: #eef5ff;
    --surface-glass: rgba(255, 255, 255, 0.82);
    --text: #0f172a;
    --text-soft: #1e293b;
    --muted: #64748b;
    --muted-light: #94a3b8;
    --border: #dbe7f3;
    --border-strong: #b9d4ef;
    --primary: #0ea5e9;
    --primary-dark: #0369a1;
    --primary-strong: #2563eb;
    --accent: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --success: #16a34a;
    --shadow: 0 22px 70px rgba(15, 23, 42, 0.10);
    --shadow-soft: 0 12px 34px rgba(15, 23, 42, 0.07);
    --shadow-card: 0 16px 42px rgba(15, 23, 42, 0.08);
    --ring: 0 0 0 4px rgba(14, 165, 233, 0.14);
    --radius: 28px;
    --radius-md: 22px;
    --radius-sm: 16px;
    --radius-xs: 12px;
    --max: 1180px;
    --header-height: 76px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    text-size-adjust: 100%;
}

body {
    margin: 0;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background:
        radial-gradient(circle at 8% 0%, rgba(14, 165, 233, 0.18), transparent 32rem),
        radial-gradient(circle at 92% 2%, rgba(37, 99, 235, 0.12), transparent 30rem),
        linear-gradient(180deg, #f8fbff 0%, var(--bg) 34%, #ffffff 100%);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
    text-decoration: none;
}

a:hover {
    color: var(--primary-dark);
}

img,
svg {
    max-width: 100%;
}

button,
input,
select,
textarea {
    font: inherit;
}

::selection {
    background: rgba(14, 165, 233, 0.22);
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    min-height: var(--header-height);
    backdrop-filter: blur(20px);
    background: rgba(248, 251, 255, 0.82);
    border-bottom: 1px solid rgba(219, 231, 243, 0.82);
}

.nav-shell {
    max-width: var(--max);
    min-height: var(--header-height);
    margin: 0 auto;
    padding: 0 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 22px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    font-weight: 900;
    letter-spacing: -0.045em;
}

.brand-mark {
    width: 40px;
    height: 40px;
    display: inline-grid;
    place-items: center;
    border-radius: 15px;
    color: white;
    background:
        radial-gradient(circle at 30% 20%, rgba(255,255,255,.42), transparent 27%),
        linear-gradient(135deg, var(--primary), var(--primary-strong) 58%, #7c3aed);
    box-shadow: 0 14px 28px rgba(14, 165, 233, 0.28);
}

.brand-text {
    font-size: 1.36rem;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 6px;
}

.nav-link {
    padding: 10px 14px;
    border-radius: 999px;
    color: var(--muted);
    font-weight: 800;
    font-size: 0.94rem;
    transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.nav-link:hover,
.nav-link.is-active {
    color: var(--primary-dark);
    background: rgba(14, 165, 233, 0.10);
}

.nav-link:hover {
    transform: translateY(-1px);
}

.menu-toggle {
    display: none;
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: var(--radius-xs);
    padding: 9px 12px;
    font-size: 1.1rem;
    box-shadow: var(--shadow-soft);
}

.hero,
.page-hero,
.section,
.site-footer {
    max-width: var(--max);
    margin: 0 auto;
    padding-left: 22px;
    padding-right: 22px;
}

.hero {
    min-height: 610px;
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(300px, .85fr);
    align-items: center;
    gap: 42px;
    padding-top: 76px;
    padding-bottom: 78px;
}

.hero-content h1,
.page-hero h1 {
    margin: 0;
    max-width: 920px;
    font-size: clamp(2.75rem, 6vw, 5.9rem);
    line-height: 0.95;
    letter-spacing: -0.08em;
}

.hero-subtitle,
.page-hero p,
.section-heading p,
.prose p {
    color: var(--muted);
    font-size: 1.08rem;
}

.eyebrow {
    color: var(--primary-dark);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    font-weight: 900;
    font-size: 0.76rem;
    margin: 0 0 14px;
}

.hero-search,
.directory-toolbar {
    display: flex;
    gap: 11px;
    margin: 32px 0 18px;
}

.hero-search input,
.directory-toolbar input,
.directory-toolbar select,
.input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.94);
    border-radius: 18px;
    padding: 16px 18px;
    color: var(--text);
    box-shadow: var(--shadow-soft);
    outline: none;
    transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.hero-search input:focus,
.directory-toolbar input:focus,
.directory-toolbar select:focus,
.input:focus,
select:focus,
textarea:focus {
    border-color: rgba(14, 165, 233, 0.72);
    box-shadow: var(--ring);
}

.hero-search button,
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 0;
    border-radius: 18px;
    padding: 15px 20px;
    min-height: 52px;
    font-weight: 900;
    font-size: 0.98rem;
    cursor: pointer;
    white-space: nowrap;
    transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.hero-search button:hover,
.button:hover {
    transform: translateY(-1px);
}

.hero-search button,
.button-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-strong));
    color: white;
    box-shadow: 0 16px 34px rgba(14, 165, 233, 0.26);
}

.button-secondary {
    background: white;
    color: var(--text);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-soft);
}

.hero-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.centered {
    justify-content: center;
}

.hero-panel {
    position: relative;
    overflow: hidden;
    background: var(--surface-glass);
    border: 1px solid rgba(219, 231, 243, 0.96);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    display: grid;
    gap: 16px;
}

.hero-panel::before {
    content: "";
    position: absolute;
    inset: -80px -80px auto auto;
    width: 190px;
    height: 190px;
    background: radial-gradient(circle, rgba(14,165,233,.18), transparent 70%);
    pointer-events: none;
}

.metric {
    position: relative;
    padding: 22px;
    border-radius: 22px;
    background: linear-gradient(180deg, #ffffff, #f4f9ff);
    border: 1px solid var(--border);
}

.metric strong {
    display: block;
    font-size: 2.45rem;
    line-height: 1;
    letter-spacing: -0.065em;
}

.metric span {
    display: block;
    color: var(--muted);
    font-weight: 800;
    margin-top: 8px;
}

.section {
    padding-top: 76px;
    padding-bottom: 76px;
}

.section-muted {
    background: rgba(255, 255, 255, 0.62);
    border: 1px solid rgba(219, 231, 243, 0.74);
    border-radius: 38px;
    margin-top: 20px;
    margin-bottom: 20px;
}

.section-heading {
    max-width: 740px;
    margin-bottom: 30px;
}

.section-heading h2,
.two-column h2,
.prose h2,
.info-card h2 {
    margin: 0;
    font-size: clamp(2rem, 4vw, 3.35rem);
    line-height: 1;
    letter-spacing: -0.065em;
}

.calculator-grid,
.category-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 19px;
}

.calculator-card,
.category-card,
.info-card,
.notice-box,
.feature-list div {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--border);
    background:
        linear-gradient(180deg, rgba(255,255,255,.98), rgba(248,251,255,.94));
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
}

.calculator-card,
.category-card {
    display: flex;
    flex-direction: column;
    gap: 13px;
    min-height: 216px;
    padding: 23px;
    transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.calculator-card::after,
.category-card::after {
    content: "";
    position: absolute;
    inset: auto 20px 0 20px;
    height: 3px;
    border-radius: 999px 999px 0 0;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    opacity: 0;
    transition: opacity 180ms ease;
}

.calculator-card:hover,
.category-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow);
    border-color: rgba(14, 165, 233, 0.42);
}

.calculator-card:hover::after,
.category-card:hover::after {
    opacity: 1;
}

.card-tag,
.category-count,
.status-pill,
.route-meta span {
    width: fit-content;
    color: var(--primary-dark);
    background: rgba(14, 165, 233, 0.10);
    border: 1px solid rgba(14, 165, 233, 0.12);
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 0.78rem;
    font-weight: 900;
}

.calculator-card h3,
.category-card h3 {
    margin: 0;
    color: var(--text);
    font-size: 1.24rem;
    letter-spacing: -0.04em;
    line-height: 1.15;
}

.calculator-card p,
.category-card p {
    margin: 0;
    color: var(--muted);
    font-size: 0.96rem;
}

.card-footer {
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.try-link {
    color: var(--primary-dark);
    font-weight: 900;
}

.priority-dot {
    width: 10px;
    height: 10px;
    flex: 0 0 10px;
    border-radius: 99px;
    background: var(--accent);
    box-shadow: 0 0 0 5px rgba(34, 197, 94, 0.12);
}

.route-status {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 900;
}

.two-column,
.two-column-info {
    display: grid;
    grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr);
    gap: 28px;
    align-items: start;
}

.two-column-info {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.feature-list {
    display: grid;
    gap: 14px;
}

.feature-list div,
.notice-box,
.info-card {
    padding: 20px;
}

.feature-list strong,
.notice-box strong {
    display: block;
    letter-spacing: -0.03em;
}

.feature-list span,
.notice-box span {
    color: var(--muted);
}

.page-hero {
    padding-top: 74px;
    padding-bottom: 34px;
}

.page-hero.compact {
    max-width: 940px;
    text-align: left;
}

.page-hero.center {
    text-align: center;
}

.directory-toolbar {
    margin-top: 0;
    align-items: center;
    padding: 14px;
    background: rgba(255,255,255,.68);
    border: 1px solid rgba(219, 231, 243, .9);
    border-radius: 26px;
    box-shadow: var(--shadow-soft);
}

.directory-toolbar input,
.directory-toolbar select {
    box-shadow: none;
}

.directory-toolbar select {
    max-width: 270px;
}

.result-count {
    color: var(--muted);
    font-weight: 800;
    margin: 0 0 18px;
}

.pagination {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 32px;
}

.pagination button {
    border: 1px solid var(--border);
    background: white;
    border-radius: 13px;
    padding: 9px 12px;
    cursor: pointer;
    font-weight: 900;
    color: var(--text);
    box-shadow: var(--shadow-soft);
}

.pagination button.is-active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.prose {
    max-width: 840px;
}

.prose ul {
    color: var(--muted);
}

.breadcrumb {
    margin: 0 0 18px;
    font-size: 0.92rem;
}

.breadcrumb ol {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.breadcrumb li {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
}

.breadcrumb li:not(:last-child)::after {
    content: "/";
    color: var(--muted-light);
}

.breadcrumb a {
    color: var(--primary-dark);
    font-weight: 800;
}

.route-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-top: 20px;
    color: var(--muted);
}

.route-meta span {
    background: var(--surface);
    color: var(--text-soft);
    padding: 8px 12px;
    font-size: 0.9rem;
}

.status-needs-review {
    color: #075985 !important;
    background: rgba(14, 165, 233, 0.12) !important;
}

.status-published {
    color: #166534 !important;
    background: rgba(34, 197, 94, 0.12) !important;
}

.status-draft {
    color: #92400e !important;
    background: rgba(245, 158, 11, 0.14) !important;
}

.status-unsafe {
    color: #991b1b !important;
    background: rgba(239, 68, 68, 0.12) !important;
}

.align-left {
    text-align: left;
    max-width: 780px;
    margin-left: 0;
}

.calculator-shell-section {
    padding-top: 30px;
}

.calculator-frame {
    width: 100%;
    min-height: 700px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.small-note {
    color: var(--muted);
    font-size: 0.92rem;
    margin-top: 12px;
}

.info-card h2 {
    margin-top: 0;
}

.info-card p {
    color: var(--muted);
}

.formula-box {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    background: var(--surface-muted);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 14px;
    overflow-wrap: anywhere;
    color: var(--text);
}

.notice-box.warning {
    border-color: rgba(239, 68, 68, 0.35);
    background: rgba(239, 68, 68, 0.08);
}

.route-card .card-footer {
    gap: 10px;
}

code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

.site-footer {
    padding-top: 58px;
    padding-bottom: 28px;
}

.footer-grid {
    display: grid;
    grid-template-columns: 1.4fr .7fr .7fr;
    gap: 24px;
    padding: 30px;
    background:
        radial-gradient(circle at top left, rgba(14,165,233,.20), transparent 18rem),
        #0f172a;
    color: white;
    border-radius: 34px;
    box-shadow: var(--shadow);
}

.footer-grid p {
    color: #cbd5e1;
    max-width: 520px;
}

.footer-grid h3 {
    margin: 0 0 12px;
}

.footer-grid a {
    display: block;
    color: #dbeafe;
    margin: 8px 0;
}

.footer-grid a:hover {
    color: #ffffff;
}

.footer-bottom {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    color: var(--muted);
    font-size: 0.9rem;
    padding: 16px 4px 0;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
    *,
    *::before,
    *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}

@media (max-width: 920px) {
    .menu-toggle {
        display: inline-flex;
    }

    .nav-links {
        display: none;
        position: absolute;
        left: 22px;
        right: 22px;
        top: calc(var(--header-height) - 4px);
        padding: 12px;
        flex-direction: column;
        align-items: stretch;
        background: white;
        border: 1px solid var(--border);
        border-radius: 22px;
        box-shadow: var(--shadow);
    }

    .nav-links.is-open {
        display: flex;
    }

    .hero,
    .two-column,
    .two-column-info,
    .footer-grid {
        grid-template-columns: 1fr;
    }

    .hero {
        min-height: auto;
    }

    .calculator-grid,
    .category-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .hero-search,
    .directory-toolbar {
        flex-direction: column;
    }

    .directory-toolbar select {
        max-width: none;
    }
}

@media (max-width: 580px) {
    .calculator-grid,
    .category-grid {
        grid-template-columns: 1fr;
    }

    .hero,
    .section,
    .page-hero,
    .site-footer {
        padding-left: 16px;
        padding-right: 16px;
    }

    .hero {
        padding-top: 52px;
        padding-bottom: 52px;
    }

    .hero-content h1,
    .page-hero h1 {
        font-size: 3rem;
        letter-spacing: -0.07em;
    }

    .calculator-frame {
        min-height: 560px;
        border-radius: 20px;
    }

    .footer-bottom {
        flex-direction: column;
    }
}
/* Phase 5 homepage redesign */
.homepage-hero {
    padding-top: 92px;
    padding-bottom: 72px;
}

.homepage-hero h1 {
    max-width: 880px;
}

.quick-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: -2px 0 6px;
}

.quick-links a {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 8px 12px;
    border-radius: 999px;
    color: var(--primary-dark);
    background: rgba(14, 165, 233, 0.09);
    border: 1px solid rgba(14, 165, 233, 0.14);
    font-size: 0.88rem;
    font-weight: 900;
}

.quick-links a:hover {
    background: rgba(14, 165, 233, 0.15);
}

.homepage-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.homepage-stats .metric {
    min-height: 136px;
}

.homepage-stats .metric strong {
    font-size: clamp(1.85rem, 4vw, 2.45rem);
}

.section-tight {
    padding-top: 58px;
}

.split-heading {
    max-width: none;
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 20px;
}

.split-heading > div {
    max-width: 760px;
}

.collection-grid,
.trust-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 19px;
}

.trust-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.collection-card {
    display: flex;
    flex-direction: column;
    gap: 18px;
    min-height: 300px;
    padding: 23px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(248,251,255,.94));
    box-shadow: var(--shadow-card);
}

.collection-card h3,
.info-card h3,
.step-list h3,
.homepage-cta h2 {
    margin: 10px 0 8px;
    letter-spacing: -0.04em;
}

.collection-card p,
.info-card p,
.step-list p,
.homepage-cta p {
    margin: 0;
    color: var(--muted);
}

.collection-links {
    display: grid;
    gap: 10px;
    margin-top: auto;
}

.collection-links a {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 12px;
    border-radius: 15px;
    background: rgba(248, 251, 255, 0.92);
    border: 1px solid rgba(219, 231, 243, .9);
    color: var(--text);
    font-weight: 850;
}

.collection-links a::after {
    content: "→";
    color: var(--primary);
}

.icon-badge {
    display: inline-grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 16px;
    background: rgba(14, 165, 233, 0.10);
    border: 1px solid rgba(14, 165, 233, 0.12);
    font-size: 1.2rem;
}

.step-list,
.notice-stack,
.faq-list {
    display: grid;
    gap: 14px;
}

.step-list article {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 16px;
    align-items: start;
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: rgba(255,255,255,.9);
    box-shadow: var(--shadow-soft);
}

.step-list article > span {
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--primary), var(--primary-strong));
    color: white;
    font-weight: 950;
}

.step-list code {
    border-radius: 8px;
    background: #eaf4ff;
    padding: 2px 6px;
    color: var(--primary-dark);
    font-weight: 850;
}

.faq-item {
    border: 1px solid var(--border);
    border-radius: 20px;
    background: white;
    box-shadow: var(--shadow-soft);
    overflow: hidden;
}

.faq-item summary {
    cursor: pointer;
    padding: 18px 20px;
    color: var(--text);
    font-weight: 950;
    letter-spacing: -0.02em;
}

.faq-item p {
    margin: 0;
    padding: 0 20px 20px;
    color: var(--muted);
}

.homepage-cta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    padding: 34px;
    margin-bottom: 40px;
    border-radius: 34px;
    background:
        radial-gradient(circle at top left, rgba(14,165,233,.16), transparent 32%),
        linear-gradient(135deg, #ffffff, #f1f8ff);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.homepage-cta h2 {
    font-size: clamp(1.8rem, 4vw, 3rem);
}

@media (max-width: 980px) {
    .homepage-stats,
    .trust-grid,
    .collection-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .split-heading,
    .homepage-cta {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (max-width: 640px) {
    .homepage-hero {
        padding-top: 62px;
        padding-bottom: 48px;
    }

    .homepage-stats,
    .trust-grid,
    .collection-grid {
        grid-template-columns: 1fr;
    }

    .quick-links {
        gap: 8px;
    }

    .quick-links a {
        font-size: 0.82rem;
    }

    .homepage-cta {
        padding: 24px;
    }
}


/* BiCalc Phase 6 calculator page template */
.template-hero {
    position: relative;
    overflow: hidden;
}

.template-note {
    display: inline-flex;
    align-items: center;
    max-width: 760px;
    margin: 1rem 0 0;
    padding: 0.85rem 1rem;
    border: 1px solid rgba(245, 158, 11, 0.28);
    border-radius: var(--radius-sm);
    background: rgba(255, 251, 235, 0.92);
    color: #92400e;
    font-size: 0.95rem;
}

.calculator-page-template {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 1.5rem;
    align-items: start;
}

.calculator-main-column {
    display: grid;
    gap: 1.25rem;
    min-width: 0;
}

.calculator-workspace-card,
.content-section,
.sidebar-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-soft);
}

.calculator-workspace-card {
    padding: clamp(1rem, 2vw, 1.5rem);
}

.workspace-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.workspace-header h2 {
    margin: 0.1rem 0 0.35rem;
}

.workspace-header p {
    margin: 0;
    color: var(--muted);
}

.phase6-frame {
    min-height: 640px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-strong);
    background: #ffffff;
}

.content-section {
    padding: clamp(1.1rem, 2.5vw, 1.75rem);
}

.content-section h2 {
    margin: 0.15rem 0 0.75rem;
    font-size: clamp(1.35rem, 2vw, 1.8rem);
    letter-spacing: -0.02em;
}

.content-section p {
    color: var(--text-soft);
}

.section-label {
    display: inline-flex;
    width: fit-content;
    align-items: center;
    gap: 0.4rem;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    background: var(--surface-muted);
    color: var(--primary-dark);
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.enhanced-formula {
    margin: 1rem 0;
    padding: 1rem 1.1rem;
    border: 1px solid rgba(14, 165, 233, 0.22);
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, rgba(238, 246, 255, 0.85), rgba(255, 255, 255, 0.95));
    overflow-x: auto;
}

.enhanced-formula code {
    font-size: 1.05rem;
    color: var(--text);
    white-space: pre-wrap;
}

.supporting-text {
    margin-bottom: 0;
    color: var(--muted);
}

.step-list {
    display: grid;
    gap: 0.75rem;
    margin: 1rem 0 0;
    padding-left: 1.25rem;
}

.step-list li {
    padding-left: 0.25rem;
    color: var(--text-soft);
}

.faq-list {
    display: grid;
    gap: 0.75rem;
    margin-top: 1rem;
}

.faq-item {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-soft);
    overflow: hidden;
}

.faq-item summary {
    cursor: pointer;
    padding: 0.95rem 1rem;
    font-weight: 800;
    color: var(--text);
}

.faq-item p {
    margin: 0;
    padding: 0 1rem 1rem;
    color: var(--muted);
}

.compact-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.compact-card {
    min-height: 100%;
}

.disclaimer-section {
    border-color: rgba(245, 158, 11, 0.26);
    background: linear-gradient(135deg, rgba(255, 251, 235, 0.72), rgba(255, 255, 255, 0.96));
}

.calculator-sidebar {
    position: sticky;
    top: calc(var(--header-height) + 1rem);
    display: grid;
    gap: 1rem;
}

.sidebar-card {
    padding: 1.1rem;
}

.sidebar-card h2 {
    margin: 0 0 0.8rem;
    font-size: 1rem;
    letter-spacing: -0.01em;
}

.detail-list {
    display: grid;
    gap: 0.75rem;
    margin: 0;
}

.detail-list div {
    display: grid;
    gap: 0.1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.detail-list div:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.detail-list dt {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.detail-list dd {
    margin: 0;
    color: var(--text);
    font-weight: 700;
}

.sidebar-links,
.check-list {
    display: grid;
    gap: 0.55rem;
    margin: 0;
    padding-left: 1.1rem;
}

.sidebar-links a {
    color: var(--primary-dark);
    font-weight: 700;
}

.review-block {
    padding: 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface-soft);
}

.review-block h3 {
    margin-top: 0;
}

.danger-block {
    border-color: rgba(239, 68, 68, 0.28);
    background: rgba(254, 242, 242, 0.86);
}

.status-published {
    background: rgba(22, 163, 74, 0.12);
    color: #166534;
    border-color: rgba(22, 163, 74, 0.2);
}

.status-draft {
    background: rgba(100, 116, 139, 0.12);
    color: #475569;
    border-color: rgba(100, 116, 139, 0.2);
}

.status-unsafe {
    background: rgba(239, 68, 68, 0.12);
    color: #b91c1c;
    border-color: rgba(239, 68, 68, 0.22);
}

@media (max-width: 980px) {
    .calculator-page-template {
        grid-template-columns: 1fr;
    }

    .calculator-sidebar {
        position: static;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .compact-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 680px) {
    .workspace-header {
        flex-direction: column;
    }

    .calculator-sidebar {
        grid-template-columns: 1fr;
    }

    .phase6-frame {
        min-height: 560px;
    }
}

/* Phase 7 security cleanup */
.phase7-sandboxed-frame{border:1px solid rgba(15,23,42,.12);background:#fff}.security-review-card{border-color:rgba(220,38,38,.24);background:linear-gradient(180deg,#fff,#fff7f7)}.danger-block{border:1px solid rgba(220,38,38,.22);background:#fff1f2;border-radius:18px;padding:1rem}.status-pill.status-unsafe,.status-unsafe{background:#fee2e2;color:#991b1b;border-color:rgba(220,38,38,.28)}.security-metadata-note{border-left:4px solid #dc2626;background:#fff7f7;padding:.85rem 1rem;border-radius:14px}


/* Phase 9 quality review enhancements */
.status-published {
    background: rgba(22, 163, 74, 0.12);
    color: #166534;
    border-color: rgba(22, 163, 74, 0.22);
}

.status-unsafe {
    background: rgba(220, 38, 38, 0.12);
    color: #991b1b;
    border-color: rgba(220, 38, 38, 0.22);
}

.quality-review-section {
    border-left: 4px solid var(--accent, #2563eb);
}

.notice-box.danger {
    border-color: rgba(220, 38, 38, 0.25);
    background: rgba(254, 242, 242, 0.92);
}

.hero-card .stat-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.stat-grid div {
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 1rem;
    padding: 1rem;
    background: rgba(255,255,255,0.8);
}

.stat-grid strong {
    display: block;
    font-size: 1.75rem;
    line-height: 1;
}

.stat-grid span {
    display: block;
    margin-top: .35rem;
    color: var(--muted, #64748b);
    font-size: .92rem;
}


/* Phase 11: search and discovery */
.suggestion-strip{display:flex;gap:.6rem;flex-wrap:wrap;margin-top:1rem}.chip{display:inline-flex;align-items:center;border:1px solid var(--border);background:var(--surface);border-radius:999px;padding:.55rem .85rem;font-weight:700;color:var(--text);text-decoration:none;box-shadow:var(--shadow-soft)}.chip:hover{transform:translateY(-1px);border-color:var(--accent)}.search-layout{display:grid;grid-template-columns:minmax(220px,300px) 1fr;gap:1.5rem;align-items:start}.filter-panel{display:grid;gap:1rem;position:sticky;top:5.5rem}.filter-card{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-lg);padding:1rem;box-shadow:var(--shadow-soft)}.filter-card h2{font-size:1.05rem;margin:0 0 .75rem}.filter-card label{display:block;font-weight:800;margin:.8rem 0 .35rem}.filter-card select,.filter-card input{width:100%;border:1px solid var(--border);border-radius:var(--radius-sm);padding:.8rem;background:#fff;color:var(--text)}.search-results-panel{min-width:0}.autocomplete-panel{display:grid;gap:.5rem;margin:-.75rem 0 1rem}.autocomplete-panel a{display:flex;justify-content:space-between;gap:1rem;background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-md);padding:.8rem 1rem;text-decoration:none;color:var(--text)}.discovery-card{display:flex;flex-direction:column}.discovery-card .card-main-link{text-decoration:none;color:inherit;display:block;flex:1}.icon-action{border:1px solid var(--border);background:#fff;border-radius:999px;width:2rem;height:2rem;display:inline-flex;align-items:center;justify-content:center;cursor:pointer;font-weight:900;color:var(--accent)}.mini-list{display:grid;gap:.45rem;margin-top:.75rem}.mini-list h3{font-size:.95rem;margin:.25rem 0}.mini-list a{font-weight:700;text-decoration:none;color:var(--accent)}.mini-list .muted,.muted{color:var(--muted);font-size:.92rem}.search-hero .hero-search{max-width:760px}.directory-tools .search-panel{grid-template-columns:1fr 220px 160px 160px}.phase11-note{background:linear-gradient(135deg,rgba(14,165,233,.12),rgba(99,102,241,.1));border:1px solid var(--border);border-radius:var(--radius-lg);padding:1rem;margin-top:1rem}
@media (max-width: 860px){.search-layout{grid-template-columns:1fr}.filter-panel{position:static}.directory-tools .search-panel{grid-template-columns:1fr}.autocomplete-panel a{display:block}.suggestion-strip{gap:.45rem}.chip{padding:.48rem .72rem}}


/* Phase 12 performance optimization */
.calculator-workspace-card.is-waiting-to-load .phase12-lazy-frame {
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.08), rgba(37, 99, 235, 0.05));
}

.calculator-workspace-card.is-waiting-to-load .workspace-header::after {
    content: "Calculator loads on demand";
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 12px;
    padding: 7px 11px;
    border-radius: 999px;
    background: var(--surface-muted);
    color: var(--primary-dark);
    font-size: 0.82rem;
    font-weight: 800;
}

.phase12-lazy-frame {
    min-height: 720px;
    contain: layout paint;
    content-visibility: auto;
    contain-intrinsic-size: 720px;
}

.performance-note,
.phase12-note {
    color: var(--muted);
    font-size: 0.94rem;
}

.perf-metric-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
}

.perf-metric-card {
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: var(--radius-sm);
    padding: 16px;
    box-shadow: var(--shadow-soft);
}

.perf-metric-card strong {
    display: block;
    font-size: 1.6rem;
    line-height: 1.1;
    letter-spacing: -0.04em;
}

/* Phase 13 trust and authority */
.trust-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 1rem;
    margin-top: 1.25rem;
}
.trust-card {
    background: var(--surface, #fff);
    border: 1px solid var(--border, #e5e7eb);
    border-radius: var(--radius-lg, 18px);
    padding: 1rem;
    box-shadow: var(--shadow-soft, 0 10px 30px rgba(15, 23, 42, 0.06));
}
.trust-card strong {
    display: block;
    font-size: 1.15rem;
    color: var(--text, #111827);
}
.trust-card span {
    display: block;
    margin-top: .25rem;
    color: var(--accent, #2563eb);
    font-weight: 700;
}
.trust-card p {
    margin-bottom: 0;
}
.calculator-trust-grid {
    margin: 1rem 0;
}
.trust-form {
    display: grid;
    gap: 1rem;
    margin-top: 1.25rem;
}
.trust-form label {
    display: grid;
    gap: .4rem;
    font-weight: 700;
}
.trust-form input,
.trust-form select,
.trust-form textarea {
    width: 100%;
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 14px;
    padding: .85rem 1rem;
    font: inherit;
    background: #fff;
}
.two-column {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
    gap: 1.25rem;
    align-items: start;
}
.compact-hero {
    padding-bottom: 2rem;
}
@media (max-width: 860px) {
    .two-column {
        grid-template-columns: 1fr;
    }
}



/* Phase 14/15 feedback and widget embed styles */
.widget-card .card-footer,.embed-code-card,.feedback-widget-section,.widget-header-card,.widget-calculator-card,.widget-powered-by{border:1px solid var(--border,#e5e7eb)}.embed-code-card{display:grid;gap:.75rem;padding:1rem;border-radius:1rem;background:var(--surface,#fff)}.embed-label{font-weight:700}.embed-code{width:100%;min-height:7rem;padding:.875rem;border-radius:.875rem;border:1px solid var(--border,#e5e7eb);font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;font-size:.875rem;resize:vertical;background:#f8fafc}.feedback-actions{display:flex;flex-wrap:wrap;gap:.75rem;align-items:center}.feedback-thanks{margin-top:.75rem;color:var(--success,#047857);font-weight:700}.widget-embed-page{background:#f8fafc;margin:0}.widget-shell{max-width:980px;margin:0 auto;padding:1rem}.widget-header-card,.widget-calculator-card,.widget-powered-by{background:#fff;border-radius:1.25rem;box-shadow:var(--shadow-soft,0 10px 30px rgba(15,23,42,.08))}.widget-header-card{display:flex;justify-content:space-between;gap:1rem;align-items:center;padding:1rem;margin-bottom:1rem}.widget-header-card h1{margin:.2rem 0;font-size:clamp(1.4rem,3vw,2rem)}.widget-calculator-card{overflow:hidden;padding:.5rem}.widget-calculator-frame{display:block;width:100%;border:0;border-radius:1rem;background:#fff}.widget-powered-by{display:flex;justify-content:space-between;gap:1rem;align-items:center;margin-top:1rem;padding:.875rem 1rem;font-size:.9rem;color:var(--muted,#64748b)}@media(max-width:720px){.widget-header-card,.widget-powered-by{display:grid}}


/* Phase 16 multilingual + RTL support */
.language-switcher {
  display: flex;
  flex-wrap: wrap;
  gap: .65rem;
  align-items: center;
  padding: .75rem;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 1rem;
  background: var(--surface, #fff);
}
.language-switcher span {
  font-size: .9rem;
  font-weight: 700;
  color: var(--muted-foreground, #64748b);
}
.language-switcher div {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}
.language-switcher a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2rem;
  padding: .35rem .7rem;
  border-radius: 999px;
  border: 1px solid var(--border, #e5e7eb);
  text-decoration: none;
  font-weight: 700;
}
.language-switcher a.is-active {
  background: var(--primary, #2563eb);
  color: #fff;
  border-color: var(--primary, #2563eb);
}
.translation-note {
  margin-top: .75rem;
  color: var(--muted-foreground, #64748b);
  font-size: .95rem;
}
html[dir="rtl"], body.rtl {
  direction: rtl;
}
html[dir="rtl"] .site-header,
body.rtl .site-header,
html[dir="rtl"] .calculator-layout,
body.rtl .calculator-layout,
html[dir="rtl"] .section-heading,
body.rtl .section-heading {
  text-align: right;
}
html[dir="rtl"] .breadcrumb span,
body.rtl .breadcrumb span {
  transform: scaleX(-1);
}
body.rtl .top-nav,
body.rtl .language-switcher div {
  direction: rtl;
}
body.rtl .legacy-calculator-frame {
  direction: ltr;
}
.multilingual-hero {
  display: grid;
  gap: 1.5rem;
}
@media (min-width: 860px) {
  .multilingual-hero {
    grid-template-columns: 1fr auto;
    align-items: center;
  }
}

/* Phase 17 layout compatibility patch
   Fixes generated calculator pages that use page-shell/content-card/legacy frame classes. */
.page-shell {
    max-width: var(--max);
    margin: 0 auto;
    padding: clamp(1.25rem, 3vw, 2.25rem) 22px clamp(3rem, 6vw, 5rem);
}

.calculator-page {
    display: block;
}

.calculator-hero {
    display: grid;
    gap: 1.1rem;
    align-items: end;
    margin: 0 0 1.35rem;
    padding: clamp(1.25rem, 3vw, 2rem);
    border: 1px solid rgba(219, 231, 243, 0.88);
    border-radius: var(--radius);
    background:
        radial-gradient(circle at top left, rgba(14, 165, 233, 0.18), transparent 22rem),
        linear-gradient(135deg, rgba(255,255,255,.96), rgba(241,248,255,.92));
    box-shadow: var(--shadow-soft);
}

.calculator-hero h1 {
    margin: 0;
    max-width: 900px;
    font-size: clamp(2.25rem, 5vw, 4.7rem);
    line-height: 0.98;
    letter-spacing: -0.075em;
}

.calculator-hero .lead {
    max-width: 760px;
    margin: 1rem 0 0;
    color: var(--text-soft);
    font-size: 1.06rem;
}

.calculator-hero .translation-note {
    margin: .6rem 0 0;
}

.calculator-hero .breadcrumb,
.breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .45rem;
    margin: 0 0 .85rem;
    color: var(--muted);
    font-size: .92rem;
}

.calculator-hero .breadcrumb a,
.breadcrumb a {
    color: var(--primary-dark);
    font-weight: 850;
}

.calculator-hero .breadcrumb span,
.breadcrumb span {
    color: var(--muted);
}

.calculator-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 1.25rem;
    align-items: start;
}

.calculator-main {
    display: grid;
    gap: 1.25rem;
    min-width: 0;
}

.content-card {
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-soft);
    padding: clamp(1.15rem, 2.5vw, 1.75rem);
    overflow: hidden;
}

.content-card h2 {
    margin: 0 0 .85rem;
    font-size: clamp(1.35rem, 2.2vw, 1.9rem);
    line-height: 1.12;
    letter-spacing: -0.035em;
}

.content-card p:first-child {
    margin-top: 0;
}

.calculator-workspace {
    padding: clamp(1rem, 2.5vw, 1.4rem);
}

.calculator-workspace .section-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
}

.section-heading h2 {
    margin: 0;
}

.section-heading p {
    margin: .3rem 0 0;
    color: var(--muted);
}

.legacy-calculator-frame {
    display: block;
    width: 100%;
    min-height: 740px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: #fff;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.65);
}

.calculator-workspace.is-waiting-to-load .legacy-calculator-frame {
    background:
        linear-gradient(90deg, rgba(241,245,249,.8), rgba(255,255,255,.95), rgba(241,245,249,.8));
}

.faq-list details {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-soft);
    overflow: hidden;
}

.faq-list details + details {
    margin-top: .75rem;
}

.faq-list summary {
    cursor: pointer;
    padding: .95rem 1rem;
    font-weight: 850;
    color: var(--text);
}

.faq-list details p {
    margin: 0;
    padding: 0 1rem 1rem;
    color: var(--muted);
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: .9rem;
}

.related-card {
    display: grid;
    gap: .25rem;
    min-height: 100%;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: linear-gradient(180deg, #fff, var(--surface-soft));
    box-shadow: 0 10px 28px rgba(15,23,42,.05);
}

.related-card:hover {
    border-color: rgba(14, 165, 233, .42);
    transform: translateY(-2px);
}

.related-card strong {
    color: var(--text);
    line-height: 1.2;
}

.related-card span {
    color: var(--muted);
    font-size: .88rem;
}

.button-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    min-height: 2.75rem;
    padding: .72rem 1rem;
    border: 0;
    border-radius: 999px;
    font-weight: 900;
    text-align: center;
}

.calculator-sidebar {
    min-width: 0;
}

.calculator-sidebar .content-card {
    padding: 1.1rem;
}

.calculator-sidebar .content-card h2 {
    font-size: 1.05rem;
}

.calculator-sidebar .embed-code {
    min-height: 7.5rem;
}

.site-footer > nav {
    display: flex;
    flex-wrap: wrap;
    gap: .85rem;
    align-items: center;
}

.site-footer > nav a {
    color: var(--primary-dark);
    font-weight: 800;
}

.site-footer > div:not(.footer-grid):not(.footer-bottom) p {
    color: var(--muted);
    max-width: 620px;
}

@media (min-width: 960px) {
    .calculator-hero {
        grid-template-columns: minmax(0, 1fr) auto;
    }
}

@media (max-width: 980px) {
    .calculator-layout {
        grid-template-columns: 1fr;
    }

    .calculator-sidebar {
        position: static;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 680px) {
    .page-shell {
        padding-left: 16px;
        padding-right: 16px;
    }

    .calculator-hero {
        border-radius: 22px;
        padding: 1.1rem;
    }

    .calculator-hero h1 {
        letter-spacing: -0.055em;
    }

    .calculator-workspace .section-heading {
        display: grid;
    }

    .legacy-calculator-frame {
        min-height: 640px;
    }

    .calculator-sidebar {
        grid-template-columns: 1fr;
    }

    .language-switcher {
        width: 100%;
    }
}

