/* ===== RESET & BASE ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --navy: #0d2f4f;
    --teal: #1a6b7a;
    --light-blue: #a8d0db;
    --pale: #e8f4f8;
    --white: #ffffff;
    --off-white: #f7fafb;
    --text: #2c3e50;
    --text-light: #5a6c7d;
    --accent: #1a6b7a;
}

html { scroll-behavior: smooth; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--text);
    line-height: 1.6;
    background: var(--white);
}

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

/* ===== NAVIGATION ===== */
nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    padding: 0.75rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-logo {
    height: 40px;
}

.nav-links {
    display: flex;
    gap: 2rem;
    list-style: none;
}

.nav-links a {
    text-decoration: none;
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    transition: color 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--teal);
}

.nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
}

.nav-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--navy);
    margin: 5px 0;
    transition: 0.3s;
}

/* ===== DROPDOWN ===== */
.nav-dropdown {
    position: relative;
}

.nav-dropdown > a {
    cursor: pointer;
}

.nav-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--white);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 8px;
    padding: 0.5rem 0;
    min-width: 200px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    z-index: 200;
    list-style: none;
}

.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown.open .nav-dropdown-menu {
    display: block;
}

.nav-dropdown-menu li a {
    display: block;
    padding: 0.5rem 1.25rem;
    font-size: 0.85rem;
    white-space: nowrap;
}

.nav-dropdown-menu li a:hover {
    background: var(--pale);
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-block;
    padding: 0.9rem 2.2rem;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.25s;
    letter-spacing: 0.02em;
}

.btn-primary {
    background: var(--navy);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--teal);
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(26, 107, 122, 0.3);
}

.btn-outline {
    background: transparent;
    color: var(--navy);
    border: 2px solid var(--navy);
}

.btn-outline:hover {
    background: var(--navy);
    color: var(--white);
}

/* ===== SECTION LAYOUT ===== */
section {
    padding: 6rem 2rem;
}

.section-header {
    text-align: center;
    margin-bottom: 4rem;
}

.section-header h2 {
    font-size: clamp(1.8rem, 3.5vw, 2.5rem);
    font-weight: 700;
    color: var(--navy);
    margin-bottom: 0.75rem;
}

.section-header p {
    font-size: 1.1rem;
    color: var(--text-light);
    max-width: 600px;
    margin: 0 auto;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

/* ===== FOOTER ===== */
footer {
    background: var(--navy);
    color: var(--light-blue);
    text-align: center;
    padding: 2.5rem 2rem;
}

.footer-logo {
    height: 32px;
    margin: 0 auto 1rem;
    filter: brightness(0) invert(1);
}

footer p {
    font-size: 0.85rem;
    opacity: 0.7;
}

.footer-legal {
    font-size: 0.72rem;
    opacity: 0.5;
    max-width: 700px;
    margin: 0.5rem auto 0;
    line-height: 1.5;
}

.footer-legal a {
    color: var(--light-blue);
    text-decoration: underline;
}

/* ===== BREADCRUMB ===== */
.breadcrumb {
    padding: 1rem 2rem;
    padding-top: 5rem;
    font-size: 0.85rem;
    color: var(--text-light);
    max-width: 1200px;
    margin: 0 auto;
}

.breadcrumb a {
    color: var(--teal);
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.breadcrumb span {
    margin: 0 0.4rem;
    color: var(--text-light);
}

/* ===== ARTICLE LAYOUT ===== */
.article-layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 3rem;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 2rem 4rem;
    align-items: start;
}

.article-toc {
    position: sticky;
    top: 5rem;
    background: var(--off-white);
    border-radius: 8px;
    padding: 1.25rem;
    border: 1px solid rgba(0, 0, 0, 0.06);
}

.article-toc h4 {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--navy);
    margin-bottom: 0.75rem;
}

.article-toc ul {
    list-style: none;
}

.article-toc ul li {
    margin-bottom: 0.4rem;
}

.article-toc ul li a {
    font-size: 0.85rem;
    color: var(--text-light);
    text-decoration: none;
    transition: color 0.2s;
}

.article-toc ul li a:hover {
    color: var(--teal);
}

/* ===== ARTICLE CONTENT ===== */
.article-content {
    max-width: 800px;
}

.article-content h1 {
    font-size: clamp(1.8rem, 3.5vw, 2.5rem);
    font-weight: 700;
    color: var(--navy);
    margin-bottom: 1.5rem;
    line-height: 1.2;
}

.article-content h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--navy);
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    padding-top: 0.5rem;
}

.article-content h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--navy);
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}

.article-content p {
    font-size: 1rem;
    color: var(--text);
    line-height: 1.8;
    margin-bottom: 1rem;
}

.article-content ul,
.article-content ol {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}

.article-content li {
    font-size: 1rem;
    color: var(--text);
    line-height: 1.8;
    margin-bottom: 0.3rem;
}

.article-content strong {
    color: var(--navy);
}

/* ===== CALLOUT BOX ===== */
.callout-box {
    background: var(--pale);
    border-left: 4px solid var(--teal);
    border-radius: 0 8px 8px 0;
    padding: 1.25rem 1.5rem;
    margin: 1.5rem 0;
    font-size: 0.95rem;
    line-height: 1.7;
}

.callout-box strong {
    color: var(--navy);
}

/* ===== CTA BANNER ===== */
.cta-banner {
    background: var(--navy);
    border-radius: 12px;
    padding: 2.5rem;
    text-align: center;
    margin-top: 3rem;
}

.cta-banner h3 {
    color: var(--white);
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.cta-banner p {
    color: var(--light-blue);
    font-size: 1rem;
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.cta-banner .btn-primary {
    background: var(--teal);
}

.cta-banner .btn-primary:hover {
    background: var(--light-blue);
    color: var(--navy);
}

/* ===== REFERENCES ===== */
.references {
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.references h2 {
    font-size: 1.3rem;
    margin-bottom: 0.75rem;
}

.references ol {
    padding-left: 1.5rem;
}

.references li {
    font-size: 0.9rem;
    color: var(--text-light);
    line-height: 1.6;
    margin-bottom: 0.4rem;
}

/* ===== HUB CARD GRID ===== */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.hub-card {
    background: var(--white);
    border-radius: 12px;
    padding: 2rem;
    border: 1px solid rgba(0, 0, 0, 0.06);
    text-decoration: none;
    color: inherit;
    transition: all 0.3s;
    display: block;
}

.hub-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.08);
    border-color: var(--light-blue);
}

.hub-card h3 {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--navy);
    margin-bottom: 0.5rem;
}

.hub-card p {
    font-size: 0.9rem;
    color: var(--text-light);
    line-height: 1.6;
}

.hub-card .card-tag {
    display: inline-block;
    margin-top: 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--teal);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ===== CALCULATOR PANEL ===== */
.calculator-panel {
    background: var(--off-white);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    padding: 2rem;
    margin: 2rem 0;
}

.calculator-panel h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--navy);
    margin-bottom: 1.25rem;
}

.calc-form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.calc-form .full-width {
    grid-column: 1 / -1;
}

.calc-field {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.calc-field label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--navy);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.calc-field input,
.calc-field select {
    padding: 0.6rem 0.8rem;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 6px;
    font-size: 0.95rem;
    font-family: inherit;
    color: var(--text);
    background: var(--white);
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}

.calc-field input:focus,
.calc-field select:focus {
    border-color: var(--teal);
    box-shadow: 0 0 0 3px rgba(26, 107, 122, 0.1);
}

.calc-field select {
    appearance: none;
    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='%235a6c7d' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.8rem center;
    padding-right: 2rem;
}

.calc-btn {
    display: inline-block;
    padding: 0.7rem 1.8rem;
    background: var(--navy);
    color: var(--white);
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.25s;
}

.calc-btn:hover {
    background: var(--teal);
}

.calc-btn-secondary {
    background: transparent;
    color: var(--navy);
    border: 1px solid var(--navy);
    margin-left: 0.5rem;
}

.calc-btn-secondary:hover {
    background: var(--navy);
    color: var(--white);
}

.calc-output {
    margin-top: 1.5rem;
}

.calc-output canvas {
    width: 100% !important;
    max-height: 400px;
}

.calc-readouts {
    display: flex;
    gap: 2rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.calc-readout {
    background: var(--white);
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 8px;
    padding: 0.75rem 1.25rem;
    text-align: center;
}

.calc-readout .label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-light);
    font-weight: 600;
}

.calc-readout .value {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--navy);
    margin-top: 0.2rem;
}

/* ===== MULTI-LAYER ===== */
.layer-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr auto;
    gap: 0.75rem;
    align-items: end;
    margin-bottom: 0.75rem;
}

.layer-row .calc-field {
    min-width: 0;
}

.remove-layer-btn {
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0.6rem;
    transition: color 0.2s;
}

.remove-layer-btn:hover {
    color: #c0392b;
}

.add-layer-btn {
    background: none;
    border: 1px dashed rgba(0, 0, 0, 0.15);
    border-radius: 6px;
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
    color: var(--teal);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 1rem;
}

.add-layer-btn:hover {
    border-color: var(--teal);
    background: var(--pale);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    nav {
        padding: 0.75rem 1.25rem;
    }

    .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--white);
        flex-direction: column;
        padding: 1.5rem 2rem;
        gap: 1.25rem;
        border-bottom: 1px solid rgba(0, 0, 0, 0.06);
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    }

    .nav-links.active {
        display: flex;
    }

    .nav-toggle {
        display: block;
    }

    .nav-dropdown-menu {
        position: static;
        box-shadow: none;
        border: none;
        padding-left: 1rem;
    }

    .nav-dropdown .nav-dropdown-menu {
        display: none;
    }

    .nav-dropdown.open .nav-dropdown-menu {
        display: block;
    }

    section {
        padding: 4rem 1.5rem;
    }

    .article-layout {
        grid-template-columns: 1fr;
        padding: 1rem 1.5rem 3rem;
    }

    .article-toc {
        position: static;
    }

    .breadcrumb {
        padding: 0.75rem 1.5rem;
        padding-top: 4.5rem;
    }

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

    .calc-form {
        grid-template-columns: 1fr;
    }

    .layer-row {
        grid-template-columns: 1fr;
    }

    .calc-readouts {
        flex-direction: column;
    }

    .cta-banner {
        padding: 2rem 1.5rem;
    }
}
