/* Typhoon visualization — adaptive scroll layout (uses theme.css variables) */

html, body {
    height: auto;
    min-height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
}

body {
    padding: 12px;
    line-height: 1.5;
}

.page {
    width: 100%;
    max-width: 1440px;
    margin: 0 auto;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    overflow: visible;
}

.page-header {
    padding: 10px 16px 12px;
    border-bottom: 1px solid var(--line);
    flex-shrink: 0;
}

.page-header .back-link {
    margin-bottom: 0;
}

.page-header-top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 6px;
}

.hero-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.status-line { min-height: 1.2em; }

.page-header h1 {
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--text);
    display: inline;
    margin-right: 12px;
}

.meta-line {
    color: var(--muted);
    font-size: 0.85em;
}

.header-title-row {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px 10px;
}

.header-title-row .domain-badge {
    margin-bottom: 0;
}

.page-body {
    display: grid;
    grid-template-columns: 3fr 7fr;
    align-items: start;
    min-height: 0;
    overflow: visible;
}

.sidebar {
    width: 100%;
    min-width: 0;
    min-height: 0;
    box-sizing: border-box;
    border-right: 1px solid var(--line);
    background: var(--surface-alt);
    overflow-x: hidden;
    overflow-y: auto;
    padding: 14px;
    /* Height is locked to the square map (see syncSidebarToMapHeight). */
}

.sidebar h2 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 10px;
}

.storm-list { display: grid; gap: 8px; }

.storm-chip {
    display: grid;
    gap: 3px;
    width: 100%;
    text-align: left;
    padding: 10px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: var(--surface);
    cursor: pointer;
}

.storm-chip strong { color: var(--text); font-size: 0.92rem; }
.storm-chip span { color: var(--muted); font-size: 0.78rem; }

.storm-chip.active {
    border-color: var(--accent);
    background: var(--accent-soft);
    box-shadow: inset 0 0 0 1px var(--chip-border);
}

.intensity-legend {
    display: grid;
    gap: 5px;
    margin: 12px 0;
    padding: 10px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.intensity-legend h3 {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--muted);
}

.legend-row {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.74rem;
    color: var(--muted);
}

.legend-swatch {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    flex-shrink: 0;
}

.storm-detail {
    margin-top: 12px;
    padding: 12px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 10px;
}

.storm-detail h3 {
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 10px;
    font-size: 0.78rem;
}

.detail-grid dt { color: var(--muted); }
.detail-grid dd { color: var(--text); font-weight: 500; margin: 0; }

.category-badge {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    color: #fff;
}

.bulletin-slider { margin-top: 10px; }
.bulletin-slider label { display: block; font-size: 0.76rem; color: var(--muted); margin-bottom: 4px; }
.bulletin-slider input[type="range"] { width: 100%; accent-color: var(--brand); }
.bulletin-time { font-size: 0.74rem; color: var(--muted); margin-top: 3px; }

.wind-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.74rem;
    margin-top: 8px;
}

.wind-table th,
.wind-table td {
    border: 1px solid var(--line);
    padding: 4px 3px;
    text-align: center;
}

.wind-table th {
    background: var(--surface-alt);
    color: var(--muted);
    font-weight: 500;
}

.wind-table .level-30 { color: #ca8a04; }
.wind-table .level-50 { color: #ea580c; }
.wind-table .level-64 { color: #dc2626; }

#cyclone-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

#cyclone-table th,
#cyclone-table td {
    border-bottom: 1px solid var(--line);
    padding: 6px 4px;
    text-align: left;
}

#cyclone-table th { color: var(--muted); font-weight: 500; }

#cyclone-table .cyclone-row.clickable {
    cursor: pointer;
    transition: background 0.12s;
}

#cyclone-table .cyclone-row.clickable:hover {
    background: var(--brand-soft);
}

#cyclone-table .cyclone-row.active {
    background: var(--accent-soft);
    box-shadow: inset 3px 0 0 var(--brand);
}

#cyclone-table .cyclone-row.disabled {
    color: var(--muted);
    cursor: not-allowed;
    opacity: 0.7;
}

#cyclone-table .cyclone-row.disabled td { color: var(--muted); }

#cyclone-table .no-track {
    font-size: 0.72rem;
    color: var(--line);
}

#cyclone-table .archive-tag {
    display: inline-block;
    margin-left: 4px;
    padding: 0 5px;
    border-radius: 4px;
    font-size: 0.68rem;
    background: var(--accent-soft);
    color: var(--accent);
}

.data-note {
    margin-top: 8px;
    font-size: 0.74rem;
    color: var(--muted);
}

.data-note a { color: var(--brand); }

.data-note code {
    padding: 1px 5px;
    border-radius: 4px;
    background: var(--surface-alt);
    color: var(--text);
}

/* Map fills the 7fr column; height = width (1:1). Page scrolls if needed. */
.map-area {
    position: relative;
    width: 100%;
    max-width: none;
    aspect-ratio: 1 / 1;
    height: auto;
    overflow: hidden;
    background: linear-gradient(180deg, #0c1929 0%, #0f2137 100%);
}

#chart-typhoon-track {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.page .site-footer {
    flex-shrink: 0;
    padding: 12px 18px;
    margin-top: 0;
    font-size: 0.76rem;
    border-top: 1px solid var(--line);
}

@media (max-width: 900px) {
    body { padding: 8px; }

    .page-body {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto;
        align-items: stretch;
    }

    .map-area {
        grid-row: 1;
        width: 100%;
        aspect-ratio: 1 / 1;
        height: auto;
    }

    .sidebar {
        grid-row: 2;
        height: auto !important;
        max-height: none !important;
        overflow: visible;
        border-right: none;
        border-top: 1px solid var(--line);
    }
}
