:root {
    /* Color System - Modern Nordic Race Palette */
    --nordic-midnight: #10242B;
    --deep-fjord: #18343C;
    --slate-coast: #35525A;
    --cold-graphite: #52666B;
    --snow-paper: #F5F7F4;
    --pure-snow: #FCFCFA;
    --frost-blue: #DCE8EA;
    --mist-sage: #D7E2DC;
    --pale-stone: #E4E0D7;
    --glacier-teal: #4FA9A6;
    --nordic-mint: #9BCBC2;
    --aurora-green: #6D8E7E;
    --race-coral: #D46E67;
    --bib-orange: #E38A52;
    --route-gold: #C6A45B;
    --ice-lavender: #938CA6;
    --deep-text: #17272D;
    --body-text: #46575D;
    --muted-text: #718087;
    --snow-text: #F7FAF8;

    /* Spacing System */
    --sp-4: 4px;
    --sp-8: 8px;
    --sp-12: 12px;
    --sp-16: 16px;
    --sp-24: 24px;
    --sp-32: 32px;
    --sp-40: 40px;
    --sp-64: 64px;

    /* Typography */
    --font-primary: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-primary);
    background-color: var(--snow-paper);
    color: var(--body-text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden; /* Only on body level to prevent horizontal scroll bars from custom scrollbars */
}

/* Accessibility */
:focus-visible {
    outline: 3px solid var(--bib-orange);
    outline-offset: 2px;
}

[hidden] {
    display: none !important;
}

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

a {
    color: var(--glacier-teal);
    text-decoration: none;
    transition: color 0.2s ease, background-color 0.2s ease;
}

a:hover {
    color: var(--deep-fjord);
}

/* Layout Utilities */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding-left: var(--sp-24);
    padding-right: var(--sp-24);
    min-width: 0;
}

.section-spacing {
    padding-top: var(--sp-64);
    padding-bottom: var(--sp-64);
}

.w-100 { width: 100%; }
.h-100 { height: 100%; }
.mt-8 { margin-top: var(--sp-8); }
.mt-16 { margin-top: var(--sp-16); }
.mt-24 { margin-top: var(--sp-24); }
.mt-40 { margin-top: var(--sp-40); }
.mt-auto { margin-top: auto; }
.mb-40 { margin-bottom: var(--sp-40); }
.p-24 { padding: var(--sp-24); }
.p-40 { padding: var(--sp-40); }
.text-center { text-align: center; }
.flex-column { display: flex; flex-direction: column; }
.justify-center { justify-content: center; }
.align-center { align-items: center; }

.bg-midnight { background-color: var(--nordic-midnight); }
.bg-fjord { background-color: var(--deep-fjord); }
.bg-frost { background-color: var(--frost-blue); }
.bg-teal { background-color: var(--glacier-teal); }
.bg-coral { background-color: var(--race-coral); }

.text-snow { color: var(--snow-text); }
.text-muted { color: var(--muted-text); }

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Typography Classes */
.heading-1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--deep-text);
    line-height: 1.1;
    margin: 0;
    letter-spacing: -0.02em;
    text-transform: uppercase;
    overflow-wrap: anywhere;
}

.heading-2 {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--deep-text);
    line-height: 1.2;
    margin: 0;
    overflow-wrap: anywhere;
}

.heading-3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--deep-text);
    margin: 0;
}

.heading-4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--deep-text);
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.text-lead {
    font-size: 1.25rem;
    color: var(--snow-text);
}

.text-body-large {
    font-size: 1.125rem;
}

.text-body {
    font-size: 1rem;
    color: inherit;
    margin: 0 0 var(--sp-16) 0;
}

.text-small {
    font-size: 0.875rem;
}

.text-snow .heading-1,
.text-snow .heading-2,
.text-snow .heading-3,
.text-snow .heading-4 {
    color: var(--snow-text);
}

/* Header & Nav */
.site-header {
    background-color: var(--pure-snow);
    height: 64px;
    border-bottom: 1px solid var(--pale-stone);
    display: flex;
    align-items: center;
    position: relative;
    z-index: 100;
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
}

.brand-link {
    display: flex;
    align-items: center;
    gap: var(--sp-12);
    text-decoration: none;
    color: var(--deep-text);
    font-weight: 600;
    font-size: 1.125rem;
}

.brand-logo {
    width: 32px;
    height: 32px;
}

.brand-name {
    overflow-wrap: anywhere;
}

.main-nav {
    display: none; /* hidden on mobile by default */
}

.nav-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: var(--sp-24);
    align-items: center;
}

.nav-link {
    color: var(--deep-text);
    font-weight: 500;
    font-size: 0.875rem;
}

.nav-link[aria-current="page"] {
    color: var(--glacier-teal);
    position: relative;
}

.nav-link[aria-current="page"]::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: var(--glacier-teal);
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 24px;
    height: 18px;
    background: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
}

.hamburger-line {
    width: 100%;
    height: 2px;
    background-color: var(--deep-text);
    transition: transform 0.3s ease, opacity 0.3s ease;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 12px var(--sp-24);
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.875rem;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.btn-sm {
    padding: 8px var(--sp-16);
    font-size: 0.75rem;
}

.btn-primary {
    background-color: var(--glacier-teal);
    color: var(--pure-snow);
}

.btn-primary:hover {
    background-color: var(--slate-coast);
    color: var(--pure-snow);
}

.btn-secondary {
    background-color: var(--deep-fjord);
    color: var(--pure-snow);
}

.btn-secondary:hover {
    background-color: var(--slate-coast);
    color: var(--pure-snow);
}

.btn-outline {
    background-color: transparent;
    border-color: var(--glacier-teal);
    color: var(--glacier-teal);
}

.btn-outline:hover {
    background-color: var(--glacier-teal);
    color: var(--pure-snow);
}

/* Card System - Horizontal Split */
.card-split {
    display: flex;
    flex-direction: column;
    gap: var(--sp-24);
}

.media-panel {
    flex: 1;
    min-width: 0;
}

.content-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}

.img-fluid {
    width: 100%;
    height: 100%;
    object-fit: cover;
    aspect-ratio: 16/9;
}

.rounded-image {
    border-radius: 8px;
}

.surface-card {
    background-color: var(--pure-snow);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(16, 36, 43, 0.04);
    border: 1px solid var(--pale-stone);
    padding: var(--sp-24);
}

/* Tag System */
.tag-group {
    display: flex;
    gap: var(--sp-8);
    margin-bottom: var(--sp-16);
    flex-wrap: wrap;
}

.tag {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px var(--sp-8);
    background-color: var(--mist-sage);
    color: var(--deep-text);
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.tag-accent {
    background-color: var(--bib-orange);
    color: var(--pure-snow);
}

/* Data Strip */
.metric-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--sp-16);
}

.metric-item {
    display: flex;
    flex-direction: column;
    padding: var(--sp-16);
    background-color: var(--pure-snow);
    border-radius: 4px;
    border-left: 4px solid var(--glacier-teal);
}

.metric-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--muted-text);
    margin-bottom: var(--sp-4);
}

.metric-value {
    font-size: 1rem;
    font-weight: 600;
    color: var(--deep-text);
}

.status-accent {
    border-left-color: var(--bib-orange);
}

.status-accent .metric-value {
    color: var(--bib-orange);
}

/* Sequence Section */
.sequence-track {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--sp-16);
}

.sequence-node {
    text-align: center;
    width: 100%;
}

.node-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--glacier-teal);
    color: var(--pure-snow);
    font-weight: 700;
    font-size: 0.875rem;
    margin-bottom: var(--sp-8);
}

.sequence-line {
    width: 2px;
    height: 24px;
    background-color: var(--slate-coast);
}

/* Tables */
.table-container {
    width: 100%;
    overflow-x: auto;
    background-color: var(--pure-snow);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(16, 36, 43, 0.04);
    border: 1px solid var(--pale-stone);
}

.table-header {
    padding: var(--sp-24);
    border-bottom: 1px solid var(--pale-stone);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

.data-table th, .data-table td {
    padding: var(--sp-16) var(--sp-24);
    text-align: left;
    border-bottom: 1px solid var(--pale-stone);
}

.data-table th {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--muted-text);
    text-transform: uppercase;
    background-color: var(--snow-paper);
}

.data-table td {
    font-size: 0.875rem;
    color: var(--deep-text);
}

/* Lists */
.bullet-list-short {
    list-style-type: disc;
    padding-left: var(--sp-24);
    margin: 0 0 var(--sp-16) 0;
}

.bullet-list-short li {
    margin-bottom: var(--sp-8);
}

.sidebar-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-links li {
    margin-bottom: var(--sp-12);
}

.sidebar-links a {
    font-weight: 500;
}

/* Layout Grids */
.content-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--sp-40);
}

/* Contact Form */
.contact-form {
    display: flex;
    flex-direction: column;
    gap: var(--sp-24);
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: var(--sp-8);
}

.form-label {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--deep-text);
}

.form-input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--pale-stone);
    border-radius: 4px;
    font-family: inherit;
    font-size: 1rem;
    background-color: var(--pure-snow);
    color: var(--deep-text);
}

.form-input:focus {
    outline: none;
    border-color: var(--glacier-teal);
    box-shadow: 0 0 0 3px rgba(79, 169, 166, 0.2);
}

.form-textarea {
    resize: vertical;
}

.form-input.is-invalid {
    border-color: var(--race-coral);
}

.error-text {
    color: var(--race-coral);
    font-size: 0.75rem;
    font-weight: 500;
}

/* Footer */
.site-footer {
    background-color: var(--nordic-midnight);
    color: var(--snow-text);
    padding: var(--sp-64) 0 var(--sp-24) 0;
}

.footer-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--sp-40);
    margin-bottom: var(--sp-64);
}

.footer-brand-link {
    display: flex;
    align-items: center;
    gap: var(--sp-12);
    text-decoration: none;
    color: var(--snow-text);
}

.footer-brand-link:hover {
    color: var(--glacier-teal);
}

.footer-logo {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
}

.brand-name-footer {
    font-size: 1.25rem;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.footer-heading {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 var(--sp-16) 0;
    color: var(--mist-sage);
}

.footer-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-list li {
    margin-bottom: var(--sp-12);
}

.footer-list a {
    color: var(--snow-text);
    font-size: 0.875rem;
}

.footer-list a:hover {
    color: var(--glacier-teal);
}

.footer-text {
    font-size: 0.875rem;
    color: var(--mist-sage);
    margin: 0;
}

.footer-bottom {
    border-top: 1px solid var(--slate-coast);
    padding-top: var(--sp-24);
    display: flex;
    flex-direction: column;
    gap: var(--sp-16);
    text-align: center;
}


/* Cookie Banner */
.cookie-banner {
    position: fixed;
    bottom: var(--sp-16);
    left: var(--sp-16);
    right: var(--sp-16);
    background-color: var(--pure-snow);
    border: 1px solid var(--pale-stone);
    border-radius: 8px;
    box-shadow: 0 12px 32px rgba(16, 36, 43, 0.15);
    padding: var(--sp-24);
    z-index: 999;
    display: flex;
    flex-direction: column;
    gap: var(--sp-16);
}

.cookie-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-8);
}

/* Breakpoints */
@media (min-width: 400px) {
    .metric-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 768px) {
    .card-split {
        flex-direction: row;
        gap: var(--sp-40);
    }

    .topic-index .card-split:nth-child(even) {
        flex-direction: row-reverse;
    }

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

    .sequence-track {
        flex-direction: row;
        justify-content: space-between;
        align-items: flex-start;
    }

    .sequence-line {
        width: 100%;
        height: 2px;
        margin-top: 20px;
    }

    .content-grid {
        grid-template-columns: 2fr 1fr;
    }

    .footer-grid {
        grid-template-columns: 2fr 1fr 1fr 1fr;
    }

    .footer-bottom {
        flex-direction: row;
        justify-content: space-between;
        text-align: left;
    }

    .cookie-banner {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        bottom: var(--sp-24);
        left: 50%;
        transform: translateX(-50%);
        max-width: 900px;
        width: calc(100% - var(--sp-48));
    }
    
    .cookie-actions {
        flex-wrap: nowrap;
    }

    .main-nav {
        display: block;
    }

    .mobile-menu-toggle {
        display: none;
    }
}

@media (min-width: 1024px) {
    .metric-grid {
        grid-template-columns: repeat(6, 1fr);
    }
}

/* Mobile Menu State */
.main-nav.is-visible {
    display: block;
    position: absolute;
    top: 64px;
    left: 0;
    width: 100%;
    background-color: var(--pure-snow);
    border-bottom: 1px solid var(--pale-stone);
    padding: var(--sp-24);
    box-shadow: 0 12px 24px rgba(16, 36, 43, 0.1);
    z-index: 99;
}

.main-nav.is-visible .nav-list {
    flex-direction: column;
    align-items: flex-start;
}

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