/* Sky Viewer — astronomy teaching HUD */

:root {
    --bg: #02060f;
    --glass: rgba(8, 14, 26, 0.55);
    --glass-border: rgba(255, 255, 255, 0.08);
    --text: rgba(236, 242, 255, 0.92);
    --muted: rgba(170, 188, 214, 0.58);
    --accent: #5EA7FF;
    --select: #7CC8FF;
    --sun: #f0c14a;
    --font: "Inter", "Manrope", system-ui, sans-serif;
    --ease: 280ms cubic-bezier(0.22, 1, 0.36, 1);
    --hud-opacity: 1;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
    margin: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    -webkit-font-smoothing: antialiased;
}

html.embed-mode,
html.embed-mode body { background: transparent; }

/* Embed follows parent lab language — hide duplicate settings gear */
html.embed-mode .lab-settings,
html.embed-mode .lab-lang-selector { display: none !important; }

.sky-app, .sky-root {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 100dvh;
    background: #02060f;
}

html.embed-mode .sky-app,
html.embed-mode .sky-root { background: transparent; }

#sky-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    touch-action: none;
}

.sky-labels {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 2;
}

.sky-label {
    position: absolute;
    transform: translate(-50%, -130%);
    padding: 0.28rem 0.55rem;
    border-radius: 999px;
    background: rgba(6, 12, 22, 0.55);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
    font-size: 11px;
    letter-spacing: 0.04em;
    opacity: 0;
    transition: opacity var(--ease);
    white-space: nowrap;
}

.sky-label.is-visible { opacity: 1; }
.sky-label strong { font-weight: 600; margin-right: 0.3rem; }
.sky-label span { color: var(--muted); }
.sky-label--angle span { color: var(--sun); font-variant-numeric: tabular-nums; }

.hud {
    position: absolute;
    z-index: 5;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(18px) saturate(1.15);
    -webkit-backdrop-filter: blur(18px) saturate(1.15);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.35);
    opacity: var(--hud-opacity);
    transition: opacity 500ms ease, transform var(--ease);
}

.sky-root.is-idle .hud { --hud-opacity: 0.22; }
.sky-root.is-idle .hud--timeline { --hud-opacity: 0.16; }
.sky-root.is-idle .hud:hover,
.sky-root.is-idle .hud:focus-within { --hud-opacity: 1; }

.hud--toolbar {
    top: 20px;
    left: 20px;
    width: min(280px, calc(100vw - 40px));
    border-radius: 20px;
    padding: 0.9rem 0.95rem 0.8rem;
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}

.hud__brand {
    display: flex;
    gap: 0.65rem;
    align-items: center;
}

.hud__orb {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #fff, var(--accent) 50%, transparent 72%);
    box-shadow: 0 0 16px rgba(94, 167, 255, 0.55);
}

.hud__kicker {
    margin: 0;
    font-size: 10px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

.hud__title {
    margin: 0.1rem 0 0;
    font-size: 18px;
    font-weight: 650;
    letter-spacing: -0.02em;
}

.view-toggle {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.3rem;
    padding: 0.25rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
}

.view-toggle__btn {
    border: 0;
    border-radius: 9px;
    padding: 0.4rem 0.35rem;
    font: inherit;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--muted);
    background: transparent;
    cursor: pointer;
}

.view-toggle__btn.is-active {
    color: var(--text);
    background: rgba(94, 167, 255, 0.16);
    box-shadow: inset 0 0 0 1px rgba(94, 167, 255, 0.28);
}

.view-toggle__hint {
    margin: -0.25rem 0 0;
    font-size: 10px;
    line-height: 1.35;
    color: rgba(170, 188, 214, 0.45);
}

.hud__fields { display: grid; gap: 0.45rem; }

.hud__row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.4rem;
}

.hud__field {
    display: flex;
    flex-direction: column;
    gap: 0.22rem;
    font-size: 10px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
}

.hud__field input,
.hud__field select {
    appearance: none;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text);
    border-radius: 10px;
    padding: 0.4rem 0.55rem;
    font: inherit;
    font-size: 13px;
    letter-spacing: 0;
    text-transform: none;
    outline: none;
}

.hud__field input:focus,
.hud__field select:focus {
    border-color: rgba(124, 200, 255, 0.4);
    box-shadow: 0 0 0 3px rgba(94, 167, 255, 0.1);
}

.hud__field select option { background: #0a1220; }

.hud__error {
    margin: 0;
    min-height: 1em;
    font-size: 11px;
    color: #ff8f9a;
}

.hud__hint {
    margin: 0;
    font-size: 10px;
    color: rgba(170, 188, 214, 0.4);
}

/* Teach panel */
.hud--teach {
    top: 20px;
    right: 20px;
    width: min(280px, calc(100vw - 40px));
    border-radius: 18px;
    padding: 0.8rem 0.85rem 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    max-height: calc(100dvh - 140px);
    overflow: auto;
}

.teach__head {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    align-items: flex-start;
}

.teach__title {
    margin: 0.12rem 0 0;
    font-size: 16px;
    font-weight: 650;
}

.term-map {
    width: 100%;
    height: auto;
    border-radius: 10px;
    display: block;
    background: #061018;
    border: 1px solid var(--glass-border);
}

.teach__stats {
    margin: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.4rem 0.6rem;
}

.teach__stats dt {
    margin: 0;
    font-size: 9px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
}

.teach__stats dd {
    margin: 0.1rem 0 0;
    font-size: 13px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.compass-wrap { margin-top: 0.15rem; }

.ecl-compass {
    width: 100%;
    height: auto;
    display: block;
    margin-top: 0.3rem;
}

/* Info card */
.hud--info {
    right: 20px;
    bottom: 108px;
    width: min(250px, calc(100vw - 40px));
    border-radius: 18px;
    padding: 0.8rem 0.9rem;
}

.info__head {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.65rem;
}

.info__head h2 {
    margin: 0.15rem 0 0;
    font-size: 18px;
    font-weight: 650;
    letter-spacing: -0.02em;
}

.info__badge {
    align-self: flex-start;
    font-size: 10px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 0.25rem 0.45rem;
    border-radius: 999px;
    border: 1px solid rgba(94, 167, 255, 0.28);
    color: var(--select);
    background: rgba(94, 167, 255, 0.08);
    white-space: nowrap;
}

.info__metrics {
    margin: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem 0.7rem;
}

.info__metrics .info__wide { grid-column: 1 / -1; }

.info__metrics dt {
    margin: 0;
    font-size: 10px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
}

.info__metrics dd {
    margin: 0.15rem 0 0;
    font-size: 14px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.info__metrics dd.small {
    font-size: 11px;
    font-weight: 500;
    color: var(--muted);
}

/* Seasonal timeline */
.hud--timeline {
    left: 50%;
    bottom: 14px;
    transform: translateX(-50%);
    width: min(820px, calc(100vw - 28px));
    border-radius: 18px;
    padding: 0.5rem 0.65rem 0.55rem;
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 0.45rem;
    align-items: center;
}

.tl-btn {
    width: 34px;
    height: 34px;
    border-radius: 999px;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    cursor: pointer;
    font: inherit;
    font-size: 13px;
}

.tl-btn--ghost {
    width: auto;
    height: 26px;
    padding: 0 0.55rem;
    font-size: 11px;
    color: var(--muted);
}

.tl-btn:hover { background: rgba(255, 255, 255, 0.08); }

.tl-main { min-width: 0; }

.tl-seasons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    font-size: 10px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(170, 188, 214, 0.45);
    margin-bottom: 0.15rem;
    text-align: center;
}

.tl-terms {
    position: relative;
    height: 18px;
    margin-bottom: 0.1rem;
}

.tl-term {
    position: absolute;
    top: 0;
    transform: translateX(-50%);
    width: 2px;
    height: 8px;
    background: rgba(110, 214, 164, 0.45);
    border-radius: 1px;
}

.tl-term.is-major {
    height: 12px;
    background: rgba(110, 214, 164, 0.75);
}

.tl-term.is-current {
    height: 14px;
    width: 3px;
    background: var(--select);
    box-shadow: 0 0 8px rgba(124, 200, 255, 0.55);
}

.tl-term-label {
    position: absolute;
    top: 9px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 8px;
    color: var(--muted);
    white-space: nowrap;
    display: none;
}

.tl-term.is-current .tl-term-label,
.tl-term.is-major .tl-term-label { display: block; }

.tl-cursor {
    position: absolute;
    top: -2px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--sun);
    box-shadow: 0 0 10px rgba(240, 193, 74, 0.7);
    transform: translateX(-50%);
    z-index: 2;
    pointer-events: none;
}

.tl-scrub {
    width: 100%;
    accent-color: var(--accent);
    height: 4px;
    cursor: pointer;
}

.tl-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.5rem;
    margin-top: 0.3rem;
}

#tl-label {
    flex: 1;
    min-width: 140px;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    color: var(--muted);
}

.tl-today {
    border: 1px solid rgba(94, 167, 255, 0.3);
    background: rgba(94, 167, 255, 0.1);
    color: var(--select);
    border-radius: 999px;
    padding: 0.2rem 0.55rem;
    font: inherit;
    font-size: 11px;
    cursor: pointer;
}

@media (max-width: 960px) {
    .hud--teach {
        top: auto;
        bottom: 100px;
        right: 12px;
        width: min(240px, calc(50vw - 18px));
        max-height: 42vh;
    }
    .compass-wrap { display: none; }
    .hud--info {
        left: 12px;
        right: auto;
        bottom: 100px;
        width: min(220px, calc(50vw - 18px));
    }
}

@media (max-width: 640px) {
    .hud--toolbar {
        top: 10px;
        left: 10px;
        width: calc(100vw - 20px);
    }
    .hud--teach,
    .hud--info { display: none; }
    .hud--timeline {
        width: calc(100vw - 16px);
        bottom: 10px;
    }
    .tl-seasons { font-size: 9px; }
}
