/* Moon Today (Tool 16, prefix mt-) — the instrument (the Moon and its data layer), the scrubber and the static phase table.
   Loaded through the `styles:` list in moon-hub.njk, so it sits in <head>, BEFORE the tool kit's inline <style> blocks.
   Rules are scoped `.mt .x`; where one restyles a kit class it carries one more class than the kit's `.tk .x`, so it outranks it.
   Depends on tokens.css, partials/tool-kit-css.njk and partials/result-kit-css.njk.

   Language: data as aesthetic. The Moon is geometry (SVG, redrawn on every step), the numbers are 800-weight and tabular, the
   accent is Lunar Cyan on the night surface (#0B1020). No photograph, no emoji, no gradient beyond one soft halo behind the disc. */
.tk.mt {
  --tk-accent: var(--accent-moon, #0284C7);
  --night: var(--bg-ink, #0B1020);
  --night-raised: var(--bg-ink-raised, #141B30);
  --night-text: #F8FAFC;
  --night-muted: #94A3B8;
  --night-soft: #CBD5E1;
  --night-line: rgba(248, 250, 252, 0.14);
  --glow: #38BDF8;
  --glow-soft: #7DD3FC;
}
.tk.mt > * + * { margin-top: 16px; }
.tk.mt > .tk-head { margin-bottom: 20px; }
.tk.mt > .tk-head + * { margin-top: 0; }
.tk.mt > .sr-only { margin: 0; }

/* ================= Hero: the Moon and its data layer ================= */
.mt .mt-hero { container: mt / inline-size; position: relative; overflow: hidden; border-radius: var(--r-card); background: var(--night); color: var(--night-text); padding: 20px 16px 16px; scroll-margin-top: 80px; }
@media (min-width: 720px) { .mt .mt-hero { padding: 32px 40px 24px; } }
.mt .mt-hero::before { content: ""; position: absolute; left: -20%; top: -30%; width: 90%; aspect-ratio: 1; background: radial-gradient(closest-side, rgba(56, 189, 248, 0.14), rgba(56, 189, 248, 0)); pointer-events: none; }
.mt .mt-hero > * { position: relative; }
.mt .mt-hero[data-ready="false"] .mt-data > *:not(.mt-phase) { visibility: hidden; }
.mt .mt-hero :focus-visible { outline: 3px solid color-mix(in srgb, var(--glow) 60%, transparent); outline-offset: 2px; border-radius: 6px; }
.mt .mt-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; }
.mt .mt-eyebrow { margin: 0; font-size: 0.8125rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--glow-soft); }
.mt .mt-view { display: inline-flex; padding: 3px; border: 1px solid var(--night-line); border-radius: 999px; background: rgba(248, 250, 252, 0.04); }
.mt .mt-view button { min-height: 36px; padding: 0 14px; border: 0; border-radius: 999px; background: none; font: inherit; font-size: 0.8125rem; font-weight: 700; color: var(--night-muted); cursor: pointer; transition: background 0.15s, color 0.15s; }
.mt .mt-view button:hover { color: var(--night-text); }
.mt .mt-view button[aria-pressed="true"] { background: rgba(248, 250, 252, 0.14); color: var(--night-text); }

.mt .mt-stage { display: grid; gap: 22px; margin-top: 18px; align-items: center; }
@container mt (min-width: 640px) { .mt .mt-stage { grid-template-columns: minmax(0, 0.9fr) minmax(0, 1fr); gap: 44px; } }
.mt .mt-orb { margin: 0 auto; width: min(100%, 440px); aspect-ratio: 1; }
.mt .mt-orb svg { display: block; width: 100%; height: auto; filter: drop-shadow(0 0 44px rgba(56, 189, 248, 0.16)); }
.mt .md-rim { stroke: rgba(248, 250, 252, 0.28); stroke-width: 1; }
.mt .md-mare { fill: rgba(11, 16, 32, 0.17); }
.mt .md-tycho { fill: rgba(255, 255, 255, 0.55); }

/* the data layer */
.mt .mt-data { min-width: 0; }
.mt .mt-chip { display: inline-flex; align-items: center; gap: 8px; min-height: 32px; margin: 0; padding: 4px 12px 4px 10px; border-radius: 999px; border: 1px solid var(--night-line); background: rgba(248, 250, 252, 0.06); font-size: 0.875rem; font-weight: 700; }
.mt .mt-chip b { color: var(--glow-soft); letter-spacing: 0.06em; text-transform: uppercase; font-size: 0.8125rem; }
.mt .mt-chip span:last-child { font-weight: 600; color: var(--night-muted); }
.mt .mt-chip-ico { display: inline-grid; width: 16px; height: 16px; }
.mt .mt-chip-ico svg { width: 16px; height: 16px; fill: none; stroke: var(--glow); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.mt .mt-phase { margin-top: 12px; font-size: clamp(2.125rem, 1.2rem + 4vw, 3.75rem); font-weight: 800; letter-spacing: -0.04em; line-height: 1; text-wrap: balance; }
.mt .mt-illum { display: flex; align-items: baseline; gap: 4px; margin: 14px 0 0; font-weight: 800; font-size: clamp(5.5rem, 30cqw, 11rem); line-height: 0.82; letter-spacing: -0.07em; color: var(--glow); text-shadow: 0 0 60px rgba(56, 189, 248, 0.34); }
.mt .mt-pct-sign { font-size: 0.36em; font-weight: 800; letter-spacing: 0; color: var(--night-soft); text-shadow: none; }
.mt .mt-illum-l { margin: 8px 0 0; font-size: 0.8125rem; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--night-muted); }
.mt .mt-reading { margin-top: 14px; max-width: 44ch; font-size: clamp(1rem, 0.95rem + 0.3vw, 1.125rem); font-weight: 600; line-height: 1.45; color: #E2E8F0; }
.mt .mt-exact { margin-top: 6px; font-size: 0.8125rem; color: var(--night-muted); }
.mt .mt-cells { display: grid; grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); gap: 1px; margin-top: 18px; border: 1px solid var(--night-line); border-radius: 14px; background: var(--night-line); overflow: hidden; }
.mt .mt-cell { padding: 12px 14px; background: var(--night); min-width: 0; }
.mt .mt-cell dt { font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--night-muted); }
.mt .mt-cell dd { margin-top: 2px; font-size: 1.375rem; font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; overflow-wrap: anywhere; }
.mt .mt-cell dd small { font-size: 0.8125rem; font-weight: 700; color: var(--night-muted); letter-spacing: 0; }
.mt .mt-cell dd.mt-sub { margin-top: 2px; font-size: 0.8125rem; font-weight: 600; letter-spacing: 0; color: var(--night-muted); }

/* the lunation: a bar, a marker at the exact Sun–Moon angle, and the eight named phases under it */
.mt .mt-lun { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--night-line); }
.mt .mt-lun-h { margin: 0 0 12px; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--night-muted); }
.mt .mt-lun-bar { position: relative; height: 6px; margin: 0 18px; border-radius: 3px; background: var(--night-line); }
.mt .mt-lun-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 3px; background: linear-gradient(90deg, rgba(56, 189, 248, 0.25), var(--glow)); }
.mt .mt-lun-dot { position: absolute; top: 50%; left: 0; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%; background: var(--glow); box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.22), 0 0 18px rgba(56, 189, 248, 0.6); }
.mt .mt-lun-phases { position: relative; height: 44px; margin: 10px 0 0; padding: 0; }
.mt .mt-lun-phases li { position: absolute; top: 0; left: calc(18px + (100% - 36px) * var(--f, 0)); transform: translateX(-50%); display: grid; justify-items: center; gap: 6px; width: 12%; min-width: 40px; padding: 4px 0; border-radius: 10px; color: var(--night-muted); transition: background 0.15s, color 0.15s; }
.mt .mt-lun-phases li.is-on { background: rgba(56, 189, 248, 0.12); color: var(--night-text); }
.mt .mt-lun-phases svg.md { width: clamp(22px, 6cqw, 32px); height: auto; }
.mt .mt-lun-phases .md-dark { fill: #161D36; }
.mt .mt-lun-phases .md-lit { fill: #EEEBE0; }
.mt .mt-lun-phases .md-rim { fill: none; stroke: rgba(248, 250, 252, 0.3); stroke-width: 4; }
.mt .mt-lun-phases span { display: none; font-size: 0.6875rem; font-weight: 700; text-align: center; line-height: 1.2; }
@container mt (min-width: 640px) { .mt .mt-lun-phases { height: 78px; } .mt .mt-lun-phases span { display: block; } }
.mt .mt-lun-cap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; margin: 12px 0 0; font-size: 0.8125rem; font-weight: 600; color: var(--night-muted); }
.mt .mt-lun-cap span:nth-child(2) { color: var(--night-soft); }

/* actions on the night surface */
.mt .mt-hero .rk-actions { margin-top: 12px; padding-top: 14px; border-top: 1px solid var(--night-line); justify-content: flex-start; }
.mt .mt-hero .btn-sm, .mt .mt-scrub .btn-sm { background: rgba(248, 250, 252, 0.06); border-color: var(--night-line); color: var(--night-text); }
.mt .mt-hero .btn-sm:hover:not(:disabled), .mt .mt-scrub .btn-sm:hover:not(:disabled) { background: rgba(248, 250, 252, 0.14); border-color: rgba(248, 250, 252, 0.3); }
.mt .mt-hero .btn-sm.primary { background: var(--glow); border-color: var(--glow); color: #0B1020; }
.mt .mt-hero .btn-sm.primary:hover:not(:disabled) { background: var(--glow); filter: brightness(1.06); }
.mt .mt-hero .fine-print { color: var(--night-muted); }

/* ================= Scrubber ================= */
.mt .mt-scrub { border-radius: var(--r-card); background: var(--night); color: var(--night-text); padding: 20px 16px 20px; }
@media (min-width: 720px) { .mt .mt-scrub { padding: 28px 40px 28px; } }
.mt .mt-scrub :focus-visible { outline: 3px solid color-mix(in srgb, var(--glow) 60%, transparent); outline-offset: 2px; border-radius: 6px; }
.mt .mt-scrub-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 20px; }
.mt .mt-scrub-title { margin: 0; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--night-muted); }
.mt .mt-readout { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin: 0; }
.mt .mt-readout b { font-size: clamp(1.375rem, 1.1rem + 1.2vw, 1.875rem); font-weight: 800; letter-spacing: -0.02em; }
.mt .mt-rel { font-size: 0.875rem; font-weight: 700; color: var(--glow-soft); }
.mt .mt-scrub-hint { margin-top: 6px; font-size: 0.875rem; color: var(--night-muted); max-width: 60ch; }

.mt .mt-ruler { position: relative; height: 112px; margin-top: 10px; user-select: none; }
.mt .mt-marks { position: absolute; left: 0; right: 0; top: 0; height: 30px; }
.mt .mt-mark { position: absolute; top: 0; left: calc(14px + (100% - 28px) * var(--f, 0)); transform: translateX(-50%); display: grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 50%; background: none; cursor: pointer; transition: transform 0.15s; }
.mt .mt-mark:hover { transform: translateX(-50%) scale(1.2); }
.mt .mt-mark svg.md { width: 22px; height: 22px; }
.mt .mt-mark .md-dark { fill: #161D36; }
.mt .mt-mark .md-lit { fill: #EEEBE0; }
.mt .mt-mark .md-rim { fill: none; stroke: rgba(248, 250, 252, 0.4); stroke-width: 6; }
.mt .mt-mark.is-here { transform: translateX(-50%) scale(1.25); }
.mt .mt-mark.is-here .md-rim { stroke: var(--glow); }
.mt .mt-ticks { position: absolute; left: 14px; right: 14px; top: 38px; width: calc(100% - 28px); height: 16px; overflow: visible; }
.mt .mt-tick { stroke: rgba(248, 250, 252, 0.22); stroke-width: 1; vector-effect: non-scaling-stroke; }
.mt .mt-tick.major { stroke: rgba(248, 250, 252, 0.5); }
.mt .mt-tick.zero { stroke: var(--glow); stroke-width: 2; }
.mt .mt-range { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 48px; margin: 0; padding: 0; background: transparent; cursor: grab; -webkit-appearance: none; appearance: none; }
.mt .mt-range:active { cursor: grabbing; }
.mt .mt-range:focus { outline: none; }
.mt .mt-range::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: var(--night-line); }
.mt .mt-range::-moz-range-track { height: 4px; border-radius: 2px; background: var(--night-line); }
.mt .mt-range::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 28px; height: 28px; margin-top: -12px; border: 3px solid #0B1020; border-radius: 50%; background: var(--glow); box-shadow: 0 0 0 2px var(--glow), 0 0 22px rgba(56, 189, 248, 0.55); }
.mt .mt-range::-moz-range-thumb { width: 22px; height: 22px; border: 3px solid #0B1020; border-radius: 50%; background: var(--glow); box-shadow: 0 0 0 2px var(--glow), 0 0 22px rgba(56, 189, 248, 0.55); }
.mt .mt-range:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 2px var(--glow), 0 0 0 7px rgba(56, 189, 248, 0.35); }
.mt .mt-range:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 2px var(--glow), 0 0 0 7px rgba(56, 189, 248, 0.35); }
.mt .mt-buttons { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 6px; }
.mt .mt-buttons .btn-sm span { white-space: nowrap; }
@media (max-width: 539px) { .mt .mt-buttons .btn-sm:not([data-act]) span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); } .mt .mt-buttons .btn-sm:not([data-act]) { width: 48px; justify-content: center; padding: 0; } }
.mt .mt-jumps { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 10px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--night-line); }
.mt .mt-date { display: grid; gap: 4px; margin-left: auto; }
.mt .mt-date label { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--night-muted); }
.mt .mt-date .input { height: 40px; width: 184px; border-color: var(--night-line); background: rgba(248, 250, 252, 0.06); color: var(--night-text); color-scheme: dark; }
.mt .mt-date .input:hover:not(:disabled) { border-color: rgba(248, 250, 252, 0.4); }
.mt .mt-date .input:focus { border-color: var(--glow); box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.2); }
.mt .mt-jump-hint { margin-top: 8px; font-size: 0.8125rem; color: var(--night-muted); }
.mt .mt-scrub .form-error { margin-top: 12px; background: rgba(225, 29, 72, 0.14); border-color: rgba(251, 113, 133, 0.5); color: #FDA4AF; }

/* ================= Static: phase table and method ================= */
.mt .mt-table { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }
.mt .mt-table th, .mt .mt-table td { padding: 12px 12px 12px 0; border-top: 1px solid var(--c-line); text-align: left; vertical-align: top; }
.mt .mt-table thead th { border-top: 0; padding-top: 0; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: var(--c-muted); }
.mt .mt-table tbody th { font-weight: 800; letter-spacing: -0.01em; white-space: nowrap; }
.mt .mt-table td.num { white-space: nowrap; }
.mt .mt-table td:last-child { color: var(--c-muted); padding-right: 0; }
@media (max-width: 719px) {
  .mt .mt-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .mt .mt-table, .mt .mt-table tbody, .mt .mt-table tr, .mt .mt-table th, .mt .mt-table td { display: block; }
  .mt .mt-table tr { padding: 12px 0; border-top: 1px solid var(--c-line); }
  .mt .mt-table th, .mt .mt-table td { padding: 0; border: 0; }
  .mt .mt-table td { margin-top: 2px; }
  .mt .mt-table td[data-label]::before { content: attr(data-label) ": "; font-weight: 600; color: var(--c-muted); }
  .mt .mt-table td:last-child::before { content: ""; }
}
.mt .mt-rules { display: grid; gap: 14px 28px; }
@media (min-width: 720px) { .mt .mt-rules { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.mt .mt-rules dt { font-weight: 800; letter-spacing: -0.01em; }
.mt .mt-rules dd { margin-top: 2px; color: var(--c-muted); font-size: 0.9375rem; }
