/* The Almanac of Returning Things.
   Paper and lamp-black, with one rubric red, as in a printed almanac.
   At night (dark mode) the page turns to ink-blue with a pale moon. */

@font-face { font-family: "EB Garamond"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("fonts/eb-garamond-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "EB Garamond"; font-style: italic; font-weight: 400; font-display: swap;
  src: url("fonts/eb-garamond-latin-400-italic.woff2") format("woff2"); }
@font-face { font-family: "EB Garamond"; font-style: normal; font-weight: 600; font-display: swap;
  src: url("fonts/eb-garamond-latin-600-normal.woff2") format("woff2"); }

:root {
  --paper: #f4efe4;
  --paper-2: #ebe3d2;
  --ink: #221e19;
  --ink-soft: #5d554a;
  --rule: #c9bea8;
  --rubric: #a8321e;
  --moon-lit: #fbf6e8;
  --moon-dark: #2b2721;
  --measure: 38rem;
  --serif: "EB Garamond", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #121725;
    --paper-2: #1a2133;
    --ink: #e6e0d2;
    --ink-soft: #a29c90;
    --rule: #34405a;
    --rubric: #e9846d;
    --moon-lit: #f3ecd6;
    --moon-dark: #252d42;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.1875rem;
  line-height: 1.55;
  font-variant-numeric: oldstyle-nums proportional-nums;
}
a { color: inherit; text-decoration-color: var(--rubric); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { color: var(--rubric); }
:focus-visible { outline: 2px solid var(--rubric); outline-offset: 2px; }

/* ---------- masthead ---------- */
.masthead {
  max-width: 64rem; margin: 0 auto; padding: 1.5rem 1rem 0.75rem;
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.5rem 2rem;
  border-bottom: 3px double var(--rule);
}
.wordmark { font-size: 1.25rem; text-decoration: none; letter-spacing: 0.01em; display: inline-flex; align-items: center; gap: 0.55rem; }
.wordmark em { color: var(--rubric); }
.ring { width: 1.05rem; height: 1.05rem; border: 1.5px solid var(--rubric); border-radius: 50%;
  background: linear-gradient(90deg, transparent 50%, var(--rubric) 50%); flex: none; }
nav { display: flex; flex-wrap: wrap; gap: 0.25rem 1.1rem; font-variant: small-caps; letter-spacing: 0.06em; font-size: 1.05rem; }
nav a { text-decoration: none; color: var(--ink-soft); }
nav a[aria-current="page"] { color: var(--ink); text-decoration: underline; text-decoration-color: var(--rubric); }

/* ---------- body text ---------- */
main { max-width: 64rem; margin: 0 auto; padding: 1.5rem 1rem 3rem; }
.prose { max-width: var(--measure); }
h1, h2, h3 { font-weight: 400; line-height: 1.15; }
h1 { font-size: clamp(2.2rem, 6vw, 3.4rem); margin: 1.5rem 0 0.5rem; letter-spacing: -0.01em; }
h2 { font-size: 1.7rem; margin: 2.5rem 0 0.5rem; }
h2::before { content: "❧ "; color: var(--rubric); }
h3 { font-size: 1.25rem; font-style: italic; margin: 1.75rem 0 0.25rem; }
.kicker { font-variant: small-caps; letter-spacing: 0.08em; color: var(--rubric); margin: 0; font-size: 1.05rem; }
.lede { font-size: 1.35rem; color: var(--ink-soft); max-width: var(--measure); margin-top: 0; }
p.dropcap::first-letter { float: left; font-size: 3.4em; line-height: 0.85; padding: 0.06em 0.08em 0 0; color: var(--rubric); }
.note { font-size: 1rem; color: var(--ink-soft); }
code, .mono { font-family: var(--mono); font-size: 0.82em; font-variant-numeric: lining-nums tabular-nums; }
.num { font-variant-numeric: lining-nums tabular-nums; }
hr { border: 0; border-top: 1px solid var(--rule); margin: 2.5rem 0; }

/* ---------- the day's panel ---------- */
.day {
  display: grid; gap: 0; margin: 1.5rem 0 1rem;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink);
}
.cell { padding: 1.1rem 1.1rem 1.25rem; border-right: 1px solid var(--rule); }
.cell:last-child { border-right: 0; }
@media (max-width: 34rem) { .cell { border-right: 0; border-bottom: 1px solid var(--rule); padding-inline: 0; } .cell:last-child { border-bottom: 0; } }
.cell h2 { font-size: 1.05rem; margin: 0 0 0.6rem; font-variant: small-caps; letter-spacing: 0.08em; color: var(--rubric); }
.cell h2::before { content: none; }
.big { font-size: 1.9rem; line-height: 1.1; margin: 0.2rem 0 0.4rem; }
.cell p { margin: 0.25rem 0; }
.cell .sub { color: var(--ink-soft); font-size: 1rem; }
.cell .more { font-size: 1rem; margin-top: 0.6rem; }
.moon-row { display: flex; align-items: center; gap: 1rem; }

.moon .moon-dark { fill: var(--moon-dark); }
.moon .moon-lit { fill: var(--moon-lit); }
.moon { flex: none; filter: drop-shadow(0 0 0.5px var(--ink)); }

/* ---------- contents ---------- */
.chapters { list-style: none; padding: 0; margin: 1rem 0; display: grid; gap: 0 2rem; grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); }
.chapters li { border-top: 1px solid var(--rule); padding: 0.9rem 0 1rem; }
.chapters a { font-size: 1.35rem; }
.chapters .roman { color: var(--rubric); font-variant: small-caps; margin-right: 0.4rem; }
.chapters p { margin: 0.2rem 0 0; color: var(--ink-soft); font-size: 1.02rem; }

/* ---------- controls ---------- */
.controls { display: flex; flex-wrap: wrap; gap: 0.75rem 1.25rem; align-items: center; margin: 1rem 0; }
label { font-variant: small-caps; letter-spacing: 0.05em; }
input[type="number"], select {
  font: inherit; font-variant-numeric: lining-nums; color: var(--ink); background: var(--paper-2);
  border: 1px solid var(--rule); border-radius: 2px; padding: 0.15rem 0.4rem; width: 6.5rem;
}
select { width: auto; }
input[type="range"] { accent-color: var(--rubric); width: min(22rem, 100%); }
button {
  font: inherit; font-variant: small-caps; letter-spacing: 0.05em; color: var(--paper); background: var(--ink);
  border: 0; border-radius: 2px; padding: 0.2rem 0.8rem; cursor: pointer;
}
button:hover { background: var(--rubric); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; max-width: 100%; }
table { border-collapse: collapse; font-variant-numeric: lining-nums tabular-nums; margin: 1rem 0; }
th, td { padding: 0.3rem 0.9rem 0.3rem 0; text-align: left; border-bottom: 1px solid var(--rule); vertical-align: baseline; }
th { font-weight: 400; font-variant: small-caps; letter-spacing: 0.05em; color: var(--ink-soft); }
td.r, th.r { text-align: right; }
tr.hit td { color: var(--rubric); }

.working { font-size: 1rem; }
.working td:first-child { font-family: var(--mono); font-size: 0.85rem; color: var(--rubric); }
.working td:nth-child(2) { font-family: var(--mono); font-size: 0.82rem; color: var(--ink-soft); }
.working td:last-child { text-align: right; }

/* ---------- figures ---------- */
figure { margin: 1.5rem 0; }
figcaption { font-size: 1rem; color: var(--ink-soft); margin-top: 0.4rem; max-width: var(--measure); }
svg.chart { width: 100%; height: auto; display: block; font-family: var(--serif); }
svg.chart .axis { stroke: var(--rule); stroke-width: 1; }
svg.chart .grid { stroke: var(--rule); stroke-width: 0.5; stroke-dasharray: 2 3; }
svg.chart text { fill: var(--ink-soft); font-size: 13px; }
svg.chart .line { fill: none; stroke: var(--ink); stroke-width: 2; }
svg.chart .line.ref { stroke: var(--ink-soft); stroke-width: 1; stroke-dasharray: 4 3; }
svg.chart .today { stroke: var(--rubric); stroke-width: 1.25; }
svg.chart .dot { fill: var(--rubric); }
svg.chart .bar { fill: var(--ink); }
svg.chart .bar.hit { fill: var(--rubric); }
svg.chart .bar.march { fill: var(--ink-soft); }

.month { display: grid; grid-template-columns: repeat(7, 1fr); gap: 0.25rem; max-width: 34rem; margin: 1rem 0; }
.month .dow { text-align: center; font-variant: small-caps; color: var(--ink-soft); font-size: 0.95rem; }
.month .d { text-align: center; padding: 0.35rem 0 0.25rem; border-top: 1px solid var(--rule); font-size: 0.95rem; font-variant-numeric: lining-nums; }
.month .d svg { display: block; margin: 0.2rem auto 0; width: 70%; max-width: 2.4rem; height: auto; }
.month .d.today { border-top: 2px solid var(--rubric); color: var(--rubric); }
.month .d.blank { border-top-color: transparent; }

/* ---------- footer ---------- */
.colophon { max-width: 64rem; margin: 0 auto; padding: 1.25rem 1rem 2.5rem; border-top: 3px double var(--rule); font-size: 1rem; color: var(--ink-soft); }
.colophon p { margin: 0.25rem 0; max-width: 46rem; }
.working td .note { font-family: var(--serif); font-size: 0.95rem; }
