/* eclipse.upsa.org.ua — UPSA Eclipse Almanac.
   Observatory-almanac instrument in the UPSA family: paper + navy ink, IBM Plex,
   square corners, borders-only depth, one yellow accent spent on "next"/selection.
   The player is the single deliberate dark surface — controls float on the image. */

:root {
  --paper: #FAFBFD;
  --panel: #FFFFFF;
  --ink: #0B1526;
  --ink-2: #33415C;
  --muted: #5A6B85;
  --faint: #8B99B0;
  --line: #D8DEE9;
  --line-strong: #AEB9CC;
  --navy: #0B2050;
  --accent: #FFD400;
  --accent-soft: #FFFBE0;
  --space: #050A16;
  --red: #B5432E;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --ease: cubic-bezier(.23, 1, .32, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { background: var(--paper); -webkit-font-smoothing: antialiased; scroll-behavior: smooth; }
body { font-family: var(--sans); color: var(--ink); font-size: 15px; line-height: 1.5; }
a { color: var(--navy); }
a:hover { background: var(--accent); color: var(--ink); text-decoration: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3 { text-wrap: balance; }
p { text-wrap: pretty; }
button, select { font-family: var(--mono); }
button { cursor: pointer; transition: background-color .15s var(--ease), border-color .15s, color .15s, opacity .15s, transform .12s; }
button:active { transform: scale(.97); }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

.wrap { max-width: 1240px; margin: 0 auto; padding: 0 24px; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- sticky masthead bar (every page) ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: rgba(250, 251, 253, .92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar .wrap { display: flex; align-items: center; gap: 18px; min-height: 54px; }
.tb-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.tb-brand:hover { background: none; }
.tb-brand img { width: 34px; height: auto; display: block; }
.tb-brand .nm { display: grid; line-height: 1.15; }
.tb-brand .nm b { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.tb-brand:hover .nm b { color: var(--navy); text-decoration: underline; text-underline-offset: 3px; }
.tb-brand .nm span { font-family: var(--mono); font-size: 10px; letter-spacing: .08em; color: var(--muted); text-transform: uppercase; }
.tb-nav { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.tb-nav > a { font-family: var(--mono); font-size: 12px; color: var(--muted); text-decoration: none; white-space: nowrap; }
.tb-nav > a:hover { background: var(--accent); color: var(--ink); }
.langsw { display: flex; border: 1px solid var(--line-strong); }
.langsw button {
  font-size: 11px; letter-spacing: .04em; padding: 5px 8px; min-height: 28px;
  background: var(--panel); color: var(--muted); border: 0; border-left: 1px solid var(--line);
}
.langsw button:first-child { border-left: 0; }
.langsw button:hover { color: var(--ink); }
.langsw button[aria-pressed="true"] { background: var(--ink); color: #fff; }

/* ---------- masthead ---------- */
.masthead { padding: 34px 0 0; }
.brand { display: flex; align-items: center; gap: 16px; }
.brand img { width: 52px; height: auto; display: block; }
.brand .lock { display: grid; gap: 1px; }
.brand .agency { font-family: var(--mono); font-size: 11px; letter-spacing: .08em; color: var(--muted); text-transform: uppercase; }
.brand .agency a { color: var(--muted); text-decoration: none; }
.brand .agency a:hover { background: var(--accent); color: var(--ink); }
.brand h1 { font-size: clamp(26px, 4.5vw, 44px); font-weight: 600; letter-spacing: -0.02em; line-height: 1.04; }
.masthead .sub { max-width: 62ch; margin-top: 12px; color: var(--ink-2); font-size: 15px; }
.masthead .rule { margin-top: 22px; border: 0; border-top: 3px solid var(--ink); }
.counts {
  display: flex; gap: 28px; flex-wrap: wrap;
  font-family: var(--mono); font-size: 12px; color: var(--muted);
  padding: 10px 0; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums;
}
.counts b { color: var(--ink); font-weight: 500; }

/* ---------- how to use ---------- */
.howto { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line-strong); border-top: 0; background: var(--panel); }
.howto .step { padding: 14px 18px 16px; border-left: 1px solid var(--line); }
.howto .step:first-child { border-left: 0; }
.howto .n { font-family: var(--mono); font-size: 11px; color: var(--paper); background: var(--navy); display: inline-block; padding: 1px 7px; margin-bottom: 8px; }
.howto .step > b { font-weight: 600; display: block; font-size: 14px; }
.howto .step span { color: var(--muted); font-size: 13px; }
.howto .step span b { font-weight: 600; color: var(--ink); }
.legend { display: flex; gap: 18px; flex-wrap: wrap; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); font-family: var(--mono); font-size: 11px; color: var(--muted); }
.legend .li { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }

/* ---------- next-eclipse strip ---------- */
.next { margin: 28px 0; border: 1px solid var(--ink); display: grid; grid-template-columns: 10px 1fr auto; background: var(--panel); }
.next .flag { background: var(--accent); }
.next .body { padding: 18px 22px; }
.next .body .tag { font-family: var(--mono); font-size: 12px; color: var(--muted); letter-spacing: .06em; }
.next .body h2 { font-size: 26px; font-weight: 600; margin: 3px 0 6px; letter-spacing: -0.015em; }
.next .body p { color: var(--ink-2); font-size: 14px; max-width: 70ch; }
.next .clock { padding: 18px 22px; text-align: right; display: flex; flex-direction: column; justify-content: center; border-left: 1px solid var(--line); min-width: 230px; }
.next .clock .cd { font-family: var(--mono); font-size: 28px; font-weight: 500; white-space: nowrap; font-variant-numeric: tabular-nums; }
.next .clock .lbl { font-family: var(--mono); font-size: 11px; color: var(--muted); letter-spacing: .06em; }
.btn {
  display: inline-block; margin-top: 10px; font-family: var(--mono); font-size: 13px;
  text-decoration: none; background: var(--navy); color: #fff; padding: 8px 16px;
  border: 1px solid var(--navy); transition: background-color .15s var(--ease);
}
.btn:hover { background: var(--ink); color: var(--accent); }

/* ---------- filters ---------- */
.filters { display: flex; gap: 18px; flex-wrap: wrap; align-items: end; padding: 14px 0; border-bottom: 1px solid var(--line); font-family: var(--mono); font-size: 12px; }
.filters .fgroup { display: grid; gap: 4px; }
.filters .flabel { font-size: 10px; letter-spacing: .08em; color: var(--faint); }
.filters .grp { display: flex; }
.filters button { font-size: 12px; background: var(--panel); color: var(--ink); border: 1px solid var(--line-strong); border-left-width: 0; padding: 7px 12px; min-height: 32px; }
.filters .grp button:first-child { border-left-width: 1px; }
.filters button:hover { border-color: var(--ink); }
.filters button[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.filters select { font-size: 12px; padding: 7px 8px; min-height: 32px; border: 1px solid var(--line-strong); background: var(--panel); color: var(--ink); max-width: 210px; }
.filters select:hover { border-color: var(--ink); }
.filters select:disabled { opacity: .55; cursor: progress; }
.filters select#city[data-set="1"] { border-color: var(--ink); background: var(--accent-soft); }
.filters .count { color: var(--muted); margin-left: auto; align-self: center; font-variant-numeric: tabular-nums; }
.citynote { padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 13px; color: var(--ink-2); }
.citynote b { font-weight: 600; }

/* ---------- catalog ledger ---------- */
.years { margin-bottom: 80px; }
.yearblock { display: grid; grid-template-columns: 84px 1fr; border-bottom: 1px solid var(--line); }
.yearblock .y { font-family: var(--mono); font-size: 20px; font-weight: 500; color: var(--line-strong); padding: 18px 0; position: sticky; top: 60px; align-self: start; }
table.cat { width: 100%; border-collapse: collapse; }
table.cat th { font-family: var(--mono); font-size: 10px; font-weight: 400; letter-spacing: .08em; color: var(--faint); text-align: left; padding: 10px 14px 6px 0; }
table.cat td { padding: 12px 14px 12px 0; border-top: 1px solid var(--line); vertical-align: baseline; font-size: 14px; }
table.cat tbody tr { transition: background-color .15s; }
table.cat tbody tr:hover { background: #F2F5FA; }
table.cat .d { font-family: var(--mono); font-size: 13px; white-space: nowrap; width: 90px; font-variant-numeric: tabular-nums; }
table.cat .g { width: 34px; vertical-align: middle; }
table.cat .k { width: 190px; }
table.cat .k b { font-weight: 600; }
table.cat .k span { color: var(--muted); font-family: var(--mono); font-size: 11px; display: block; }
table.cat .best { color: var(--muted); }
table.cat .best b { color: var(--ink); font-weight: 500; }
table.cat .go { text-align: right; white-space: nowrap; }
table.cat .go a { font-family: var(--mono); font-size: 12px; text-decoration: none; border: 1px solid var(--line-strong); padding: 5px 10px; color: var(--navy); transition: border-color .15s, background-color .15s; }
table.cat .go a:hover { border-color: var(--ink); background: var(--accent); color: var(--ink); }
tr.is-next td { background: var(--accent-soft); }
.gl { display: inline-block; vertical-align: middle; }

/* ---------- footer ---------- */
footer { border-top: 3px solid var(--ink); padding: 24px 0 40px; margin-top: 8px; font-size: 13px; color: var(--muted); }
footer .wrap { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; }
footer h3 { font-family: var(--mono); font-size: 10px; font-weight: 400; letter-spacing: .1em; color: var(--faint); margin-bottom: 8px; }
footer p { margin: 0 0 6px; }
.built {
  border-top: 1px solid var(--line); margin-top: 24px; padding-top: 16px;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  font-family: var(--mono); font-size: 11px; letter-spacing: .04em; color: var(--faint);
}
.built a { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: var(--muted); }
.built a:hover { background: none; color: var(--ink); }
.built img { height: 15px; width: auto; display: block; opacity: .75; transition: opacity .15s; }
.built a:hover img { opacity: 1; }

/* ================= eclipse page ================= */
.crumbs { font-family: var(--mono); font-size: 12px; padding: 14px 0 6px; color: var(--muted); display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.crumbs a { text-decoration: none; border-bottom: 1px solid var(--line-strong); }
.crumbs .sp { margin-left: auto; display: flex; gap: 14px; }
.evhead { padding: 8px 0 18px; }
.evhead .chiprow { display: flex; gap: 10px; align-items: center; margin-bottom: 6px; flex-wrap: wrap; }
.chip { font-family: var(--mono); font-size: 11px; letter-spacing: .07em; padding: 3px 9px; border: 1px solid var(--ink); background: var(--ink); color: #fff; }
.chip.A { background: var(--navy); border-color: var(--navy); }
.chip.P, .chip.N { background: transparent; color: var(--ink); }
.evhead .id { font-family: var(--mono); font-size: 12px; color: var(--faint); }
.evhead h1 { font-size: clamp(24px, 4vw, 38px); font-weight: 600; letter-spacing: -0.02em; }
.evhead .summary { margin-top: 6px; color: var(--ink-2); font-size: 15px; max-width: 78ch; }
.evgrid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 24px; border-top: 3px solid var(--ink); padding-top: 24px; margin-bottom: 64px; }

/* ---------- the player ---------- */
.player { position: relative; background: #000; border: 1px solid var(--ink); overflow: hidden; user-select: none; }
.p-stage { position: relative; aspect-ratio: 16 / 9; overflow: hidden; }
.player canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.player:fullscreen { width: 100vw; height: 100vh; border: 0; display: flex; flex-direction: column; }
.player:fullscreen .p-stage { flex: 1; aspect-ratio: auto; min-height: 0; }
.player:fullscreen .p-bottom { position: absolute; bottom: 0; left: 0; right: 0; background: none; }
.player .scrim-t, .player .scrim-b { position: absolute; left: 0; right: 0; pointer-events: none; transition: opacity .25s var(--ease); }
.player .scrim-t { top: 0; height: 110px; background: linear-gradient(rgba(2,5,12,.62), rgba(2,5,12,0)); }
.player .scrim-b { bottom: 0; height: 190px; background: linear-gradient(rgba(2,5,12,0), rgba(2,5,12,.80)); }
.p-top, .p-bottom { position: absolute; left: 0; right: 0; transition: opacity .25s var(--ease), transform .25s var(--ease); }
.p-top { top: 0; padding: 12px 16px; display: flex; align-items: flex-start; gap: 12px; }
.p-bottom { bottom: 0; padding: 0 16px 12px; }
.player.idle .p-top, .player.idle .p-bottom, .player.idle .scrim-t, .player.idle .scrim-b { opacity: 0; }
.player.idle { cursor: none; }
.player.idle .p-top { transform: translateY(-6px); }
.player.idle .p-bottom { transform: translateY(6px); }

/* phase readout floating top-left */
.p-phase { display: flex; gap: 8px; flex-wrap: wrap; font-family: var(--mono); font-size: 11px; }
.p-phase span { background: rgba(6,10,20,.55); border: 1px solid rgba(255,255,255,.14); color: #C9D5E8; padding: 4px 9px; letter-spacing: .05em; font-variant-numeric: tabular-nums; }
.p-phase span b { color: #fff; font-weight: 500; }
.p-phase span.hl { border-color: var(--accent); }
.p-phase span.hl b { color: var(--accent); }
.p-place { margin-left: auto; font-family: var(--mono); font-size: 11px; color: #C9D5E8; background: rgba(6,10,20,.55); border: 1px solid rgba(255,255,255,.14); padding: 4px 9px; }

/* centre play */
.p-big {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 78px; height: 78px; border: 1px solid rgba(255,255,255,.72);
  background: rgba(6,10,20,.26); color: #fff; font-size: 30px; line-height: 1;
  display: grid; place-items: center; backdrop-filter: blur(2px);
  box-shadow: 0 0 0 1px rgba(0,0,0,.28), 0 6px 26px rgba(0,0,0,.35);
  transition: opacity .2s var(--ease), transform .2s var(--ease), background-color .2s, border-color .2s;
}
.p-big:hover { background: rgba(6,10,20,.5); border-color: var(--accent); color: var(--accent); }
.p-big:active { transform: translate(-50%, -50%) scale(.95); }
.p-big[hidden] { display: none; }
.p-big span { display: block; margin-left: 5px; }   /* optical centring of ▶ */

/* scrub bar */
.p-scrub { position: relative; padding: 14px 0 10px; cursor: pointer; touch-action: none; }
.p-track { position: relative; height: 5px; background: rgba(255,255,255,.20); }
.p-part { position: absolute; top: 0; height: 5px; background: rgba(255,255,255,.34); }
.p-tot { position: absolute; top: 0; height: 5px; background: var(--accent); opacity: .55; }
.p-fill { position: absolute; top: 0; left: 0; height: 5px; background: #fff; }
.p-handle {
  position: absolute; top: 50%; width: 13px; height: 13px; margin: -6.5px 0 0 -6.5px;
  background: var(--accent); border: 1px solid rgba(0,0,0,.35);
  transition: transform .15s var(--ease);
}
.p-scrub:hover .p-handle, .p-scrub:focus-visible .p-handle { transform: scale(1.25); }
.p-ticks { position: absolute; inset: 0; pointer-events: none; }
.p-ticks i { position: absolute; top: -5px; width: 1px; height: 15px; background: rgba(255,255,255,.55); }
.p-ticks i::after {
  content: attr(data-l); position: absolute; top: -14px; left: 50%; transform: translateX(-50%);
  font-family: var(--mono); font-size: 9px; color: rgba(255,255,255,.7); letter-spacing: .06em;
}
.p-tip {
  position: absolute; bottom: 30px; transform: translateX(-50%); pointer-events: none;
  background: rgba(6,10,20,.9); border: 1px solid rgba(255,255,255,.2); color: #fff;
  font-family: var(--mono); font-size: 11px; padding: 3px 7px; white-space: nowrap; opacity: 0;
  transition: opacity .12s; font-variant-numeric: tabular-nums;
}
.p-scrub:hover .p-tip { opacity: 1; }

/* control row */
.p-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.p-row button, .p-row select {
  font-family: var(--mono); font-size: 12px; min-height: 34px; padding: 6px 11px;
  background: rgba(6,10,20,.5); color: #E8EEFA; border: 1px solid rgba(255,255,255,.18);
}
.p-row button:hover, .p-row select:hover { border-color: var(--accent); color: var(--accent); }
.p-row button[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); background: rgba(255,212,0,.10); }
.p-row .icn { font-size: 14px; padding: 6px 12px; }
.p-row .p-time { font-family: var(--mono); font-size: 12px; color: #C9D5E8; font-variant-numeric: tabular-nums; white-space: nowrap; padding-left: 4px; }
.p-row .gap { margin-left: auto; }
.p-more { margin-top: 7px; }
.p-more select, .p-more button { font-size: 11.5px; min-height: 30px; padding: 5px 9px; background: rgba(6,10,20,.42); }
.p-hint { font-family: var(--mono); font-size: 10.5px; color: rgba(201,213,232,.55); letter-spacing: .03em; align-self: center; }

/* ---------- data sheets ---------- */
.sheet { border: 1px solid var(--line-strong); background: var(--panel); align-self: start; }
.sheet h2 { font-size: 12px; font-weight: 600; font-family: var(--mono); letter-spacing: .07em; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.sheet h2 small { font-weight: 400; color: var(--faint); letter-spacing: 0; display: block; margin-top: 1px; }
.sheet dl { display: grid; grid-template-columns: 1fr 1fr; }
.sheet dl div { padding: 10px 14px; border-bottom: 1px solid var(--line); }
.sheet dt { font-family: var(--mono); font-size: 10px; letter-spacing: .07em; color: var(--faint); }
.sheet dd { font-size: 14px; font-variant-numeric: tabular-nums; }
.ptswrap { overflow-x: auto; }
.pts { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.pts th:first-child, .pts td:first-child { width: 12px; color: var(--faint); }
.pts th { font-family: var(--mono); font-size: 10px; text-align: left; color: var(--faint); letter-spacing: .05em; padding: 8px 5px; border-bottom: 1px solid var(--line); font-weight: 400; }
.pts th:first-child, .pts td:first-child { padding-left: 10px; }
.pts td { padding: 8px 5px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.pts tr.pt { cursor: pointer; transition: background-color .15s; }
.pts tr.pt:hover td { background: #F0F4FA; }
.pts tr.pt[aria-selected="true"] td { background: var(--accent-soft); }
.pts .mono { font-family: var(--mono); font-size: 12px; white-space: nowrap; }
.badge { font-family: var(--mono); font-size: 10px; padding: 1px 6px; border: 1px solid var(--ink); white-space: nowrap; }
.badge.T { background: var(--ink); color: #fff; }
.badge.A { background: var(--navy); color: #fff; border-color: var(--navy); }
.badge.P { background: transparent; }
.badge.N { border-color: var(--muted); color: var(--muted); }

/* ---------- map ---------- */
.mapbox { border: 1px solid var(--line-strong); background: var(--panel); margin-top: 24px; }
.mapbox h2 { font-size: 12px; font-weight: 600; font-family: var(--mono); letter-spacing: .07em; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.mapbox svg { display: block; width: 100%; height: auto; }
.mapnote { font-family: var(--mono); font-size: 11px; color: var(--muted); padding: 8px 14px 12px; }

/* ---------- about ---------- */
.about { margin: 0 0 64px; max-width: 76ch; }
.about summary { font-family: var(--mono); font-size: 13px; cursor: pointer; padding: 12px 0; border-bottom: 1px solid var(--line); }
.about summary:hover { color: var(--navy); }
.about p { color: var(--ink-2); font-size: 14px; margin: 10px 0; }
.about b { color: var(--ink); font-weight: 600; }

.loading { padding: 60px 0; font-family: var(--mono); color: var(--muted); }

/* ---------- small screens ---------- */
@media (max-width: 980px) { .evgrid { grid-template-columns: 1fr; } }
@media (max-width: 720px) {
  .topbar .wrap { gap: 10px; min-height: 50px; }
  .tb-nav { gap: 10px; }
  .tb-nav > a.hide-s { display: none; }
  .brand img { width: 40px; }
  .howto { grid-template-columns: 1fr; }
  .howto .step { border-left: 0; border-top: 1px solid var(--line); }
  .howto .step:first-child { border-top: 0; }
  .next { grid-template-columns: 10px 1fr; }
  .next .clock { border-left: 0; border-top: 1px solid var(--line); text-align: left; min-width: 0; }
  .yearblock { grid-template-columns: 1fr; }
  .yearblock .y { padding: 14px 0 0; position: static; }
  table.cat .best, table.cat th.h-best { display: none; }
  footer .wrap { grid-template-columns: 1fr; gap: 18px; }
  /* phone: the control deck sits under the picture instead of covering it */
  .p-stage { aspect-ratio: 4 / 3; }
  .p-bottom { position: static; padding: 0 10px 10px; background: #080D18; }
  .player:not(:fullscreen) .scrim-b { display: none; }
  .player.idle .p-bottom { opacity: 1; transform: none; }
  .p-row { gap: 6px; }
  .p-row button, .p-row select { min-height: 38px; font-size: 11.5px; padding: 6px 9px; }
  .p-row select { max-width: 46vw; }
  .p-row .gap { display: none; }
  .p-row .p-time { width: 100%; padding: 2px 0 0; order: 9; }
  .p-hint { display: none; }
  .p-big { width: 64px; height: 64px; font-size: 20px; }
  .p-phase span:nth-child(n+3) { display: none; }
  .p-place { font-size: 10px; }
}
