/* SUN ALMANACK — a warm ground, and the light in it.
 *
 * The moon's pages are night glass: one pale object, hairlines, a glow that follows the phase.
 * This is the other kind of looking. The ground is paper, and its temperature is computed from
 * the sun's height where the reader is — cold before dawn, rose at the horizon, cream at noon.
 * The ink never changes, so the page never fights its own contrast. --field and the glow are
 * set by assets/sun.js; everything here is the fallback.
 */

@font-face { font-family: "Newsreader"; src: url("/assets/fonts/newsreader.woff2") format("woff2"); font-weight: 200 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Inter"; src: url("/assets/fonts/inter.woff2") format("woff2"); font-weight: 300 700; font-style: normal; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("/assets/fonts/plexmono-400.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("/assets/fonts/plexmono-500.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }

:root {
  --field: #f3e3cd;              /* set by JS from the sun's height */
  --glow: rgba(240, 190, 110, 0.0);
  --glow-x: 50%;
  --glow-y: 34%;

  --ink: #3a1410;                /* oxblood, not black */
  --ink-2: #58261d;
  --mute: #8a6b52;
  --gold: #b98428;
  --ember: #a3341a;
  --rule: rgba(58, 20, 16, 0.16);
  --rule-strong: rgba(58, 20, 16, 0.34);

  --serif: "Newsreader", "Iowan Old Style", Georgia, serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --measure: 62ch;
  --max: 1180px;
  --gut: 26px;
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  background: var(--field);
  overflow-x: clip;
}

body {
  margin: 0;
  background: var(--field);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.58;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  transition: background-color 1.2s ease;
}

/* the warmth, pooling where the sun is */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(58vw 46vw at var(--glow-x) var(--glow-y), var(--glow), transparent 68%);
  z-index: 0;
}

main, header, footer { position: relative; z-index: 1; }

/* links are the site's ember wherever they appear, not the browser's blue */
a { color: var(--ember); text-decoration: none; }
a:hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }

/* ---- masthead ---- */

.masthead {
  max-width: var(--max);
  margin: 0 auto;
  padding: 38px var(--gut) 0;
  border-bottom: 1px solid var(--rule-strong);
}
.masthead__top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  padding-bottom: 16px;
}
.wordmark {
  font-weight: 300;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  line-height: 0.92;
  margin: 0;
  font-size: clamp(26px, 3.6vw, 40px);
  color: var(--ink);
  text-decoration: none;
  display: block;
}
.wordmark span { display: block; }
.volume {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  color: var(--mute);
  padding-bottom: 4px;
}

.nav {
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 0 0 14px;
}
.nav a { color: var(--mute); text-decoration: none; }
.nav a:hover { color: var(--ember); }
.nav a[aria-current="page"] { color: var(--ink); border-bottom: 1px solid var(--gold); padding-bottom: 2px; }

/* ---- the hour: the season, spoken ---- */

.hour {
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(34px, 5vw, 62px) var(--gut) clamp(26px, 4vw, 44px);
}
.hour--split {
  display: grid;
  grid-template-columns: minmax(0, 30ch) minmax(0, 1fr);
  gap: clamp(28px, 5vw, 64px);
  align-items: start;
}
.hour__text { max-width: 62ch; }
.hour--split .hour__text { max-width: 34ch; }
.hour:not(.hour--split) .season { font-size: clamp(34px, 5vw, 64px); max-width: 18ch; }
.hour__figure { margin: 0; }
.hour__figure canvas { display: block; width: 100%; height: auto; }
.hour__figure figcaption {
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.6;
  color: var(--mute);
  margin-top: 10px;
  max-width: 46ch;
}
.hour__figure figcaption a { color: var(--ember); text-decoration: none; border-bottom: 1px solid var(--rule-strong); }

.greet {
  font-family: var(--sans);
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ember);
  margin: 0 0 18px;
}
.kicker {
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--mute);
  margin: 0 0 16px;
}

.season {
  font-weight: 300;
  font-size: clamp(38px, 6.4vw, 82px);
  line-height: 0.98;
  letter-spacing: -0.02em;
  margin: 0 0 26px;
  color: var(--ink);
  text-wrap: balance;
}

.para {
  font-size: clamp(19px, 2.1vw, 23px);
  line-height: 1.5;
  color: var(--ink-2);
  margin: 0 0 20px;
  max-width: 40ch;
}

.turn {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--mute);
  margin: 30px 0 0;
  padding-top: 18px;
  border-top: 1px solid var(--rule);
}
.turn b { color: var(--ember); font-weight: 500; }

/* ---- the strip ---- */

.strip {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gut) clamp(30px, 5vw, 52px);
}
.strip__head {
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--mute);
  font-weight: 400;
  margin: 0 0 14px;
}

.strip dl {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 1px;
  margin: 0;
  border-top: 1px solid var(--rule-strong);
  border-bottom: 1px solid var(--rule-strong);
  background: var(--rule);
}
.strip dl > div {
  background: var(--field);
  padding: 16px 14px 18px;
}
.strip dt {
  font-family: var(--sans);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--mute);
  margin-bottom: 8px;
}
.strip dd {
  margin: 0;
  font-family: var(--mono);
  font-size: clamp(15px, 1.5vw, 19px);
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.where,
.prose .where {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--mute);
  margin: 14px 0 0;
}
.place {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--gold);
  padding: 0 14px 1px 0;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--mute) 50%),
                    linear-gradient(135deg, var(--mute) 50%, transparent 50%);
  background-position: right 6px center, right 2px center;
  background-size: 4px 4px, 4px 4px;
  background-repeat: no-repeat;
  max-width: 100%;
}
.place:hover { color: var(--ember); }
.place:focus-visible { outline: 1px solid var(--ember); outline-offset: 2px; }

/* ---- figures ---- */

.figure {
  max-width: var(--max);
  margin: 0 auto clamp(34px, 6vw, 64px);
  padding: 0 var(--gut);
}
.figure canvas { display: block; width: 100%; height: auto; }
.figure figcaption {
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.6;
  color: var(--mute);
  margin-top: 12px;
  max-width: 62ch;
}
.figure figcaption a { color: var(--ember); text-decoration: none; border-bottom: 1px solid var(--rule-strong); }

/* ---- cards ---- */

.links {
  max-width: var(--max);
  margin: 0 auto clamp(50px, 8vw, 90px);
  padding: 0 var(--gut);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  background: var(--rule);
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.card {
  display: block;
  background: var(--field);
  padding: 26px 24px 30px;
  text-decoration: none;
  color: inherit;
}
.card:hover h2 { color: var(--ember); }
.card__label {
  font-family: var(--sans);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--mute);
  margin: 0 0 10px;
}
.card h2 {
  font-weight: 300;
  font-size: clamp(20px, 2.4vw, 27px);
  line-height: 1.15;
  margin: 0 0 10px;
}
.card p:last-child { margin: 0; color: var(--ink-2); font-size: 16px; max-width: 40ch; }

/* ---- prose ---- */

.prose {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gut) clamp(50px, 8vw, 90px);
}
.prose h2 {
  font-weight: 300;
  font-size: clamp(24px, 2.6vw, 32px);
  line-height: 1.1;
  margin: 48px 0 14px;
  max-width: 22ch;
}
.prose p {
  font-size: 18px;
  line-height: 1.68;
  color: var(--ink-2);
  max-width: var(--measure);
  margin: 0 0 18px;
}
.prose code { font-family: var(--mono); font-size: 13px; }
.prose a { color: var(--ember); }

.prose blockquote {
  margin: 30px 0 32px;
  padding: 2px 0 2px 22px;
  border-left: 2px solid var(--gold);
  max-width: 56ch;
}
.prose blockquote p {
  font-size: clamp(19px, 2vw, 22px);
  line-height: 1.55;
  color: var(--ink);
  margin: 0;
  max-width: none;
}
.prose blockquote cite {
  display: block;
  margin-top: 12px;
  font-family: var(--mono);
  font-size: 11px;
  font-style: normal;
  line-height: 1.6;
  color: var(--mute);
}
.smallcaps { font-variant: small-caps; letter-spacing: 0.05em; }

.note,
.prose .note {
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.7;
  color: var(--mute);
  max-width: 68ch;
  margin: 16px 0 0;
  letter-spacing: 0.01em;
}
.reg,
.prose .reg {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--mute);
  margin: 0 0 18px;
}

/* ---- tables ---- */

.weeks {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--mono);
  font-size: 13px;
  margin: 8px 0 0;
}
.weeks th {
  text-align: left;
  font-family: var(--sans);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 400;
  color: var(--mute);
  padding: 10px 12px 10px 0;
  border-bottom: 1px solid var(--rule-strong);
}
.weeks td {
  padding: 11px 12px 11px 0;
  border-bottom: 1px solid var(--rule);
  color: var(--ink-2);
}
.weeks .num { text-align: right; font-variant-numeric: tabular-nums; }
.weeks tbody tr:hover td { color: var(--ink); }

/* ---- the dark half ---- */

.darkhalf { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule-strong); }
.darkhalf li {
  display: grid;
  grid-template-columns: minmax(90px, 130px) minmax(0, 1fr);
  gap: 24px;
  padding: 22px 0 24px;
  border-bottom: 1px solid var(--rule);
}
.dh__date {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--ember);
  padding-top: 3px;
}
.darkhalf h3 {
  font-weight: 400;
  font-size: 21px;
  margin: 0 0 8px;
}
.darkhalf p {
  margin: 0;
  font-size: 17px;
  line-height: 1.66;
  color: var(--ink-2);
  max-width: 58ch;
}

/* ---- footer ---- */

footer {
  max-width: var(--max);
  margin: 0 auto;
  padding: 26px var(--gut) 46px;
  border-top: 1px solid var(--rule-strong);
  display: flex;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--mute);
}

/* ---- small screens ---- */

@media (max-width: 860px) {
  .hour { grid-template-columns: 1fr; gap: 26px; }
  .strip dl { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .links { grid-template-columns: 1fr; }
  .hour__text, .para { max-width: none; }
  .darkhalf li { grid-template-columns: 1fr; gap: 6px; }
  .nav { gap: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  body { transition: none; }
}

@media print {
  body::before { display: none; }
  .masthead, .nav, footer { display: none; }
  body { background: #fff; font-size: 12pt; }
}

/* ---- the essay: a margin to read against ---------------------------------
 * Long-form pages get a narrow margin column carrying the section numbers and the
 * register marks, and a text column of 58ch. Below 900px the margin folds into the
 * heading and everything is one column again.
 */
.hour--essay,
.essay {
  --margin-col: 8.5rem;
}
.hour--essay {
  /* the title block sits over the text column, with the margin empty beside it */
  max-width: calc(58ch + var(--margin-col) + 2.5rem);
  padding-left: calc(var(--gut) + var(--margin-col));
}
.essay {
  counter-reset: sec;
  max-width: calc(58ch + var(--margin-col) + 2.5rem);
  margin: 0 auto;
  padding: 0 var(--gut) clamp(50px, 8vw, 90px) calc(var(--gut) + var(--margin-col));
  position: relative;
}
.essay > p,
.essay .note {
  max-width: 58ch;
}

.essay h2 {
  position: relative;
  counter-increment: sec;
  margin: 64px 0 16px;
  padding-top: 26px;
  border-top: 1px solid var(--rule);
  font-size: clamp(23px, 2.5vw, 30px);
  max-width: 22ch;
}
.essay h2::before {
  content: counter(sec, upper-roman);
  position: absolute;
  left: calc(var(--margin-col) * -1 - 0.75rem);
  top: 0.55em;
  width: calc(var(--margin-col) + 0.75rem);
  text-align: right;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--ember);
}

/* the register line is a standfirst, not marginalia — the margin is kept for the numbers */
.essay .reg {
  margin: 0 0 10px;
  font-size: 9.5px;
  line-height: 1.6;
  letter-spacing: 0.1em;
  max-width: 46ch;
}

/* the published nulls are apparatus: give them a rule so they read as an aside */
.essay .note {
  border-left: 2px solid var(--rule-strong);
  padding: 2px 0 2px 16px;
  margin: 26px 0 30px;
}

.essay blockquote {
  margin: 34px 0 36px;
  padding: 4px 0 4px 24px;
  border-left: 2px solid var(--gold);
  max-width: 52ch;
}
.essay blockquote p { font-size: clamp(18px, 1.9vw, 21px); line-height: 1.55; }
.essay blockquote cite { margin-top: 14px; }

.essay table.weeks { max-width: 58ch; }

/* the lede, and the cap that says: settle in */
.hour--essay .para {
  font-size: clamp(20px, 2.3vw, 24px);
  line-height: 1.45;
  color: var(--ink-2);
}
.hour--essay .para::first-letter {
  float: left;
  font-size: 3.15em;
  line-height: 0.82;
  padding: 0.08em 0.1em 0 0;
  color: var(--ember);
  font-weight: 300;
}

@media (max-width: 900px) {
  .hour--essay { max-width: none; padding-left: var(--gut); }
  .essay {
    padding-left: var(--gut);
    padding-right: var(--gut);
  }
  .essay h2 { padding-top: 20px; margin-top: 48px; }
  .essay h2::before {
    position: static;
    display: block;
    width: auto;
    text-align: left;
    margin-bottom: 6px;
  }

  .essay blockquote { max-width: none; }
}

/* the printed pamphlet */
@media print {
  .essay { max-width: none; padding: 0; }
  .essay h2 { break-after: avoid; }
  .essay h2::before { color: #6b4a2f; }
  .essay blockquote { break-inside: avoid; }
  .essay .note { border-left: 1px solid #999; }
}

/* ---- plates, in the text column ------------------------------------------ */
.plate {
  margin: 34px 0 40px;
  max-width: 40ch;
}
.plate img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--rule-strong);
  background: #fff;
}
.plate figcaption {
  font-family: var(--mono);
  font-size: 10.5px;
  line-height: 1.65;
  color: var(--mute);
  margin-top: 12px;
  max-width: 46ch;
}

/* the wheel: our own drawing, so it can be used as a figure */
.plate--mark {
  margin: 44px auto 48px;
  max-width: 22rem;
  text-align: center;
}
.plate--mark img { border: 0; background: none; margin: 0 auto; width: 132px; }
.plate--mark figcaption { margin: 18px auto 0; max-width: 40ch; }
