:root {
    --bg-color: #0a1628;
    --accent-1: #a8d8ea;
    --accent-2: #ff6b35;
    --accent-3: #4fc3f7;
    --text-color: #ffffff;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    overflow-x: hidden;
}

/* Fixed Three.js background canvas */
#earth-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
    pointer-events: none;
}

/* Sections float over the fixed background */
section {
    position: relative;
    z-index: 1;
    width: 100vw;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 4rem 2rem;
}
.container {
    max-width: 1100px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}
.scroll-reveal {
    opacity: 0;
    transform: translateY(60px);
}

/* Glass card: each section content sits in this */
.glass {
    background: rgba(10, 22, 40, 0.75);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(168, 216, 234, 0.12);
    border-radius: 16px;
    padding: 3rem 2.5rem;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

/* Typography */
h1 {
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    text-align: center;
    text-shadow: 0 4px 20px rgba(0,0,0,0.9);
    line-height: 1.1;
}
h2 {
    font-size: clamp(1.6rem, 3.5vw, 2.5rem);
    color: var(--accent-1);
    text-align: center;
}
p, .caption {
    font-size: 1.15rem;
    line-height: 1.7;
    max-width: 780px;
    text-align: center;
    color: #ccd;
}

/* Chart wrapper */
.chart-container {
    width: 100%;
    height: 55vh;
    min-height: 320px;
    position: relative;
    background: rgba(255,255,255,0.03);
    border-radius: 12px;
    padding: 1rem;
}
.iframe-container {
    width: 100%;
    min-height: 400px;
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    background: rgba(255,255,255,0.03);
}
.iframe-container iframe {
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 12px;
}

/* Dark mode inversion for iframes */
.iframe-container iframe[id^="datawrapper-chart-"] {
    filter: invert(1) hue-rotate(180deg) contrast(1.1);
}

/* Hero specifics */
#s1-hero {
    background: transparent;
}
#s1-hero .container {
    z-index: 2;
}
.scroll-chevron {
    position: absolute;
    bottom: 40px;
    z-index: 2;
    width: 24px;
    height: 24px;
    border-right: 3px solid var(--accent-1);
    border-bottom: 3px solid var(--accent-1);
    transform: rotate(45deg);
    animation: bounceChevron 2s infinite;
    cursor: pointer;
}
@keyframes bounceChevron {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0) rotate(45deg); }
    40% { transform: translateY(-15px) rotate(45deg); }
    60% { transform: translateY(-7px) rotate(45deg); }
}
.stats-ticker span {
    display: inline-block;
}
.stats-ticker {
    display: flex;
    gap: 2rem;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--accent-2);
    flex-wrap: wrap;
    justify-content: center;
    background: rgba(0,0,0,0.45);
    padding: 1rem 2rem;
    border-radius: 30px;
    backdrop-filter: blur(6px);
}

/* SVG Grid */
#cryosat-svg { max-width: 100%; height: auto; }
.grid-legend {
    display: flex;
    justify-content: space-between;
    width: 100%;
    max-width: 500px;
    margin-top: 0.5rem;
    background: linear-gradient(to right, #8b0000, #ffffff, #add8e6);
    height: 18px;
    border-radius: 10px;
    position: relative;
}
.grid-legend span {
    position: absolute;
    top: 24px;
    font-size: 0.85rem;
    font-weight: 700;
}

/* Leaflet overrrides */
.leaflet-container {
    background: transparent;
    font-family: inherit;
}
.leaflet-popup-content-wrapper {
    background: rgba(10,22,40,0.9);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 8px;
    backdrop-filter: blur(5px);
}
.leaflet-popup-tip {
    background: rgba(10,22,40,0.9);
}

/* HCU Logo & Footer */
.hcu-logo {
    width: 250px;
    max-width: 100%;
    margin-bottom: 2rem;
    filter: brightness(0) invert(1); 
    opacity: 0.9;
}

.site-footer {
    width: 100%;
    padding: 3rem 1rem;
    text-align: center;
    background: linear-gradient(to top, rgba(10,22,40,0.95), transparent);
    color: #aaa;
    font-size: 0.95rem;
    position: relative;
    z-index: 1;
}
.site-footer strong {
    color: var(--accent-1);
}

/* Map Controls */
.map-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
    background: rgba(0,0,0,0.5);
    padding: 0.75rem 1.25rem;
    border-radius: 8px;
    z-index: 2;
    flex-wrap: wrap;
}
.map-controls button {
    background: var(--accent-1);
    border: none;
    padding: 0.45rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 700;
    color: var(--bg-color);
    font-size: 0.9rem;
}
.map-controls input[type="range"] { cursor: pointer; accent-color: var(--accent-3); }
.highlight-badge {
    background: var(--accent-2);
    color: #fff;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 700;
    animation: pulse 1.5s infinite;
}
@keyframes pulse {
    0%   { transform: scale(1);   box-shadow: 0 0 0 0   rgba(255,107,53,0.7); }
    70%  { transform: scale(1.1); box-shadow: 0 0 0 10px rgba(255,107,53,0);   }
    100% { transform: scale(1);   box-shadow: 0 0 0 0   rgba(255,107,53,0);   }
}
.map-container {
    width: 100%;
    height: 55vh;
    min-height: 320px;
    border-radius: 12px;
    z-index: 1;
    background: #111;
}

/* Section 9: CTA */
.stat-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    width: 100%;
}
.stat-card {
    background: rgba(255,255,255,0.05);
    padding: 2rem 1.5rem;
    border-radius: 12px;
    text-align: center;
    border-top: 4px solid var(--accent-3);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.stat-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 8px 30px rgba(79,195,247,0.15);
}
.stat-card h3 {
    font-size: 2.5rem;
    margin: 0;
    color: var(--accent-2);
}
.quote-block {
    font-style: italic;
    font-size: 1.4rem;
    border-left: 4px solid var(--accent-1);
    padding-left: 1.5rem;
    margin: 2rem 0;
    max-width: 780px;
    color: #ddd;
    line-height: 1.7;
}
.elder-story-block {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2rem;
    max-width: 850px;
    margin: 2rem 0;
    background: rgba(255,255,255,0.03);
    padding: 1.5rem;
    border-radius: 12px;
    border-left: 4px solid var(--accent-1);
}
.elder-image-wrapper {
    flex: 1 1 250px;
    position: relative;
}
.elder-image {
    width: 100%;
    height: 220px;
    object-fit: cover;
    object-position: center 20%;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
}
.elder-image-wrapper .image-citation {
    font-size: 0.8rem;
    color: #889;
    text-align: right;
    margin-top: 0.5rem;
}
.elder-story-block .quote-block {
    flex: 2 1 300px;
    border-left: none;
    margin: 0;
    padding-left: 0;
}
.sea-level-counter {
    font-size: clamp(1.8rem, 4vw, 3rem);
    font-weight: 700;
    color: var(--accent-1);
    text-align: center;
}
.sea-level-counter span {
    color: var(--accent-3);
    font-family: 'Courier New', monospace;
}
.sources-list {
    text-align: left;
    font-size: 0.9rem;
    color: #aab;
    width: 100%;
    max-width: 780px;
    background: rgba(0,0,0,0.3);
    padding: 2rem;
    border-radius: 8px;
}
.sources-list h4 { margin-top: 0; color: var(--accent-1); }
.sources-list ul { padding-left: 1.5rem; }
.sources-list a { color: var(--accent-3); text-decoration: none; }
.sources-list a:hover { text-decoration: underline; }

/* Responsive */
@media (max-width: 768px) {
    section { padding: 2rem 1rem; }
    .glass { padding: 2rem 1.25rem; }
    .chart-container, .map-container { height: 45vh; min-height: 260px; }
    .stat-cards { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
    .stat-cards { grid-template-columns: 1fr; }
}

/* ============================================================
   NAVIGATION
   ============================================================ */
#site-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 100;
    background: rgba(10, 22, 40, 0.55);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(168, 216, 234, 0.12);
    transition: background 0.3s ease, transform 0.35s ease, box-shadow 0.3s ease;
}
#site-nav.scrolled {
    background: rgba(10, 22, 40, 0.9);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.4);
}
#site-nav.nav-hidden {
    transform: translateY(-100%);
}
.nav-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1.5rem;
}
.nav-brand {
    font-weight: 800;
    color: var(--accent-1);
    text-decoration: none;
    font-size: 1.05rem;
    white-space: nowrap;
}
.nav-links {
    list-style: none;
    display: flex;
    gap: 1.25rem;
    margin: 0 auto;
    padding: 0;
    flex-wrap: wrap;
}
.nav-links a {
    color: #dce6f0;
    text-decoration: none;
    font-size: 0.92rem;
    font-weight: 600;
    padding: 0.25rem 0;
    border-bottom: 2px solid transparent;
    transition: color 0.2s ease, border-color 0.2s ease;
}
.nav-links a:hover {
    color: var(--accent-3);
    border-bottom-color: var(--accent-3);
}
#nav-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--accent-1);
    font-size: 1.5rem;
    cursor: pointer;
    margin-left: auto;
}
#mute-toggle {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(168, 216, 234, 0.2);
    border-radius: 50%;
    width: 38px;
    height: 38px;
    cursor: pointer;
    font-size: 1rem;
    flex-shrink: 0;
}
#mute-toggle:hover { background: rgba(255, 255, 255, 0.16); }

/* Offset the hero so it isn't hidden behind the fixed nav */
#s1-hero { padding-top: 5rem; }

/* ============================================================
   SECTION HELPERS
   ============================================================ */
.section-kicker {
    display: inline-block;
    font-size: 0.8rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--accent-2);
    font-weight: 700;
    background: rgba(255, 107, 53, 0.12);
    padding: 0.3rem 0.9rem;
    border-radius: 20px;
}
.research-question {
    font-size: clamp(1.3rem, 2.5vw, 1.8rem);
    font-weight: 700;
    color: #fff;
    line-height: 1.5;
    border-left: 4px solid var(--accent-2);
    padding-left: 1.5rem;
    text-align: left;
    max-width: 900px;
}
.sub-head {
    color: var(--accent-1);
    font-size: 1.3rem;
    width: 100%;
    max-width: 900px;
    text-align: left;
    margin-top: 1rem;
    border-bottom: 1px solid rgba(168, 216, 234, 0.2);
    padding-bottom: 0.4rem;
}
.scope-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    width: 100%;
}
.scope-item {
    background: rgba(255, 255, 255, 0.04);
    border-radius: 12px;
    padding: 1.5rem;
    border-top: 3px solid var(--accent-3);
}
.scope-item h4 { color: var(--accent-2); margin-bottom: 0.5rem; font-size: 1.1rem; }
.scope-item p { text-align: left; font-size: 1rem; }

/* ============================================================
   STAKEHOLDER ONION MODEL (interactive, side callouts)
   ============================================================ */
.onion-interactive {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 1.5rem;
    width: 100%;
    margin-top: 1rem;
}
.onion {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0.5rem;
}
.onion-ring {
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 50%;
    position: relative;
    text-align: center;
    cursor: pointer;
    transition: box-shadow 0.25s ease, transform 0.25s ease;
    outline: none;
}
.ring-4 { width: min(440px, 80vw); height: min(440px, 80vw); background: rgba(79, 195, 247, 0.10); border: 1px solid rgba(79,195,247,0.3); }
.ring-3 { width: 80%; height: 80%; background: rgba(79, 195, 247, 0.16); border: 1px solid rgba(79,195,247,0.35); }
.ring-2 { width: 76%; height: 76%; background: rgba(168, 216, 234, 0.22); border: 1px solid rgba(168,216,234,0.4); }
.ring-1 { width: 70%; height: 70%; background: rgba(255, 107, 53, 0.28); border: 1px solid rgba(255,107,53,0.5); }
.onion-ring.active {
    box-shadow: inset 0 0 0 3px var(--accent-3), 0 0 25px rgba(79,195,247,0.5);
    z-index: 5;
}
.ring-1.active { box-shadow: inset 0 0 0 3px #fff, 0 0 30px rgba(255,107,53,0.7); }
.onion-core {
    width: 64%;
    height: 64%;
    border-radius: 50%;
    background: var(--accent-2);
    color: #fff;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    font-size: clamp(0.75rem, 1.6vw, 1rem);
    box-shadow: 0 0 30px rgba(255, 107, 53, 0.5);
}
.ring-label {
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    font-size: clamp(0.6rem, 1.3vw, 0.8rem);
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    text-shadow: 0 1px 4px rgba(0,0,0,0.8);
    pointer-events: none;
}

/* Side callouts */
.onion-callout {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}
.callout-left { align-items: flex-end; text-align: right; }
.callout-right { align-items: flex-start; text-align: left; }
.callout-card {
    background: rgba(255, 255, 255, 0.04);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    max-width: 320px;
    cursor: pointer;
    position: relative;
    border: 1px solid rgba(168, 216, 234, 0.12);
    transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
}
.callout-card h4 { margin-bottom: 0.4rem; font-size: 1rem; }
.callout-card p { text-align: inherit; font-size: 0.92rem; margin: 0; color: #cdd; }
.callout-card[data-layer="1"] { border-left: 4px solid var(--accent-2); }
.callout-card[data-layer="2"] { border-right: 4px solid var(--accent-1); }
.callout-card[data-layer="3"] { border-left: 4px solid var(--accent-3); }
.callout-card[data-layer="4"] { border-right: 4px solid #7fb8d8; }
.callout-card.active {
    background: rgba(79, 195, 247, 0.14);
    transform: scale(1.04);
    box-shadow: 0 6px 24px rgba(0,0,0,0.35);
}
/* Connector arrows */
.callout-left .callout-card::after,
.callout-right .callout-card::after {
    content: "";
    position: absolute;
    top: 50%;
    width: 0;
    height: 0;
    border-top: 9px solid transparent;
    border-bottom: 9px solid transparent;
    transform: translateY(-50%);
    opacity: 0.4;
    transition: opacity 0.25s ease;
}
.callout-left .callout-card::after {
    right: -13px;
    border-left: 13px solid var(--accent-3);
}
.callout-right .callout-card::after {
    left: -13px;
    border-right: 13px solid var(--accent-3);
}
.callout-card.active::after { opacity: 1; }

/* ============================================================
   LITERATURE / THEORETICAL FOUNDATION
   ============================================================ */
.lit-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    width: 100%;
}
.lit-card {
    background: rgba(255, 255, 255, 0.04);
    border-radius: 12px;
    padding: 1.5rem;
    border-top: 3px solid var(--accent-3);
    display: flex;
    flex-direction: column;
}
.lit-card h4 { color: var(--accent-1); margin-bottom: 0.6rem; font-size: 1.05rem; }
.lit-card p { text-align: left; font-size: 0.97rem; flex-grow: 1; }
.lit-card a {
    color: var(--accent-3);
    text-decoration: none;
    font-weight: 700;
    font-size: 0.9rem;
    margin-top: 0.75rem;
}
.lit-card a:hover { text-decoration: underline; }

/* ============================================================
   METHODS
   ============================================================ */
.method-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    width: 100%;
}
.method-block {
    background: rgba(255, 255, 255, 0.04);
    border-radius: 12px;
    padding: 1.75rem 1.5rem 1.5rem;
    border-top: 3px solid var(--accent-2);
    position: relative;
}
.method-num {
    position: absolute;
    top: 1rem;
    right: 1.25rem;
    font-size: 2.2rem;
    font-weight: 800;
    color: rgba(255, 107, 53, 0.25);
    line-height: 1;
}
.method-block h4 { color: var(--accent-1); margin-bottom: 0.6rem; padding-right: 2.5rem; }
.method-block p, .method-block ul { text-align: left; font-size: 0.97rem; }
.method-block ul { padding-left: 1.2rem; }
.method-block li { margin-bottom: 0.4rem; }

/* ============================================================
   RESULTS & RECOMMENDATIONS
   ============================================================ */
.result-list {
    text-align: left;
    max-width: 900px;
    width: 100%;
    padding-left: 1.5rem;
    font-size: 1.05rem;
    line-height: 1.7;
}
.result-list li { margin-bottom: 0.5rem; }
.rec-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    width: 100%;
}
.rec-card {
    background: rgba(79, 195, 247, 0.08);
    border-radius: 12px;
    padding: 1.5rem;
    border-top: 3px solid var(--accent-3);
}
.rec-card h4 { color: var(--accent-2); margin-bottom: 0.5rem; font-size: 1.15rem; }
.rec-card p { text-align: left; font-size: 0.97rem; margin: 0; }
#s-results p { text-align: left; max-width: 900px; }

/* ============================================================
   NAV RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
    #nav-toggle { display: block; order: 3; }
    #mute-toggle { order: 2; }
    .nav-brand { order: 1; }
    .nav-links {
        order: 4;
        flex-basis: 100%;
        flex-direction: column;
        gap: 0.5rem;
        margin: 0;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
    }
    .nav-links.open { max-height: 500px; margin-top: 0.75rem; }

    /* Onion stacks: callouts below the rings */
    .onion-interactive { grid-template-columns: 1fr; }
    .onion-callout { align-items: stretch; text-align: left; }
    .callout-card { max-width: none; }
    .callout-left .callout-card::after,
    .callout-right .callout-card::after { display: none; }
    .callout-left, .callout-right { order: 2; }
    .onion { order: 1; }

    /* Methods stack to a single column */
    .method-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   GOOGLE EARTH ENGINE TIMELAPSE — prevent Chrome cropping
   ============================================================ */
.timelapse-container {
    min-height: 520px;
    height: 60vh;
    max-height: 640px;
}
.timelapse-container iframe {
    width: 100%;
    height: 100%;
    display: block;
    border: 0;
}
