/* ============================================================
   SQUARE FOOT STUDIO — PREMIUM DARK THEME
   ============================================================ */

/* --- Design Tokens --- */
:root {
    --bg-primary: #0a0e1a;
    --bg-secondary: #0f1424;
    --bg-tertiary: #141a2e;
    --surface: rgba(20, 26, 46, 0.65);
    --surface-hover: rgba(28, 36, 64, 0.8);
    --surface-elevated: rgba(22, 30, 54, 0.85);
    --glass: rgba(255, 255, 255, 0.04);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-border-hover: rgba(255, 255, 255, 0.14);

    --ink: #e8ecf4;
    --ink-secondary: #9ba4b8;
    --ink-muted: #6b7490;
    --ink-faint: #4a5168;

    --accent-start: #00d4ff;
    --accent-end: #7c3aed;
    --accent-gradient: linear-gradient(135deg, var(--accent-start), #6366f1, var(--accent-end));
    --accent-glow: rgba(99, 102, 241, 0.3);
    --accent-soft: rgba(99, 102, 241, 0.08);

    --success: #34d399;
    --warning: #fbbf24;
    --danger: #f87171;

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.4);
    --shadow-accent: 0 8px 32px rgba(99, 102, 241, 0.25);
    --shadow-glow: 0 0 40px rgba(99, 102, 241, 0.15);

    --radius-xs: 8px;
    --radius-sm: 12px;
    --radius-md: 16px;
    --radius-lg: 20px;
    --radius-xl: 24px;
    --radius-2xl: 32px;
    --radius-full: 999px;

    --font-sans: "Inter", "Manrope", system-ui, -apple-system, sans-serif;
    --font-display: "Space Grotesk", "Inter", sans-serif;

    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --transition-fast: 0.15s var(--ease-out);
    --transition-base: 0.25s var(--ease-out);
    --transition-slow: 0.4s var(--ease-out);
}

/* --- Reset & Base --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    color: var(--ink);
    background: var(--bg-primary);
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
    line-height: 1.6;
    font-size: 15px;
}

a {
    color: inherit;
    text-decoration: none;
    transition: color var(--transition-fast);
}

/* Inline links inside content paragraphs — visibly blue with underline */
.content-strip p a,
.page-shell p a,
.intro-strip p a,
.section-split-content p a,
.boxed-section p a,
.lead-card p a,
.faq-item p a {
    color: #818cf8;
    text-decoration: underline;
    text-underline-offset: 2px;
    text-decoration-thickness: 1px;
    text-decoration-color: rgba(129, 140, 248, 0.5);
}

.content-strip p a:hover,
.page-shell p a:hover,
.intro-strip p a:hover,
.section-split-content p a:hover,
.boxed-section p a:hover,
.lead-card p a:hover,
.faq-item p a:hover {
    color: var(--accent-start);
    text-decoration-color: var(--accent-start);
}

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

button {
    cursor: pointer;
    border: none;
    background: none;
}

img {
    max-width: 100%;
    display: block;
}

/* --- Ambient Background Effects --- */
.page-glow, .texture-grid {
    position: fixed;
    pointer-events: none;
    z-index: 0;
}

.page-glow {
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.6;
    animation: orbFloat 20s ease-in-out infinite;
}

.page-glow-one {
    width: 500px;
    height: 500px;
    top: -120px;
    right: -100px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.3), rgba(124, 58, 237, 0.15), transparent 70%);
    animation-delay: 0s;
}

.page-glow-two {
    width: 600px;
    height: 600px;
    left: -200px;
    top: 40%;
    background: radial-gradient(circle, rgba(0, 212, 255, 0.2), rgba(99, 102, 241, 0.1), transparent 70%);
    animation-delay: -7s;
}

@keyframes orbFloat {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(30px, -20px) scale(1.05); }
    50% { transform: translate(-15px, 25px) scale(0.95); }
    75% { transform: translate(20px, 15px) scale(1.02); }
}

.texture-grid {
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
    background-size: 60px 60px;
    mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.3), transparent 60%);
}

/* --- Layout Containers --- */
.hero,
.content-strip,
.page-shell,
.site-footer {
    position: relative;
    z-index: 1;
    width: min(1280px, calc(100% - 40px));
    margin: 0 auto;
}

.hero {
    width: min(1240px, calc(100% - 40px));
    padding-top: 40px;
}

.calculator-shell {
    position: relative;
    z-index: 1;
    width: 100%;
    margin: 0 auto;
    padding: 0 0 44px;
    border-radius: var(--radius-2xl);
    background: linear-gradient(180deg, rgba(20, 26, 46, 0.9), rgba(15, 20, 36, 0.95));
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 255, 255, 0.05), inset 4px 0 0 rgba(99, 102, 241, 0.55);
    backdrop-filter: blur(20px);
    min-height: calc(100vh - 102px);
}

/* --- Navbar (separated header bar — full-width, outside hero) --- */
.navbar {
    position: relative;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 18px 0;
    background: rgba(8, 12, 24, 0.95);
    border-bottom: 1px solid var(--glass-border);
}

.navbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    width: min(1100px, calc(100% - 60px));
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    letter-spacing: -0.02em;
    transition: opacity var(--transition-fast);
    flex-shrink: 0;
}

.brand:hover { opacity: 0.85; }

.brand-mark {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
    font-weight: 800;
    font-size: 0.95rem;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
    position: relative;
    overflow: hidden;
}

.brand-mark::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.2), transparent 60%);
    border-radius: inherit;
}

.brand-text {
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #fff;
}

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

.nav-links a {
    padding: 8px 16px;
    border-radius: var(--radius-full);
    color: #fff;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all var(--transition-fast);
}

.nav-links a:hover {
    color: var(--accent-start);
    background: rgba(0, 212, 255, 0.06);
}

/* --- Nav right area (language + mobile btn) --- */
.nav-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* --- Language Dropdown --- */
.lang-dropdown {
    position: relative;
}

.lang-toggle {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 1.5px solid rgba(255,255,255,0.2);
    background: transparent;
    color: rgba(255,255,255,0.7);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.lang-toggle:hover {
    color: #fff;
    border-color: var(--accent-start);
    background: rgba(0, 212, 255, 0.06);
}

.lang-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    min-width: 200px;
    max-height: 360px;
    overflow-y: auto;
    padding: 8px;
    border-radius: var(--radius-md);
    background: rgba(12, 16, 32, 0.98);
    border: 1px solid var(--glass-border);
    box-shadow: 0 20px 48px rgba(0,0,0,0.5);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: all 0.2s ease;
    z-index: 100;
}

.lang-dropdown.open .lang-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.lang-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    border-radius: var(--radius-sm);
    color: var(--ink-secondary);
    font-size: 0.88rem;
    font-weight: 500;
    transition: all var(--transition-fast);
    text-decoration: none;
}

.lang-item:hover {
    background: rgba(255,255,255,0.06);
    color: #fff;
}

.lang-item.active {
    background: rgba(99, 102, 241, 0.12);
    color: var(--accent-start);
}

.lang-code {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--ink-muted);
    text-transform: uppercase;
    min-width: 22px;
}

.lang-item.active .lang-code {
    color: var(--accent-start);
}

/* --- Nav Dropdown (Regional Calculators) --- */
.nav-dropdown {
    position: relative;
}

.nav-dropdown::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    height: 14px;
    display: none;
    z-index: 99;
}

.nav-dropdown:hover::after {
    display: block;
}

.nav-dropdown-toggle {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 8px 16px;
    border-radius: var(--radius-full);
    color: #fff;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all var(--transition-fast);
    cursor: pointer;
    background: none;
    border: none;
    font-family: inherit;
}

.nav-dropdown-toggle:hover {
    color: var(--accent-start);
    background: rgba(0, 212, 255, 0.06);
}

.nav-dropdown-toggle .dropdown-arrow {
    display: inline-block;
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid currentColor;
    transition: transform var(--transition-fast);
}

.nav-dropdown:hover .dropdown-arrow,
.nav-dropdown.open .dropdown-arrow {
    transform: rotate(180deg);
}

.nav-dropdown-toggle .dropdown-label {
    font-weight: 600;
    color: inherit;
}

/* --- Mega Menu --- */
.mega-menu {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    min-width: 900px;
    padding: 0;
    border-radius: var(--radius-md);
    background: rgba(10, 14, 28, 0.98);
    border: 1px solid var(--glass-border);
    box-shadow: 0 24px 56px rgba(0,0,0,0.5);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.2s ease;
    z-index: 100;
}

.nav-mega:hover .mega-menu,
.nav-mega.open .mega-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.mega-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    padding: 20px 0;
}

.mega-divider {
    height: 1px;
    background: var(--glass-border);
    margin: 0 20px;
}

.mega-col {
    padding: 0 24px;
    border-right: 1px solid var(--glass-border);
}

.mega-col:last-child {
    border-right: none;
}

.mega-heading {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent-start);
    margin: 0 0 10px;
}

.mega-menu a,
.nav-dropdown-menu a {
    display: block;
    padding: 4px 0;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1.4;
    color: var(--ink-secondary);
    transition: color var(--transition-fast);
    text-decoration: none;
    white-space: nowrap;
}

.mega-menu a:hover,
.nav-dropdown-menu a:hover {
    color: #fff;
}

@media (max-width: 820px) {
    .mega-menu {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        min-width: 0;
        max-height: 70vh;
        overflow-y: auto;
        border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    }

    .mega-row {
        grid-template-columns: repeat(2, 1fr);
        padding: 16px;
        gap: 16px;
    }

    .mega-col {
        border-right: none;
        padding: 0;
    }

    .mega-divider {
        margin: 0;
    }
}

@media (max-width: 480px) {
    .mega-row {
        grid-template-columns: 1fr;
    }
}

.nav-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    min-width: 260px;
    padding: 10px;
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateX(-50%) translateY(6px);
    transition: all var(--transition-fast);
    z-index: 100;
}

.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown.open .nav-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.nav-dropdown-menu a {
    color: var(--ink-secondary) !important;
    border: 1px solid transparent;
}

.nav-dropdown-menu a:hover {
    color: #fff !important;
}

/* --- Grid Systems --- */
.hero-content,
.calculator-layout,
.lead-grid,
.preview-metrics,
.shape-grid,
.inputs-grid,
.addons-grid,
.results-grid,
.formula-grid,
.use-case-grid,
.footer-grid,
.page-grid {
    display: grid;
    gap: 16px;
}

/* --- Hero Section --- */
.hero-content {
    grid-template-columns: minmax(0, 1.1fr) minmax(340px, 0.9fr);
    gap: 48px;
    align-items: center;
    padding: 48px 0 56px;
}

.eyebrow,
.mini-label,
.tile-kicker {
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-size: 0.72rem;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero h1,
.page-hero h1 {
    font-family: var(--font-display);
    margin: 14px 0 18px;
    font-size: clamp(2.4rem, 4.5vw, 4.6rem);
    line-height: 1.0;
    letter-spacing: -0.045em;
    font-weight: 700;
}

.hero h1 {
    max-width: none;
}

/* gradient text for hero h1 */
.hero h1 {
    background: linear-gradient(135deg, #fff 20%, var(--accent-start) 50%, var(--accent-end) 80%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-text,
.page-intro,
.footer-copy,
.lead-card p,
.use-card p,
.info-tile p,
.summary-card,
.steps-list,
.faq-item p,
.prose-card p,
.prose-card li,
.contact-list li {
    color: var(--ink-secondary);
    line-height: 1.8;
}

.hero-text {
    max-width: 560px;
    font-size: 1.05rem;
    line-height: 1.85;
}

.hero-pills, .cta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.hero-pills { margin-top: 28px; }
.cta-row { margin-top: 28px; }

.hero-pills span {
    display: inline-flex;
    align-items: center;
    padding: 8px 14px;
    border-radius: var(--radius-full);
    font-size: 0.82rem;
    font-weight: 600;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    color: var(--ink-secondary);
    transition: all var(--transition-fast);
}

.hero-pills span:hover {
    border-color: var(--glass-border-hover);
    background: var(--surface);
}

.primary-link, .secondary-link {
    display: inline-flex;
    align-items: center;
    padding: 12px 24px;
    border-radius: var(--radius-full);
    font-size: 0.92rem;
    font-weight: 700;
    transition: all var(--transition-base);
}

.primary-link {
    background: var(--accent-gradient);
    color: #fff;
    box-shadow: var(--shadow-accent);
    position: relative;
    overflow: hidden;
}

.primary-link::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.15), transparent 60%);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.primary-link:hover::before { opacity: 1; }
.primary-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(99, 102, 241, 0.35);
}

.secondary-link {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    color: var(--ink-secondary);
}

.secondary-link:hover {
    border-color: var(--glass-border-hover);
    color: var(--ink);
    transform: translateY(-2px);
}

/* --- Hero Preview Card --- */
.preview-card {
    padding: 24px;
    border-radius: var(--radius-xl);
    background: var(--surface-elevated);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(20px);
    position: relative;
    overflow: hidden;
}

.preview-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--accent-gradient);
    opacity: 0.5;
}

.hero-preview {
    align-self: stretch;
}

.hero-preview-copy {
    margin: 16px 0 0;
    color: var(--ink-muted);
    line-height: 1.7;
    font-size: 0.9rem;
}

.preview-topline, .diagram-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--ink-muted);
    font-size: 0.82rem;
    gap: 16px;
}

.preview-metrics {
    grid-template-columns: repeat(2, 1fr);
    margin: 20px 0 22px;
}

.preview-metrics div {
    padding: 16px;
    border-radius: var(--radius-md);
    background: var(--glass);
    border: 1px solid var(--glass-border);
}

.preview-metrics strong, .metric-value {
    display: block;
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    font-family: var(--font-display);
}

.preview-metrics span,
.metric-label,
.metric-unit {
    font-size: 0.82rem;
    color: var(--ink-muted);
    font-weight: 600;
}

.preview-graph, .shape-stage {
    position: relative;
    border-radius: var(--radius-lg);
    border: 1px solid var(--glass-border);
    overflow: hidden;
}

.preview-graph {
    height: 200px;
    background: linear-gradient(180deg, rgba(99, 102, 241, 0.06), rgba(0, 212, 255, 0.03));
}

.graph-room {
    position: absolute;
    inset: 44px 60px 48px 50px;
    border: 2px solid rgba(99, 102, 241, 0.5);
    border-radius: var(--radius-xs);
    background: rgba(99, 102, 241, 0.06);
    box-shadow: inset 0 0 20px rgba(99, 102, 241, 0.08);
}

.graph-label, .shape-axis {
    position: absolute;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--ink-muted);
}

.graph-label-x {
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
}

.graph-label-y, .shape-axis-right {
    top: 50%;
    right: 14px;
    transform: translateY(-50%);
    writing-mode: vertical-rl;
}

/* --- Section & Card Shared Styles --- */
.panel,
.info-tile,
.use-card,
.lead-card,
.table-card,
.faq-item,
.prose-card {
    backdrop-filter: blur(16px);
    background: var(--surface);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-md);
    transition: all var(--transition-base);
}

.panel,
.lead-card,
.table-card,
.prose-card {
    border-radius: var(--radius-xl);
}

.info-tile,
.use-card,
.faq-item {
    border-radius: var(--radius-md);
}

.info-tile:hover,
.use-card:hover,
.lead-card:hover {
    border-color: var(--glass-border-hover);
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
}

/* --- Section Headings --- */
.section-heading {
    margin-bottom: 32px;
}

.section-heading h2,
.prose-card h2 {
    font-family: var(--font-display);
    margin: 10px 0 0;
    font-size: clamp(1.6rem, 2.5vw, 2.6rem);
    line-height: 1.08;
    letter-spacing: -0.035em;
    font-weight: 700;
}

.content-strip, .intro-strip, .page-shell {
    padding-bottom: 80px;
}

/* --- Calculator Intro --- */
.calculator-intro {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    margin: 0 36px;
    padding: 48px 0 32px;
    margin-bottom: 28px;
    border-bottom: 1px solid var(--glass-border);
    text-align: center;
}

.calc-intro-title {
    font-size: clamp(28px, 4.5vw, 64px);
    font-weight: 400;
    font-family: 'DM Serif Display', Georgia, 'Times New Roman', serif;
    font-style: normal;
    letter-spacing: -0.01em;
    line-height: 1.15;
    margin: 10px 0 8px;
    overflow-wrap: break-word;
    word-wrap: break-word;
    background: linear-gradient(135deg, #fff 20%, var(--accent-start) 50%, var(--accent-end) 80%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.calculator-intro-copy {
    margin: 0 auto;
    color: var(--ink-secondary);
    line-height: 1.6;
    font-size: 1.05rem;
    font-weight: 500;
    max-width: 680px;
    text-align: center;
}

/* --- Calculator Layout --- */
.calculator-layout {
    grid-template-columns: minmax(0, 1.2fr) minmax(360px, 0.8fr);
    gap: 24px;
    align-items: start;
}

.panel {
    padding: 28px;
    background: var(--surface-elevated);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-md);
}

.panel-heading,
.results-header,
.steps-card-header,
.footer-grid {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.panel-badge,
.results-status {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    border-radius: var(--radius-full);
    font-size: 0.78rem;
    font-weight: 700;
    background: var(--accent-soft);
    border: 1px solid rgba(99, 102, 241, 0.15);
    color: var(--accent-start);
    letter-spacing: 0.04em;
}

.panel h3 {
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: -0.02em;
}

/* --- Shape Grid --- */
.control-group + .control-group,
.toggle-row,
.inputs-grid,
.addons-grid,
.action-row,
.summary-card,
.steps-card {
    margin-top: 22px;
}

.group-label {
    display: block;
    margin-bottom: 12px;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--ink-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

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

.shape-chip {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 96px;
    padding: 14px 10px;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    background: var(--glass);
    color: var(--ink-secondary);
    font-size: 0.78rem;
    font-weight: 700;
    transition: all var(--transition-base);
}

.shape-chip:hover {
    border-color: var(--glass-border-hover);
    background: var(--surface);
    transform: translateY(-2px);
    color: var(--ink);
}

.shape-chip.active {
    background: linear-gradient(180deg, rgba(99, 102, 241, 0.15), rgba(99, 102, 241, 0.08));
    border-color: rgba(99, 102, 241, 0.4);
    color: var(--ink);
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

/* --- Shape Icons --- */
.shape-icon {
    position: relative;
    width: 26px;
    height: 26px;
}

.rectangle-icon::before,
.circle-icon::before,
.triangle-icon::before,
.trapezoid-icon::before,
.lshape-icon::before {
    content: "";
    position: absolute;
    inset: 0;
    border: 2px solid currentColor;
}

.rectangle-icon::before { border-radius: 4px; }
.circle-icon::before { border-radius: 50%; }

.triangle-icon {
    width: 0;
    height: 0;
    border-left: 13px solid transparent;
    border-right: 13px solid transparent;
    border-bottom: 24px solid currentColor;
}

.triangle-icon::before { display: none; }

.trapezoid-icon {
    width: 28px;
    height: 20px;
}

.trapezoid-icon::before {
    inset: 2px;
    clip-path: polygon(18% 0, 82% 0, 100% 100%, 0 100%);
}

.lshape-icon::before {
    clip-path: polygon(0 0, 70% 0, 70% 30%, 100% 30%, 100% 100%, 0 100%);
    border-radius: 4px;
}

/* --- Toggle Row --- */
.toggle-row {
    display: grid;
    grid-template-columns: 0.75fr 1.25fr;
    gap: 16px;
}

.segmented {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 6px;
}

.segment {
    border: 1px solid var(--glass-border);
    background: var(--glass);
    color: var(--ink-muted);
    padding: 10px 16px;
    border-radius: var(--radius-full);
    font-size: 0.85rem;
    font-weight: 700;
    transition: all var(--transition-base);
}

.segment:hover {
    border-color: var(--glass-border-hover);
    color: var(--ink-secondary);
    transform: translateY(-1px);
}

.segment.active {
    background: var(--accent-gradient);
    color: #fff;
    border-color: transparent;
    box-shadow: var(--shadow-accent);
}

.segmented-wrap .segment {
    min-width: 52px;
    text-align: center;
}

/* --- Input Fields --- */
.inputs-grid,
.addons-grid,
.results-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

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

.use-case-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

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

.field-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 14px;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    transition: border-color var(--transition-fast);
}

.field-card:focus-within {
    border-color: rgba(99, 102, 241, 0.3);
}

.field-card span {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--ink-muted);
}

.field-card input,
.field-card select,
.prose-card input,
.prose-card textarea {
    width: 100%;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--glass-border);
    background: rgba(10, 14, 26, 0.6);
    color: var(--ink);
    outline: none;
    transition: all var(--transition-fast);
    font-size: 0.95rem;
}

.field-card input:focus,
.field-card select:focus,
.prose-card input:focus,
.prose-card textarea:focus {
    border-color: rgba(99, 102, 241, 0.4);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.field-card input::placeholder,
.prose-card input::placeholder,
.prose-card textarea::placeholder {
    color: var(--ink-faint);
}

.input-shell {
    position: relative;
}

.input-shell input {
    padding-right: 60px;
}

.unit-tag {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--accent-start);
}

.unit-tag.muted {
    color: var(--ink-muted);
}

/* --- Action Buttons --- */
.action-row {
    display: flex;
    gap: 12px;
}

.primary-btn,
.secondary-btn,
.ghost-btn {
    border-radius: var(--radius-sm);
    font-weight: 700;
    border: 1px solid transparent;
    transition: all var(--transition-base);
}

.primary-btn {
    flex: 1;
    padding: 14px 22px;
    background: var(--accent-gradient);
    color: #fff;
    box-shadow: var(--shadow-accent);
    position: relative;
    overflow: hidden;
    font-size: 0.95rem;
}

.primary-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.15), transparent 60%);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.primary-btn:hover::before { opacity: 1; }
.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(99, 102, 241, 0.35);
}

.primary-btn:active {
    transform: translateY(0);
}

.secondary-btn,
.ghost-btn {
    background: var(--glass);
    border-color: var(--glass-border);
    color: var(--ink-secondary);
}

.secondary-btn {
    padding: 14px 18px;
    font-size: 0.95rem;
}

.secondary-btn:hover,
.ghost-btn:hover {
    border-color: var(--glass-border-hover);
    color: var(--ink);
    transform: translateY(-1px);
}

.ghost-btn {
    padding: 8px 14px;
    font-size: 0.85rem;
}

.form-note {
    margin: 14px 0 0;
    color: var(--ink-muted);
    font-size: 0.85rem;
}

/* --- Results Panel --- */
.diagram-card,
.summary-card,
.steps-card {
    padding: 18px;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    background: var(--glass);
}

.shape-stage {
    height: 240px;
    margin-top: 14px;
    background: linear-gradient(180deg, rgba(99, 102, 241, 0.05), rgba(0, 212, 255, 0.02));
}

.shape-display {
    position: absolute;
    left: 42px;
    right: 72px;
    top: 36px;
    bottom: 44px;
    border: 2px solid rgba(99, 102, 241, 0.5);
    background: rgba(99, 102, 241, 0.06);
}

.shape-display.rectangle { border-radius: 8px; }

.shape-display.circle {
    left: 56px;
    right: 86px;
    top: 32px;
    bottom: 32px;
    border-radius: 50%;
}

.shape-display.triangle {
    clip-path: polygon(50% 0, 100% 100%, 0 100%);
    background: transparent;
}

.shape-display.trapezoid {
    clip-path: polygon(18% 0, 82% 0, 100% 100%, 0 100%);
}

.shape-display.lshape {
    clip-path: polygon(0 0, 75% 0, 75% 30%, 100% 30%, 100% 100%, 0 100%);
}

.shape-axis-bottom {
    left: 50%;
    bottom: 12px;
    transform: translateX(-50%);
}

/* --- Metric Cards --- */
.metric-card {
    padding: 16px;
    border-radius: var(--radius-md);
    background: var(--glass);
    border: 1px solid var(--glass-border);
    transition: all var(--transition-fast);
}

.metric-card:hover {
    border-color: var(--glass-border-hover);
}

.metric-card.accent {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(0, 212, 255, 0.06));
    border-color: rgba(99, 102, 241, 0.2);
    box-shadow: var(--shadow-glow);
}

.metric-card.accent .metric-value {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.steps-list {
    margin: 16px 0 0;
    padding-left: 20px;
    color: var(--ink-secondary);
}

.steps-list li {
    margin-bottom: 6px;
}

/* --- Lead Cards --- */
.lead-card,
.table-card,
.prose-card {
    padding: 24px;
}

.lead-card h3,
.use-card h3,
.info-tile h3 {
    font-family: var(--font-display);
    margin: 0 0 10px;
    font-size: 1.1rem;
    letter-spacing: -0.02em;
    font-weight: 700;
}

.info-tile,
.use-card {
    padding: 20px;
}

/* gradient accent line on top of info tiles */
.info-tile {
    position: relative;
    overflow: hidden;
}

.info-tile::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent-gradient);
    opacity: 0;
    transition: opacity var(--transition-base);
}

.info-tile:hover::before { opacity: 1; }

/* --- Table --- */
.table-card {
    overflow-x: auto;
    padding: 0 20px;
    margin: 20px 0;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--glass-border);
    text-align: left;
}

tr:last-child td {
    border-bottom: none;
}

th {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent-start);
    font-weight: 700;
}

td {
    color: var(--ink-secondary);
    font-size: 0.95rem;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background: var(--glass);
}

/* --- FAQ --- */
.faq-list {
    display: grid;
    gap: 12px;
}

.faq-item {
    padding: 18px 22px;
}

.faq-item summary {
    cursor: pointer;
    font-weight: 700;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: color var(--transition-fast);
}

.faq-item summary::-webkit-details-marker {
    display: none;
}

.faq-item summary::after {
    content: '+';
    font-size: 1.3rem;
    font-weight: 400;
    color: var(--ink-muted);
    transition: transform var(--transition-base);
    flex-shrink: 0;
    margin-left: 16px;
}

.faq-item[open] summary::after {
    content: '−';
    color: var(--accent-start);
}

.faq-item summary:hover {
    color: var(--accent-start);
}

.faq-item p {
    margin: 14px 0 0;
}

.faq-item[open] {
    border-color: rgba(99, 102, 241, 0.2);
    background: rgba(99, 102, 241, 0.03);
}

/* --- Footer --- */
.site-footer {
    padding: 20px 0 52px;
}

.footer-grid {
    display: grid;
    grid-template-columns: 1.2fr repeat(5, 0.7fr);
    align-items: start;
    justify-content: stretch;
    padding: 32px;
    border-radius: var(--radius-xl);
    background: var(--surface);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-md);
    gap: 20px;
}

.footer-grid div {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 8px;
}

.footer-grid h3 {
    margin: 0 0 8px;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--ink);
}

.footer-grid a {
    display: block;
    color: var(--ink-muted);
    font-size: 0.9rem;
    transition: color var(--transition-fast);
}

.footer-grid a:hover {
    color: var(--accent-start);
}

.footer-social {
    flex-direction: row !important;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px !important;
    margin-top: 8px;
}

.footer-social a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    background: var(--glass);
    border: 1px solid var(--glass-border);
    color: var(--ink-muted);
    transition: all var(--transition-base);
}

.footer-social a:hover {
    color: var(--accent-start);
    border-color: rgba(99, 102, 241, 0.3);
    background: var(--accent-soft);
    transform: translateY(-2px);
}

.footer-copy {
    max-width: 420px;
    font-size: 0.9rem;
}

.footer-contact-row {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--ink-secondary);
    font-size: 0.95rem;
    line-height: 1.4;
    white-space: nowrap;
    text-decoration: none;
}

.footer-contact-row svg {
    width: 18px;
    height: 18px;
    color: var(--ink-muted);
    flex-shrink: 0;
}

.footer-contact-row:hover {
    color: var(--accent-start);
}

.footer-contact-row:hover svg {
    color: var(--accent-start);
}

.footer-bottom {
    text-align: center;
    color: var(--ink-faint);
    margin: 20px 0 0;
    font-size: 0.85rem;
}

/* --- Sub-Pages --- */
.page-shell {
    padding-top: 10px;
}

.page-hero {
    padding: 24px 0 48px;
}

.page-hero h1 {
    max-width: 14ch;
    background: linear-gradient(135deg, #fff 30%, var(--accent-start) 70%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.page-intro {
    max-width: 680px;
    font-size: 1.05rem;
}

.page-grid {
    grid-template-columns: 1fr 300px;
    align-items: start;
}

.prose-card h2 {
    margin-bottom: 14px;
}

.prose-card ul {
    margin: 0;
    padding-left: 20px;
}

.prose-card ul li {
    margin-bottom: 6px;
}

.sidebar-card {
    padding: 22px;
    border-radius: var(--radius-xl);
    background: var(--surface);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-md);
}

.sidebar-card h3 {
    margin-top: 0;
    font-family: var(--font-display);
    font-weight: 700;
}

.sidebar-card a {
    display: block;
    margin-top: 8px;
    color: var(--accent-start);
    font-weight: 600;
    font-size: 0.9rem;
    transition: color var(--transition-fast);
}

.sidebar-card a:hover {
    color: var(--ink);
}

/* --- Contact Form --- */
.contact-list {
    margin: 0;
    padding-left: 20px;
}

.contact-form {
    display: grid;
    gap: 14px;
    margin-top: 18px;
}

.contact-form button {
    width: fit-content;
}

/* --- Toast --- */
.toast {
    position: fixed;
    left: 50%;
    bottom: 28px;
    transform: translateX(-50%) translateY(20px);
    padding: 12px 22px;
    border-radius: var(--radius-full);
    background: var(--accent-gradient);
    color: #fff;
    font-weight: 700;
    font-size: 0.9rem;
    box-shadow: var(--shadow-accent);
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s var(--ease-spring);
    z-index: 100;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* --- Mobile Menu --- */
.mobile-menu-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    background: var(--glass);
    border: 1px solid var(--glass-border);
    color: var(--ink);
    font-size: 1.4rem;
    transition: all var(--transition-fast);
}

.mobile-menu-btn:hover {
    background: var(--surface);
    border-color: var(--glass-border-hover);
}

/* --- Scroll Reveal Animations --- */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.content-strip {
    animation: fadeInUp 0.6s var(--ease-out) both;
}

.content-strip:nth-child(2) { animation-delay: 0.1s; }
.content-strip:nth-child(3) { animation-delay: 0.2s; }
.content-strip:nth-child(4) { animation-delay: 0.3s; }
.content-strip:nth-child(5) { animation-delay: 0.4s; }

/* --- Responsive: Tablet --- */
@media (max-width: 1100px) {
    .shape-grid,
    .formula-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 920px) {
    .hero-content,
    .calculator-intro,
    .calculator-layout,
    .toggle-row,
    .formula-grid,
    .use-case-grid,
    .lead-grid,
    .page-grid,
    .footer-grid {
        grid-template-columns: 1fr;
    }

    .hero-content {
        padding: 36px 0 44px;
        gap: 32px;
    }

    .hero h1 { max-width: none; }
}

/* --- Responsive: Mobile --- */
@media (max-width: 720px) {
    body { font-size: 14px; }

    .nav-links { display: none; }
    .mobile-menu-btn { display: flex; }

    .navbar {
        padding: 14px 0;
    }

    .navbar-inner {
        width: calc(100% - 32px);
    }

    .calculator-intro {
        margin: 0 16px;
        padding: 28px 0 18px;
    }

    .calc-compact-wrap {
        padding: 0 16px;
    }

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

    .calc-intro-title {
        white-space: normal;
        font-size: clamp(28px, 7vw, 42px);
        line-height: 1.1;
    }

    .lang-toggle {
        width: 36px;
        height: 36px;
    }

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

    .inputs-grid,
    .addons-grid,
    .results-grid {
        grid-template-columns: 1fr;
    }

    .action-row {
        flex-direction: column;
    }

    .hero,
    .calculator-shell,
    .content-strip,
    .page-shell,
    .site-footer {
        width: min(100% - 24px, 1280px);
    }

    .calculator-shell {
        padding: 8px 0 28px;
        border-radius: 0;
        border: none;
        background: none;
        box-shadow: none;
        backdrop-filter: none;
        min-height: 0;
    }

    .panel,
    .preview-card,
    .lead-card,
    .table-card,
    .prose-card,
    .sidebar-card {
        padding: 18px;
    }

    .hero-content {
        padding-top: 20px;
    }

    .hero h1,
    .page-hero h1 {
        max-width: none;
        font-size: clamp(2rem, 7vw, 3.2rem);
    }

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

    .footer-grid {
        padding: 24px;
    }

    .page-glow-one { width: 300px; height: 300px; }
    .page-glow-two { width: 350px; height: 350px; }
}

/* --- Mobile Menu Overlay --- */
.mobile-menu-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
}

.mobile-menu-overlay.open {
    opacity: 1;
    visibility: visible;
}

.mobile-menu-panel {
    position: absolute;
    top: 0;
    right: 0;
    width: min(360px, 85vw);
    height: 100%;
    background: var(--bg-secondary);
    border-left: 1px solid var(--glass-border);
    box-shadow: -20px 0 60px rgba(0, 0, 0, 0.5);
    padding: 24px;
    transform: translateX(100%);
    transition: transform 0.35s var(--ease-out);
    overflow-y: auto;
}

.mobile-menu-overlay.open .mobile-menu-panel {
    transform: translateX(0);
}

.mobile-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 32px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--glass-border);
}

.mobile-menu-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    background: var(--glass);
    border: 1px solid var(--glass-border);
    color: var(--ink);
    transition: all var(--transition-fast);
}

.mobile-menu-close:hover {
    background: var(--surface);
    border-color: var(--glass-border-hover);
}

.mobile-menu-links {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.mobile-menu-links a {
    display: block;
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--ink-secondary);
    transition: all var(--transition-fast);
}

.mobile-menu-links a:hover {
    background: var(--glass);
    color: var(--ink);
}

/* --- Mobile Menu: Other Tools categories --- */
.mobile-menu-tools {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.mobile-menu-tools-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 14px 18px;
    border: none;
    background: none;
    border-radius: var(--radius-sm);
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--ink-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.mobile-menu-tools-toggle:hover {
    background: var(--glass);
    color: var(--ink);
}

.mobile-menu-tools-arrow {
    flex-shrink: 0;
    transition: transform var(--transition-fast);
}

.mobile-menu-tools-toggle[aria-expanded="true"] .mobile-menu-tools-arrow {
    transform: rotate(180deg);
}

.mobile-menu-tools-panel {
    display: none;
    padding-top: 4px;
}

.mobile-menu-tools-panel.open {
    display: block;
}

.mobile-menu-cat {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: 12px;
}

.mobile-menu-cat-title {
    padding: 6px 18px;
    font-size: 0.74rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    background: linear-gradient(135deg, #00d4ff, #7c3aed);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.mobile-menu-cat a {
    display: block;
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--ink-secondary);
    transition: all var(--transition-fast);
}

.mobile-menu-cat a:hover {
    background: var(--glass);
    color: var(--ink);
}

/* --- Footer Social Icons --- */
.footer-social {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}

.footer-social a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    background: var(--glass);
    border: 1px solid var(--glass-border);
    color: var(--ink-muted);
    transition: all var(--transition-base);
}

.footer-social a:hover {
    background: var(--accent-soft);
    border-color: rgba(99, 102, 241, 0.3);
    color: var(--accent-start);
    transform: translateY(-2px);
}

/* --- Language Switcher --- */
.locale-switcher {
    margin-top: 24px;
    padding: 20px 32px;
    border-radius: var(--radius-xl);
    background: var(--glass);
    border: 1px solid var(--glass-border);
}

.locale-switcher-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--ink-muted);
    margin-bottom: 12px;
}

.locale-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.locale-link {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--ink-muted);
    background: var(--glass);
    border: 1px solid var(--glass-border);
    transition: all var(--transition-fast);
}

.locale-link:hover {
    color: var(--ink);
    border-color: var(--glass-border-hover);
    background: var(--surface);
}

.locale-link.active {
    background: var(--accent-soft);
    border-color: rgba(99, 102, 241, 0.3);
    color: var(--accent-start);
}

/* --- RTL Support (Arabic) --- */
html[dir="rtl"] {
    direction: rtl;
}

html[dir="rtl"] .navbar {
    flex-direction: row-reverse;
}

html[dir="rtl"] .brand {
    flex-direction: row-reverse;
}

html[dir="rtl"] .nav-links {
    flex-direction: row-reverse;
}

html[dir="rtl"] .mobile-menu-panel {
    right: auto;
    left: 0;
    border-left: none;
    border-right: 1px solid var(--glass-border);
    transform: translateX(-100%);
}

html[dir="rtl"] .mobile-menu-overlay.open .mobile-menu-panel {
    transform: translateX(0);
}

html[dir="rtl"] .hero-content {
    direction: rtl;
}

html[dir="rtl"] .input-shell input {
    padding-right: 14px;
    padding-left: 60px;
}

html[dir="rtl"] .unit-tag {
    right: auto;
    left: 12px;
}

html[dir="rtl"] .steps-list {
    padding-left: 0;
    padding-right: 20px;
}

html[dir="rtl"] .prose-card ul {
    padding-left: 0;
    padding-right: 20px;
}

html[dir="rtl"] .contact-list {
    padding-left: 0;
    padding-right: 20px;
}

/* --- Body scroll lock when menu open --- */
body.menu-open {
    overflow: hidden;
}

/* --- Responsive Mobile Menu --- */
@media (max-width: 720px) {
    .locale-switcher {
        padding: 16px 20px;
    }

    .locale-link {
        font-size: 0.75rem;
        padding: 5px 10px;
    }
}

/* --- Selection Color --- */
::selection {
    background: rgba(99, 102, 241, 0.3);
    color: #fff;
}

/* --- Scrollbar (Webkit) --- */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--ink-faint);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--ink-muted);
}

/* --- Focus Visible for accessibility --- */
:focus-visible {
    outline: 2px solid var(--accent-start);
    outline-offset: 2px;
}

/* ============================================================
   COMPACT CALCULATOR REDESIGN (cc- prefix)
   ============================================================ */

/* --- Compact Wrapper (two-column grid inside calculator-shell) --- */
.calc-compact-wrap {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(300px, 0.85fr);
    gap: 28px;
    align-items: start;
    max-width: 100%;
    padding: 0 36px;
}

/* --- Form Panel --- */
.calc-compact-form {
    background: var(--surface-elevated);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    padding: 28px 32px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* --- Label --- */
.cc-label {
    display: block;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--ink-muted);
    text-transform: uppercase;
    letter-spacing: 0.09em;
    margin-bottom: 8px;
}

.cc-label-sub {
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
    color: var(--ink-faint);
}

/* --- Field --- */
.cc-field {
    display: flex;
    flex-direction: column;
}

.cc-field-grow {
    flex: 1;
    min-width: 0;
}

.cc-quantity-row {
    align-items: flex-end;
}

.cc-quantity-field {
    width: 100%;
}

/* --- Horizontal Row of Fields --- */
.cc-row {
    display: flex;
    gap: 14px;
    align-items: flex-start;
}

/* --- Dimension Header (shape-specific label with icon) --- */
.cc-dims-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    color: var(--accent-start, #6366f1);
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.cc-dims-header svg {
    flex-shrink: 0;
}

/* --- Per-field Unit Select --- */
.cc-unit-select {
    padding: 10px 10px;
    background: rgba(10, 14, 26, 0.6);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--ink);
    font-size: 0.92rem;
    font-family: inherit;
    cursor: pointer;
    min-width: 65px;
    outline: none;
    transition: border-color var(--transition-fast);
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%236b7490' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 6px center;
    padding-right: 22px;
}

.cc-unit-select:focus {
    border-color: rgba(99, 102, 241, 0.4);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.09);
}

/* --- Angle unit label (for sector) --- */
.cc-angle-unit {
    padding: 7px 10px;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--ink-muted);
    display: flex;
    align-items: center;
}

/* --- Dimension Inputs --- */
.cc-dims {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cc-dim {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cc-dim-inputs {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.cc-dim-input-wrap {
    display: flex;
    align-items: center;
    background: rgba(10, 14, 26, 0.6);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    transition: border-color var(--transition-fast);
    flex: 1;
}

.cc-dim-input-wrap:focus-within {
    border-color: rgba(99, 102, 241, 0.4);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.09);
}

.cc-dim-secondary {
    flex: 0 0 auto;
}

.cc-dim-input-wrap input {
    flex: 1;
    min-width: 0;
    padding: 12px 14px;
    background: none;
    border: none;
    color: var(--ink);
    font-size: 1rem;
    font-family: inherit;
    outline: none;
}

.cc-dim-input-wrap input::placeholder {
    color: var(--ink-faint);
}

.cinput-unit {
    padding: 0 9px 0 2px;
    font-size: 0.74rem;
    font-weight: 700;
    color: var(--ink-faint);
    white-space: nowrap;
    flex-shrink: 0;
}

/* --- Generic Input --- */
.cc-input {
    width: 100%;
    padding: 12px 14px;
    background: rgba(10, 14, 26, 0.6);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--ink);
    font-size: 1rem;
    font-family: inherit;
    outline: none;
    transition: all var(--transition-fast);
    appearance: none;
    -webkit-appearance: none;
}

.cc-input:focus {
    border-color: rgba(99, 102, 241, 0.4);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.09);
}

.cc-input::placeholder {
    color: var(--ink-faint);
}

.cc-select {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7490' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    padding-right: 28px;
}

/* --- Input Group (prefix/suffix) --- */
.cc-input-group {
    display: flex;
    align-items: stretch;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    transition: border-color var(--transition-fast);
}

.cc-input-group:focus-within {
    border-color: rgba(99, 102, 241, 0.4);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.09);
}

.cc-prefix, .cc-suffix {
    display: flex;
    align-items: center;
    padding: 0 9px;
    background: rgba(10, 14, 26, 0.85);
    color: var(--ink-muted);
    font-size: 0.84rem;
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
}

.cc-input-mid {
    border: none;
    border-radius: 0;
    flex: 1;
    min-width: 0;
}

.cc-input-mid:focus {
    box-shadow: none;
}

.cc-input-end {
    border: none;
    border-radius: 0;
    border-left: 1px solid var(--glass-border);
    background-color: rgba(10, 14, 26, 0.85);
    flex: 0 0 auto;
    width: auto;
}

.cc-input-end:focus {
    box-shadow: none;
}

/* --- Optional / Collapsible Sections --- */
.cc-optional {
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.cc-opt-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    cursor: pointer;
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--ink-secondary);
    user-select: none;
    list-style: none;
    transition: background var(--transition-fast), color var(--transition-fast);
    gap: 10px;
}

.cc-opt-summary::-webkit-details-marker { display: none; }
.cc-opt-summary::marker { display: none; }

.cc-opt-summary:hover {
    color: var(--ink);
    background: var(--glass);
}

.cc-optional[open] > .cc-opt-summary {
    border-bottom: 1px solid var(--glass-border);
    background: var(--glass);
}

.cc-opt-tag {
    font-size: 0.67rem;
    font-weight: 700;
    color: var(--ink-muted);
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-full);
    padding: 2px 7px;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    flex-shrink: 0;
}

.cc-opt-body {
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* --- Action Buttons --- */
.cc-buttons {
    display: flex;
    gap: 8px;
    margin-top: 2px;
}

.cc-calc-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 20px;
    background: var(--accent-gradient);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-accent);
    position: relative;
    overflow: hidden;
}

.cc-calc-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.15), transparent 60%);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.cc-calc-btn:hover::before { opacity: 1; }
.cc-calc-btn:hover { transform: translateY(-1px); box-shadow: 0 10px 32px rgba(99,102,241,0.35); }
.cc-calc-btn:active { transform: translateY(0); }

.cc-reset-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 14px 24px;
    background: var(--glass);
    color: var(--ink-secondary);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.cc-reset-btn:hover {
    border-color: var(--glass-border-hover);
    color: var(--ink);
}

/* cc-note removed in redesign */

/* --- Results Panel --- */
.calc-compact-results {
    background: var(--surface-elevated);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: sticky;
    top: 20px;
}

/* --- Live Shape Diagram --- */
.cc-live-diagram {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 340px;
    padding: 24px;
    border-radius: var(--radius-md);
    background: rgba(10, 14, 26, 0.5);
    border: 1px solid var(--glass-border);
}

.cc-live-diagram svg {
    width: 100%;
    height: auto;
}

/* --- Primary Result Display --- */
.cc-primary-result {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, rgba(99,102,241,0.1), rgba(0,212,255,0.06));
    border: 1px solid rgba(99,102,241,0.25);
}

.cc-primary-val {
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.cc-primary-val strong {
    font-size: 1.6rem;
    font-weight: 800;
    font-family: var(--font-display);
    color: #fff;
    letter-spacing: -0.03em;
}

.cc-primary-val span {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--ink-muted);
}

.cc-copy-icon {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--glass-border);
    background: var(--glass);
    color: var(--ink-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.cc-copy-icon:hover {
    border-color: var(--glass-border-hover);
    color: var(--ink);
    background: var(--surface);
}

/* --- Multi-unit Results Table --- */
.cc-results-table {
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.cc-result-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    font-size: 0.88rem;
    gap: 10px;
}

.cc-result-row:last-child {
    border-bottom: none;
}

.cc-result-row span {
    color: var(--ink-secondary);
    font-weight: 500;
}

.cc-result-row strong {
    font-weight: 700;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
    text-align: right;
    font-size: 0.95rem;
}

.cc-results-header {
    background: rgba(255,255,255,0.03);
    padding: 6px 11px;
}

.cc-results-header span {
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--ink-muted);
}

/* --- Cost Box --- */
.cc-cost-box {
    background: linear-gradient(135deg, rgba(52,211,153,0.08), rgba(52,211,153,0.04));
    border: 1px solid rgba(52, 211, 153, 0.2);
    border-radius: var(--radius-md);
    padding: 14px;
    text-align: center;
}

.cc-cost-label {
    font-size: 0.72rem;
    font-weight: 800;
    color: var(--ink-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 5px;
}

.cc-cost-val {
    display: block;
    font-size: 1.55rem;
    font-weight: 800;
    font-family: var(--font-display);
    letter-spacing: -0.03em;
    color: var(--success);
    line-height: 1;
}

.cc-cost-sub {
    font-size: 0.76rem;
    color: var(--ink-muted);
    margin-top: 5px;
    line-height: 1.4;
}

/* --- Ghost Button --- */
.cc-ghost-btn {
    width: 100%;
    padding: 8px;
    background: none;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--ink-muted);
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.cc-ghost-btn:hover {
    border-color: var(--glass-border-hover);
    color: var(--ink-secondary);
    background: var(--glass);
}

/* --- Responsive: Stack on small screens --- */
@media (max-width: 820px) {
    .calc-compact-wrap {
        grid-template-columns: 1fr;
        max-width: 100%;
        padding: 0;
    }

    .calc-compact-results {
        position: static;
    }

    .calc-intro-title {
        font-size: clamp(24px, 6vw, 40px);
        white-space: normal;
        line-height: 1.15;
    }

    .calculator-intro-copy {
        font-size: 0.88rem;
        max-width: 100%;
    }

    .calculator-shell {
        overflow: hidden;
    }

    .calc-compact-form {
        padding: 14px;
        overflow: hidden;
    }
}

@media (max-width: 520px) {
    .calculator-shell {
        padding: 4px 0 24px;
    }

    .calc-intro-title {
        font-size: clamp(20px, 6.5vw, 30px);
    }

    .calc-compact-form {
        padding: 10px;
    }

    .cc-row {
        flex-direction: column;
    }

    .cc-field-grow {
        width: 100%;
    }

    .cc-dim-inputs {
        flex-wrap: wrap;
    }

    .cc-unit-select {
        min-width: 50px;
        font-size: 0.76rem;
    }
}

/* --- Screenshot Footer --- */
.compact-footer {
    width: min(100% - 60px, 1340px);
    margin: 0 auto;
    padding: 0 0 52px;
}

.compact-footer::before {
    content: "";
    display: block;
    height: 1px;
    margin: 0 0 48px;
    background: rgba(148, 163, 184, 0.14);
}

.footer-rule {
    height: 1px;
    background: rgba(148, 163, 184, 0.14);
    margin-top: 30px;
    margin-bottom: 34px;
}

.footer-screenshot-layout {
    display: grid;
    grid-template-columns: minmax(320px, 570px) 1fr;
    align-items: start;
    gap: 40px;
}

.footer-left {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.compact-footer .footer-bottom {
    margin: 0;
    text-align: left;
    color: #8390a5;
    font-size: 0.84rem;
    line-height: 1.5;
}

.footer-disclaimer {
    max-width: 650px;
    padding: 13px 14px 12px;
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 6px;
    background: rgba(30, 41, 59, 0.56);
}

.footer-disclaimer strong {
    display: block;
    margin-bottom: 7px;
    color: #cbd5e1;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.08em;
}

.footer-disclaimer p {
    margin: 0;
    color: #eef4ff;
    font-size: 0.82rem;
    line-height: 1.45;
}

.footer-disclaimer b {
    color: #ffffff;
}

.compact-footer .locale-switcher {
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
}

.compact-footer .locale-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 16px 14px;
}

.compact-footer .locale-link {
    min-width: 58px;
    justify-content: center;
    padding: 5px 11px;
    border-radius: 6px;
    border-color: rgba(203, 213, 225, 0.56);
    background: rgba(15, 23, 42, 0.38);
    color: #cbd5e1;
    font-size: 0.78rem;
    font-weight: 500;
    line-height: 1.2;
}

.compact-footer .locale-link:hover {
    color: #ffffff;
    border-color: rgba(226, 232, 240, 0.82);
    background: rgba(30, 41, 59, 0.72);
}

.compact-footer .locale-link.active {
    border-color: rgba(226, 232, 240, 0.92);
    background: #f8fafc;
    color: #64748b;
}

.compact-footer .footer-language-disabled {
    cursor: default;
}

.compact-footer .footer-grid {
    margin-top: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    align-items: start;
    justify-content: stretch;
}

.compact-footer .footer-grid > div {
    align-items: flex-start;
    justify-content: flex-start;
}

@media (max-width: 920px) {
    .footer-screenshot-layout {
        grid-template-columns: 1fr;
    }

    .compact-footer .locale-links {
        justify-content: flex-start;
    }
}

@media (max-width: 720px) {
    .compact-footer {
        width: min(100% - 24px, 1280px);
        padding: 0 0 28px;
    }

    .compact-footer::before {
        margin-bottom: 32px;
    }
}

/* ============================================================
   HOMEPAGE CONTENT SECTIONS
   ============================================================ */

/* --- Content prose --- */
.content-strip > p,
.content-strip > ol,
.content-strip > ul {
    color: var(--ink-secondary);
    font-size: 0.98rem;
    line-height: 1.7;
    max-width: 820px;
    margin-bottom: 16px;
}

.content-strip > ol,
.content-strip > ul {
    padding-left: 24px;
}

.content-strip > ol li,
.content-strip > ul li {
    margin-bottom: 8px;
    color: var(--ink-secondary);
}

/* --- Subsection --- */
.subsection {
    margin-top: 40px;
}

.subsection h3 {
    font-family: var(--font-display);
    font-size: clamp(1.15rem, 1.8vw, 1.4rem);
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--ink);
}

.subsection > p {
    margin-bottom: 20px;
}

.subsection > p:last-child,
.subsection > .table-card + p {
    margin-top: 20px;
}

/* --- Formula highlight box --- */
.formula-highlight {
    display: inline-block;
    padding: 18px 32px;
    margin: 20px 0 24px;
    border-radius: var(--radius-sm);
    background: var(--accent-soft);
    border: 1px solid rgba(99, 102, 241, 0.2);
    font-size: 1.1rem;
    color: var(--ink);
    letter-spacing: 0.01em;
}

/* --- Visual block (inline SVG diagram container) --- */
.visual-block {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 24px 0;
    padding: 32px 24px;
    border-radius: var(--radius-xl);
    background: rgba(10, 14, 26, 0.5);
    border: 1px solid var(--glass-border);
}

.visual-block svg {
    width: 100%;
    max-width: 560px;
    height: auto;
}

@media (max-width: 720px) {
    .visual-block {
        padding: 20px 12px;
    }
}

/* --- Tools Explore Grid --- */
.tools-explore {
    text-align: center;
    margin: 24px 0 36px;
    padding: 38px 30px 40px;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    background: var(--surface);
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(14px);
    width: 100%;
}

.tools-explore-title {
    font-family: var(--font-display);
    font-size: clamp(1.2rem, 2.2vw, 1.6rem);
    font-weight: 700;
    color: var(--ink);
    margin: 0 0 8px;
    letter-spacing: -0.02em;
}

.tools-explore-sub {
    font-size: 0.92rem;
    color: var(--ink-secondary);
    margin: 0 auto 28px;
    max-width: 600px;
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    max-width: 100%;
    margin: 0 auto;
}

.tool-link {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 56px;
    padding: 11px 14px;
    border-radius: var(--radius-md);
    border: 1px solid var(--glass-border);
    background: var(--surface);
    color: var(--ink-secondary);
    font-size: 0.86rem;
    font-weight: 600;
    transition: all var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
    text-decoration: none;
}

.tool-link:hover {
    color: var(--ink);
    border-color: var(--glass-border-hover);
    background: var(--surface-hover);
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

.tool-link svg {
    flex-shrink: 0;
    color: var(--accent-start);
    opacity: 1;
    width: 14px;
    height: 14px;
    padding: 7px;
    border-radius: 10px;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    box-sizing: content-box;
}

.tool-link:hover svg {
    opacity: 1;
    color: var(--accent-start);
    border-color: var(--glass-border-hover);
}

@media (max-width: 720px) {
    .tools-explore {
        margin: 16px 0 26px;
        padding: 28px 16px;
    }

    .tools-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .tool-link {
        min-height: 52px;
        padding: 9px 10px;
        font-size: 0.8rem;
    }
}

@media (max-width: 420px) {
    .tools-grid {
        grid-template-columns: 1fr;
    }
}

/* --- Boxed section (card wrapper for full sections) --- */
.boxed-section {
    padding: 40px 36px;
    border-radius: var(--radius-2xl);
    background: var(--surface);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(16px);
}

.boxed-section-center {
    text-align: center;
}

.boxed-section-center .reference-box,
.boxed-section-center .surplus-visual,
.boxed-section-center .formula-highlight {
    margin-left: auto;
    margin-right: auto;
}

.boxed-section-center p {
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.boxed-section-center .surplus-visual {
    justify-content: center;
}

@media (max-width: 720px) {
    .boxed-section {
        padding: 28px 20px;
    }
}

/* --- Section split layout (content + visual side-by-side) --- */
.section-split {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 36px;
    align-items: center;
}

.section-split-reverse {
    grid-template-columns: 0.8fr 1.2fr;
}

.section-split-content .section-heading {
    margin-bottom: 16px;
}

.section-split-content p,
.section-split-content ol,
.section-split-content ul {
    color: var(--ink-secondary);
    line-height: 1.75;
    font-size: 0.95rem;
}

.section-split-content ol {
    padding-left: 20px;
    margin: 8px 0 12px;
}

.section-split-content ol li {
    margin-bottom: 8px;
}

.section-split-content .lead-grid {
    margin-top: 32px;
}

.section-split-visual {
    padding: 24px;
    border-radius: var(--radius-xl);
    background: rgba(10, 14, 26, 0.5);
    border: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: center;
}

.section-split-visual svg {
    width: 100%;
    max-width: 360px;
    height: auto;
    display: block;
}

/* --- Section hero illustration --- */
.section-hero-img {
    margin-bottom: 28px;
    padding: 16px;
    border-radius: var(--radius-xl);
    background: rgba(10, 14, 26, 0.4);
    border: 1px solid var(--glass-border);
}
.section-hero-img svg {
    width: 100%;
    max-width: 600px;
    height: auto;
    display: block;
    margin: 0 auto;
}

/* --- Reference box --- */
.reference-box {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    max-width: 700px;
    margin: 0 auto;
}
.ref-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    border-radius: var(--radius-md);
    background: var(--surface);
    border: 1px solid var(--glass-border);
    font-size: 0.95rem;
}
.ref-val {
    font-weight: 700;
    color: var(--ink);
}
.ref-eq {
    color: var(--accent-start);
    font-weight: 700;
}
.ref-result {
    color: var(--ink-secondary);
}

/* --- Shapes grid (3 per row) --- */
.shapes-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-top: 32px;
}

/* --- Shape cards --- */
.shape-card {
    padding: 24px;
    border-radius: var(--radius-xl);
    background: var(--surface);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(16px);
    box-shadow: var(--shadow-md);
}

.shape-card h3 {
    font-family: var(--font-display);
    font-size: clamp(1.2rem, 2vw, 1.5rem);
    font-weight: 700;
    color: var(--ink);
    margin-bottom: 4px;
}

.shape-card h4 {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--accent-start);
    margin-bottom: 20px;
    letter-spacing: 0.01em;
}

.shape-card p,
.shape-card ul {
    color: var(--ink-secondary);
    font-size: 0.88rem;
    line-height: 1.65;
}

.shape-card ul {
    list-style: none;
    padding: 0;
    margin: 8px 0 16px;
}

.shape-card ul li {
    padding: 4px 0;
    padding-left: 16px;
    position: relative;
}

.shape-card ul li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 12px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent-start);
}

/* --- Shape diagram container --- */
.shape-diagram {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 16px 0 20px;
    padding: 18px 12px;
    border-radius: var(--radius-md);
    background: rgba(10, 14, 26, 0.6);
    border: 1px solid var(--glass-border);
}

.shape-diagram svg {
    width: 100%;
    height: auto;
}

/* --- Surplus visual --- */
.surplus-visual {
    display: flex;
    align-items: center;
    gap: 20px;
    margin: 24px 0;
    flex-wrap: wrap;
}

.surplus-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 20px 32px;
    border-radius: var(--radius-md);
    background: var(--surface);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(16px);
}

.surplus-box-total {
    border-color: rgba(99, 102, 241, 0.3);
    background: rgba(99, 102, 241, 0.06);
}

.surplus-label {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--ink-muted);
    font-weight: 600;
}

.surplus-value {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--ink);
}

.surplus-box-total .surplus-value {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.surplus-arrow {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent-start);
    padding: 8px 14px;
    border-radius: var(--radius-xs);
    background: rgba(0, 212, 255, 0.08);
    border: 1px solid rgba(0, 212, 255, 0.15);
}

/* --- FAQ h3 inside summary --- */
.faq-item summary h3 {
    font-size: 1rem;
    font-weight: 700;
    margin: 0;
    line-height: 1.4;
    display: inline;
    font-family: var(--font-sans);
}

/* --- Responsive: tablet adjustments --- */
@media (max-width: 1024px) {
    .shapes-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }

    .section-split,
    .section-split-reverse {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .section-split-reverse .section-split-visual {
        order: -1;
    }

    .section-split-visual {
        position: static;
        max-width: 420px;
    }
}

/* --- Responsive adjustments for new content --- */
@media (max-width: 720px) {
    .shapes-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .shape-card {
        padding: 20px 16px;
    }

    .shape-diagram {
        padding: 14px 8px;
    }

    .reference-box {
        grid-template-columns: 1fr;
    }

    .ref-item {
        padding: 10px 14px;
        font-size: 0.88rem;
    }

    .section-hero-img {
        padding: 10px;
        margin-bottom: 20px;
    }

    .surplus-visual {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .surplus-box {
        padding: 16px 20px;
    }

    .surplus-arrow {
        text-align: center;
    }

    .formula-highlight {
        padding: 12px 18px;
        font-size: 1rem;
    }
}

/* ============================================================
   BACK TO TOP BUTTON
   ============================================================ */
.back-to-top {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: 1.5px solid rgba(255, 255, 255, 0.15);
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.95), rgba(124, 58, 237, 0.95));
    color: #fff;
    cursor: pointer;
    display: grid;
    place-items: center;
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: opacity 0.25s ease, visibility 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    z-index: 999;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 32px rgba(0, 212, 255, 0.4);
}

.back-to-top:active {
    transform: translateY(-1px);
}

.back-to-top svg {
    width: 22px;
    height: 22px;
    pointer-events: none;
}

[dir="rtl"] .back-to-top {
    right: auto;
    left: 24px;
}

@media (max-width: 600px) {
    .back-to-top {
        bottom: 18px;
        right: 18px;
        width: 42px;
        height: 42px;
    }
    [dir="rtl"] .back-to-top {
        left: 18px;
    }
}

/* ============================================================
   FURTHER READING & REFERENCES SECTION
   ============================================================ */

.references-section {
    padding: 56px 0 40px;
}

.references-header {
    margin-bottom: 36px;
}

.references-chip {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 4px 14px;
    border-radius: var(--radius-full);
    background: rgba(99, 102, 241, 0.12);
    color: var(--accent-start);
    border: 1px solid rgba(99, 102, 241, 0.28);
    margin-bottom: 14px;
}

.references-header h2 {
    font-family: var(--font-display);
    font-size: clamp(1.6rem, 2.8vw, 2.2rem);
    font-weight: 700;
    color: var(--ink);
    margin: 0 0 10px;
    line-height: 1.2;
}

.references-desc {
    color: var(--ink-secondary);
    font-size: 0.98rem;
    max-width: 680px;
    line-height: 1.65;
    margin: 0;
}

.references-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 768px) {
    .references-grid {
        grid-template-columns: 1fr;
    }
}

.references-card {
    background: var(--surface);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 26px 28px 28px;
}

.references-card h3 {
    font-family: var(--font-display);
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--ink);
    margin: 0 0 18px;
    letter-spacing: 0.01em;
}

.references-internal,
.references-external {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.references-internal li a {
    color: #818cf8;
    text-decoration: none;
    font-size: 0.93rem;
    transition: color 0.18s;
}

.references-internal li a:hover {
    color: var(--accent-start);
    text-decoration: underline;
}

.references-external li {
    display: flex;
    align-items: center;
    gap: 9px;
}

.references-external li a {
    color: #818cf8;
    text-decoration: none;
    font-size: 0.93rem;
    transition: color 0.18s;
}

.references-external li a:hover {
    color: var(--accent-start);
    text-decoration: underline;
}

.ref-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.07em;
    padding: 2px 8px;
    border-radius: 4px;
    flex-shrink: 0;
    min-width: 36px;
}

.ref-badge.ref-wiki {
    background: #3b4a88;
    color: #ffffff;
}

.ref-badge.ref-gov {
    background: #1a5c52;
    color: #ffffff;
}

/* ============================================================
   QUICK PAGE NAVIGATION BAR
   ============================================================ */

.page-quicknav {
    margin-top: 18px;
    padding: 11px 16px;
    border-left: 3px solid rgba(99, 102, 241, 0.5);
    background: rgba(99, 102, 241, 0.06);
    border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px 2px;
    align-items: center;
    line-height: 1.4;
}

.page-quicknav a {
    color: #818cf8;
    text-decoration: none;
    font-size: 0.88rem;
    transition: color 0.15s;
    white-space: nowrap;
}

.page-quicknav a:hover {
    color: var(--accent-start);
    text-decoration: underline;
}

.quicknav-sep {
    color: var(--ink-faint);
    font-size: 0.8rem;
    padding: 0 3px;
    user-select: none;
}

/* --- Section shading: alternating full-width background bands so each section reads separate --- */
.content-strip {
    padding: 64px 0 72px;
    margin-bottom: 0;
}

.content-strip:nth-of-type(even) {
    background: rgba(24, 31, 56, 0.55);
    box-shadow: 0 0 0 100vmax rgba(24, 31, 56, 0.55);
    clip-path: inset(0 -100vmax);
}

.content-strip > .section-heading:first-child .eyebrow,
.content-strip > h2:first-child {
    margin-top: 0;
}

@media (max-width: 720px) {
    .content-strip {
        padding: 44px 0 52px;
    }
}

/* ============================================================
   SAAS HERO SPLIT (homepage) — copy left, calculator right
   Scoped to .hero-split / .hero-panel / .hero-results-shell so
   the shared .calc-compact-* rules used by other pages stay intact.
   ============================================================ */

.hero-split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 0.92fr);
    gap: 56px;
    align-items: center;
    padding: 40px 0 40px;
}

/* --- Left column --- */
.hero-copy {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 22px;
    max-width: 580px;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 7px 15px;
    border-radius: var(--radius-full);
    border: 1px solid rgba(245, 158, 11, 0.32);
    background: rgba(245, 158, 11, 0.09);
    color: #f4c46a;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.hero-stars {
    color: #f59e0b;
    font-size: 0.72rem;
    letter-spacing: 0.06em;
}

.hero-title {
    margin: 0;
    font-family: 'DM Serif Display', Georgia, 'Times New Roman', serif;
    font-weight: 400;
    font-size: clamp(34px, 4.6vw, 60px);
    line-height: 1.06;
    letter-spacing: -0.02em;
    color: #fff;
}

.hero-title em {
    font-style: italic;
    background: linear-gradient(135deg, var(--accent-start), #6366f1 55%, var(--accent-end));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-lede {
    margin: 0;
    max-width: 520px;
    color: var(--ink-secondary);
    font-size: 1.02rem;
    line-height: 1.7;
    font-weight: 500;
}

.hero-cta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 4px;
}

.hero-btn-primary,
.hero-btn-ghost {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 13px 24px;
    border-radius: var(--radius-sm);
    font-size: 0.94rem;
    font-weight: 700;
    text-decoration: none;
    transition: all var(--transition-base);
}

.hero-btn-primary {
    background: linear-gradient(135deg, #6366f1, var(--accent-end));
    color: #fff;
    border: 1px solid rgba(124, 58, 237, 0.6);
    box-shadow: var(--shadow-accent);
}

.hero-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 40px rgba(99, 102, 241, 0.38);
}

.hero-btn-ghost {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    color: var(--ink);
}

.hero-btn-ghost:hover {
    border-color: var(--glass-border-hover);
    background: var(--surface);
}

.hero-trust {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 26px;
    margin-top: 6px;
    color: var(--ink-muted);
    font-size: 0.85rem;
    font-weight: 500;
}

.hero-trust span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.hero-trust svg {
    color: var(--accent-start);
    flex-shrink: 0;
}

/* --- Right column: calculator panel --- */
.hero-panel {
    position: relative;
    border-radius: var(--radius-2xl);
    border: 1px solid var(--glass-border);
    background: linear-gradient(180deg, rgba(22, 29, 50, 0.92), rgba(14, 19, 34, 0.96));
    box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    padding: 18px 20px 22px;
}

.hero-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 4px 2px 16px;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--glass-border);
}

.hero-panel-title {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-secondary);
}

.hero-panel-mark {
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    border-radius: var(--radius-xs);
    background: linear-gradient(135deg, #6366f1, var(--accent-end));
    color: #fff;
    flex-shrink: 0;
}

.hero-panel-live {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    color: var(--success);
}

.hero-panel-live::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.14);
    animation: heroLivePulse 2s ease-in-out infinite;
}

@keyframes heroLivePulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.35; }
}

/* the form sits flush inside the panel — no nested card */
.hero-panel .calc-compact-form {
    background: none;
    border: none;
    border-radius: 0;
    padding: 4px 0 0;
    gap: 15px;
}

/* --- Results: full width strip under the hero --- */
.hero-results-shell {
    padding: 4px 0 48px;
}

.hero-results-shell .calc-compact-results {
    position: static;
    top: auto;
    padding: 26px 28px 28px;
    gap: 18px;
}

.cc-results-head {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.cc-results-title {
    margin: 0;
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: #fff;
}

.cc-results-sub {
    margin: 0;
    font-size: 0.86rem;
    color: var(--ink-muted);
    font-weight: 500;
}

.cc-results-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(300px, 0.95fr);
    gap: 24px;
    align-items: start;
}

.cc-results-data {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* --- Responsive --- */
@media (max-width: 1000px) {
    .hero-split {
        grid-template-columns: 1fr;
        gap: 36px;
        padding: 36px 0 28px;
    }

    .hero-copy {
        max-width: none;
    }

    .hero-lede {
        max-width: none;
    }
}

@media (max-width: 820px) {
    .cc-results-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .hero-split {
        padding: 24px 0 20px;
        gap: 28px;
    }

    .hero-panel {
        padding: 14px 14px 18px;
        border-radius: var(--radius-xl);
    }

    .hero-panel .calc-compact-form {
        padding: 2px 0 0;
    }

    .hero-results-shell .calc-compact-results {
        padding: 18px 16px 20px;
    }

    .hero-cta-row,
    .hero-btn-primary,
    .hero-btn-ghost {
        width: 100%;
        justify-content: center;
    }

    .hero-cta-row {
        flex-direction: column;
    }
}


/* ============================================================
   GOOGLE PREFERRED SOURCE
   Buttons reuse the existing site button classes
   (.hero-btn-ghost / .cc-ghost-btn) - the rules below only add
   the layout the Google mark needs, plus our own toast.
   ============================================================ */

.pref-source-btn {
    font-family: inherit;
    cursor: pointer;
    line-height: 1.25;
}

.pref-source-btn svg {
    flex-shrink: 0;
}

/* .hero-btn-ghost is authored for <a>; as a <button> it needs these. */
button.hero-btn-ghost {
    font-family: inherit;
    cursor: pointer;
}

/* Full-width ghost button in the results column: centre mark + label. */
.cc-ghost-btn.pref-source-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 8px;
}

/* Footer: the Fazier badge and the button share one row. */
.footer-ps-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.footer-ps-row > a {
    margin: 0 !important;
}

.footer-ps-row .pref-source-btn {
    padding: 11px 18px;
    font-size: 0.88rem;
}

/* --- Google's own confirmation toast: hidden, never removed --- */
iframe.publisher-toast {
    display: none !important;
}

/* --- Our replacement toast (no "Manage Preferred Sources" link) --- */
.ps-toast {
    position: fixed;
    left: 24px;
    bottom: 24px;
    z-index: 2147483000;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    width: max-content;
    max-width: min(420px, calc(100vw - 48px));
    padding: 14px 14px 14px 16px;
    border-radius: var(--radius-md);
    background: #131a2f;
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
    color: var(--ink);
    font-family: inherit;
    font-size: 0.88rem;
    line-height: 1.45;
    /* Visible the instant it is in the DOM - the entry is a keyframe,
       never an rAF-driven reveal (an unfocused tab pauses rAF). */
    opacity: 1;
    animation: psToastIn 260ms cubic-bezier(0.2, 0.8, 0.25, 1) both;
}

@keyframes psToastIn {
    from { transform: translateY(14px); }
    to   { transform: translateY(0); }
}

.ps-toast.ps-toast-out {
    animation: psToastOut 240ms ease forwards;
}

@keyframes psToastOut {
    to { opacity: 0; transform: translateY(14px); }
}

.ps-toast-icon {
    display: inline-flex;
    flex-shrink: 0;
    margin-top: 1px;
    color: #34d399;
}

.ps-toast-err .ps-toast-icon {
    color: #fbbc05;
}

.ps-toast-text {
    min-width: 0;
}

.ps-toast-title {
    display: block;
    margin-bottom: 3px;
    font-size: 0.9rem;
    font-weight: 700;
    color: #fff;
}

.ps-toast-body {
    margin: 0;
    color: var(--ink-secondary);
    font-size: 0.86rem;
}

.ps-toast-close {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    margin: -2px -2px 0 4px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: none;
    color: var(--ink-muted);
    cursor: pointer;
    transition: color var(--transition-fast), background var(--transition-fast);
}

.ps-toast-close:hover {
    color: var(--ink);
    background: rgba(255, 255, 255, 0.08);
}

/* Keep clear of the fixed back-to-top button (24px right, 46px wide). */
@media (max-width: 620px) {
    .ps-toast {
        left: 14px;
        right: 84px;
        bottom: 14px;
        width: auto;
        max-width: none;
    }
}
