/* Daylight. The page background is the sky at the time on the dial. */
@font-face { font-family: "Fraunces"; font-weight: 600; font-display: swap; src: url("/fonts/fraunces-600-normal.woff2") format("woff2"); }
@font-face { font-family: "DM Sans"; font-weight: 400; font-display: swap; src: url("/fonts/dm-sans-400-normal.woff2") format("woff2"); }
@font-face { font-family: "DM Sans"; font-weight: 500; font-display: swap; src: url("/fonts/dm-sans-500-normal.woff2") format("woff2"); }
@font-face { font-family: "DM Sans"; font-weight: 600; font-display: swap; src: url("/fonts/dm-sans-600-normal.woff2") format("woff2"); }

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

:root {
  --sky-top: #141a46;
  --sky-bot: #4a3977;
  --ink: #f4f1ea;
  --ink-2: rgba(244, 241, 234, .78);
  --ink-3: rgba(244, 241, 234, .58);
  --glass: rgba(9, 12, 30, .52);
  --glass-2: rgba(255, 255, 255, .07);
  --line: rgba(255, 255, 255, .13);
  --sun: #ffcf73;
  --warm: #ffb36b;
  --moon: #e9e6dc;
  --good: #9be3b0;
  --r: 20px;
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}

html { -webkit-text-size-adjust: 100%; }
body {
  min-height: 100vh; min-height: 100dvh;
  color: var(--ink);
  font: 400 16px/1.5 var(--sans);
  font-variant-numeric: tabular-nums;
  background: linear-gradient(180deg, var(--sky-top) 0%, var(--sky-bot) 100%) fixed;
  background-color: var(--sky-top);
  transition: background .6s ease;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: var(--ink); text-underline-offset: 3px; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--sun); outline-offset: 3px; border-radius: 6px; }

#stars { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; transition: opacity 1s; }
.glow {
  position: fixed; left: -20%; right: -20%; bottom: -30vh; height: 70vh; z-index: 0; pointer-events: none;
  background: radial-gradient(ellipse at 50% 60%, var(--glow, rgba(255, 150, 90, .5)) 0%, transparent 62%);
  opacity: 0; transition: opacity 1s;
}

#veil { position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: 0; transition: opacity 1s;
  background: linear-gradient(180deg, var(--veil, rgba(150,158,174,.75)) 0%, transparent 115%); }

/* ── header ─────────────────────────────────────────────── */
.top {
  position: relative; z-index: 2;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  padding: calc(env(safe-area-inset-top) + 12px) 16px 4px;
  max-width: 1180px; margin: 0 auto;
}
.home { font-size: 13px; color: var(--ink-3); text-decoration: none; letter-spacing: .02em; }
.home:hover { color: var(--ink); }
.brand { font: 600 20px/1 var(--serif); letter-spacing: .01em; }
.chip {
  justify-self: end; display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px 7px 10px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--glass); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  font-size: 14px; font-weight: 500; cursor: pointer; max-width: 46vw;
}
.chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip svg { width: 15px; height: 15px; flex: none; }

/* ── layout ─────────────────────────────────────────────── */
.layout { position: relative; z-index: 1; max-width: 560px; margin: 0 auto; padding: 0 16px calc(env(safe-area-inset-bottom) + 32px); }
.stack { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); min-width: 0; }
.stack > * { min-width: 0; }
@media (min-width: 980px) {
  .layout { max-width: 1180px; display: grid; grid-template-columns: minmax(420px, 1fr) minmax(0, 560px); gap: 40px; align-items: start; }
  .hero { position: sticky; top: 16px; }
}

/* ── dial ───────────────────────────────────────────────── */
.hero { padding: 6px 0 14px; }
.dial-wrap { position: relative; width: min(100%, 470px); margin: 0 auto; aspect-ratio: 1; }
#dial { width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; overflow: visible; }
#dial:active { cursor: grabbing; }
#dial:focus-visible { outline: none; }
#dial:focus-visible .ring-outline { stroke: var(--sun); stroke-width: 2; }
.dial-center {
  position: absolute; inset: 24%; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; touch-action: pan-y; border-radius: 50%;
}
.h-label { font-size: clamp(13px, 3.6vw, 16px); font-weight: 500; color: var(--ink-2); letter-spacing: .04em; text-transform: uppercase; }
.h-value { font: 600 clamp(36px, 11.5vw, 62px)/1.02 var(--serif); letter-spacing: -.02em; margin: 4px 0 6px; text-shadow: 0 2px 24px rgba(0, 0, 0, .25); white-space: nowrap; }
.h-sub { font-size: clamp(13px, 3.5vw, 15px); color: var(--ink-2); max-width: 15em; }
.dial-text { font: 500 12px var(--sans); fill: var(--ink-2); }
.dial-hour { font: 600 12px var(--sans); fill: var(--ink-3); }
.dial-event { font: 600 13px var(--sans); fill: var(--ink); }

.travel {
  display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap;
  margin: 6px auto 0; font-size: 14px; color: var(--ink-2);
}
.travel[hidden] { display: none; }
.btn-now {
  border: 0; border-radius: 999px; padding: 7px 14px; background: var(--sun); color: #2a1c05; font-weight: 600; cursor: pointer;
}
.hint { text-align: center; font-size: 13px; color: var(--ink-3); margin-top: 8px; transition: opacity .4s; }

/* ── tiles ──────────────────────────────────────────────── */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile, .card {
  background: var(--glass); border: 1px solid var(--line); border-radius: var(--r);
  backdrop-filter: blur(16px) saturate(1.2); -webkit-backdrop-filter: blur(16px) saturate(1.2);
}
.tile { padding: 14px 14px 12px; }
.tile .k { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); font-weight: 600; }
.tile .v { font: 600 30px/1.1 var(--serif); margin: 4px 0 2px; letter-spacing: -.01em; }
.tile .s { font-size: 13px; color: var(--ink-2); }
.tile .up { color: var(--good); }
.tile .down { color: var(--warm); }

/* ── cards ──────────────────────────────────────────────── */
.card { padding: 18px 18px 16px; }
.card h2 { font: 600 22px/1.2 var(--serif); margin-bottom: 10px; }
.card h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); margin: 16px 0 8px; }
.muted { color: var(--ink-2); }
.small { font-size: 13px; }
.lead { font-size: 17px; margin-bottom: 12px; }
.lead b { color: var(--sun); font-weight: 600; }

/* plan */
.plan { list-style: none; display: grid; gap: 2px; }
.plan li { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: start; padding: 9px 0; border-top: 1px solid var(--line); }
.plan li:first-child { border-top: 0; }
.plan .ic { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--glass-2); }
.plan .ic svg { width: 20px; height: 20px; }
.plan .t { font-weight: 600; }
.plan .d { font-size: 14px; color: var(--ink-2); }
.plan .w { font-size: 13px; color: var(--ink-3); white-space: nowrap; padding-top: 2px; }
.plan li.past { opacity: .48; }
.plan li.now .w { color: var(--sun); font-weight: 600; }

.hours { display: flex; align-items: flex-end; gap: 3px; height: 92px; margin-top: 14px; padding-bottom: 18px; position: relative; }
.hours .b { flex: 1; position: relative; height: 100%; display: flex; align-items: flex-end; }
.hours .b i { display: block; width: 100%; border-radius: 5px 5px 2px 2px; min-height: 3px; }
.hours .b span { position: absolute; bottom: -18px; left: 50%; transform: translateX(-50%); font-size: 10px; color: var(--ink-3); }
.hours .b.best i { box-shadow: 0 0 0 2px var(--sun), 0 0 18px rgba(255, 207, 115, .6); }
.hours .b.nowh::after { content: ""; position: absolute; top: -6px; left: 50%; width: 5px; height: 5px; border-radius: 50%; background: var(--ink); transform: translateX(-50%); }
.hours .b em { position: absolute; top: -2px; left: 50%; transform: translateX(-50%); font-style: normal; font-size: 10px; color: #9ccaf5; }
.hours-note { font-size: 14px; color: var(--ink-2); margin-top: 8px; }
.hours-note b { color: var(--ink); }
.link-btn { background: none; border: 0; padding: 0; color: var(--sun); font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

/* timeline */
.timeline { list-style: none; position: relative; padding-left: 22px; }
.timeline::before { content: ""; position: absolute; left: 6px; top: 8px; bottom: 8px; width: 2px; background: linear-gradient(var(--sun), rgba(255, 255, 255, .15)); border-radius: 2px; }
.timeline li { position: relative; padding: 7px 0 9px; }
.timeline li::before { content: ""; position: absolute; left: -21px; top: 13px; width: 12px; height: 12px; border-radius: 50%; background: var(--sky-top); border: 2px solid var(--ink-2); }
.timeline li.season::before { background: var(--sun); border-color: var(--sun); box-shadow: 0 0 12px rgba(255, 207, 115, .7); }
.timeline li.turn::before { border-color: var(--sun); }
.timeline li.clock::before { border-color: #9ccaf5; }
.timeline .row { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.timeline .t { font-weight: 600; }
.timeline .when { font-size: 13px; color: var(--ink-3); white-space: nowrap; }
.timeline .when b { color: var(--ink); font-weight: 600; }
.timeline .d { font-size: 14px; color: var(--ink-2); }

/* tonight */
.moon-row { display: grid; grid-template-columns: 76px 1fr; gap: 14px; align-items: center; }
#moon { width: 76px; height: 76px; overflow: visible; }
.moon-name { font: 600 19px/1.2 var(--serif); }
.moon-row .muted { font-size: 14px; }
.kids { margin-top: 14px; padding: 12px 14px; border-radius: 14px; background: rgba(255, 207, 115, .12); border: 1px solid rgba(255, 207, 115, .3); font-size: 15px; }
.kids:empty { display: none; }
.kids b { color: var(--sun); }
.dark { margin-top: 12px; font-size: 14px; color: var(--ink-2); }
.planets { list-style: none; margin-top: 6px; }
.planets li { display: grid; grid-template-columns: 14px 1fr; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.planets .dot { width: 12px; height: 12px; border-radius: 50%; margin-top: 5px; }
.planets .n { font-weight: 600; }
.planets .n small { font-weight: 400; color: var(--ink-3); font-size: 13px; margin-left: 4px; }
.planets .d { font-size: 14px; color: var(--ink-2); }
.planets .empty { display: block; color: var(--ink-2); font-size: 14px; }
.extras { display: grid; gap: 10px; margin-top: 10px; }
.extra { display: grid; grid-template-columns: 34px 1fr; gap: 10px; padding: 12px; border-radius: 14px; background: var(--glass-2); }
.extra svg { width: 26px; height: 26px; margin-top: 2px; }
.extra .t { font-weight: 600; }
.extra .d { font-size: 14px; color: var(--ink-2); }

/* weather */
.wx-pitch { font-size: 16px; margin-bottom: 12px; }
.wx-fine { margin-top: 10px; }
.wx-fine a { color: var(--ink-2); }
.wx-now { display: grid; grid-template-columns: 88px 1fr; gap: 14px; align-items: center; }
.wx-now > svg { width: 88px; height: 88px; }
.wx-temp { font: 600 52px/1 var(--serif); letter-spacing: -.02em; }
.wx-words { font-size: 17px; font-weight: 500; margin-top: 2px; }
.stale { color: var(--warm); }
.wx-wear { margin-top: 14px; padding: 12px 14px; border-radius: 14px; background: var(--glass-2); font-size: 15px; }
.wx-wear b { color: var(--sun); }
.wx-hours { list-style: none; display: flex; gap: 4px; overflow-x: auto; margin: 14px -18px 0; padding: 4px 18px 8px; scroll-snap-type: x proximity; scrollbar-width: none; }
.wx-hours::-webkit-scrollbar { display: none; }
.wx-hours li { flex: 0 0 52px; display: grid; justify-items: center; gap: 2px; padding: 8px 0; border-radius: 14px; scroll-snap-align: start; }
.wx-hours li:first-child { background: var(--glass-2); }
.wx-hours svg { width: 32px; height: 32px; }
.wh-t { font-size: 12px; color: var(--ink-3); font-weight: 600; }
.wh-v { font-size: 15px; font-weight: 600; }
.wh-r { font-size: 11px; color: #9ccaf5; min-height: 14px; }
.wx-hours li.wh-sun { flex-basis: 62px; background: rgba(255, 207, 115, .1); }
.wx-hours li.wh-sun .wh-v { font-size: 11px; color: var(--sun); }
.wx-hours li.wh-sun svg { width: 26px; height: 26px; margin: 3px 0; }
.wx-days { list-style: none; margin-top: 8px; }
.wx-days li { display: grid; grid-template-columns: 52px 30px 34px 32px 1fr 32px; gap: 8px; align-items: center; padding: 6px 0; border-top: 1px solid var(--line); font-size: 15px; }
.wx-days svg { width: 28px; height: 28px; }
.wd-n { font-weight: 600; }
.wd-r { font-size: 12px; color: #9ccaf5; }
.wd-lo { color: var(--ink-3); text-align: right; }
.wd-hi { font-weight: 600; }
.wd-bar { position: relative; height: 6px; border-radius: 3px; background: rgba(255, 255, 255, .1); }
.wd-bar b { position: absolute; top: 0; bottom: 0; border-radius: 3px; }
.wd-now { position: absolute; top: 50%; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; background: #fff; border: 2px solid var(--sky-top); }

/* calendar */
.cal { list-style: none; margin-top: 10px; }
.cal > li { display: grid; grid-template-columns: 30px 1fr; gap: 12px; padding: 11px 0; border-top: 1px solid var(--line); }
.cal > li:first-child { border-top: 0; }
.cal > li > svg { width: 30px; height: 30px; margin-top: 2px; }
.cal .row { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.cal .t { font-weight: 600; }
.cal .when { font-size: 13px; color: var(--ink-3); white-space: nowrap; }
.cal .when b { color: var(--ink); font-weight: 600; }
.cal .d { font-size: 14px; color: var(--ink-2); }
.cal li.far { opacity: .85; }
.cal-wait { display: block !important; }
.btn-ghost { margin-top: 8px; width: 100%; padding: 10px; border-radius: 12px; border: 1px solid var(--line); background: var(--glass-2); font-weight: 600; cursor: pointer; }
.btn-ghost[hidden] { display: none; }
@media (max-width: 380px) { .cal .row { flex-direction: column; gap: 0; } .wx-days li { grid-template-columns: 46px 28px 30px 28px 1fr 30px; gap: 6px; } }

/* year */
.ribbon-wrap { position: relative; margin: 12px 0 8px; border-radius: 12px; overflow: hidden; }
#ribbon { display: block; width: 100%; height: 210px; cursor: crosshair; touch-action: pan-y; }
.legend { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--ink-2); margin-bottom: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; border: 1px solid var(--line); }

.foot { font-size: 13px; color: var(--ink-3); padding: 10px 4px 0; display: grid; gap: 8px; }
.foot a { color: var(--ink-2); }

/* ── settings sheet ─────────────────────────────────────── */
dialog {
  border: 0; padding: 0; background: transparent; color: var(--ink);
  max-width: 520px; width: calc(100% - 24px); margin: auto;
}
dialog::backdrop { background: rgba(3, 5, 14, .6); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.sheet { background: #12162f; border: 1px solid var(--line); border-radius: 22px; padding: 18px; max-height: 86vh; overflow: auto; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.sheet h2 { font: 600 22px var(--serif); }
.sheet h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); margin: 20px 0 10px; }
.x { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: var(--glass-2); font-size: 22px; line-height: 1; cursor: pointer; }
.btn-wide { width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 12px; border-radius: 14px; border: 0; background: var(--sun); color: #2a1c05; font-weight: 600; cursor: pointer; }
.btn-wide svg { width: 18px; height: 18px; }
#geo-msg { margin: 8px 0 12px; text-align: center; }
.cities { display: flex; flex-wrap: wrap; gap: 8px; }
.cities button { padding: 8px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--glass-2); cursor: pointer; font-size: 14px; }
.cities button[aria-pressed="true"] { background: var(--ink); color: #12162f; font-weight: 600; }
.toggle { display: grid; grid-template-columns: 48px 1fr; gap: 12px; align-items: center; cursor: pointer; margin-bottom: 8px; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle .track { width: 48px; height: 28px; border-radius: 999px; background: rgba(255, 255, 255, .18); position: relative; transition: background .2s; }
.toggle .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform .2s; }
.toggle input:checked + .track { background: var(--sun); }
.toggle input:checked + .track::after { transform: translateX(20px); }
.toggle input:focus-visible + .track { outline: 2px solid var(--sun); outline-offset: 3px; }

@media (prefers-reduced-motion: reduce) {
  body, .glow, #stars, .hint, #veil { transition: none; }
}
