/* Light Left. The page sits on a sky that follows the real sun (--sky-top / --sky-bot set by app.js);
   text is white on frosted dark cards so it reads over dawn pinks, midday blue and night navy alike. */
:root {
  --sky-top: #2d3a78; --sky-bot: #b0647a; --stars: 0;
  --ink: #fff; --ink2: rgba(255, 255, 255, .78); --ink3: rgba(255, 255, 255, .6);
  --card: rgba(8, 12, 32, .34); --line: rgba(255, 255, 255, .16);
  --gold: #ffd27a; --blue: #9db8ff;
  --pad: max(16px, env(safe-area-inset-left)); --padr: max(16px, env(safe-area-inset-right));
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--sky-top); }
body {
  margin: 0; min-height: 100dvh; color: var(--ink);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, Roboto, "Helvetica Neue", Arial, sans-serif;
  font-variant-numeric: tabular-nums;
}
body.locked { overflow: hidden; }
.sky { position: fixed; inset: 0; z-index: -1; background: linear-gradient(180deg, var(--sky-top) 0%, var(--sky-top) 18%, var(--sky-bot) 100%); transition: background .8s; }
.stars {
  position: absolute; inset: 0 0 35% 0; opacity: var(--stars); transition: opacity 1s;
  background-image:
    radial-gradient(1.2px 1.2px at 12% 18%, #fff 50%, transparent 51%), radial-gradient(1px 1px at 27% 42%, #fff 50%, transparent 51%),
    radial-gradient(1.4px 1.4px at 44% 12%, #fff 50%, transparent 51%), radial-gradient(1px 1px at 61% 33%, #fff 50%, transparent 51%),
    radial-gradient(1.3px 1.3px at 78% 9%, #fff 50%, transparent 51%), radial-gradient(1px 1px at 88% 46%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 6% 61%, #fff 50%, transparent 51%), radial-gradient(1.2px 1.2px at 52% 58%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 35% 74%, #fff 50%, transparent 51%), radial-gradient(1px 1px at 93% 70%, #fff 50%, transparent 51%);
  background-size: 360px 300px;
}
a { color: inherit; }
.nw { white-space: nowrap; }
button { font: inherit; color: inherit; }

#app { max-width: 1180px; margin: 0 auto; padding: max(12px, env(safe-area-inset-top)) var(--padr) max(24px, env(safe-area-inset-bottom)) var(--pad); }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; }
.city {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 14px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--line); font-weight: 600; cursor: pointer;
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); min-width: 0; white-space: nowrap;
}
.city svg { width: 12px; height: 8px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; flex: none; }
.date { color: var(--ink2); font-size: 15px; text-align: right; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.ds { display: none; }
@media (max-width: 400px) { .dl { display: none; } .ds { display: inline; } }
.layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
.hero { padding: 18px 2px 4px; text-shadow: 0 1px 14px rgba(0, 0, 0, .28); }
.hero p { margin: 0; }
.label { font-size: 18px; font-weight: 600; letter-spacing: .02em; color: var(--ink2); }
.big { font-size: clamp(64px, 21vw, 116px); line-height: 1; font-weight: 700; letter-spacing: -.035em; margin: 4px 0 8px !important; white-space: nowrap; }
.sub { font-size: 19px; color: var(--ink); }
.arc { position: relative; height: 112px; margin: 22px 0 6px; }
.arc svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.arc .curve { fill: none; stroke: rgba(255, 255, 255, .85); stroke-width: 2.5; }
.arc .horizon { stroke: rgba(255, 255, 255, .45); stroke-width: 1; }
.arc .nowline { stroke: rgba(255, 255, 255, .3); stroke-width: 1; stroke-dasharray: 3 3; }
.sundot { position: absolute; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%; background: #ffe7a0; box-shadow: 0 0 0 4px rgba(255, 231, 160, .25), 0 0 22px 6px rgba(255, 210, 120, .55); }
body[data-phase=night] .sundot, body[data-phase=dusk] .sundot, body[data-phase=dawn] .sundot { background: #c9d4ff; box-shadow: 0 0 0 4px rgba(201, 212, 255, .2); }
.arcl, .len { display: flex; justify-content: space-between; gap: 12px; color: var(--ink2); font-size: 15px; }
.arcl b, .len b { color: var(--ink); font-weight: 600; }
.len span:last-child { color: var(--ink); }
.len { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); flex-wrap: wrap; }

.cards { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; align-content: start; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 16px 16px 14px;
  -webkit-backdrop-filter: blur(16px) saturate(1.2); backdrop-filter: blur(16px) saturate(1.2);
}
.card h2 { margin: 0 0 8px; font-size: 18px; }
.card h3 { margin: 14px 0 4px; font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--ink3); }
.card .stat { margin: 0 0 8px; font-size: 17px; color: var(--ink2); }
.card .stat b { color: var(--ink); font-size: 22px; }
.note { margin: 8px 0 0; font-size: 14px; color: var(--ink2); }
.row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; padding: 7px 0; border-top: 1px solid var(--line); font-size: 15px; }
.row span { color: var(--ink2); }
.row b { font-weight: 600; text-align: right; }
.row.gold b { color: var(--gold); }
.row.blue b { color: var(--blue); }
.row.head { border-top: 0; padding-bottom: 0; font-size: 13px; }
.row.head b { color: var(--ink3); font-weight: 600; }
.card .row:has(> b + b) { grid-template-columns: minmax(0, 1fr) 6.5em 6.5em; }

.yearchart { margin: 12px 0 0 38px; }
.plot { position: relative; height: 180px; border-radius: 6px; background: rgba(0, 0, 20, .28); }
.plot svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.plot .grid { stroke: rgba(255, 255, 255, .12); stroke-width: 1; }
.plot .twi { fill: rgba(170, 190, 255, .28); }
.plot .sunband { fill: rgba(255, 216, 130, .78); }
.plot .today { stroke: #fff; stroke-width: 2; }
.yl { position: absolute; left: -40px; width: 34px; text-align: right; transform: translateY(-50%); font-size: 11px; color: var(--ink3); white-space: nowrap; }
.months { position: relative; height: 18px; margin-top: 4px; font-size: 11px; color: var(--ink3); }
.months span { position: absolute; transform: translateX(-50%); }

.about { padding: 6px 4px 0; font-size: 13px; color: var(--ink2); }
.about p { margin: 0 0 8px; }

/* city picker */
#sheet { position: fixed; inset: 0; z-index: 10; }
.scrim { position: absolute; inset: 0; background: rgba(0, 0, 10, .5); }
.panel {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: min(86dvh, 720px); display: flex; flex-direction: column;
  background: #141a33; border-radius: 20px 20px 0 0; border: 1px solid var(--line); border-bottom: 0;
  padding-bottom: env(safe-area-inset-bottom);
}
.panelhead { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; padding: 14px var(--padr) 10px var(--pad); }
#find {
  -webkit-appearance: none; appearance: none; width: 100%; min-width: 0; height: 44px; padding: 0 14px; border-radius: 12px;
  border: 1px solid var(--line); background: rgba(255, 255, 255, .08); color: var(--ink); font: inherit; font-size: 16px;
}
.x { height: 44px; padding: 0 14px; border-radius: 12px; border: 0; background: rgba(255, 255, 255, .1); cursor: pointer; }
.list { overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding: 0 var(--padr) 16px var(--pad); }
.list h3 { margin: 14px 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink3); }
.list button {
  display: block; width: 100%; min-height: 46px; text-align: left; padding: 10px 14px; margin: 0 0 4px; border-radius: 12px;
  border: 0; background: rgba(255, 255, 255, .05); cursor: pointer; font-size: 17px;
}
.list button.on { background: rgba(255, 210, 120, .22); font-weight: 600; }
.list button:hover { background: rgba(255, 255, 255, .12); }
.list [hidden] { display: none; }
.empty { color: var(--ink2); padding: 12px 4px; }

:focus-visible { outline: 2px solid #ffe7a0; outline-offset: 2px; }

/* sideways phones, tablets and computers: the big number on the left stays put, cards scroll on the right */
@media (min-width: 720px) {
  .layout { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 28px; align-items: start; }
  .hero { position: sticky; top: max(12px, env(safe-area-inset-top)); }
}
@media (min-width: 720px) and (max-height: 500px) {
  .hero { padding-top: 4px; }
  .big { font-size: clamp(56px, 12vw, 84px); }
  .arc { height: 84px; margin-top: 12px; }
}
@media (min-width: 1100px) {
  .layout { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 48px; }
  .big { font-size: 128px; }
  .hero { padding-top: 40px; }
}
@media (min-width: 720px) { .panel { left: 50%; right: auto; bottom: auto; top: 50%; transform: translate(-50%, -50%); width: min(480px, 92vw); border-radius: 20px; border-bottom: 1px solid var(--line); } }
@media (prefers-reduced-motion: reduce) { .sky, .stars { transition: none; } }
