/* Sun, Moon & Year · the Sky tab (sky.js)

   The sky fills everything between the bar and the tabs, or the whole screen in full screen. Its controls float on it
   as dark glass with light text in every theme, since the sky behind them is always night (or daylight blue), and
   they are kept small: the clock at the top left, a column of buttons down the right edge, and below, the card for
   what's chosen over a two-row time panel (one row on a wide screen). The glass takes the theme's own deep colour; in
   the Day theme it is a plain night blue. */

.atlas-stage {
  --atlas-ink: #ece6d6; --atlas-dim: rgb(236 230 214 / 0.68); --atlas-gold: #ecca80; --atlas-hair: rgb(236 230 214 / 0.16);
  --atlas-glass: rgb(var(--shade) / 0.66);
  position: fixed; z-index: 1; left: 0; right: 0;
  top: var(--top-h, 56px); bottom: var(--nav-height);
  overflow: hidden; color: var(--atlas-ink); background: #070a12;
}
:root[data-theme="light"] .atlas-stage { --atlas-glass: rgb(10 14 26 / 0.7); }
@media (prefers-color-scheme: light) { :root:not([data-theme]) .atlas-stage { --atlas-glass: rgb(10 14 26 / 0.7); } }
:root[data-dial="sky"] .top { z-index: 5; }
/* the time controls sit where the app's toast usually rises, so on the sky it comes down from the top instead, under
   the clock and clear of the column of buttons */
:root[data-dial="sky"] .toast { top: calc(var(--top-h, 56px) + 76px); bottom: auto; max-width: min(calc(100vw - 128px), 420px); }
:root[data-dial="sky"], :root[data-dial="sky"] body { overflow: hidden; overscroll-behavior: none; }

/* ───── Full screen ─────
   The sky covers the bar and the tabs (and, where the browser allows, its own bars too: sky.js asks). Its controls keep
   clear of the notch and the home indicator. The eye button hides them all (.is-bare: the clock, the buttons, the card
   and the time), and a tap anywhere brings them back. */
:root.atlas-full .atlas-stage { top: 0; bottom: 0; z-index: 42; }
:root.atlas-full .top, :root.atlas-full .tabs { visibility: hidden; }
:root.atlas-full .atlas-hud, :root.atlas-full .atlas-sheet { margin-top: env(safe-area-inset-top, 0px); }
:root.atlas-full .atlas-dock { bottom: calc(8px + env(safe-area-inset-bottom, 0px)); }
:root.atlas-full .atlas-stage::before { height: calc(76px + env(safe-area-inset-top, 0px)); }
:root.atlas-full[data-dial="sky"] .toast { top: calc(76px + env(safe-area-inset-top, 0px)); }
.atlas-full-btn .atlas-full-out, .atlas-full-btn[aria-pressed="true"] .atlas-full-in { display: none; }
.atlas-full-btn[aria-pressed="true"] .atlas-full-out { display: inline; }
.atlas-hud, .atlas-dock, .atlas-stage::before { transition: opacity 0.3s, visibility 0s; }
.atlas-stage.is-bare :is(.atlas-hud, .atlas-dock), .atlas-stage.is-bare::before {
  opacity: 0; visibility: hidden; pointer-events: none; transition: opacity 0.3s, visibility 0s 0.3s;
}
@media (prefers-reduced-motion: reduce) { .atlas-hud, .atlas-dock, .atlas-stage::before, .atlas-stage.is-bare :is(.atlas-hud, .atlas-dock), .atlas-stage.is-bare::before { transition: none; } }

#skyCanvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; -webkit-touch-callout: none; user-select: none; }
#skyCanvas.grabbing { cursor: grabbing; }
#skyCanvas:focus-visible { outline: 2px solid var(--atlas-gold); outline-offset: -4px; }

.atlas-stage button, .atlas-stage input { font-family: var(--font-ui); }
.atlas-stage .icon-btn { color: var(--atlas-ink); border-color: var(--atlas-hair); background: var(--atlas-glass); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.atlas-stage .icon-btn[aria-expanded="true"] { color: var(--atlas-gold); border-color: var(--atlas-gold); }
.atlas-glyph { font-family: "Segoe UI Symbol", "Apple Symbols", "Noto Sans Symbols 2", "Noto Sans Symbols", serif; color: var(--atlas-gold); margin-right: 0.3em; }

/* ───── Above: when, where, which way; the buttons down the right edge ───── */
.atlas-hud {
  position: absolute; top: 8px; left: max(12px, env(safe-area-inset-left, 0px)); right: max(10px, env(safe-area-inset-right, 0px));
  display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; pointer-events: none;
}
.atlas-clock { min-width: 0; padding-top: 2px; text-shadow: 0 1px 3px rgb(0 0 0 / 0.85), 0 0 12px rgb(0 0 0 / 0.5); }
/* a little shade at the top, so the clock reads over any star names behind it */
.atlas-stage::before {
  content: ""; position: absolute; z-index: 0; inset: 0 0 auto 0; height: 76px; pointer-events: none;
  background: linear-gradient(rgb(0 0 0 / 0.42), rgb(0 0 0 / 0));
}
.atlas-hud, .atlas-dock { z-index: 1; }
.atlas-clock p { margin: 0; line-height: 1.3; }
#skyWhen { font-size: 0.92rem; font-weight: 600; letter-spacing: 0.02em; }
#skyWhere, #skyLook { font-size: 0.72rem; color: var(--atlas-dim); }
/* a column: it takes a thin strip of the edge rather than rows across the top */
.atlas-tools { display: flex; flex-direction: column; gap: 7px; pointer-events: auto; }
.atlas-stage .atlas-tools .icon-btn { width: 40px; height: 40px; }
.atlas-tools .icon-btn svg { width: 18px; height: 18px; }

/* ───── The camera behind the sky ───── */
.atlas-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #000; pointer-events: none; }
.atlas-stage.is-camera .atlas-time { display: none; }   /* the camera's sky is always now */
.atlas-camhint {
  display: flex; align-items: center; gap: 10px; padding: 6px 6px 6px 12px;
  border: 1px solid var(--atlas-hair); border-radius: 16px; background: var(--atlas-glass);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
}
.atlas-camhint p { flex: 1; margin: 0; font-size: 0.74rem; line-height: 1.35; color: var(--atlas-dim); }
.atlas-camhint button { flex: none; min-height: 34px; padding: 4px 14px; border: 1px solid var(--atlas-gold); border-radius: 999px; background: none; color: var(--atlas-gold); font-size: 0.8rem; font-weight: 600; cursor: pointer; }
/* once the stars have been lined up, the how-to steps aside (it is in Help) and only Reset stays, at the side */
.atlas-camhint.is-tuned { align-self: flex-end; padding: 0; border: 0; background: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
.atlas-camhint.is-tuned p { display: none; }
.atlas-camhint.is-tuned button { background: var(--atlas-glass); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
/* lining up (sky.js): what to do, with Set (or Done) beside it */
.atlas-align {
  display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 12px;
  border: 1px solid var(--atlas-gold); border-radius: 16px; background: var(--atlas-glass);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
}
.atlas-align p { flex: 1; margin: 0; font-size: 0.8rem; line-height: 1.35; color: var(--atlas-ink); }
.atlas-align button { flex: none; min-height: 38px; padding: 4px 14px; border: 1px solid var(--atlas-gold); border-radius: 999px; background: var(--atlas-gold); color: #14100a; font-size: 0.82rem; font-weight: 600; cursor: pointer; }
.atlas-align .atlas-align-stop { background: none; color: var(--atlas-gold); border-color: var(--atlas-hair); }
.atlas-align button:focus-visible { outline: 2px solid var(--atlas-ink); outline-offset: 2px; }
#skyCardAlign { min-height: 34px; padding: 3px 12px; border: 1px solid var(--atlas-gold); border-radius: 999px; color: var(--atlas-gold); background: none; font-size: 0.78rem; font-weight: 600; cursor: pointer; }
/* a short screen (a phone on its side): the buttons go back to a row across the top, full screen at the corner,
   and the sheets open below them */
@media (max-height: 520px) {
  .atlas-tools { flex-direction: row-reverse; }
  .atlas-stage .atlas-sheet { top: 56px; right: max(12px, env(safe-area-inset-right, 0px)); width: min(340px, calc(100% - 24px)); max-height: calc(100% - 64px); }
}
/* turned on its side, the card keeps to the left above the time, so the sky beside it stays open */
@media (max-height: 520px) and (min-width: 600px) {
  .atlas-card { align-self: flex-start; width: min(400px, 100%); max-height: 46vh; max-height: 46dvh; }
}

/* ───── Pointing at the sky, and the figure-8 card ───── */
.atlas-stage .atlas-point[aria-pressed="true"] { color: var(--atlas-gold); border-color: var(--atlas-gold); box-shadow: 0 0 0 3px rgb(236 202 128 / 0.18); }
.atlas-stage .atlas-point[aria-busy="true"] { opacity: 0.6; }
.atlas-calibrate svg { stroke-width: 1.9; }
.atlas-coach {
  position: absolute; z-index: 4; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(320px, calc(100% - 32px)); display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 14px; align-items: center;
  padding: 16px 18px; border: 1px solid var(--atlas-hair); border-radius: 20px;
  background: rgb(var(--shade) / 0.94); box-shadow: 0 30px 70px -26px rgb(0 0 0 / 0.95);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
}
:root[data-theme="light"] .atlas-coach { background: rgb(12 16 28 / 0.95); }
@media (prefers-color-scheme: light) { :root:not([data-theme]) .atlas-coach { background: rgb(12 16 28 / 0.95); } }
.atlas-coach h3 { margin: 0 0 4px; font: 600 0.98rem var(--font-display); letter-spacing: 0.04em; color: var(--atlas-ink); }
.atlas-coach p { margin: 0 0 10px; font-size: 0.82rem; line-height: 1.45; color: var(--atlas-dim); }
.atlas-coach button { min-height: 38px; padding: 4px 16px; border: 1px solid var(--atlas-gold); border-radius: 999px; background: none; color: var(--atlas-gold); font-size: 0.84rem; font-weight: 600; cursor: pointer; }
.atlas-coach-art { width: 76px; height: 114px; overflow: visible; }
.atlas-coach-path { fill: none; stroke: var(--atlas-gold); stroke-width: 1.4; stroke-dasharray: 2 4; stroke-linecap: round; opacity: 0.75; }
.atlas-coach-phone rect { fill: rgb(var(--shade)); stroke: var(--atlas-ink); stroke-width: 1.5; }
.atlas-coach-phone path { stroke: var(--atlas-ink); stroke-width: 1.2; stroke-linecap: round; }
/* still: the phone rests where the loops cross */
@media (prefers-reduced-motion: reduce) { .atlas-coach-phone { transform: translate(30px, 45px); } }

/* ───── The sheets ─────
   beside the column of buttons, so the one that opened it stays in sight (and in reach to close it) */
.atlas-sheet {
  position: absolute; z-index: 3; top: 8px; right: calc(max(10px, env(safe-area-inset-right, 0px)) + 48px);
  width: min(340px, calc(100% - 70px)); max-height: calc(100% - 16px); overflow-y: auto; overscroll-behavior: contain;
  padding: 12px 14px 14px; border: 1px solid var(--atlas-hair); border-radius: 18px;
  background: rgb(var(--shade) / 0.92); box-shadow: 0 24px 60px -24px rgb(0 0 0 / 0.9);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
}
:root[data-theme="light"] .atlas-sheet { background: rgb(12 16 28 / 0.94); }
@media (prefers-color-scheme: light) { :root:not([data-theme]) .atlas-sheet { background: rgb(12 16 28 / 0.94); } }
.atlas-sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.atlas-sheet h3 { margin: 0; font: 600 1rem var(--font-display); letter-spacing: 0.08em; color: var(--atlas-ink); }
.atlas-sheet .icon-btn { background: none; }
.atlas-layer { display: flex; align-items: center; gap: 10px; min-height: 40px; font-size: 0.9rem; cursor: pointer; }
.atlas-layer input { width: 18px; height: 18px; accent-color: var(--atlas-gold); }
.atlas-find input[type="search"] {
  width: 100%; min-height: 42px; margin: 2px 0 8px; padding: 8px 12px; border: 1px solid var(--atlas-hair); border-radius: 12px;
  color: var(--atlas-ink); background: rgb(255 255 255 / 0.06); font-size: 1rem; color-scheme: dark;
}
.atlas-find input[type="search"]:focus { outline: none; border-color: var(--atlas-gold); }
.atlas-find-list h4 { margin: 12px 0 4px; font-size: 0.7rem; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--atlas-dim); }
.atlas-find-list ul { list-style: none; margin: 0; padding: 0; }
.atlas-find-list button {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 10px; width: 100%; min-height: 44px; padding: 6px 8px;
  border: 0; border-radius: 10px; background: none; color: var(--atlas-ink); text-align: left; cursor: pointer;
}
.atlas-find-list button:focus-visible { outline: 2px solid var(--atlas-gold); outline-offset: -2px; }
@media (hover: hover) { .atlas-find-list button:hover { background: rgb(255 255 255 / 0.07); } }
.atlas-find-name { font-size: 0.92rem; font-weight: 500; }
.atlas-find-sub { grid-column: 1; font-size: 0.75rem; color: var(--atlas-dim); }
.atlas-find-up { grid-column: 2; grid-row: 1 / 3; align-self: center; font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--atlas-dim); }
.atlas-find-up.is-up { color: var(--atlas-gold); }
.atlas-find-tag { margin-left: 4px; padding: 1px 6px; border: 1px solid var(--atlas-hair); border-radius: 999px; font-size: 0.64rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--atlas-gold); vertical-align: 1px; }
.atlas-find-none { color: var(--atlas-dim); font-size: 0.88rem; }

/* ───── Below: the card for what's chosen, over the time controls ───── */
.atlas-dock {
  position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%);
  width: min(calc(100% - 16px), 540px); display: flex; flex-direction: column; gap: 6px; pointer-events: none;
}
.atlas-dock > * { pointer-events: auto; }
.atlas-card, .atlas-time {
  border: 1px solid var(--atlas-hair); border-radius: 18px; background: var(--atlas-glass);
  -webkit-backdrop-filter: blur(14px) saturate(1.2); backdrop-filter: blur(14px) saturate(1.2);
  box-shadow: 0 18px 44px -24px rgb(0 0 0 / 0.9);
}
.atlas-card { position: relative; padding: 9px 12px 11px 14px; max-height: 34vh; max-height: 34dvh; overflow-y: auto; overscroll-behavior: contain; }
.atlas-card h3 { margin: 0; padding: 5px 112px 0 0; font: 600 1.02rem var(--font-display); letter-spacing: 0.06em; }
.atlas-card-kind { margin: 0 0 6px; font-size: 0.76rem; color: var(--atlas-dim); }
.atlas-card dl { margin: 0; display: grid; gap: 2px; }
.atlas-card-row { display: grid; grid-template-columns: 6.6rem minmax(0, 1fr); gap: 8px; font-size: 0.8rem; line-height: 1.4; }
.atlas-card dt { color: var(--atlas-dim); }
.atlas-card dd { margin: 0; }
.atlas-card small { color: var(--atlas-dim); }
.atlas-card-note { margin: 6px 0 0; font-size: 0.76rem; line-height: 1.42; color: var(--atlas-dim); }
.atlas-card-actions { position: absolute; top: 7px; right: 7px; display: flex; align-items: center; gap: 4px; }
.atlas-card-actions .icon-btn { width: 36px; height: 36px; background: none; }
.atlas-card-actions .icon-btn svg { width: 17px; height: 17px; }
#skyCardCenter { min-height: 34px; padding: 3px 12px; border: 1px solid var(--atlas-hair); border-radius: 999px; color: var(--atlas-gold); background: none; font-size: 0.78rem; cursor: pointer; }

.atlas-time { padding: 4px 8px 8px; }
.atlas-scrub { display: flex; align-items: center; gap: 8px; padding: 0 4px; font: 0.66rem var(--font-mono); color: var(--atlas-dim); }
#skyScrub { flex: 1; min-width: 0; height: 26px; margin: 0; accent-color: var(--atlas-gold); }
.atlas-time-row { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; margin-top: 2px; }
.atlas-time-row button {
  min-height: 40px; border: 1px solid var(--atlas-hair); border-radius: 999px; background: rgb(255 255 255 / 0.04); color: var(--atlas-ink); cursor: pointer;
}
.atlas-time-row button:focus-visible, .atlas-date:has(#skyDate:focus-visible) { outline: 2px solid var(--atlas-gold); outline-offset: 1px; }
.atlas-arrow { width: 40px; display: grid; place-items: center; padding: 0; }
.atlas-arrow svg { width: 18px; height: 18px; }
.atlas-step { min-width: 70px; padding: 0 10px; font-size: 0.8rem; font-weight: 600; letter-spacing: 0.04em; color: var(--atlas-gold) !important; }
.atlas-play .atlas-play-go { fill: currentColor; stroke: none; }
.atlas-play .atlas-play-pause { display: none; }
.atlas-play[aria-pressed="true"] { color: var(--atlas-gold); border-color: var(--atlas-gold); }
.atlas-play[aria-pressed="true"] .atlas-play-go { display: none; }
.atlas-play[aria-pressed="true"] .atlas-play-pause { display: inline; stroke-width: 2.4; }
/* the calendar button, with the real date field lying invisibly over it: a tap on a phone opens its own picker, a click
   on a computer opens the browser's (sky.js), and from the keyboard it can be typed into, the clock above showing the
   result. (16px, or an iPhone zooms the page when it is focused) */
.atlas-date {
  position: relative; flex: none; width: 40px; height: 40px; margin-left: auto; overflow: hidden;
  display: grid; place-items: center; border: 1px solid var(--atlas-hair); border-radius: 999px;
  background: rgb(255 255 255 / 0.04); color: var(--atlas-ink);
}
.atlas-date svg { width: 18px; height: 18px; pointer-events: none; }
#skyDate {
  position: absolute; inset: 0; width: 100%; height: 100%; min-width: 0; margin: 0; padding: 0; border: 0;
  opacity: 0; cursor: pointer; font-size: 16px; color-scheme: dark;
}
@media (hover: hover) { .atlas-date:hover, .atlas-time-row button:not(:disabled):hover { border-color: var(--atlas-gold); } }
.atlas-now { padding: 0 12px; font-size: 0.8rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--atlas-gold) !important; border-color: var(--atlas-gold) !important; }
.atlas-now:disabled { opacity: 0.4; cursor: default; color: var(--atlas-dim) !important; border-color: var(--atlas-hair) !important; }

/* wide: the slider and the buttons in one row */
@media (min-width: 700px) {
  .atlas-dock { width: min(calc(100% - 16px), 680px); }
  .atlas-time { display: flex; align-items: center; gap: 10px; padding: 6px 8px; }
  .atlas-scrub { flex: 1; min-width: 0; }
  .atlas-time-row { flex: none; flex-wrap: nowrap; margin: 0; }
}
@media (max-width: 380px) {
  .atlas-card-row { grid-template-columns: 6rem minmax(0, 1fr); }
  #skyWhen { font-size: 0.86rem; }
}
/* the narrowest phones: the row still fits on one line */
@media (max-width: 359px) {
  .atlas-time-row { gap: 4px; }
  .atlas-arrow, .atlas-date { width: 36px; }
  .atlas-step { min-width: 62px; padding: 0 6px; }
  .atlas-now { padding: 0 9px; letter-spacing: 0.04em; }
}
