/* Near-Earth Objects — Stylesheet */
/* Design language: matches interactive-globe / moving-continents */

:root {
    --bg-primary: #424658;
    --font-color: #E0CDB2;
    --accent-blue: #51a3d6;
    --accent-orange: #ea752c;
    --space-bg: #0a0e1a;
    --earth-blue: #4a90d9;
    --moon-gray: #b0b0b0;
    --threat-green: #44dd66;
    --threat-yellow: #ddcc22;
    --threat-orange: #ee8822;
    --threat-red: #ee3333;
    --ring-color: rgba(255, 255, 255, 0.15);
    --trail-color: rgba(255, 255, 255, 0.3);
    --font-sans: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-primary);
    color: var(--font-color);
    padding: 20px;
}

.container {
    max-width: 1008px;
    margin: 0 auto;
}

/* ── Header ────────────────────────────────────────────────────── */

.title-row {
    display: flex;
    margin-bottom: 12px;
}

.title-content {
    flex: 1;
    text-align: center;
}

h1 {
    font-size: 1.35rem;
    margin: 0 0 5px 0;
    color: var(--font-color);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    position: relative;
    padding-left: 20px;
}

h1 .home-button {
    position: absolute;
    left: 0;
}

h1 .title-text {
    margin-left: 0;
}

.home-button {
    flex-shrink: 0;
    line-height: 0;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.home-button img {
    width: 50px;
    height: 48px;
    display: block;
}

h2 {
    font-size: 0.85rem;
    font-weight: bold;
    margin: 0;
    color: var(--font-color);
}

h2 a {
    color: var(--font-color);
    text-decoration: none;
}

h2 a:hover {
    color: #4a9eff;
    text-decoration: underline;
}

/* ── Size Filter Buttons ───────────────────────────────────────── */

.size-filters {
    margin-bottom: 12px;
    text-align: center;
}

.filter-label {
    display: block;
    font-size: 0.82rem;
    color: #a09880;
    margin-bottom: 6px;
}

.filter-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    justify-content: center;
}

.filter-btn {
    background: none;
    border: 1px solid #a09880;
    color: #a09880;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.75rem;
    font-family: var(--font-sans);
    transition: all 0.2s;
    user-select: none;
    touch-action: manipulation;
}

.filter-btn:hover {
    border-color: var(--font-color);
    color: var(--font-color);
}

.filter-btn.active {
    background-color: var(--font-color);
    color: var(--bg-primary);
    border-color: var(--font-color);
}

.filter-btn[data-size="all"] {
    font-weight: 600;
}

/* ── Click Hint ────────────────────────────────────────────────── */

.click-hint {
    text-align: center;
    padding: 6px 12px;
    font-size: 0.85rem;
    color: var(--font-color);
    font-weight: 600;
}

/* ── Scene Wrapper (timeline + projection) ─────────────────────── */

.scene-wrapper {
    margin-bottom: 12px;
}

/* ── Timeline Controls ─────────────────────────────────────────── */

.timeline-controls {
    background-color: rgba(0, 0, 0, 0.2);
    padding: 10px 18px;
    border-radius: 8px 8px 0 0;
}

.controls-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}

.play-btns {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.play-btn {
    background-color: var(--font-color);
    color: var(--bg-primary);
    border: none;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background-color 0.2s, transform 0.1s;
    line-height: 1;
    padding: 0;
    text-indent: 0;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    -webkit-user-select: none;
    user-select: none;
}

.play-btn:hover {
    background-color: #fff;
    transform: scale(1.05);
}

.play-btn:active {
    transform: scale(0.95);
}

.play-btn.playing {
    background-color: #ee8822;
    color: #fff;
}

.play-btn svg {
    display: block;
}

.slider-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.slider-wrapper {
    position: relative;
    width: 100%;
    height: 22px;
    display: flex;
    align-items: center;
}

.time-slider {
    width: 100%;
    height: 8px;
    -webkit-appearance: none;
    appearance: none;
    background: linear-gradient(to right, #1a3a6a, #2a5a9a, #3a7aca, #4a9ada, #5abaff);
    border-radius: 4px;
    outline: none;
    cursor: pointer;
    margin: 0;
}

.time-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
    border: none;
    box-shadow: none;
}

.time-slider::-moz-range-thumb {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
    border: none;
    box-shadow: none;
}

.slider-thumb-label {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    height: 22px;
    padding: 0 10px;
    background: var(--font-color);
    color: var(--bg-primary);
    font-size: 0.7rem;
    font-weight: 700;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    pointer-events: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    border: 3px solid var(--bg-primary);
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: #a09880;
}

.time-display {
    text-align: center;
    flex-shrink: 0;
    min-width: 140px;
}

.time-value {
    font-size: 1.15rem;
    font-weight: bold;
    color: var(--font-color);
    line-height: 1.2;
}

.time-label {
    font-size: 0.8rem;
    color: #a09880;
}

.controls-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 5px;
}

.speed-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}

.speed-btn {
    background: none;
    border: 1px solid #a09880;
    color: #a09880;
    padding: 3px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.75rem;
    font-family: var(--font-sans);
    transition: all 0.2s;
    touch-action: manipulation;
}

.speed-btn:hover,
.speed-btn.active {
    background-color: var(--font-color);
    color: var(--bg-primary);
    border-color: var(--font-color);
}

.speed-label {
    font-size: 0.75rem;
    color: #a09880;
}

.object-counter {
    font-size: 0.78rem;
    color: #a09880;
    text-align: right;
}

/* ── Scene Container (2D projection) ───────────────────────────── */

.scene-container {
    width: 100%;
    aspect-ratio: 2.08 / 1;
    background-color: var(--space-bg);
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    position: relative;
}

.scene-container svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* Loading overlay */

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--space-bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: 0 0 8px 8px;
}

.loading-text {
    color: var(--font-color);
    font-size: 1.1rem;
    margin-bottom: 15px;
}

.loading-bar {
    width: 200px;
    height: 6px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
}

.loading-bar-fill {
    height: 100%;
    background-color: var(--font-color);
    border-radius: 3px;
    width: 0%;
    transition: width 0.3s;
}

/* ── Info Panel ────────────────────────────────────────────────── */

.info-panel {
    background-color: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(224, 205, 178, 0.3);
    border-radius: 8px;
    padding: 15px 20px;
    margin-bottom: 12px;
    position: relative;
    transition: opacity 0.3s, transform 0.3s;
}

.info-panel.hidden {
    display: none;
}

.info-close {
    position: absolute;
    top: 8px;
    right: 12px;
    background: none;
    border: none;
    color: var(--font-color);
    font-size: 1.4rem;
    cursor: pointer;
    line-height: 1;
    opacity: 0.7;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.info-close:hover {
    opacity: 1;
}

.copyright-link,
.api-link {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.info-panel h3 {
    font-size: 1.05rem;
    margin-bottom: 10px;
    color: var(--font-color);
    padding-right: 25px;
}

.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 20px;
    font-size: 0.85rem;
}

.info-item {
    display: flex;
    gap: 6px;
}

.info-label {
    color: #a09880;
    white-space: nowrap;
}

/* ── Top 3 Closest Encounters ──────────────────────────────────── */

.top3-section {
    margin-top: 8px;
}

.top3-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.top3-toggle-btn {
    background-color: rgba(74, 158, 255, 0.15);
    border: 1px solid rgba(74, 158, 255, 0.4);
    color: #4a9eff;
    padding: 6px 8px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
    font-family: inherit;
    touch-action: manipulation;
}

.top3-toggle-btn:hover {
    background-color: rgba(74, 158, 255, 0.25);
    border-color: rgba(74, 158, 255, 0.6);
}

.top3-label {
    color: var(--font-color);
    font-size: 0.88rem;
}

.top3-content {
    margin-top: 10px;
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    padding: 16px 20px;
    font-size: 0.82rem;
    line-height: 1.6;
    color: var(--font-color);
}

.top3-content.hidden {
    display: none;
}

.top3-category {
    margin-bottom: 18px;
}

.top3-category:last-child {
    margin-bottom: 0;
}

.top3-category h4 {
    font-size: 0.9rem;
    margin-bottom: 8px;
    color: var(--font-color);
}

.top3-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 6px;
    font-size: 0.78rem;
}

.top3-table th {
    text-align: left;
    padding: 5px 10px;
    border-bottom: 1px solid rgba(224, 205, 178, 0.3);
    color: #a09880;
    font-weight: 600;
}

.top3-table td {
    padding: 4px 10px;
    border-bottom: 1px solid rgba(224, 205, 178, 0.08);
    vertical-align: top;
}

.top3-table td:first-child {
    color: #a09880;
    width: 24px;
}

.top3-note {
    font-size: 0.76rem;
    color: #a09880;
    font-style: italic;
    margin-top: 4px;
}

/* ── Footer / Disclaimer ──────────────────────────────────────── */

.disclaimer {
    background-color: rgba(0, 0, 0, 0.2);
    padding: 20px;
    border-radius: 8px;
    margin-top: 48px;
    font-size: 0.82rem;
    line-height: 1.6;
    color: var(--font-color);
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.disclaimer a {
    color: #87CEEB;
    text-decoration: none;
}

.disclaimer a:hover {
    text-decoration: underline;
}

.disclaimer-title {
    font-size: 1rem;
    margin-bottom: 12px;
    color: var(--font-color);
}

.disclaimer-subtitle {
    font-size: 0.9rem;
    margin: 16px 0 10px 0;
    color: var(--font-color);
}

/* Threat tables */

.threat-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 8px;
    font-size: 0.78rem;
}

.threat-table th {
    text-align: left;
    padding: 6px 10px;
    border-bottom: 1px solid rgba(224, 205, 178, 0.3);
    color: #a09880;
    font-weight: 600;
}

.threat-table td {
    padding: 6px 10px;
    border-bottom: 1px solid rgba(224, 205, 178, 0.1);
    vertical-align: top;
}

.threat-table td:first-child {
    white-space: nowrap;
    font-weight: 600;
    min-width: 55px;
}

.threat-city { color: var(--font-color); }
.threat-metro { color: var(--font-color); }
.threat-regional { color: var(--font-color); }
.threat-continental { color: var(--font-color); }
.threat-subglobal { color: var(--font-color); font-weight: 600; }
.threat-global { color: var(--font-color); font-weight: 600; }

.context-notes {
    margin: 14px 0;
    padding: 10px 15px;
    background-color: rgba(255, 255, 255, 0.03);
    border-radius: 6px;
    border-left: 3px solid var(--accent-blue);
}

.context-notes p {
    margin-bottom: 6px;
}

.context-notes ul {
    padding-left: 18px;
}

.context-notes li {
    margin-bottom: 3px;
}

.data-source {
    margin-top: 12px;
    font-size: 0.76rem;
    color: #a09880;
}

/* ── Responsive: Tablet ────────────────────────────────────────── */

@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    h1 {
        font-size: 1.4rem;
        gap: 8px;
        padding-left: 20px;
    }

    h2 {
        font-size: 0.9rem;
    }

    .home-button img {
        width: 50px;
        height: 48px;
    }

    .controls-row {
        flex-wrap: wrap;
        gap: 10px;
    }

    .time-display {
        min-width: auto;
        order: -1;
        width: 100%;
    }

    .time-value {
        font-size: 1.3rem;
    }

    .timeline-controls {
        padding: 5px 10px;
    }

    .controls-bottom {
        flex-direction: column;
        gap: 6px;
    }

    .object-counter {
        text-align: center;
    }

    .info-grid {
        grid-template-columns: 1fr;
    }

    .disclaimer {
        font-size: 0.8rem;
        padding: 15px;
    }

    .top3-table {
        font-size: 0.74rem;
    }

    .top3-table th,
    .top3-table td {
        padding: 4px 6px;
    }
}

/* ── Responsive: Mobile ────────────────────────────────────────── */

@media (max-width: 480px) {
    .home-button img {
        width: 45px;
        height: 43px;
    }

    h1 {
        font-size: 1.2rem;
    }

    h2 {
        font-size: 0.8rem;
    }

    .filter-btn {
        padding: 3px 7px;
        font-size: 0.7rem;
    }

    .play-btn {
        width: 36px;
        height: 36px;
        font-size: 0.85rem;
    }

    .time-value {
        font-size: 1.1rem;
    }

    .timeline-controls {
        padding: 5px;
    }

    .speed-controls {
        flex-wrap: wrap;
    }

    .threat-table {
        font-size: 0.72rem;
    }

    .threat-table td:first-child {
        min-width: 45px;
    }

    .top3-header {
        flex-wrap: wrap;
        gap: 8px;
    }

    .top3-toggle-btn {
        font-size: 0.78rem;
        padding: 5px 6px;
    }

    .top3-label {
        font-size: 0.8rem;
    }

    .top3-content {
        padding: 12px;
    }

    .top3-table {
        font-size: 0.7rem;
    }

    .top3-table th,
    .top3-table td {
        padding: 3px 5px;
    }
}

/* ── Responsive: Small mobile ──────────────────────────────────── */

@media (max-width: 360px) {
    body {
        padding: 5px;
    }

    h1 {
        font-size: 1rem;
    }

    h2 {
        font-size: 0.7rem;
    }

    .home-button img {
        width: 45px;
        height: 43px;
    }

    .filter-btn {
        padding: 2px 5px;
        font-size: 0.65rem;
    }

    .filter-label {
        font-size: 0.75rem;
    }

    .speed-btn {
        padding: 2px 7px;
        font-size: 0.7rem;
    }
}
