/* NO GROUND — Sky Map app layout (sky.html only). Active when js/sky-app.js adds html.sky-app; without JS the page keeps
   the plain layout (map, then sections and footer). Phones: full-screen map, tab bar above the time slider, draggable
   bottom sheet (half / full). 900px and wider: the sheet is a right-side panel. */

/* ---- tab bar (in the time bar, above the slider) */
.sa-tabs { display: none; }
html.sky-app .sa-tabs { display: flex; gap: 5px; max-width: 720px; margin: 0 auto 8px; }
.sa-tab { flex: 1 1 0; min-width: 0; min-height: 46px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 5px 2px 4px;
  border-radius: 12px; border: 1px solid var(--sky-line); background: var(--sky-ui); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  color: var(--sky-fg); font: 700 .64rem/1.1 var(--body); letter-spacing: .01em; text-decoration: none; -webkit-tap-highlight-color: transparent; }
@media (min-width: 900px) { .sa-tab { flex-direction: row; gap: 7px; font-size: .76rem; min-height: 40px; } .sa-tab svg { width: 18px; height: 18px; } }
.sa-tab span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sa-tab svg { width: 20px; height: 20px; fill: currentColor; flex: none; }
.sa-tab:hover { color: var(--sky-fg); border-color: var(--sky-acc); }
.sa-tab.on { background: var(--sky-acc); border-color: var(--sky-acc); color: #1a1000; }
.sa-tab:focus-visible { outline: 2px solid var(--sky-acc); outline-offset: 2px; }
html.sky-night .sa-tab.on { color: #000; }

/* ---- page: no scrolling, the map fills the screen under a compact header */
html.sky-app { --header-h: 56px; --sa-pw: min(440px, 40vw); }
html.sky-app, html.sky-app body { height: 100%; overflow: hidden; overscroll-behavior: none; }
html.sky-app body { -webkit-text-size-adjust: 100%; }
html.sky-app .site-header { padding-top: env(safe-area-inset-top, 0px); }
html.sky-app .brand-tagline { display: none; }
html.sky-app .brand { font-size: 1.12rem; }
html.sky-app .sky-stage, html.sky-app .sky-stage:not(.is-full) {
  height: calc(100vh - var(--header-h) - 1px - env(safe-area-inset-top, 0px));   /* 1px = the header's bottom border */
  height: calc(100dvh - var(--header-h) - 1px - env(safe-area-inset-top, 0px));
  min-height: 0; max-height: none; border-bottom: 0; }
/* "full screen" in app mode just hides the header (the map is already full width) */
html.sky-app .sky-stage.is-full { position: relative; inset: auto; z-index: auto; height: 100vh; height: 100dvh; }
html.sky-app.sky-locked .site-header { display: none; }
html.sky-app .sky-top { padding-left: calc(12px + env(safe-area-inset-left, 0px)); padding-right: calc(12px + env(safe-area-inset-right, 0px)); }
html.sky-app .sky-time { padding: 8px calc(12px + env(safe-area-inset-right, 0px)) calc(10px + env(safe-area-inset-bottom, 0px)) calc(12px + env(safe-area-inset-left, 0px)); }

/* things that sat just above the time bar now sit above the tab bar */
html.sky-app .sky-card { bottom: calc(var(--sa-time-h, 150px) + 8px); max-height: min(46%, calc(100% - var(--sa-time-h, 150px) - 70px)); overscroll-behavior: contain; }
html.sky-app .iss-strip { bottom: calc(var(--sa-time-h, 150px) + 8px); }
html.sky-app .sky-realsky-credit { bottom: calc(var(--sa-time-h, 150px) + 46px); }
html.sky-app .sky-toast { bottom: calc(var(--sa-time-h, 150px) + 56px); }
html.sky-app .sky-point-ui { bottom: calc(var(--sa-time-h, 150px) + 14px); }
html.sky-app .sky-panel { overscroll-behavior: contain; }

/* ---- the sheet */
html.sky-app .sa-sheet { position: fixed; z-index: 40; left: 0; right: 0; bottom: var(--sa-time-h, 150px); height: 0; padding: 0;
  display: flex; flex-direction: column; overflow: hidden; visibility: hidden;
  background: rgba(9, 14, 30, .97); border: 1px solid var(--line-2); border-bottom: 0; border-radius: 20px 20px 0 0;
  box-shadow: 0 -12px 40px rgba(0, 0, 0, .45); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  transition: height .28s cubic-bezier(.2, .8, .2, 1), visibility 0s linear .28s; }
html.sky-app.sa-open .sa-sheet { visibility: visible; transition: height .28s cubic-bezier(.2, .8, .2, 1), visibility 0s; }
.sa-head { display: none; }
html.sky-app .sa-head { flex: none; position: relative; display: flex; align-items: center; gap: 8px; padding: 16px 12px 8px 16px; touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; }
.sa-grab { position: absolute; left: 50%; top: 6px; width: 42px; height: 5px; margin-left: -21px; border-radius: 3px; background: rgba(238, 241, 250, .3); }
.sa-title { flex: 1; min-width: 0; margin: 0; font-family: var(--display); font-weight: 800; font-size: 1.02rem; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sa-x, .sa-size { flex: none; width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line-2); background: var(--glass-2); color: #fff; font-size: 1.2rem; line-height: 1; padding: 0; cursor: pointer; }
.sa-size { font-size: 1rem; }
html.sky-app .sa-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; touch-action: pan-y; }
html.sky-app .sa-body > .container { padding: 0 14px 18px; }
html.sky-app .sky-below { padding: 0; }
html.sky-app .sa-pane { display: none; }
html.sky-app[data-sa-pane="tonight"] [data-pane="tonight"], html.sky-app[data-sa-pane="iss"] [data-pane="iss"], html.sky-app[data-sa-pane="moon"] [data-pane="moon"],
html.sky-app[data-sa-pane="events"] [data-pane="events"], html.sky-app[data-sa-pane="aurora"] [data-pane="aurora"], html.sky-app[data-sa-pane="live"] [data-pane="live"] { display: block; }
html.sky-app .sa-sheet .sp-sec { padding-top: 4px; }
html.sky-app .sa-sheet .sa-hl { padding-top: 22px; }
html.sky-app .sa-sheet .sky-how { margin-top: 26px; }
html.sky-app .sa-sheet .site-footer { margin-top: 28px; padding: 36px 0 22px; }
html.sky-app .sa-sheet .site-footer .container { padding: 0 16px; }
html.sky-app .sa-sheet .footer-top { grid-template-columns: repeat(2, 1fr); gap: 22px; }
html.sky-app .sa-sheet .footer-brand-block { grid-column: 1 / -1; }
html.sky-app .sa-sheet .footer-bottom a:first-child { margin-left: 0; }

/* phones + tablets: sheet open -> the map buttons line up in a row across the top, above the sheet */
@media (max-width: 899px) {
  html.sky-app .sky-card { right: 62px; }   /* keeps the button column free */
  html.sky-app.sa-open .sky-top { flex-direction: column-reverse; align-items: stretch; gap: 6px; padding-top: 8px; }
  html.sky-app.sa-open .sky-tools { flex-direction: row; justify-content: flex-end; gap: 6px; }
  html.sky-app.sa-open .sky-btn { width: 38px; height: 38px; }
  html.sky-app.sa-open .sky-btn svg { width: 19px; height: 19px; }
  html.sky-app.sa-open .sky-title, html.sky-app.sa-open .sky-place-note, html.sky-app.sa-open .iss-strip, html.sky-app.sa-open .sky-hint { display: none; }
  html.sky-app.sa-open .sky-panel { top: calc(52px + env(safe-area-inset-top, 0px)); right: 12px; width: min(360px, calc(100% - 24px)); }
  html.sky-app.sa-full .sky-where { visibility: hidden; }
}
@media (max-width: 380px) { html.sky-app.sa-open .sky-tools { gap: 4px; } html.sky-app.sa-open .sky-btn { width: 36px; height: 36px; } }

/* 900px and wider: a panel on the right, the map stays usable on the left */
html.sky-app.sa-wide .sa-sheet { top: var(--sa-top, 56px); bottom: 0; left: auto; right: 0; width: var(--sa-pw); height: auto !important; border-radius: 0; border: 0; border-left: 1px solid var(--line-2);
  transform: translateX(100%); transition: transform .28s cubic-bezier(.2, .8, .2, 1), visibility 0s linear .28s; box-shadow: -12px 0 40px rgba(0, 0, 0, .4); }
html.sky-app.sa-wide.sa-open .sa-sheet { transform: none; transition: transform .28s cubic-bezier(.2, .8, .2, 1), visibility 0s; }
html.sky-app.sa-wide .sa-head { cursor: default; touch-action: auto; padding-top: 14px; }
html.sky-app.sa-wide .sa-grab, html.sky-app.sa-wide .sa-size { display: none; }
html.sky-app.sa-wide.sa-open .sky-top, html.sky-app.sa-wide.sa-open .sky-time { right: var(--sa-pw); }
html.sky-app.sa-wide.sa-open .sky-panel { right: calc(var(--sa-pw) + 74px); }
html.sky-app.sa-wide.sa-open .sky-banner { left: calc((100% - var(--sa-pw)) / 2); max-width: calc(100% - var(--sa-pw) - 480px); }
html.sky-app.sa-wide.sa-open .sky-hint { left: calc((100% - var(--sa-pw)) / 2); }
html.sky-app.sa-wide .sa-sheet .sp-grid, html.sky-app.sa-wide .sa-sheet .best3, html.sky-app.sa-wide .sa-sheet .cal, html.sky-app.sa-wide .sa-sheet #moon-root { grid-template-columns: 1fr; }
html.sky-app.sa-wide .sa-sheet .sky-highlights { grid-template-columns: 1fr; }
html.sky-app.sa-wide .sa-sheet .sky-how { grid-template-columns: 1fr; }

/* ---- Live tab: click-to-load players */
.sa-vids { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
html.sky-app .sa-sheet .sa-vids { grid-template-columns: 1fr; }
.sa-vid { margin: 0 0 0; padding: 10px; }
.sa-poster { position: relative; display: block; width: 100%; aspect-ratio: 16 / 9; padding: 0; border: 0; border-radius: 12px; overflow: hidden; cursor: pointer; color: #fff;
  background: radial-gradient(120% 90% at 80% 10%, rgba(99, 211, 255, .25), transparent 60%), radial-gradient(90% 90% at 10% 100%, rgba(255, 154, 46, .28), transparent 60%), #0a1024; }
.sa-poster img { display: block; width: 100%; height: 100%; object-fit: cover; opacity: .82; }
.sa-poster-plain::before { content: ""; position: absolute; inset: 0; background-image: radial-gradient(circle at 20% 30%, #fff 1px, transparent 1.5px), radial-gradient(circle at 70% 20%, #fff 1px, transparent 1.5px), radial-gradient(circle at 85% 65%, #fff 1.2px, transparent 1.7px), radial-gradient(circle at 40% 70%, #fff .8px, transparent 1.3px), radial-gradient(circle at 60% 45%, #fff .8px, transparent 1.3px); opacity: .55; }
.sa-play { position: absolute; left: 50%; top: 50%; width: 62px; height: 62px; margin: -31px 0 0 -31px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 26px rgba(255, 154, 46, .6); transition: transform .2s; }
.sa-play::after { content: ""; position: absolute; left: 25px; top: 19px; border: 12px solid transparent; border-left: 18px solid #1a1000; border-right: 0; }
.sa-poster:hover .sa-play, .sa-poster:focus-visible .sa-play { transform: scale(1.08); }
.sa-live-tag { position: absolute; left: 10px; top: 10px; padding: 3px 7px; border-radius: 6px; background: #E5322D; color: #fff; font: 800 .62rem/1.2 var(--body); letter-spacing: .08em; }
.sa-poster-txt { position: absolute; left: 14px; bottom: 12px; right: 14px; text-align: left; font-family: var(--display); font-weight: 800; font-size: 1.15rem; line-height: 1.15; }
.sa-poster-txt small { display: block; margin-top: 3px; font-family: var(--body); font-weight: 600; font-size: .74rem; color: var(--muted); }
.sa-frame { position: relative; width: 100%; aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden; background: #000; }
.sa-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.sa-vid figcaption { padding: 10px 2px 2px; }
.sa-vid figcaption b { display: block; color: #fff; font-size: .95rem; }
.sa-vid figcaption span { display: block; margin-top: 3px; font-size: .8rem; line-height: 1.45; color: var(--text); }
.sa-vid figcaption small { display: block; margin-top: 6px; font-size: .68rem; color: var(--dim); }
.sa-vid figcaption a { color: var(--muted); text-decoration: underline; text-underline-offset: 2px; }
.ln-cd .sa-watch { min-height: 28px; padding: 3px 10px; font-size: .72rem; }

/* red night mode */
html.sky-night.sky-app .sa-sheet { background: rgba(8, 0, 0, .97); border-color: rgba(255, 60, 40, .3); }
html.sky-night .sa-play { background: #ff3b2a; box-shadow: none; }

@media (prefers-reduced-motion: reduce) { html.sky-app .sa-sheet { transition: none !important; } }
.sa-slot { margin: 0 0 10px; }
.sa-slot-cap { margin: 6px 2px 0; font-size: .78rem; color: var(--muted); }
.sa-live-list .sa-watch { margin-top: 6px; }
.evlist .sa-watch { margin-top: 6px; min-height: 28px; padding: 3px 10px; font-size: .72rem; }
