/* palette white-link-blue (Sheet and biro), type mona; the page reads as a set of figures and tables */
:root {
  --p-bg: #ffffff; --p-surface: #f4f4f4; --p-ink: #111111; --p-muted: #6b6b6b;
  --p-accent: #1a4be0; --p-accent-ink: #ffffff; --p-action: #1a4be0; --p-action-ink: #ffffff;
  --p-inv-bg: #111111; --p-inv-surface: #1e1e1e; --p-inv-ink: #ffffff; --p-inv-muted: #9a9a9a;
  --p-inv-accent: #ffffff; --p-inv-accent-ink: #111111; --p-inv-action: #ffffff; --p-inv-action-ink: #111111;
  --font-display: "Mona Sans", system-ui, sans-serif;
  --font-text: "Mona Sans", system-ui, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --display-weight: 500;
  --display-tracking: -0.03em;
  --display-tracking-xl: -0.04em;
  --display-stretch: 104%;
  --ly-scale: 0.96;

  --high: #1a4be0;
  --low: #d9480f;
  --range: #c3c8d0;
  --rule: #e2e4e8;
  --grid-line: #eef0f2;
  --ground-bg: #f4f4f4; --ground-ink: #111111; --ground-muted: #6b6b6b;
}

.num, .mono, .tbl td, .ystats dd, .kv dd, .meta dd, .axis-y, .axis-x, .months, .tooltip { font-variant-numeric: tabular-nums; }
.num, .mono { font-family: var(--font-mono); }
.is-high { color: var(--high); }
.is-low { color: var(--low); }
.link { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }

/* sections grow with their content: the first screen holds the whole instrument */
#top > section { height: auto; min-height: 0; padding: 0; }
#top > section > .wrap { height: auto; display: block; }
#top > section > .wrap.dash-grid { display: grid; margin-top: 0; }
#top > section.dash { padding: calc(var(--nav) + 16px) 0 var(--s-6); }
#top > section.band { padding: var(--s-7) 0; border-top: 1px solid var(--rule); }

/* ---------------------------------------------------------------- header strip */
.dash-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: var(--s-3) var(--s-5); padding-bottom: var(--s-3); border-bottom: 1px solid var(--ink); }
.dash-head > .meta { grid-column: 1 / -1; margin: 0; }
.dash-head h1 { font-size: clamp(26px, 1.2vw + 18px, 34px); line-height: 1.1; }
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: var(--s-2); }
.crumbs a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--rule); text-underline-offset: 3px; }
.meta { display: flex; flex-wrap: wrap; gap: var(--s-1) var(--s-5); margin: var(--s-3) 0 0; }
.meta dt { font-size: 13px; color: var(--muted); }
.meta dd { margin: 0; font: 400 13px/1.4 var(--font-mono); }
.dash-head__pick { display: grid; gap: 6px; width: min(100%, 440px); position: relative; }
.dash-head__pick .notice { position: absolute; top: 100%; right: 0; margin-top: 4px; }
.dash-head__pick label { font-size: 13px; color: var(--muted); }
.pick-row { display: flex; gap: var(--s-2); }
.station-select {
  flex: 1; min-width: 0; height: var(--btn-h); padding: 0 36px 0 12px; border: 1px solid var(--ink); border-radius: var(--r-sm);
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5l3 3 3-3' fill='none' stroke='%23111' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right 12px center;
  color: var(--ink); font: 400 15px var(--font-text); appearance: none; cursor: pointer;
}
.pick-row .btn { white-space: nowrap; }
.notice { font-size: 13px; color: var(--low); min-height: 0; }
.notice:empty { display: none; }

/* ---------------------------------------------------------------- grid and panels */
.dash-grid { display: grid; grid-template-columns: minmax(260px, 3fr) minmax(0, 9fr); gap: var(--s-4); margin-top: var(--s-4); align-items: start; }
.dash-grid--even { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); margin-top: 0; }
.dash-side, .dash-main, .records { display: grid; gap: var(--s-4); align-content: start; }
.panel-box { border: 1px solid var(--rule); border-radius: var(--r-md); padding: var(--s-3) var(--s-4) var(--s-4); background: #fff; }
.panel-box__head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s-3); padding-bottom: var(--s-2); margin-bottom: var(--s-3); border-bottom: 1px solid var(--rule); }
.panel-box__head h2 { font: 500 14px/1.3 var(--font-text); letter-spacing: 0; white-space: pre; }
.fig1 .panel-box__head h2, .fig2 .panel-box__head h2 { font: 600 22px/1.2 var(--font-display, var(--font-text)); letter-spacing: -0.01em; }
.panel-box__note { font-size: 13px; color: var(--muted); text-align: right; }

.king__count { display: flex; align-items: baseline; gap: var(--s-2); margin-bottom: var(--s-3); }
.king__count #kingDays { font: var(--display-weight) 56px/0.9 var(--font-display); letter-spacing: -0.04em; color: var(--high); font-variant-numeric: tabular-nums; }
.king__unit { font-size: 15px; color: var(--muted); }
.kv { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-2) var(--s-4); margin: 0; }
.kv dt { font-size: 13px; color: var(--muted); }
.kv dd { margin: 0; font: 500 15px/1.3 var(--font-mono); }
.king__later { margin-top: var(--s-3); padding-top: var(--s-2); border-top: 1px solid var(--rule); font: 400 13px/1.5 var(--font-mono); color: var(--muted); }

.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-weight: 500; font-size: 13px; color: var(--muted); padding: 0 8px 6px 0; border-bottom: 1px solid var(--rule); white-space: nowrap; }
.tbl td { padding: 6px 8px 6px 0; border-bottom: 1px solid var(--grid-line); vertical-align: middle; white-space: nowrap; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .r { text-align: right; padding-right: 0; }
.tbl td small { display: block; font: 400 12px/1.4 var(--font-mono); color: var(--muted); }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; background: var(--high); }
.dot.is-low { background: var(--low); }

/* ---------------------------------------------------------------- plots */
.plot { display: grid; grid-template-columns: 34px minmax(0, 1fr); }
.plot__area { position: relative; }
.plot__area > svg { position: absolute; left: 0; right: 0; top: 0; width: 100%; overflow: visible; }
.plot--48 .plot__area { height: 128px; margin-bottom: 22px; }
.plot--48 .plot__area > svg { height: 100%; }
.axis-y { position: relative; font: 400 12px var(--font-mono); color: var(--muted); }
.plot--48 .axis-y { height: 128px; }
.axis-y span { position: absolute; right: 8px; transform: translateY(-50%); }
.grid-lines line { stroke: var(--grid-line); stroke-width: 1; }
.grid-lines line.is-zero { stroke: var(--ink); stroke-opacity: .55; }
.axis-x { position: absolute; left: 0; right: 0; top: 100%; height: 20px; font: 400 12px var(--font-mono); color: var(--muted); }
.axis-x span { position: absolute; top: 4px; transform: translateX(-50%); white-space: nowrap; }
.axis-x span::before { content: ""; position: absolute; left: 50%; top: -6px; height: 4px; border-left: 1px solid var(--range); }
.curve__line { fill: none; stroke: var(--high); stroke-width: 2; }
.curve__fill { fill: rgb(26 75 224 / .07); }
.curve__now { stroke: var(--ink); stroke-width: 1; stroke-dasharray: 3 3; }
.plot__labels { position: absolute; inset: 0; pointer-events: none; }
.plot__labels span { position: absolute; font: 500 12px var(--font-mono); white-space: nowrap; transform: translate(-50%, calc(-100% - 5px)); color: var(--high); }
.plot__labels span.is-low { transform: translate(-50%, 5px); color: var(--low); }
.plot__labels span.now { top: 2px; transform: translate(6px, 0); color: var(--ink); background: #fff; padding: 0 3px; }

.legend { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--s-1) var(--s-4); font-size: 13px; color: var(--muted); }
.legend li { display: flex; align-items: center; gap: 6px; }
.key { width: 14px; height: 3px; background: var(--range); }
.key.is-high { background: var(--high); }
.key.is-low { background: var(--low); }
.moon-key { width: 8px; height: 8px; border-radius: 50%; border: 1px solid var(--ink); }
.moon-key.is-new { background: var(--ink); }

.plot--year .plot__area { height: 214px; cursor: crosshair; touch-action: pan-y; }
.plot--year .axis-y { height: 178px; margin-top: 14px; }
.plot--year .plot__area > svg { top: 14px; height: 178px; }
.moons { position: absolute; left: 0; right: 0; top: 0; height: 10px; }
.moons i { position: absolute; top: 0; width: 8px; height: 8px; margin-left: -4px; border-radius: 50%; border: 1px solid var(--ink); }
.moons i.is-new { background: var(--ink); }
.bar { fill: none; stroke-width: 2; }
.bar.is-range { stroke: var(--range); }
.bar.is-high { stroke: var(--high); }
.bar.is-low { stroke: var(--low); }
.hover-line { position: absolute; top: 14px; height: 178px; width: 1px; background: var(--ink); pointer-events: none; }
.tooltip { position: absolute; top: 24px; z-index: 2; pointer-events: none; white-space: nowrap; background: var(--ink); color: #fff; border-radius: var(--r-sm); padding: 8px 10px; font: 400 12px/1.6 var(--font-mono); }
.tooltip-date { font: 500 14px var(--font-text); }
.tooltip-moon { color: #b8b8b8; }
.months { position: absolute; left: 0; right: 0; top: 196px; height: 18px; font: 400 12px var(--font-mono); color: var(--muted); }
.months span { position: absolute; top: 0; overflow: hidden; white-space: nowrap; border-left: 1px solid var(--range); padding-left: 4px; }

.ystats { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: var(--s-3); margin: var(--s-3) 0 0; padding-top: var(--s-3); border-top: 1px solid var(--rule); }
.ystats dt { font-size: 13px; color: var(--muted); }
.ystats dd { margin: 2px 0 0; font: 500 17px/1.25 var(--font-mono); }
.ystats dd small { display: block; font: 400 12px var(--font-mono); color: var(--muted); }
#statMax { color: var(--high); }
#statMin { color: var(--low); }

/* ---------------------------------------------------------------- week, records */
.tbl--week td:first-child { width: 112px; }
.tbl--week .spark { width: 40%; padding-right: var(--s-4); }
.tbl--week .spark svg { width: 100%; height: 30px; display: block; overflow: visible; }
.tbl--week .spark path { fill: none; stroke: var(--high); stroke-width: 1.5; }
.spark__zero { stroke: var(--range); stroke-dasharray: 2 3; }
.tbl--week tr.is-today td { font-weight: 500; }
.tbl--week td { padding-top: 8px; padding-bottom: 8px; }
.tbl--rec td.big { font: 500 18px var(--font-mono); }
.tbl--rec.rec-high td.big { color: var(--high); }
.tbl--rec.rec-low td.big { color: var(--low); }
.tbl--rec td:first-child { width: 22px; }

/* ---------------------------------------------------------------- method */
.band__head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s-4); margin-bottom: var(--s-4); }
.band__head h2, .faq-col h2, .links-col h2 { font-size: 22px; letter-spacing: -0.02em; }
.method-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-5); }
.method { margin: 0; display: grid; gap: var(--s-3); align-content: start; }
.method .fig { width: 100%; height: auto; aspect-ratio: 340 / 196; border: 1px solid var(--rule); border-radius: var(--r-md); padding: var(--s-3); background: #fff; overflow: visible; }
.method figcaption { font-size: 14px; line-height: 1.55; color: var(--ink); }
.method figcaption b { font-weight: 500; }
.fig text { font: 400 11px var(--font-mono); fill: var(--muted); }
.fig__part { fill: none; stroke: var(--range); stroke-width: 1.5; }
.fig__main { fill: none; stroke: var(--high); stroke-width: 2; }
.fig__rule { stroke: var(--rule); }
.fig__datum line { stroke: var(--range); stroke-dasharray: 3 3; }
.fig__datum.is-zero line { stroke: var(--ink); stroke-dasharray: none; }
.fig__datum.is-zero text { fill: var(--ink); }
.fig__bar { fill: var(--range); }
.fig__bar.is-king { fill: var(--high); }
.fig__moon circle { fill: #fff; stroke: var(--ink); }
.fig__moon circle.is-new { fill: var(--ink); }

/* ---------------------------------------------------------------- questions, stations */
.faq-col > p { margin-top: var(--s-2); font-size: 14px; }
.faq-list { margin: var(--s-4) 0 0; display: grid; gap: var(--s-4); }
.faq-list dt { font-weight: 500; }
.faq-list dd { margin: 4px 0 0; font-size: 15px; line-height: 1.6; max-width: 66ch; }
.place-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: var(--s-5); margin-top: var(--s-3); }
.place-list a { display: flex; justify-content: space-between; gap: var(--s-3); padding: 7px 0; border-bottom: 1px solid var(--grid-line); font-size: 15px; }
.place-list a:hover, .article-list a:hover { color: var(--accent); }
.place-list .mono { font-size: 12px; }
.links-col__second { margin-top: var(--s-6); }
.article-list { margin-top: var(--s-3); display: grid; }
.article-list a { display: block; padding: 7px 0; border-bottom: 1px solid var(--grid-line); font-size: 15px; }

/* ---------------------------------------------------------------- footer */
.site-footer { border-top: 1px solid var(--ink); padding: var(--s-6) 0 var(--s-7); font-size: 14px; }
.site-footer__grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: var(--s-5); }
.site-footer__about p { margin-top: var(--s-3); color: var(--muted); max-width: 44ch; }
.site-footer ul { display: grid; gap: 6px; }
.site-footer a:hover { color: var(--accent); }
.site-footer__legal { grid-column: 1 / -1; color: var(--muted); font-size: 13px; padding-top: var(--s-4); border-top: 1px solid var(--rule); }

/* ---------------------------------------------------------------- narrower screens */
@media (max-width: 1100px) {
  .dash-grid, .dash-grid--even { grid-template-columns: minmax(0, 1fr); }
  .dash-side { grid-template-columns: 1fr 1fr; }
  .ystats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .dash-side { grid-template-columns: minmax(0, 1fr); }
  .method-grid { grid-template-columns: minmax(0, 1fr); }
  .ystats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .site-footer__grid { grid-template-columns: 1fr 1fr; }
  .site-footer__about { grid-column: 1 / -1; }
  .place-list { grid-template-columns: minmax(0, 1fr); }
  .tbl--week th:nth-child(4), .tbl--week td:nth-child(4), .tbl--week th:nth-child(6), .tbl--week td:nth-child(6) { display: none; }
  .tbl--week td:first-child { width: auto; }
  .months span:nth-child(even) { visibility: hidden; }
  .bar { stroke-width: 1; }
  .pick-row { flex-direction: column; }
  .dash-head { grid-template-columns: minmax(0, 1fr); }
  .dash-head__pick { width: 100%; }
  .legend { justify-content: flex-start; }
  .panel-box__head { flex-wrap: wrap; }
  .panel-box__note:not(:has(.legend)) { display: none; }
}

/* ---------------------------------------------------------------- text pages (state, articles, method):
   long reading, so their sections grow with their content instead of holding to one screen */
#top.doc-main > section.section { height: auto; min-height: 0; padding-bottom: var(--s-8); }
#top.doc-main > section.section > .wrap { height: auto; }
#top.doc-main > section.doc-hero { padding-top: calc(var(--nav) + var(--s-7)); }
#top.doc-main > section.doc-hero h1 { font-size: clamp(30px, 2vw + 20px, 48px); }
.doc-hero h1 { max-width: 18ch; }
.doc-hero .t-lead { max-width: 62ch; margin-top: var(--s-5); color: var(--muted); }
#top.doc-main > section.doc-section { padding-top: var(--s-6); }
.doc-section .section-head { margin-bottom: var(--s-6); }
.card-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gutter); }
.card-grid > a, .card-grid > article { display: grid; gap: var(--s-2); padding: var(--s-5); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); transition: transform var(--dur) var(--ease), border-color var(--dur) var(--ease); }
.card-grid > a:hover { transform: translateY(-2px); border-color: var(--line-strong); }
.card-grid .card-title { font-weight: 500; font-size: var(--t-card); }
.card-grid .card-meta { font: 400 13px var(--font-mono); color: var(--muted); }
.card-grid .card-text { color: var(--muted); font-size: var(--t-small); }
@media (max-width: 1023px) { .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 639px) { .card-grid { grid-template-columns: minmax(0, 1fr); } }

.prose { max-width: 68ch; font-size: 17px; line-height: 1.7; }
.prose > * + * { margin-top: var(--s-4); }
.prose h2 { font-size: clamp(26px, 1.2vw + 20px, 34px); margin-top: var(--s-8); }
.prose h3 { font-size: 22px; margin-top: var(--s-6); }
.prose h4 { margin-top: var(--s-5); }
.prose ul, .prose ol { padding-left: 1.3em; list-style: disc; }
.prose ol { list-style: decimal; }
.prose li + li { margin-top: var(--s-2); }
.prose a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.prose strong { font-weight: 500; color: var(--ink); }
.prose code { font: 400 0.9em var(--font-mono); background: var(--surface); padding: 2px 6px; border-radius: var(--r-sm); }
.prose pre { background: var(--surface); padding: var(--s-4); border-radius: var(--r-md); overflow-x: auto; }
.prose pre code { background: none; padding: 0; }
.prose blockquote { border-left: 2px solid var(--accent); padding-left: var(--s-4); color: var(--muted); }
.prose table { width: 100%; border-collapse: collapse; font-size: var(--t-small); }
.prose th, .prose td { text-align: left; padding: 10px 12px 10px 0; border-bottom: 1px solid var(--line); }
.prose th { font-weight: 500; color: var(--muted); }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: var(--s-7) 0; }
.prose img { border-radius: var(--r-md); }
.article-meta { font: 400 13px var(--font-mono); color: var(--muted); margin-top: var(--s-5); }
.panel-box { min-width: 0; }
.tbl .r { padding-left: 10px; }
@media (max-width: 760px) {
  .tbl--rec td:nth-child(3) { display: none; }
  .tbl--week th:nth-child(7), .tbl--week td:nth-child(7) { display: none; }
  .tbl--week .spark { width: auto; padding-right: 8px; }
  .tbl--week td:first-child span { display: block; font-size: 12px; }
  .axis-x span:nth-child(even) { display: none; }
  .plot__labels span.pt { font-size: 11px; }
  .dash-head h1 { font-size: 26px; }
  .meta { gap: var(--s-1) var(--s-4); }
}
.station-select { width: 100%; max-width: 100%; }
.dash-head__pick, .pick-row { min-width: 0; }
@media (max-width: 760px) { .pick-row .station-select { flex: none; } .band__head { flex-direction: column; } }
