/* THE NIGHT OFFICE — broadsheet stylesheet.
   The sky sets the palette: html[data-band] carries the twilight band
   computed from the sun's actual depression angle. No cards, no tiles;
   rules, columns, a masthead. Print has no rounded corners, so nothing
   here does either. */

:root {
  --ink: #ccd5e3;
  --ink-dim: rgba(204, 213, 227, 0.74);
  --ink-faint: rgba(204, 213, 227, 0.42);
  --hair: rgba(204, 213, 227, 0.20);
  --hair-strong: rgba(204, 213, 227, 0.34);
  --gold: #c9a648;
  --gold-dim: rgba(201, 166, 72, 0.55);
  --red: #c4523f;        /* set-event marks on dark paper */
  --red-deep: #a63a2b;   /* fills, larger shapes */
  --serif: 'EB Garamond', Georgia, 'Times New Roman', serif;
  --mono: 'IBM Plex Mono', 'SFMono-Regular', Menlo, monospace;
  --ease-ink: cubic-bezier(0.33, 0, 0.15, 1);
  --ease-swap: cubic-bezier(0.32, 0, 0.18, 1);
  --ease-hover: cubic-bezier(0.3, 0, 0.2, 1);
}

html[data-band="day"]      { --paper: #27314e; --star-alpha: 0; }
html[data-band="civil"]    { --paper: #1b2439; --star-alpha: 0.14; }
html[data-band="nautical"] { --paper: #151d2f; --star-alpha: 0.45; }
html[data-band="astro"]    { --paper: #0f1626; --star-alpha: 0.78; }
html[data-band="night"]    { --paper: #0a0f1b; --star-alpha: 1; }

* { margin: 0; padding: 0; box-sizing: border-box; border-radius: 0; }

html {
  background-color: var(--paper);
  transition: background-color 0.8s var(--ease-ink);
  scrollbar-color: var(--hair-strong) transparent;
}

body {
  font: 400 17.5px/1.62 var(--serif);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  position: relative;
}

/* faint press-room vignette, a printed depth rather than a glow */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse 120% 90% at 50% 12%, transparent 55%, rgba(0, 0, 0, 0.30) 100%);
  z-index: -1;
}

#stars {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -2;
  opacity: var(--star-alpha);
  transition: opacity 0.8s var(--ease-ink);
}

main, header.masthead, footer.colophon {
  width: min(1240px, 92vw);
  margin: 0 auto;
}

::selection { background: var(--gold); color: #0f1626; }

.skip {
  position: absolute;
  left: -9000px;
  top: 12px;
  background: var(--gold);
  color: #0f1626;
  padding: 8px 14px;
  font: 500 12px/1 var(--mono);
  letter-spacing: 0.08em;
  z-index: 10;
}
.skip:focus { left: 12px; }

a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--ink-faint); text-underline-offset: 3px; transition: text-decoration-color 0.18s var(--ease-hover); }
a:hover { text-decoration-color: var(--gold); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

/* ------------------------------ rules ------------------------------ */
.rule { border-top: 1px solid var(--hair); }
.rule-double { border-top: 3px double var(--hair-strong); }

.sect {
  display: flex;
  align-items: center;
  gap: 14px;
  font: 500 10.5px/1 var(--mono);
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--ink-dim);
  margin: 0 0 18px;
}
.sect::before, .sect::after {
  content: "";
  flex: 1;
  border-top: 1px solid var(--hair);
}
.sect span { display: inline-flex; align-items: center; gap: 10px; }
.sect span::before, .sect span::after {
  content: "";
  width: 5px; height: 5px;
  background: var(--hair-strong);
  transform: rotate(45deg);
}

/* ---------------------------- masthead ----------------------------- */
.masthead { padding-top: clamp(20px, 3.5vw, 44px); }

.motto {
  text-align: center;
  font-style: italic;
  font-size: 14.5px;
  color: var(--ink-dim);
  margin-bottom: clamp(14px, 2vw, 22px);
}

.ears {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 18px;
}

.ear {
  font: 400 10.5px/1.7 var(--mono);
  letter-spacing: 0.14em;
  color: var(--ink-dim);
  white-space: nowrap;
}
.ear-right { text-align: right; }

.title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(14px, 2.2vw, 28px);
  font-weight: 600;
  font-size: clamp(34px, 5.3vw, 70px);
  letter-spacing: 0.115em;
  text-transform: uppercase;
  line-height: 1;
  white-space: nowrap;
  color: var(--ink);
}
.title-word { text-shadow: 0 0 34px rgba(204, 213, 227, 0.14); }

.emblem { display: inline-flex; }
.emblem svg { width: clamp(50px, 6.2vw, 82px); height: auto; display: block; }

.rule-double { margin-top: clamp(16px, 2.4vw, 26px); }

.dateline {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 9px 2px 8px;
  font: 500 10.5px/1.5 var(--mono);
  letter-spacing: 0.18em;
  color: var(--ink-dim);
}
.dateline span { white-space: nowrap; }

.phase-sentence {
  text-align: center;
  font-style: italic;
  font-size: clamp(19px, 2.35vw, 27.5px);
  line-height: 1.42;
  padding: clamp(20px, 3vw, 34px) clamp(4px, 6vw, 90px);
  text-wrap: balance;
  color: var(--ink);
}
.phase-sentence .depth { color: var(--gold); font-style: italic; }

/* --------------------------- the instrument ------------------------ */
.instrument { margin-top: clamp(4px, 1vw, 10px); }

.scrub-wrap { padding: 2px 0 0; }

#scrubber {
  touch-action: none;
  cursor: ew-resize;
  user-select: none;
  -webkit-user-select: none;
}
#scrubber:focus-visible { outline-offset: 6px; }
#rail { display: block; width: 100%; height: 104px; }

.instr-caption {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  font: 400 11px/1.7 var(--mono);
  letter-spacing: 0.07em;
  color: var(--ink-faint);
  padding-top: 6px;
}
.instr-caption .hint { font-style: normal; }
.live-state { white-space: nowrap; color: var(--ink-dim); }
#live-state::before {
  content: "";
  display: inline-block;
  width: 6px; height: 6px;
  background: var(--gold);
  transform: rotate(45deg) translateY(-1px);
  margin-right: 8px;
}
#return-now {
  background: none;
  border: 1px solid var(--gold-dim);
  color: var(--gold);
  font: 500 10.5px/1 var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 5px 10px 4px;
  margin-left: 10px;
  cursor: pointer;
  transition: background-color 0.18s var(--ease-hover), color 0.18s var(--ease-hover);
}
#return-now:hover { background-color: var(--gold); color: #0f1626; }

/* ------------------------- countdown standfirst -------------------- */
.countdown {
  text-align: center;
  font-style: italic;
  font-size: clamp(16.5px, 1.7vw, 20px);
  color: var(--ink-dim);
  padding: clamp(18px, 2.6vw, 30px) 24px 0;
  text-wrap: balance;
}

/* ------------------------------ sheet ------------------------------ */
.sheet {
  display: grid;
  gap: 0 56px;
  margin-top: clamp(30px, 4.5vw, 56px);
  grid-template-columns: minmax(0, 1.72fr) minmax(0, 0.98fr);
  grid-template-areas:
    "lead  aside"
    "queue queue";
  align-items: start;
}
.lead-wrap { grid-area: lead; }
.queue-wrap { grid-area: queue; margin-top: clamp(38px, 5vw, 64px); }
.rail-right { grid-area: aside; border-left: 1px solid var(--hair); padding-left: clamp(26px, 3vw, 44px); }

/* essays */
.essay h3 {
  font-weight: 600;
  font-size: 21px;
  line-height: 1.2;
  letter-spacing: 0.012em;
  text-wrap: balance;
  margin-bottom: 2px;
}
.filed {
  font: 500 9.5px/2 var(--mono);
  letter-spacing: 0.22em;
  color: var(--ink-faint);
  text-transform: uppercase;
  margin-bottom: 8px;
}
.essay p { text-wrap: pretty; }

#lead-slot .essay { opacity: 1; transition: opacity 0.32s var(--ease-swap); }
#lead-slot .essay.swapping { opacity: 0; }
#lead-slot .kicker {
  font: 600 10.5px/1 var(--mono);
  letter-spacing: 0.3em;
  color: var(--gold);
  text-transform: uppercase;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}
#lead-slot .kicker::after { content: ""; flex: 1; border-top: 1px solid var(--hair); }
#lead-slot .essay h3 {
  font-size: clamp(30px, 3.4vw, 44px);
  font-weight: 600;
  line-height: 1.08;
  margin-bottom: 6px;
}
#lead-slot .filed { margin-bottom: 16px; }
#lead-slot .essay p {
  font-size: clamp(18.5px, 1.55vw, 21px);
  line-height: 1.66;
}
#lead-slot .essay p:not(.filed):not(.kicker)::first-letter {
  font-size: 3.05em;
  float: left;
  line-height: 0.83;
  padding: 5px 12px 0 0;
  font-weight: 500;
  color: var(--gold);
}

.queue { columns: 3; column-gap: 52px; column-rule: 1px solid var(--hair); }
.queue .essay {
  break-inside: avoid;
  padding-bottom: 22px;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--hair);
}
.queue .essay:last-child { border-bottom: none; }
.queue .essay h3 { font-size: 20.5px; }
.queue .essay p { font-size: 15.8px; line-height: 1.6; color: var(--ink-dim); }

/* live values inside essays read as annotations */
[data-val] { color: var(--gold); font-style: inherit; }

/* --------------------------- right rail ---------------------------- */
.rail-right section { margin-bottom: clamp(30px, 3.6vw, 46px); }
.rail-right section:last-child { margin-bottom: 0; }

.moon-fig { display: flex; gap: 22px; align-items: flex-start; }
.moon-col { display: flex; flex-direction: column; align-items: center; gap: 12px; }
#moon-large svg { width: clamp(104px, 10vw, 138px); height: auto; display: block; }
#moon-rose svg { width: 78px; height: 78px; display: block; }
.rose-cap {
  font: 400 8.5px/1.4 var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  text-align: center;
}

.moon-data { font: 400 12.5px/1.9 var(--mono); flex: 1; min-width: 0; }
.moon-data > div { display: flex; justify-content: space-between; gap: 10px; border-bottom: 1px solid var(--hair); padding: 2px 0; }
.moon-data > div:last-child { border-bottom: none; }
.moon-data dt { color: var(--ink-faint); letter-spacing: 0.1em; font-size: 10px; text-transform: uppercase; padding-top: 4px; white-space: nowrap; }
.moon-data dd { text-align: right; color: var(--ink); white-space: nowrap; }

table.eph {
  width: 100%;
  border-collapse: collapse;
  font: 400 12.5px/1.5 var(--mono);
  font-variant-numeric: tabular-nums;
}
table.eph th {
  font-size: 9.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 500;
  color: var(--ink-faint);
  text-align: left;
  padding: 0 0 7px;
  border-bottom: 1px solid var(--hair-strong);
}
table.eph th.t-num, table.eph td.t-num { text-align: right; }
table.eph td { padding: 6.5px 0; border-bottom: 1px solid var(--hair); vertical-align: baseline; }
table.eph tr:last-child td { border-bottom: none; }
table.eph td + td, table.eph th + th { padding-left: 14px; }
table.eph .event { color: var(--ink-dim); }
table.eph .never { color: var(--ink-faint); font-style: italic; }

.pip {
  display: inline-block;
  width: 6px; height: 6px;
  transform: rotate(45deg);
  margin: 0 7px 1px 0;
}
.pip.rise { background: var(--ink-dim); }
.pip.set { background: var(--red); }

table.planets td.verdict { color: var(--ink-dim); font-size: 12px; }
table.planets td.now-col { font-size: 12px; }
table.planets .below { color: var(--ink-faint); font-style: italic; }

.foot-note {
  font-size: 13.5px;
  font-style: italic;
  color: var(--ink-faint);
  margin-top: 12px;
  text-wrap: pretty;
}

.locate-line { font-size: 15px; font-style: italic; color: var(--ink-dim); margin-bottom: 12px; text-wrap: pretty; }
.locate-btn {
  background: none;
  border: 1px solid var(--hair-strong);
  color: var(--ink);
  font: 500 11px/1 var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 9px 14px 8px;
  cursor: pointer;
  transition: border-color 0.18s var(--ease-hover), color 0.18s var(--ease-hover);
}
.locate-btn:hover { border-color: var(--gold); color: var(--gold); }
.locate-btn[disabled] { opacity: 0.55; cursor: default; }

/* ---------------------------- prospect ----------------------------- */
.prospect-sect { margin-top: clamp(40px, 5.5vw, 72px); }
.prospect-sub {
  text-align: center;
  font-style: italic;
  font-size: 15px;
  color: var(--ink-dim);
  margin-bottom: 16px;
  text-wrap: balance;
}
#prospect { display: block; width: 100%; height: auto; }

/* ---------------------------- colophon ----------------------------- */
.colophon {
  margin-top: clamp(46px, 6vw, 84px);
  padding-bottom: 72px;
  text-align: center;
}
.colophon .rule-double { margin-bottom: 26px; }
.colo-title {
  font: 500 10.5px/1.9 var(--mono);
  letter-spacing: 0.22em;
  color: var(--ink-dim);
  margin-bottom: 14px;
}
.colophon p { font-size: 14.5px; color: var(--ink-faint); max-width: 640px; margin: 0 auto 9px; text-wrap: pretty; }
.colophon code { font: 400 12px/1 var(--mono); color: var(--gold); }
.colo-fiction { font-style: italic; padding-top: 10px; }

/* ----------------------------- mobile ------------------------------ */
@media (max-width: 999px) {
  .sheet {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "lead" "aside" "queue";
    gap: 0;
  }
  .rail-right {
    border-left: none;
    padding-left: 0;
    border-top: 3px double var(--hair-strong);
    margin-top: 34px;
    padding-top: 30px;
  }
  .queue-wrap { margin-top: 38px; }
  .queue { columns: 1; }
  .ears { grid-template-columns: 1fr; }
  .ear { display: none; }
  .title {
    flex-direction: column;
    gap: 14px;
    letter-spacing: 0.14em;
    font-size: clamp(36px, 11vw, 46px);
    white-space: normal;
  }
  .emblem svg { width: 60px; }
  .dateline { flex-wrap: wrap; justify-content: center; row-gap: 2px; }
  .price { display: none; }
  .instr-caption { flex-direction: column; gap: 4px; }
  #rail { height: 112px; }
  .moon-fig { gap: 16px; }
  body { font-size: 16.5px; }
}

@media (max-width: 430px) {
  .title { font-size: clamp(32px, 10.2vw, 42px); gap: 12px; }
  .emblem svg { width: 54px; }
}

/* --------------------------- keeper's guide ------------------------- */
.guide-page .masthead .title { font-size: clamp(30px, 4.2vw, 54px); }
.guide-page .masthead .emblem svg { width: clamp(44px, 4.6vw, 64px); }

.guide-prose { max-width: 720px; margin: 0 auto; }
.guide-prose p { margin-bottom: 14px; text-wrap: pretty; }
.guide-prose section { margin-top: clamp(40px, 5vw, 64px); }
.guide-prose .sect { margin-bottom: 22px; }

.guide-page pre {
  font: 400 12px/1.65 var(--mono);
  color: var(--ink-dim);
  border-top: 1px solid var(--hair);
  border-bottom: 1px solid var(--hair);
  padding: 16px 2px;
  margin: 18px 0 8px;
  overflow-x: auto;
  tab-size: 2;
}
.guide-page pre .c { color: var(--ink-faint); font-style: italic; }
.guide-page pre .g { color: var(--gold); }
.guide-page code { white-space: nowrap; }
.excerpt-src {
  font: 400 10px/1 var(--mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 22px;
}

table.claims { margin: 12px 0 6px; }
table.claims td:first-child { color: var(--ink-dim); }

.month-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 10px;
  justify-content: center;
  margin: 20px 0 6px;
}
.month-strip figure { text-align: center; }
.month-strip svg { width: 34px; height: 34px; display: block; }
.month-strip figcaption {
  font: 400 8.5px/2.2 var(--mono);
  letter-spacing: 0.08em;
  color: var(--ink-faint);
}

.guide-page .kv { font: 400 12.5px/2 var(--mono); }
.guide-page .kv b { font-weight: 500; color: var(--gold); }
.back-line { text-align: center; margin-top: clamp(36px, 5vw, 60px); font-style: italic; }

/* ------------------------- reduced motion --------------------------- */
@media (prefers-reduced-motion: reduce) {
  html, #stars, #lead-slot .essay, a, #return-now, .locate-btn {
    transition: none !important;
  }
}
