:root {
  --bg: #f5f2ea;
  --surface: #fffdf8;
  --surface-2: #eeeadf;
  --line: #e1dbcc;
  --line-strong: #cfc7b4;
  --ink: #1b2133;
  --ink-2: #4b5367;
  --ink-3: #868b98;
  --accent: #a36d12;
  --accent-soft: #f4e5c4;
  --accent-ink: #fffaf0;
  --indigo: #33417c;
  --indigo-soft: #e1e4f3;
  --t-common: #e6e1d4;
  --t-long: #9ea9d8;
  --t-full: #3a4888;
  --moon-full: #aab1c2;
  --sun: #b8433a;
  --shadow: 0 1px 2px rgb(27 33 51 / 0.06), 0 6px 24px rgb(27 33 51 / 0.07);
  --radius: 14px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1220;
    --surface: #151c2e;
    --surface-2: #1d2539;
    --line: #262f47;
    --line-strong: #36405c;
    --ink: #ebe7dc;
    --ink-2: #b4b8c6;
    --ink-3: #7c8296;
    --accent: #e5b45a;
    --accent-soft: #3b3122;
    --accent-ink: #1a1408;
    --indigo: #a9b5f0;
    --indigo-soft: #232c4a;
    --t-common: #232b41;
    --t-long: #4b5a9c;
    --t-full: #9fb0ff;
    --moon-full: #e4e2d8;
    --sun: #f08a7e;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 8px 28px rgb(0 0 0 / 0.25);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0d1220;
  --surface: #151c2e;
  --surface-2: #1d2539;
  --line: #262f47;
  --line-strong: #36405c;
  --ink: #ebe7dc;
  --ink-2: #b4b8c6;
  --ink-3: #7c8296;
  --accent: #e5b45a;
  --accent-soft: #3b3122;
  --accent-ink: #1a1408;
  --indigo: #a9b5f0;
  --indigo-soft: #232c4a;
  --t-common: #232b41;
  --t-long: #4b5a9c;
  --t-full: #9fb0ff;
  --moon-full: #e4e2d8;
  --sun: #f08a7e;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 8px 28px rgb(0 0 0 / 0.25);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 var(--sans);
  font-variant-numeric: tabular-nums;
  overflow-x: hidden;
}

a { color: var(--indigo); text-decoration-thickness: 1px; text-underline-offset: 2px; }
button { font: inherit; color: inherit; }
code, .mono { font-family: var(--mono); font-size: 0.92em; }
.muted { color: var(--ink-3); }
.nw { white-space: nowrap; }
.small { font-size: 13px; }

.wrap { max-width: 1200px; margin: 0 auto; padding: 0 16px; }

/* ---- Masthead ---------------------------------------------------------- */

.masthead { border-bottom: 1px solid var(--line); background: var(--surface); }
.masthead-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 14px; padding-bottom: 14px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; min-width: 0; }
.brand-mark { width: 38px; height: 38px; flex: none; }
.brand-mark .sun { fill: var(--accent); }
.brand-mark .moon { fill: var(--indigo); }
.brand-title { display: block; font-family: var(--serif); font-size: 21px; font-weight: 600; letter-spacing: 0.005em; line-height: 1.2; }
.brand-sub { display: block; color: var(--ink-3); font-size: 13px; }

.today-chip {
  display: inline-flex; align-items: baseline; gap: 10px; padding: 7px 14px;
  border: 1px solid var(--line-strong); border-radius: 999px; background: var(--bg); cursor: pointer;
}
.today-chip:hover { border-color: var(--accent); }
.today-label { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }
.today-date { font-weight: 500; }

/* ---- Toolbar ----------------------------------------------------------- */

.toolbar { position: sticky; top: 0; z-index: 20; border-bottom: 1px solid var(--line); }
/* The blur lives on a pseudo-element: backdrop-filter on the toolbar itself clips its popovers. */
.toolbar::before { content: ""; position: absolute; inset: 0; z-index: -1; background: color-mix(in srgb, var(--bg) 88%, transparent); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.toolbar-inner { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; padding-top: 10px; padding-bottom: 10px; }

.segmented { display: inline-flex; justify-self: start; padding: 3px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); }
.segmented button { border: 0; background: transparent; padding: 6px 14px; border-radius: 7px; cursor: pointer; color: var(--ink-2); font-weight: 500; }
.segmented button.is-on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgb(0 0 0 / 0.12); }

.stepper { display: flex; align-items: center; gap: 6px; }
.stepper-title { margin: 0; min-width: 170px; text-align: center; font-family: var(--serif); font-size: 19px; font-weight: 600; white-space: nowrap; }
.stepper-title .mono { font-family: var(--mono); font-size: 16px; font-weight: 500; }

.toolbar-end { display: flex; justify-self: end; align-items: center; gap: 8px; }

.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 9px;
  border: 1px solid var(--line-strong); background: var(--surface); cursor: pointer; padding: 0;
}
.icon-btn:hover { border-color: var(--ink-3); }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
#themeBtn svg { fill: currentColor; stroke: none; }
#settings svg circle { fill: var(--surface); }
.stepper.is-static .icon-btn { visibility: hidden; }

.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border-radius: 9px;
  border: 1px solid var(--line-strong); background: var(--surface); cursor: pointer;
  color: var(--ink); text-decoration: none; font-weight: 500; font-size: 14px; list-style: none; white-space: nowrap;
}
.btn:hover { border-color: var(--ink-3); }
.btn::-webkit-details-marker { display: none; }
.btn.primary { background: var(--indigo); border-color: var(--indigo); color: var(--surface); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- Go-to panel ------------------------------------------------------- */

.pop { position: relative; }
.pop > summary { list-style: none; }
.pop > summary::-webkit-details-marker { display: none; }
.pop[open] > summary { border-color: var(--ink-3); background: var(--surface-2); }
.pop-panel {
  position: absolute; right: 0; top: calc(100% + 8px); width: min(460px, calc(100vw - 32px));
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px; display: grid; gap: 18px; z-index: 30;
}
.goto-form { display: grid; gap: 10px; }
.goto-form + .goto-form { border-top: 1px solid var(--line); padding-top: 16px; }
.goto-head { font-weight: 600; font-size: 14px; }
.goto-head .muted { font-weight: 400; font-size: 12px; display: block; }
.fields { display: grid; gap: 8px; }
.fields-mp { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.9fr) minmax(0, 0.8fr); }
.fields-ce { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 1.4fr) minmax(0, 0.8fr); }
.fields label { display: grid; gap: 3px; font-size: 12px; color: var(--ink-2); min-width: 0; }
.fields input, .fields select {
  -webkit-appearance: none; appearance: none; display: block;
  width: 100%; min-width: 0; height: 38px; margin: 0; padding: 0 10px; border-radius: 8px;
  border: 1px solid var(--line-strong); background-color: var(--bg); color: var(--ink);
  font: inherit; font-size: 14px; line-height: 36px;
}
.fields input[type="number"] { -moz-appearance: textfield; padding-right: 4px; }
.fields input::-webkit-inner-spin-button { height: 26px; }
.fields select {
  padding-right: 28px; text-overflow: ellipsis; white-space: nowrap; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%);
  background-position: calc(100% - 15px) 16px, calc(100% - 10px) 16px;
  background-size: 5px 5px; background-repeat: no-repeat;
}
.fields input:focus, .fields select:focus { outline: none; border-color: var(--indigo); box-shadow: 0 0 0 3px color-mix(in srgb, var(--indigo) 22%, transparent); }
.goto-form .btn { justify-self: start; }

.settings-panel { width: min(320px, calc(100vw - 32px)); }
.settings-panel fieldset { border: 0; margin: 0; padding: 0; display: grid; gap: 8px; }
.settings-panel legend { float: left; width: 100%; font-weight: 600; font-size: 14px; margin-bottom: 0; padding: 0; }
.opt { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.opt:has(input:checked) { border-color: var(--indigo); background: var(--indigo-soft); }
.opt input { margin: 3px 0 0; accent-color: var(--indigo); }
.opt b { display: block; font-weight: 600; font-size: 14px; }
.settings-panel fieldset + fieldset { border-top: 1px solid var(--line); padding-top: 14px; }
.seg-opts.seg-2 { grid-template-columns: repeat(2, 1fr); }
.seg-opts { display: grid; grid-template-columns: repeat(3, 1fr); padding: 3px; gap: 3px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); }
.seg-opts label { position: relative; cursor: pointer; }
.seg-opts input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg-opts span { display: block; text-align: center; padding: 6px 4px; border-radius: 7px; font-size: 13.5px; font-weight: 500; color: var(--ink-2); }
.seg-opts input:checked + span { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgb(0 0 0 / 0.12); }
.seg-opts input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }
.opt small { display: block; color: var(--ink-3); font-family: var(--mono); font-size: 12px; }
.form-msg { margin: 0; min-height: 0; font-size: 13px; color: var(--sun); }
.form-msg:empty { display: none; }

/* ---- View header ------------------------------------------------------- */

main { padding-top: 28px; padding-bottom: 24px; }

.view-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px 32px; flex-wrap: wrap; margin-bottom: 18px; }
.head-main { min-width: 0; flex: 1 1 380px; }
.head-side { flex: 0 1 320px; }
.eyebrow { margin: 0 0 4px; color: var(--ink-3); font-size: 12.5px; letter-spacing: 0.04em; text-transform: uppercase; font-weight: 600; }
.eyebrow a { color: inherit; }
.view-title { margin: 0; font-family: var(--serif); font-weight: 600; font-size: clamp(30px, 5vw, 44px); line-height: 1.1; letter-spacing: -0.01em; }
.view-title .mono { font-family: var(--mono); font-weight: 500; font-size: 0.8em; letter-spacing: -0.02em; }
.view-title .title-year { color: var(--ink-3); font-size: 0.5em; margin-left: 6px; }
.view-meta { margin: 10px 0 0; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; color: var(--ink-2); }
.view-span { margin: 6px 0 0; color: var(--ink-2); }
.view-note { margin: 8px 0 0; color: var(--ink-3); max-width: 60ch; }
.callout { margin: 0 0 8px; padding: 10px 12px; border-radius: 10px; background: var(--accent-soft); color: var(--ink); font-size: 14px; }

.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); }
.badge.t-common { background: var(--t-common); }
.badge.t-long { background: var(--t-long); color: #fff; border-color: transparent; }
.badge.t-full { background: var(--t-full); color: var(--surface); border-color: transparent; }

/* ---- Legend ------------------------------------------------------------ */

.legend { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--ink-3); font-size: 12.5px; }
.legend li { display: inline-flex; align-items: center; gap: 6px; }
.lg { display: inline-block; width: 12px; height: 12px; border-radius: 3px; }
.lg-today { background: var(--accent); border-radius: 50%; }
.lg-new { border: 1.5px solid var(--ink-2); border-radius: 50%; }
.lg-full { background: var(--moon-full); border-radius: 50%; }
.lg-ce { width: auto; height: auto; font-size: 10px; color: var(--ink-3); }
.lg-ce::before { content: "12"; }
.lg-now { background: transparent; box-shadow: inset 0 0 0 2px var(--accent); }
.lg.t-common { background: var(--t-common); }
.lg.t-long { background: var(--t-long); }
.lg.t-full { background: var(--t-full); }
.legend-types { margin: 8px 0 0; }

/* ---- Cycle strip (year view) ------------------------------------------ */

.cycle { flex: 0 1 360px; min-width: 0; }
.cycle-head { display: flex; justify-content: space-between; font-size: 12.5px; font-weight: 600; margin-bottom: 6px; color: var(--ink-2); }
.cycle-head .muted { font-weight: 400; }
.cycle-strip { display: grid; grid-template-columns: repeat(20, 1fr); gap: 3px; }
.cy { aspect-ratio: 1; border: 0; padding: 0; border-radius: 3px; cursor: pointer; min-width: 0; }
.cy:hover, .ey:hover { outline: 2px solid var(--ink-2); outline-offset: 0; }
.cy.is-now, .ey.is-now { box-shadow: inset 0 0 0 2px var(--accent); }
.cy.is-cur, .ey.is-cur { outline: 2px solid var(--ink); outline-offset: 1px; z-index: 1; }
.t-common { background: var(--t-common); }
.t-long { background: var(--t-long); }
.t-full { background: var(--t-full); }

/* ---- Year grid --------------------------------------------------------- */

.year-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(262px, 1fr)); gap: 14px; }

.month-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 12px 10px; box-shadow: var(--shadow); }
.month-card.is-current { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); }
.month-card.is-meton { background: linear-gradient(var(--accent-soft), var(--surface) 70px); }
.month-card header { display: flex; flex-direction: column; gap: 1px; padding: 0 4px 8px; }
.m-link { display: flex; align-items: baseline; gap: 8px; color: inherit; text-decoration: none; }
.m-link:hover .m-name { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.m-num { font-family: var(--mono); font-size: 12px; color: var(--ink-3); min-width: 1.4em; }
.m-name { font-family: var(--serif); font-size: 18px; font-weight: 600; }
.m-meta { font-size: 12px; color: var(--ink-3); padding-left: calc(1.4em + 8px); }

.mini { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.mini .wd { text-align: center; font-size: 10.5px; font-weight: 600; color: var(--ink-3); padding-bottom: 3px; text-transform: uppercase; letter-spacing: 0.03em; }
.wd.is-sun { color: var(--sun); }

.d {
  position: relative; border: 0; background: transparent; cursor: pointer; border-radius: 7px;
  padding: 3px 0 2px; display: flex; flex-direction: column; align-items: center; line-height: 1.15; min-width: 0;
}
.d:hover { background: var(--surface-2); }
.d-mp { font-size: 14px; font-weight: 500; }
.d-ce { font-size: 9.5px; color: var(--ink-3); }
.d-ce b { font-weight: 700; color: var(--ink-2); }
.d.is-sun .d-mp { color: var(--sun); }
.d.ph-full::after, .d.ph-new::after {
  content: ""; position: absolute; top: 3px; right: 3px; width: 6px; height: 6px; border-radius: 50%;
}
.d.ph-full::after { background: var(--moon-full); }
.d.ph-new::after { border: 1.3px solid var(--ink-2); width: 4px; height: 4px; }
.d.is-today { background: var(--accent); }
.d.is-today .d-mp, .d.is-today .d-ce, .d.is-today .d-ce b { color: var(--accent-ink); }
.d.is-sel { box-shadow: inset 0 0 0 2px var(--indigo); }
.d.is-today.is-sel { box-shadow: inset 0 0 0 2px var(--accent-ink), 0 0 0 2px var(--indigo); }

/* ---- Month view -------------------------------------------------------- */

.pills { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 12px; scrollbar-width: thin; }
.pill { flex: none; padding: 5px 11px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); text-decoration: none; font-size: 13px; }
.pill:hover { border-color: var(--ink-3); }
.pill.is-cur { background: var(--ink); color: var(--bg); border-color: var(--ink); }

.month-grid {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px;
  background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
}
.month-grid .wd { background: var(--surface-2); padding: 8px 10px; font-size: 12px; font-weight: 600; color: var(--ink-2); text-transform: uppercase; letter-spacing: 0.05em; }
.month-grid .wd.is-sun { color: var(--sun); }
.wd-short { display: none; }
.month-grid .pad { background: color-mix(in srgb, var(--surface) 55%, var(--bg)); }
.d.big {
  background: var(--surface); border-radius: 0; min-height: 104px; padding: 8px 10px;
  align-items: stretch; justify-content: space-between; text-align: left;
}
.d.big:hover { background: color-mix(in srgb, var(--surface-2) 70%, var(--surface)); }
.c-top { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; }
.d.big .d-mp { font-family: var(--serif); font-size: 26px; font-weight: 600; line-height: 1; }
.d.big .d-ce { font-size: 12px; white-space: nowrap; }
.d.big .d-ce.is-first { color: var(--ink); font-weight: 700; }
.d.big::after { display: none; }
.c-moon { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--ink-2); }
.moon-ico { flex: none; width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.moon-ico.full { background: var(--moon-full); box-shadow: 0 0 0 3px color-mix(in srgb, var(--moon-full) 22%, transparent); }
.moon-ico.new { border: 1.6px solid var(--ink-2); }
.d.big.is-today { background: var(--accent-soft); }
.d.big.is-today .d-mp { color: var(--accent); }
.d.big.is-today .d-ce { color: var(--ink-2); }
.d.big.is-today .c-top::after { content: "Today"; position: absolute; left: 10px; top: 40px; font-size: 10.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); }
.d.big.is-sel { box-shadow: inset 0 0 0 2px var(--indigo); }
.d.big.is-today.is-sel { box-shadow: inset 0 0 0 2px var(--indigo); }

/* ---- Era view ---------------------------------------------------------- */

.era-legend { flex-direction: column; gap: 4px; margin: 0; }
.era-scroll { overflow-x: auto; padding: 4px 2px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.era-grid { display: grid; gap: 2px; padding: 10px 12px; min-width: max-content; }
.era-row { display: flex; align-items: center; gap: 10px; }
.era-label { flex: none; width: 88px; display: flex; justify-content: space-between; align-items: baseline; font-size: 11px; }
.era-label b { font-family: var(--mono); font-weight: 600; color: var(--ink-2); }
.era-label small { color: var(--ink-3); font-size: 10.5px; }
.era-cols { display: grid; grid-template-columns: repeat(60, 13px); gap: 2px; }
.era-head .era-cols span { font-size: 9.5px; color: var(--ink-3); text-align: center; overflow: visible; white-space: nowrap; }
.era-row:nth-child(6n + 1):not(.era-head) { margin-bottom: 4px; }
.ey { width: 13px; height: 13px; border: 0; padding: 0; border-radius: 2px; cursor: pointer; position: relative; }

/* ---- Day card ---------------------------------------------------------- */

.day-card {
  position: fixed; z-index: 40; width: 320px; max-width: calc(100vw - 32px);
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius);
  box-shadow: 0 12px 40px rgb(0 0 0 / 0.18); padding: 14px 16px;
}
.day-card.is-hover { pointer-events: none; animation: fade 0.12s ease-out; }
.day-card.is-sheet { left: 16px; right: 16px; bottom: 16px; width: auto; max-width: 420px; margin: 0 auto; animation: pop 0.16s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(8px); } }
@keyframes fade { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .day-card.is-hover, .day-card.is-sheet { animation: none; } }
.card-hint { margin: 10px 0 0; padding-top: 8px; border-top: 1px solid var(--line); font-size: 12px; color: var(--ink-3); }
.day-card .close { position: absolute; top: 10px; right: 10px; width: 30px; height: 30px; border: 0; background: transparent; }
.day-card .eyebrow { text-transform: none; letter-spacing: 0; font-family: var(--mono); font-weight: 500; }
.today-tag { color: var(--accent); font-family: var(--sans); font-weight: 700; text-transform: uppercase; font-size: 11px; letter-spacing: 0.06em; }
.day-card h3 { margin: 0 0 10px; font-family: var(--serif); font-size: 22px; font-weight: 600; line-height: 1.2; }
.day-card dl { display: grid; grid-template-columns: auto 1fr; gap: 5px 14px; margin: 0; font-size: 13.5px; }
.day-card dt { color: var(--ink-3); }
.day-card dd { margin: 0; }
.day-card dd .muted { font-size: 12px; margin-left: 4px; white-space: nowrap; }
.card-actions { margin-top: 14px; display: flex; gap: 8px; }

.day-card.is-sheet h3 { margin-right: 32px; }

/* ---- Events view ------------------------------------------------------- */

.pills-wrap { flex-wrap: wrap; overflow: visible; }
.pills button.pill { font: inherit; font-size: 13px; cursor: pointer; }
.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.events { width: 100%; border-collapse: collapse; font-size: 14px; }
.events th, .events td { text-align: left; vertical-align: top; padding: 10px 14px; }
.events thead th { background: var(--surface-2); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-2); border-bottom: 1px solid var(--line); }
.events tbody tr + tr td { border-top: 1px solid var(--line); }
.events .ev-group th {
  padding: 16px 14px 8px; font-family: var(--serif); font-size: 17px; font-weight: 600; color: var(--accent);
  background: linear-gradient(var(--bg), var(--surface)); border-top: 1px solid var(--line);
}
.events tbody tr:first-child.ev-group th { border-top: 0; }
.events tbody tr:not(.ev-group):hover td { background: color-mix(in srgb, var(--surface-2) 45%, var(--surface)); }
.events small { display: block; color: var(--ink-3); font-size: 12px; margin-top: 2px; }
.ev-title { font-weight: 500; width: 36%; }
.ev-mp a { color: var(--ink); font-weight: 600; text-decoration: none; border-bottom: 1px dashed var(--line-strong); }
.ev-mp a:hover { color: var(--indigo); border-bottom-color: var(--indigo); }
.ev-mp, .ev-ce { white-space: nowrap; }
.ev-moon { color: var(--ink-2); font-size: 13px; white-space: nowrap; }
.ev-moon .moon-ico { vertical-align: -1px; margin-right: 6px; }
.cal-tag { display: inline-block; margin-left: 4px; padding: 0 6px; border-radius: 5px; font-size: 11px; font-weight: 600; background: var(--surface-2); color: var(--ink-3); vertical-align: 1px; }
.cal-tag.cal-J { background: var(--accent-soft); color: var(--accent); }

@media (max-width: 900px) {
  .events thead { display: none; }
  .events, .events tbody, .events tr, .events td, .events th { display: block; width: auto; }
  .events tbody tr:not(.ev-group) { padding: 10px 14px; }
  .events tbody tr + tr td { border-top: 0; }
  .events tbody tr + tr:not(.ev-group) { border-top: 1px solid var(--line); }
  .events td { padding: 2px 0; white-space: normal; }
  .events td.ev-title { font-size: 15px; padding-bottom: 6px; }
  .events td:not(.ev-title)::before { content: attr(data-label); display: inline-block; width: 92px; color: var(--ink-3); font-size: 12px; }
  .events td:not(.ev-title) small { margin-left: 92px; }
}

/* ---- About ------------------------------------------------------------- */

.about { padding-top: 28px; padding-bottom: 48px; border-top: 1px solid var(--line); margin-top: 24px; }
.about h2 { font-family: var(--serif); font-size: 26px; font-weight: 600; margin: 0 0 16px; }
.about-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px 32px; }
.about h3 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--accent); margin: 0 0 6px; }
.about p, .about li { color: var(--ink-2); max-width: 62ch; }
.about p { margin: 0 0 10px; }
.about ol { padding-left: 20px; margin: 0 0 10px; }
.about var { font-family: var(--serif); font-style: italic; color: var(--ink); }
.about code { background: var(--surface-2); padding: 1px 5px; border-radius: 5px; }
.sources { margin-top: 18px !important; font-size: 13px; color: var(--ink-3) !important; max-width: none !important; }

/* ---- Responsive -------------------------------------------------------- */

@media (max-width: 860px) {
  .toolbar-inner { display: flex; flex-wrap: wrap; align-items: center; }
  .toolbar-end { margin-left: auto; }
  .stepper { order: 3; flex: 1 0 100%; justify-content: space-between; }
  .stepper-title { flex: 1; min-width: 0; }
  .toolbar-inner { position: relative; }
  .pop { position: static; }
  .pop-panel { left: 16px; right: 16px; width: auto; max-width: 520px; margin-left: auto; top: calc(100% - 4px); }
}

@media (max-width: 640px) {
  body { font-size: 14.5px; }
  .brand-title { font-size: 18px; }
  .brand-sub { display: none; }
  .today-chip { width: 100%; justify-content: center; }
  .segmented button { padding: 6px 11px; }
  main { padding-top: 18px; }
  .year-grid { grid-template-columns: 1fr; }
  .cycle { flex-basis: 100%; }
  .wd-long { display: none; }
  .wd-short { display: inline; }
  .month-grid .wd { padding: 6px 4px; text-align: center; font-size: 11px; }
  .d.big { min-height: 64px; padding: 5px 5px; }
  .d.big .d-mp { font-size: 18px; }
  .d.big .d-ce { font-size: 10px; }
  .c-top { flex-direction: column; gap: 2px; }
  .c-moon-t { display: none; }
  .d.big.is-today .c-top::after { display: none; }
}
