/* Base styles adapted from AndyZHENG0715/hko-signal8-validation, commit 5c6dae859542b56f086fc55399ae1146d694a2e5. */
/* Global Styles */
:root {
    --primary-color: #FF6B35;
    --secondary-color: #004E89;
    --accent-color: #FFD23F;
    --text-dark: #1a1a1a;
    --text-light: #666;
    --bg-light: #f8f9fa;
    --bg-white: #ffffff;
    --border-color: #e0e0e0;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
    --shadow-hover: 0 4px 16px rgba(0,0,0,0.15);
    /* Design Tokens */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 32px;
    --radius-sm: 4px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.12);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.12);
    --shadow-lg: 0 8px 28px rgba(0,0,0,0.18);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-dark);
    background-color: var(--bg-light);
    padding-top: 70px; /* Account for fixed nav */
}

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

/* Main Navigation */
.main-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--bg-white);
    border-bottom: 1px solid var(--border-color);
    z-index: 999;
    box-shadow: var(--shadow);
}

.nav-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 70px;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text-dark);
    font-weight: 700;
    font-size: 18px;
    transition: opacity 0.3s;
}

.nav-logo:hover {
    opacity: 0.7;
}

.logo-icon {
    font-size: 28px;
}

.logo-text {
    display: none;
}

@media (min-width: 768px) {
    .logo-text {
        display: inline;
    }
}

.nav-links {
    display: flex;
    gap: 5px;
}

.nav-link {
    padding: 8px 16px;
    text-decoration: none;
    color: var(--text-dark);
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.3s;
    font-size: 15px;
}

.nav-link:hover {
    background: var(--bg-light);
    color: var(--primary-color);
}

.nav-link.active {
    background: var(--primary-color);
    color: white;
}

/* Language Toggle */
.language-toggle {
    position: fixed;
    top: 80px; /* Below main nav */
    right: 20px;
    z-index: 998; /* Below nav */
    background: var(--bg-white);
    border-radius: 20px;
    box-shadow: var(--shadow);
    display: flex;
    gap: 5px;
    padding: 5px;
}

.language-toggle button {
    padding: 8px 16px;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 15px;
    font-weight: 600;
    transition: all 0.3s;
    color: var(--text-light);
    font-size: 14px;
    min-width: 44px; /* Touch target */
    min-height: 36px;
}

.language-toggle button.active {
    background: var(--primary-color);
    color: white;
}

.language-toggle button:hover:not(.active) {
    background: var(--bg-light);
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, var(--secondary-color) 0%, #003366 100%);
    color: white;
    padding: 120px 0 80px;
    position: relative;
    overflow: visible;
    z-index: 1;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 600"><path d="M0,300 Q300,100 600,300 T1200,300 L1200,600 L0,600 Z" fill="rgba(255,255,255,0.05)"/></svg>') no-repeat bottom;
    background-size: cover;
    opacity: 0.3;
}

.hero-content {
    position: relative;
    z-index: 1;
    text-align: center;
}

.hero-title {
    font-size: 48px;
    font-weight: 700;
    margin-bottom: 20px;
    line-height: 1.2;
}

.hero-subtitle {
    font-size: 20px;
    opacity: 0.9;
    max-width: 700px;
    margin: 0 auto;
}

/* Metrics Dashboard */
.metrics-dashboard {
    margin-top: 20px;
    padding: 0 0 60px;
    position: relative;
    z-index: 2;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.metric-card {
    background: var(--bg-white);
    border-radius: 12px;
    padding: 30px;
    text-align: center;
    box-shadow: var(--shadow);
    transition: transform 0.3s, box-shadow 0.3s;
}

.metric-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

.metric-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.metric-value {
    font-size: 42px;
    font-weight: 700;
    color: var(--secondary-color);
    margin-bottom: 10px;
}

.metric-unit {
    font-size: 24px;
    font-weight: 400;
}

.metric-label {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 5px;
}

.metric-sublabel {
    font-size: 14px;
    color: var(--text-light);
}

/* CTA Cards */
.cta-cards {
    padding: 60px 0;
    background: var(--bg-white);
}

.cta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.cta-card {
    background: var(--bg-light);
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    border: 2px solid transparent;
}

.cta-card:hover {
    background: var(--bg-white);
    border-color: var(--primary-color);
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

.cta-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.cta-card h3 {
    font-size: 22px;
    margin-bottom: 15px;
    color: var(--text-dark);
}

.cta-card p {
    color: var(--text-light);
    line-height: 1.6;
}

/* Section Styles */
.section-title {
    font-size: 36px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 15px;
    color: var(--text-dark);
}

.section-subtitle {
    font-size: 18px;
    text-align: center;
    color: var(--text-light);
    margin-bottom: 50px;
}

/* Typhoon Timeline */
.typhoon-timeline {
    padding: 80px 0;
}

.timeline-container {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.typhoon-event {
    background: var(--bg-white);
    border-radius: 12px;
    padding: 30px;
    box-shadow: var(--shadow);
    transition: all 0.3s;
    cursor: pointer;
    border-left: 5px solid var(--secondary-color);
}

.typhoon-event:hover {
    transform: translateX(5px);
    box-shadow: var(--shadow-hover);
}

.typhoon-event.severity-T10 {
    border-left-color: var(--danger-color);
}

.typhoon-event.severity-T8 {
    border-left-color: var(--warning-color);
}

.typhoon-event.severity-none {
    border-left-color: var(--text-light);
}

/* Tier-based border colors (override severity when tier class present) */
.typhoon-event.tier-verified {
    border-left-color: var(--success-color) !important;
}

.typhoon-event.tier-pattern_validated {
    border-left-color: var(--warning-color) !important;
}

.typhoon-event.tier-unverified {
    border-left-color: var(--text-light) !important;
}

.typhoon-event.tier-no_signal {
    border-left-color: var(--border-color) !important;
}

.event-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.event-name {
    display: flex;
    align-items: center;
    gap: 15px;
}

.event-icon {
    font-size: 42px;
}

.event-title h3 {
    font-size: 28px;
    color: var(--text-dark);
    margin-bottom: 5px;
}

.event-date {
    font-size: 14px;
    color: var(--text-light);
}

.event-verdict {
    padding: 10px 20px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 14px;
}

.verdict-appropriate {
    background: #d4edda;
    color: #155724;
}

.verdict-forecast {
    background: #fff3cd;
    color: #856404;
}

/* New pattern-validated badge */
.verdict-pattern {
    background: #ffe8cc;
    color: #995700;
}

.verdict-consistent {
    background: #d1ecf1;
    color: #0c5460;
}

.event-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.event-stat {
    padding: 15px;
    background: var(--bg-light);
    border-radius: 8px;
}

.event-stat-label {
    font-size: 12px;
    color: var(--text-light);
    text-transform: uppercase;
    margin-bottom: 5px;
}

.event-stat-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--secondary-color);
}

.event-stat-value.na {
    color: var(--text-light);
}

/* Key Findings Section */
.key-findings {
    padding: 80px 0;
    background: var(--bg-light);
}

.findings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 30px;
    margin-top: 40px;
}

.finding-card {
    background: var(--bg-white);
    border-radius: 12px;
    padding: 30px;
    box-shadow: var(--shadow);
}

.finding-card h3 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 20px;
    text-align: center;
}

.finding-stats {
    display: flex;
    justify-content: space-around;
    gap: 20px;
    margin-bottom: 20px;
}

.finding-stat {
    text-align: center;
    flex: 1;
}

.finding-icon {
    font-size: 32px;
    margin-bottom: 10px;
}

.finding-value {
    font-size: 36px;
    font-weight: 700;
    color: var(--secondary-color);
    margin-bottom: 5px;
}

.finding-label {
    font-size: 13px;
    color: var(--text-light);
    text-transform: uppercase;
}

.finding-range {
    background: var(--bg-light);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
}

.range-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 14px;
}

.range-label {
    font-weight: 600;
    color: var(--text-dark);
}

.range-value {
    color: var(--text-light);
}

.finding-note {
    font-size: 13px;
    color: var(--text-light);
    line-height: 1.6;
    margin: 0;
    padding: 12px;
    background: #fffbeb;
    border-left: 3px solid #f59e0b;
    border-radius: 4px;
}

.t10-summary {
    background: #faf5ff;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
}

.t10-event {
    padding: 8px 0;
    font-size: 14px;
    color: var(--text-dark);
}

.t10-event:first-child {
    border-bottom: 1px solid #e9d5ff;
    padding-bottom: 12px;
    margin-bottom: 8px;
}

/* Footer */
.footer {
    background: var(--text-dark);
    color: white;
    padding: 60px 0 20px;
    margin-top: 80px;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 40px;
    margin-bottom: 40px;
}

.footer-section h4 {
    font-size: 18px;
    margin-bottom: 15px;
    color: var(--accent-color);
}

.footer-section p {
    font-size: 14px;
    line-height: 1.6;
    opacity: 0.8;
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 10px;
}

.footer-section ul li a {
    color: white;
    text-decoration: none;
    opacity: 0.8;
    transition: opacity 0.3s;
}

.footer-section ul li a:hover {
    opacity: 1;
    text-decoration: underline;
}

.footer-bottom {
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: 20px;
    text-align: center;
}

.footer-bottom p {
    font-size: 14px;
    opacity: 0.6;
}

/* Responsive Design */
@media (max-width: 768px) {
    .hero-title {
        font-size: 32px;
    }

    .hero-subtitle {
        font-size: 16px;
    }

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

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

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

    .event-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .section-title {
        font-size: 28px;
    }
}

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

    .hero {
        padding: 80px 0 40px;
    }

    .metric-value {
        font-size: 32px;
    }

    .finding-stats {
        flex-direction: column;
        gap: 15px;
    }

    .metric-label {
        font-size: 12px;
    }
}

/* Print Styles */
@media print {
    .language-toggle,
    .cta-cards,
    .footer {
        display: none;
    }

    .hero {
        background: white;
        color: var(--text-dark);
        padding: 20px 0;
    }

    .typhoon-event {
        page-break-inside: avoid;
    }
}
/* Loading States */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 1;
    transition: opacity 0.3s;
}

.loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-message {
    margin-top: 20px;
    font-size: 14px;
    color: var(--text-light);
    text-align: center;
}

/* Error States */
.error-message {
    background: #fee;
    border: 1px solid #fcc;
    color: #c33;
    padding: 15px 20px;
    border-radius: 8px;
    margin: 20px 0;
    display: none;
}

.error-message.show {
    display: block;
}

/* Breadcrumbs */
.breadcrumb {
    background: var(--bg-white);
    padding: 15px 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
}

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

.breadcrumb-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.breadcrumb-item a {
    color: var(--secondary-color);
    text-decoration: none;
    transition: color 0.3s;
}

.breadcrumb-item a:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

.breadcrumb-separator {
    color: var(--text-light);
    user-select: none;
}

.breadcrumb-item.active {
    color: var(--text-dark);
    font-weight: 500;
}

/* Generic Card Component */
.card {
    background: var(--bg-white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow);
    padding: var(--space-lg);
    position: relative;
    transition: box-shadow 0.3s, transform 0.3s;
}

.card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-3px);
}

/* Skip Link for Accessibility */
.skip-link {
    position: absolute;
    top: -40px;
    left: 10px;
    background: var(--secondary-color);
    color: white;
    padding: 8px 16px;
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-weight: 600;
    z-index: 1000;
    transition: top 0.2s;
}

.skip-link:focus {
    top: 10px;
}

/* Focus Styles */
a:focus-visible,
button:focus-visible,
.nav-link:focus-visible {
    outline: 3px solid var(--accent-color);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* Completion pass: retain the original portal palette and card structure. */
body{padding-top:0} .main-nav{position:relative}.nav-content{flex-wrap:wrap;gap:12px;padding:14px 0}.nav-links{display:flex!important;flex-wrap:wrap;gap:12px}.nav-links a{white-space:nowrap}.hero{padding:48px 0}.hero-title{font-size:clamp(1.8rem,5vw,3rem)}.hero-subtitle{max-width:760px;margin:auto}.toolbar{display:flex;gap:12px;align-items:center;flex-wrap:wrap;margin:20px 0}.toolbar select{max-width:100%;padding:10px}.page-content{padding:32px 0}.panel{background:white;border:1px solid #e0e0e0;border-radius:12px;padding:24px;margin:20px 0;min-width:0}.cards{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,300px),1fr));gap:20px}.event-card{display:block;color:inherit;text-decoration:none;background:white;border:1px solid #ddd;border-radius:12px;padding:24px;border-top:4px solid #004e89}.event-card h2{font-size:1.3rem}.event-card:hover{border-color:#ff6b35}.badge{display:inline-block;padding:4px 10px;border-radius:18px;background:#edf2f7;font-size:.9rem;margin:8px 0}.tier1{background:#dcfce7}.tier2{background:#fef3c7}.notice{border-left:4px solid #004e89;background:#edf5fa;padding:16px;margin:20px 0}.muted{color:#555;font-size:.95rem}.chart-wrap{height:340px;position:relative;min-width:0}.table-scroll{overflow-x:auto;max-width:100%}table{border-collapse:collapse;width:100%;font-size:.9rem}th,td{padding:10px;border-bottom:1px solid #ddd;text-align:left;white-space:nowrap}caption{text-align:left;margin-bottom:12px}.heatmap td{padding:0;min-width:10px;height:28px;border:1px solid white}.heatmap th{position:sticky;left:0;background:white;z-index:1}.heatmap{width:max-content}.heatmap .missing{background:repeating-linear-gradient(45deg,#ddd,#ddd 3px,#fff 3px,#fff 6px)}button,select,a{touch-action:manipulation}button{padding:8px 12px;border:1px solid #bbb;border-radius:6px;background:white;color:#004e89;cursor:pointer}button[aria-pressed=true]{background:#004e89;color:white}a{color:#004e89}.source-list li{margin:10px 0}.metric{font-size:2rem;font-weight:700;color:#004e89}.metric-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(130px,1fr));gap:20px}h2{margin:20px 0 10px}h3{margin:12px 0}.footer{margin-top:30px;padding:25px 0}.skip-link{position:absolute;left:-10000px}.skip-link:focus{left:10px;top:10px;z-index:9999}.error{padding:20px;background:#fff1f2;color:#9f1239}.checklist{display:flex;gap:16px;flex-wrap:wrap}.checklist label{display:flex;gap:6px;align-items:center}small{display:block}.loading{padding:32px}.download-links{display:flex;gap:16px;flex-wrap:wrap;margin:10px 0}section{scroll-margin-top:20px}@media(max-width:600px){.container{padding:0 16px}.panel{padding:16px}.nav-logo .logo-text{font-size:1rem}.nav-links{gap:10px;font-size:.85rem}.hero{padding:30px 0}.chart-wrap{height:300px}.footer{font-size:.9rem}}

.nav-content{height:auto;min-height:70px}.footer a{color:#7dd3fc}.tier0{background:#fee2e2}

.nav-logo .logo-text{display:inline!important} .nav-logo{color:#004e89;text-decoration:none}
