/* LunarImages.com — design system & layout. No external fonts or assets. */

:root {
  --void: #07080A;
  --panel: #0E1013;
  --raised: #161A1F;
  --raised-2: #1C2127;
  --line: #252A31;
  --line-strong: #3A414B;
  --text-1: #ECE9E2;
  --text-2: #A1A5AB;
  --text-3: #80868E;
  --signal: #FF6A2B;
  --signal-2: #FF8A57;
  --tele: #5ED6E6;
  --sol: #FFC24B;
  --go: #47D18C;
  --hold: #F2B23A;
  --fault: #FF4F4F;

  --f-display: "Bahnschrift", "DIN Alternate", "DIN Condensed", "Barlow Semi Condensed", "Roboto Condensed", "Arial Narrow", sans-serif;
  --f-sans: -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --f-mono: ui-monospace, "SF Mono", "Cascadia Mono", "JetBrains Mono", Menlo, Consolas, "Roboto Mono", monospace;

  --ease: cubic-bezier(.2, 0, 0, 1);
  --t-fast: 120ms;
  --t-med: 240ms;
  --t-slow: 700ms;

  --max: 1280px;
  --gutter: 24px;
  --pad-section: 128px;
  --header-h: 64px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: var(--header-h); }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; } }
body {
  margin: 0; background: var(--void); color: var(--text-1);
  font: 400 16px/26px var(--f-sans);
  font-feature-settings: "tnum" 1;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
body.ws-open { overflow: hidden; }
img, svg, canvas { display: block; max-width: 100%; }
a { color: inherit; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--signal); }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--signal); color: var(--void); }
:focus-visible { outline: 2px solid var(--tele); outline-offset: 2px; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mono { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.skip { position: absolute; left: 16px; top: -48px; z-index: 100; background: var(--signal); color: var(--void); padding: 8px 14px; font-weight: 600; text-decoration: none; }
.skip:focus { top: 12px; }

/* ---------- type ---------- */
.display {
  font-family: var(--f-display); font-weight: 700; text-transform: uppercase; letter-spacing: .01em;
  font-stretch: semi-condensed;
}
h1.display { font-size: clamp(44px, 5.9vw, 76px); line-height: .95; margin: 0 0 24px; }
h2.display { font-size: clamp(32px, 4vw, 52px); line-height: 1; margin: 0 0 20px; }
h3 { font: 600 20px/28px var(--f-sans); letter-spacing: -.01em; margin: 0 0 8px; }
main h1, main h2, main h3 { text-wrap: balance; }
main p { text-wrap: pretty; }
main h3 { font-size: 18px; line-height: 26px; letter-spacing: -.012em; }
.lede { font-size: 18px; line-height: 29px; color: var(--text-2); max-width: 36em; margin: 0 0 32px; }
.lede strong { color: var(--text-1); font-weight: 500; }
p { margin: 0 0 16px; }
.small { font-size: 14px; line-height: 20px; color: var(--text-2); }

/* ---------- buttons ---------- */
.btn {
  --b: var(--line-strong);
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  height: 48px; padding: 0 22px; border: 1px solid var(--b); background: transparent; color: var(--text-1);
  font: 600 13px/1 var(--f-sans); letter-spacing: .12em; text-transform: uppercase; text-decoration: none;
  cursor: pointer; position: relative; transition: background var(--t-med) var(--ease), border-color var(--t-med) var(--ease), color var(--t-med) var(--ease), transform var(--t-fast) var(--ease);
  white-space: nowrap; user-select: none; -webkit-user-select: none;
}
.btn:hover { --b: var(--text-1); }
.btn:active { transform: translateY(1px); }
.btn:not(.primary) { background: rgba(7,8,10,.55); }
.btn.primary { background: var(--signal); --b: var(--signal); color: #120700; }
.btn.primary:hover { background: var(--signal-2); --b: var(--signal-2); }
.btn.sm { height: 36px; padding: 0 14px; font-size: 11px; letter-spacing: .1em; }
.btn.xs { height: 28px; padding: 0 10px; font-size: 11px; letter-spacing: .08em; }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn .kbd { font-family: var(--f-mono); font-size: 10px; letter-spacing: 0; color: currentColor; opacity: .6; border: 1px solid currentColor; padding: 1px 4px; }
.btn[disabled] { opacity: .4; cursor: not-allowed; }
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }

/* ---------- header ---------- */
.site-header {
  position: fixed; inset: 0 0 auto; height: var(--header-h); z-index: 40;
  display: flex; align-items: center; gap: 0; padding: 0 max(var(--gutter), calc((100vw - var(--max)) / 2 + var(--gutter)));
  background: linear-gradient(to bottom, rgba(7,8,10,.92), rgba(7,8,10,.6));
  -webkit-backdrop-filter: blur(14px) saturate(140%); backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid transparent; transition: border-color var(--t-med) var(--ease), background var(--t-med) var(--ease);
}
.site-header.scrolled { border-bottom-color: var(--line); background: rgba(7,8,10,.88); }
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text-1); }
.brand svg { width: 28px; height: 28px; flex: none; }
.brand-word { font: 700 17px/1 var(--f-display); letter-spacing: .2em; text-transform: uppercase; font-stretch: semi-condensed; }
.brand-word b { color: var(--text-2); font-weight: 700; }
.nav { display: flex; gap: 4px; margin-left: auto; margin-right: -2px; }
.nav a { font: 500 14px/1 var(--f-sans); color: var(--text-2); text-decoration: none; padding: 10px 14px; transition: color var(--t-fast) var(--ease); }
.nav a:hover { color: var(--text-1); }
.site-header .btn { height: 38px; font-size: 11px; margin-left: 12px; }
@media (max-width: 960px) { .nav { display: none; } .site-header .btn { margin-left: auto; } }

/* ---------- layout ---------- */
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }
section.block { padding: var(--pad-section) 0; position: relative; }
section.block + section.block { border-top: 1px solid var(--line); }
.grid-12 { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--gutter); }
.section-head { grid-column: 1 / -1; margin-bottom: 48px; display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); column-gap: calc(var(--gutter) * 2); align-items: end; }
.section-head h2 { grid-column: 1; margin-bottom: 0; }
.section-head .lede { grid-column: 2; margin: 0; font-size: 17px; line-height: 27px; }
@media (max-width: 960px) { .section-head { grid-template-columns: 1fr; } .section-head .lede { grid-column: 1; margin-top: 20px; } }
@media (max-width: 860px) { :root { --pad-section: 80px; --gutter: 16px; } }

/* ---------- hero ---------- */
.hero { position: relative; min-height: 100vh; min-height: 100svh; padding-top: var(--header-h); display: flex; flex-direction: column; overflow: hidden; }
.hero-stars { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none;
  -webkit-mask-image: linear-gradient(90deg, rgba(0,0,0,.15) 30%, #000 58%); mask-image: linear-gradient(90deg, rgba(0,0,0,.15) 30%, #000 58%); }
@media (max-width: 960px) { .hero-stars { -webkit-mask-image: linear-gradient(#000 40%, rgba(0,0,0,.1) 58%); mask-image: linear-gradient(#000 40%, rgba(0,0,0,.1) 58%); } }
.hero-moon #hero-canvas { opacity: 0; transition: opacity 900ms var(--ease); }
.hero-moon #hero-canvas.in { opacity: 1; }
.hero-ov { opacity: 0; transition: opacity 900ms var(--ease) 300ms; }
.hero-ov.in { opacity: 1; }
.hero-inner { position: relative; z-index: 1; flex: 1; display: grid; grid-template-columns: minmax(0, 11fr) minmax(0, 13fr); align-items: center; gap: 24px; max-width: var(--max); width: 100%; margin: 0 auto; padding: 32px var(--gutter) 72px; }
.hero-copy { position: relative; z-index: 2; }
.hero-copy .lede { max-width: 24em; margin-bottom: 36px; }
.hero-note { margin: 18px 0 0; font-size: 14px; line-height: 20px; color: var(--text-3); }
.hero-moon { position: relative; aspect-ratio: 1 / 1; justify-self: center;
  /* square, as large as the column allows but never taller than the window: shrink both ways */
  width: min(100%, max(300px, calc(100vh - 200px))); width: min(100%, max(300px, calc(100svh - 200px))); }
.hero-moon canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
/* time slider: the readout has its own line, so the track never changes width while dragging */
.hero-moon .scrub {
  position: absolute; left: 50%; top: calc(100% - 14px); transform: translateX(-50%); width: min(400px, 92%);
  display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 16px; align-items: baseline;
}
.hero-moon .scrub output { font: 400 13px/22px var(--f-sans); color: var(--text-2); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hero-moon .scrub output b { font-weight: 600; color: var(--text-1); margin-right: 6px; }
/* a tick under the track marks "now" */
.hero-moon .scrub::after { content: ""; position: absolute; left: 50%; bottom: 2px; width: 1px; height: 5px; background: var(--line-strong); pointer-events: none; }
.scrub-reset { visibility: hidden; padding: 0; border: 0; background: none; cursor: pointer; font: 500 13px/22px var(--f-sans); color: var(--text-2); text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
.scrub-reset.on { visibility: visible; }
.scrub-reset:hover { color: var(--text-1); text-decoration-color: var(--signal); }
.hero-moon .scrub input { grid-column: 1 / -1; }
@media (max-width: 960px) {
  .hero-inner { grid-template-columns: 1fr; padding-top: 16px; padding-bottom: 56px; }
  .hero-moon { order: -1; width: min(86vw, 400px); margin-bottom: 52px; }
  .hero-copy .lede { font-size: 17px; line-height: 27px; margin-bottom: 26px; }
  h1.display { font-size: clamp(40px, 11.5vw, 64px); margin-bottom: 18px; }
}

/* drag-and-drop veil */
.drop-veil {
  position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; background: rgba(7,8,10,.82);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); opacity: 0; pointer-events: none; transition: opacity var(--t-med) var(--ease);
}
.drop-veil.on { opacity: 1; }
.drop-target { width: min(560px, 86vw); aspect-ratio: 1.6; display: grid; place-items: center; text-align: center; border: 1px dashed var(--signal); }
.drop-target .display { font-size: 34px; line-height: 1; margin: 18px 0 8px; }
.drop-target svg { width: 64px; height: 64px; margin: 0 auto; color: var(--signal); }

/* ---------- how it works ---------- */
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 40px; }
.step { border-top: 1px solid var(--line-strong); padding-top: 16px; }
.step .n { display: block; font: 500 12px/20px var(--f-mono); letter-spacing: .04em; color: var(--signal); }
.step svg { width: 100%; height: auto; aspect-ratio: 2 / 1; margin: 12px 0 24px; background: var(--panel); border: 1px solid var(--line); }
.step p { color: var(--text-2); margin: 0; max-width: 30em; font-size: 15px; line-height: 24px; }
@media (max-width: 860px) { .steps { grid-template-columns: 1fr; gap: 48px; } }

/* ---------- precision ---------- */
.precision { display: grid; grid-template-columns: minmax(0, 6fr) minmax(0, 6fr); gap: 48px; align-items: center; }
.libration-stage { position: relative; aspect-ratio: 1; max-width: 520px; width: 100%; justify-self: center; }
.libration-stage canvas { width: 100%; height: 100%; }
.libration-stage .caption { position: absolute; left: 0; right: 0; bottom: -8px; text-align: center; font-size: 13px; line-height: 18px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.stats { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--line); border-left: 1px solid var(--line); margin-top: 36px; }
.stat { padding: 20px 22px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.stat .v { font: 500 30px/34px var(--f-mono); letter-spacing: -.02em; }
.stat .k { font-size: 13px; line-height: 18px; color: var(--text-2); margin-top: 6px; }
@media (max-width: 860px) { .precision { grid-template-columns: 1fr; } }

/* range input */
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 24px; background: transparent; cursor: pointer; margin: 0; }
input[type=range]::-webkit-slider-runnable-track { height: 1px; background: var(--line-strong); }
input[type=range]::-moz-range-track { height: 1px; background: var(--line-strong); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; margin-top: -7px; background: var(--void); border: 1px solid var(--text-1); transform: rotate(45deg); transition: border-color var(--t-fast); }
input[type=range]::-moz-range-thumb { width: 12px; height: 12px; background: var(--void); border: 1px solid var(--text-1); border-radius: 0; transform: rotate(45deg); }
input[type=range]:hover::-webkit-slider-thumb { border-color: var(--signal); }
input[type=range]:focus-visible { outline: none; }
input[type=range]:focus-visible::-webkit-slider-thumb { border-color: var(--tele); box-shadow: 0 0 0 3px rgba(94,214,230,.25); }

/* ---------- form controls ---------- */
.input, select.input {
  height: 40px; padding: 0 12px; background: var(--void); border: 1px solid #666E79; color: var(--text-1);
  font: 500 14px/1 var(--f-mono); border-radius: 0; width: 100%; min-width: 0;
}
.input:focus { outline: none; border-color: var(--tele); }
select.input { -webkit-appearance: none; appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text-2) 50%), linear-gradient(135deg, var(--text-2) 50%, transparent 50%); background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 30px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row-time { display: grid; grid-template-columns: 1fr; gap: 8px; }
.row-time .input { padding: 0 8px; font-size: 13px; }
input[type=datetime-local]::-webkit-calendar-picker-indicator { filter: invert(.8); opacity: .6; cursor: pointer; }
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--text-2); cursor: pointer; user-select: none; }
.check input { -webkit-appearance: none; appearance: none; width: 16px; height: 16px; border: 1px solid #666E79; background: var(--void); display: grid; place-items: center; margin: 0; cursor: pointer; flex: none; }
.check input:checked { border-color: var(--signal); background: var(--signal); }
.check input:checked::after { content: ""; width: 8px; height: 4px; border: solid #120700; border-width: 0 0 2px 2px; transform: translateY(-1px) rotate(-45deg); }
.result { display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; padding: 14px 24px; border-bottom: 1px solid var(--line); }
.result:last-child { border-bottom: 0; }
.result .d { font: 500 15px/20px var(--f-mono); }
.result .w { font-size: 12px; color: var(--text-2); }
.result .q { font: 500 11px/20px var(--f-mono); color: var(--go); text-align: right; }
.result .q.hold { color: var(--hold); }
.empty { padding: 28px 24px; color: var(--text-3); font-size: 14px; }

/* ---------- code / report blocks ---------- */
.code {
  font: 400 12.5px/20px var(--f-mono); color: var(--text-2); background: var(--panel); border: 1px solid var(--line); padding: 20px 22px; overflow-x: auto; white-space: pre-wrap; word-break: break-word; margin: 0;
}
.code .k { color: var(--tele); } .code .n { color: var(--signal); }
#report { white-space: pre; overflow-x: auto; font-size: 11.5px; line-height: 18px; padding: 14px 16px; word-break: normal; }

/* ---------- faq ---------- */
.faq-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 32px 64px; align-items: start; }
.faq-grid h2 { margin: 0; position: sticky; top: calc(var(--header-h) + 32px); }
.faq { border-top: 1px solid var(--line); }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary { list-style: none; cursor: pointer; padding: 20px 44px 20px 0; position: relative; font: 500 17px/26px var(--f-sans); letter-spacing: -.008em; transition: color var(--t-fast) var(--ease); }
.faq summary::-webkit-details-marker { display: none; }
/* a drawn plus (two 1.5px bars) that turns into a cross when open */
.faq summary::after {
  content: ""; position: absolute; right: 4px; top: 50%; width: 13px; height: 13px; margin-top: -6.5px; color: var(--text-3);
  background: linear-gradient(currentColor, currentColor) center / 100% 1.5px no-repeat, linear-gradient(currentColor, currentColor) center / 1.5px 100% no-repeat;
  transition: transform var(--t-med) var(--ease), color var(--t-fast) var(--ease);
}
.faq summary:hover::after { color: var(--text-1); }
.faq details[open] summary::after { transform: rotate(45deg); color: var(--signal); }
.faq .ans { padding: 0 44px 24px 0; color: var(--text-2); font-size: 15px; line-height: 25px; max-width: 44em; }
/* answers slide open where the browser can animate to an automatic height */
@supports (interpolate-size: allow-keywords) {
  .faq { interpolate-size: allow-keywords; }
  .faq details::details-content { block-size: 0; overflow: clip; transition: block-size var(--t-med) var(--ease), content-visibility var(--t-med) allow-discrete; }
  .faq details[open]::details-content { block-size: auto; }
}
@media (max-width: 860px) { .faq-grid { grid-template-columns: 1fr; } .faq-grid h2 { position: static; } }

/* ---------- tonight ---------- */
.tonight-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 24px; margin-bottom: 40px; }
.tonight-head h2 { margin-bottom: 14px; }
.tonight-now { margin: 0; font-size: 19px; line-height: 28px; color: var(--text-2); }
.tonight-now [data-tm] { color: var(--text-1); }
.week { list-style: none; margin: 0 0 64px; padding: 32px 0 28px; display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 28px 8px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); min-height: 216px; }
.night { display: flex; flex-direction: column; align-items: center; text-align: center; animation: night-in 500ms var(--ease) both; }
@keyframes night-in { from { opacity: 0; } }
.night canvas { width: min(104px, 100%); height: auto; aspect-ratio: 1; margin-bottom: 14px; }
.night .d { font: 600 14px/20px var(--f-sans); }
.night.now .d { color: var(--signal-2); }
.night .p { font-size: 13px; line-height: 18px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.night .ev { margin-top: 6px; font: 600 12px/16px var(--f-sans); color: var(--sol); }
/* Two tables on one grid: headings share a row and the lists share a row, so their first rules
   line up; every row is the same height, so the rest do too. */
.tonight-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: auto auto; grid-auto-flow: column; column-gap: 64px; align-items: start; }
.tcol-head { padding-bottom: 18px; }
.tcol-head h3 { margin: 0 0 4px; }
.tcol-head p { margin: 0; font-size: 14px; line-height: 22px; color: var(--text-2); }
.rows { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.rows > li, .rows > .row { border-bottom: 1px solid var(--line); }
.rows .row { display: flex; align-items: center; gap: 16px; width: 100%; min-height: 52px; padding: 0; margin: 0; border-top: 0; border-left: 0; border-right: 0; background: none; text-align: left; }
.rows li > .row { border: 0; }
.rows > .row { min-height: 53px; }   /* 52 + its rule, to match the list rows beside it */
.rows .nm { flex: 1; min-width: 0; font: 500 15px/22px var(--f-sans); letter-spacing: -.006em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rows .num { flex: none; width: 5.2em; text-align: right; font: 400 13px/22px var(--f-mono); color: var(--text-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.rows .num.sun { width: 5.6em; }
/* selectable rows: a quiet highlight that bleeds 12px past the text, and a chevron */
.rows .row.go { position: relative; cursor: pointer; transition: color var(--t-fast) var(--ease); }
.rows .row.go::before { content: ""; position: absolute; inset: 0 -12px; background: var(--text-1); opacity: 0; transition: opacity var(--t-fast) var(--ease); pointer-events: none; }
.rows .row.go:hover::before, .rows .row.go:focus-visible::before { opacity: .045; }
.rows .row.go::after { content: ""; flex: none; width: 6px; height: 6px; margin: 0 2px 0 4px; border: solid var(--text-3); border-width: 1.5px 1.5px 0 0; transform: rotate(45deg); transition: transform var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease); }
.rows .row.go:hover::after { border-color: var(--signal); transform: translateX(2px) rotate(45deg); }
.rows .none { padding: 15px 0; color: var(--text-2); font-size: 15px; line-height: 24px; }
.facts dt { flex: 1; min-width: 0; font-size: 15px; line-height: 22px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.facts dt span { color: var(--text-3); font-size: 13px; margin-left: 6px; }
.facts dd { flex: none; margin: 0; font: 400 14px/22px var(--f-mono); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
@media (max-width: 860px) {
  .week { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 48px; }
  .tonight-cols { grid-template-columns: 1fr; grid-auto-flow: row; }
  .tonight-cols .rows + .tcol-head { margin-top: 44px; }
}
@media (max-width: 480px) { .facts dt span { display: none; } }

/* ---------- 404 ---------- */
.notfound { min-height: 100vh; min-height: 100svh; display: grid; align-items: center; padding: 64px 0; }

/* ---------- legal pages ---------- */
.site-header .brand + .btn { margin-left: auto; }
.legal { padding: calc(var(--header-h) + 72px) 0 96px; }
.legal .wrap { max-width: calc(720px + 2 * var(--gutter)); }
.legal h1.display { font-size: clamp(40px, 5vw, 60px); margin-bottom: 16px; }
.legal .updated { font: 500 12px/20px var(--f-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); margin: 0 0 40px; }
.legal h2 { font: 600 20px/28px var(--f-sans); letter-spacing: -.01em; margin: 44px 0 12px; padding-top: 28px; border-top: 1px solid var(--line); }
.legal p, .legal li { color: var(--text-2); }
.legal strong { color: var(--text-1); font-weight: 600; }
.legal ul { margin: 0 0 16px; padding-left: 20px; }
.legal li { margin: 0 0 8px; }
.legal a { color: var(--text-1); }
.legal .caps { text-transform: uppercase; font-size: 14px; line-height: 23px; }
.footer-nav a[aria-current="page"] { color: var(--text-1); }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 36px 0 44px; }
.footer-row { display: grid; grid-template-columns: auto 1fr; gap: 24px 48px; align-items: center; }
.footer-nav { justify-self: end; display: flex; flex-wrap: wrap; gap: 8px 28px; }
.footer-nav a { font-size: 14px; line-height: 20px; color: var(--text-2); text-decoration: none; }
.footer-nav a:hover { color: var(--text-1); }
.sources { grid-column: 1 / -1; margin: 0; padding-top: 24px; border-top: 1px solid var(--line); max-width: none; font-size: 13px; line-height: 20px; color: var(--text-3); }
@media (max-width: 640px) { .footer-row { grid-template-columns: 1fr; } .footer-nav { justify-self: start; } }


/* =====================================================================
   WORKSPACE
   ===================================================================== */
.ws {
  position: fixed; inset: 0; z-index: 60; background: var(--void); display: grid;
  grid-template-columns: minmax(0, 1fr) 380px; grid-template-rows: 52px minmax(0, 1fr) 34px;
  grid-template-areas: "top top" "view side" "rail side";
  opacity: 0; transition: opacity var(--t-med) var(--ease);
}
.ws.on { opacity: 1; }
.ws-top { grid-area: top; display: flex; align-items: center; gap: 16px; padding: 0 12px 0 8px; border-bottom: 1px solid var(--line); background: var(--panel); min-width: 0; }
.icon-btn { width: 36px; height: 36px; display: grid; place-items: center; background: transparent; border: 1px solid transparent; color: var(--text-2); cursor: pointer; flex: none; transition: color var(--t-fast), border-color var(--t-fast), background var(--t-fast); }
.icon-btn:hover { color: var(--text-1); border-color: var(--line-strong); }
.icon-btn[aria-pressed="true"] { color: var(--signal); border-color: var(--signal); }
.icon-btn svg { width: 18px; height: 18px; }
.ws-file { min-width: 0; display: flex; flex-direction: column; }
.ws-file .nm { font: 600 13px/16px var(--f-sans); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 32vw; }
.ws-file .mt { font: 500 11px/14px var(--f-mono); color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.poll { display: flex; gap: 2px; margin-left: auto; }
.poll .p { display: flex; align-items: center; gap: 7px; height: 28px; padding: 0 10px; border: 1px solid var(--line); font: 600 10px/1 var(--f-mono); letter-spacing: .1em; color: var(--text-3); }
.poll .p i { width: 7px; height: 7px; border-radius: 50%; background: var(--line-strong); transition: background var(--t-med); }
.poll .p.run i { background: var(--hold); animation: blink .8s infinite; }
.poll .p.go i { background: var(--go); } .poll .p.go { color: var(--text-2); }
.poll .p.hold i { background: var(--hold); } .poll .p.hold { color: var(--hold); }
.poll .p.fault i { background: var(--fault); } .poll .p.fault { color: var(--fault); }
@keyframes blink { 50% { opacity: .25; } }
.ws-actions { display: flex; gap: 8px; align-items: center; }

.ws-view { grid-area: view; position: relative; overflow: hidden; background: #030405; touch-action: none; cursor: crosshair; }
.ws-view canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.ws-view.panning { cursor: grabbing; }
.ws-view.picking { cursor: copy; }
/* toggle chips (workspace layer switches) */
.chip {
  display: inline-flex; align-items: center; gap: 8px; height: 30px; padding: 0 10px; border: 1px solid var(--line);
  background: transparent; font: 500 11px/1 var(--f-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--text-2); cursor: pointer;
  transition: border-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.chip:hover { color: var(--text-1); border-color: var(--line-strong); }
.chip[aria-pressed="true"] { color: var(--text-1); border-color: var(--text-2); background: var(--raised); }
.chip .sw { width: 8px; height: 8px; border: 1px solid currentColor; transform: rotate(45deg); }
.chip .sw.fill { background: currentColor; }
.chip .k { opacity: .55; }
.ws-chips { position: absolute; left: 12px; top: 12px; display: flex; flex-wrap: wrap; gap: 4px; z-index: 3; max-width: calc(100% - 140px); }
.ws-chips .chip { background: rgba(7,8,10,.72); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); height: 30px; }
.ws-zoom { position: absolute; right: 12px; top: 12px; display: flex; flex-direction: column; gap: 4px; z-index: 3; }
.ws-zoom .icon-btn { background: rgba(7,8,10,.72); border-color: var(--line); }
.ws-banner {
  position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 4; width: min(520px, calc(100% - 32px));
  display: flex; flex-wrap: wrap; align-items: flex-start; gap: 10px 12px; padding: 14px 14px 12px 16px; background: rgba(14,16,19,.94); border: 1px solid var(--line-strong);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); font-size: 14px; line-height: 20px; box-shadow: 0 16px 48px rgba(0,0,0,.5);
}
.ws-banner .bi { width: 8px; height: 8px; border-radius: 50%; background: var(--hold); flex: none; margin-top: 6px; }
.ws-banner .btn-row { margin-left: auto; gap: 8px; }
.ws-banner.ok .bi { background: var(--go); } .ws-banner.bad .bi { background: var(--fault); }
.ws-banner .bt { flex: 1 1 calc(100% - 24px); color: var(--text-2); font-size: 13.5px; line-height: 20px; } .ws-banner .bt b { color: var(--text-1); font-weight: 600; }
.ws-tip {
  position: absolute; z-index: 5; pointer-events: none; padding: 10px 12px; background: rgba(7,8,10,.92); border: 1px solid var(--line-strong);
  font-size: 12px; line-height: 17px; max-width: 280px; transform: translate(14px, 14px); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.ws-tip .t { font-weight: 600; font-size: 13px; color: var(--text-1); }
.ws-tip .s { font-family: var(--f-mono); color: var(--text-2); font-size: 11px; }
.ws-fit {
  position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 4; width: min(640px, calc(100% - 32px));
  padding: 14px 16px 12px; background: rgba(14,16,19,.94); border: 1px solid rgba(94,214,230,.45); box-shadow: 0 16px 48px rgba(0,0,0,.5);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); font-size: 13.5px; line-height: 20px; color: var(--text-2);
}
.ws-fit .fh { display: flex; align-items: baseline; gap: 12px; margin-bottom: 4px; }
.ws-fit .fh b { color: var(--tele, #5ED6E6); font: 600 11px/1 var(--f-sans); letter-spacing: .14em; text-transform: uppercase; }
.ws-fit .fh .src { font: 500 11.5px/1 var(--f-mono); color: var(--text-1); margin-left: auto; text-align: right; }
.ws-fit p { margin: 0 0 10px; }
.ws-fit .fit-stat { margin-top: -4px; font: 500 12px/18px var(--f-mono); color: var(--go); }
.ws-fit .fit-stat.hold { color: var(--hold, #E8B14A); }
.lock-line { margin: 10px 0 2px; font: 500 12px/18px var(--f-mono); color: var(--go); }
.lock-line.hold { color: var(--text-3); }
.ws-fit .btn-row { gap: 8px; flex-wrap: wrap; }
.ws-fit .btn-row .primary { margin-left: auto; }
.ws-view.checking .ws-banner { display: none; }
@media (max-width: 860px) { .ws-fit { bottom: 150px; padding: 12px 12px 10px; } .ws-fit p { font-size: 12.5px; line-height: 18px; } }
.ws-loading { position: absolute; inset: 0; display: grid; place-items: center; z-index: 6; background: rgba(3,4,5,.55); }
.ws-loading .ring { width: 72px; height: 72px; border: 1px solid var(--line-strong); border-top-color: var(--signal); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.ws-loading .lt { margin-top: 18px; font: 500 11px/1 var(--f-mono); letter-spacing: .12em; color: var(--text-2); text-transform: uppercase; text-align: center; }

.ws-rail { grid-area: rail; display: flex; align-items: center; gap: 0; border-top: 1px solid var(--line); background: var(--panel); font: 500 11.5px/1 var(--f-mono); color: var(--text-2); overflow: hidden; white-space: nowrap; }
.ws-rail span { padding: 0 14px; border-right: 1px solid var(--line); height: 100%; display: flex; align-items: center; gap: 8px; }
.ws-rail span b { color: var(--text-3); font-weight: 500; letter-spacing: .08em; }
.ws-rail span:last-child { border-right: 0; }
.ws-rail em { font-style: normal; color: var(--text-1); }

.ws-side { grid-area: side; border-left: 1px solid var(--line); background: var(--panel); display: flex; flex-direction: column; min-height: 0; }
.ws-grip { display: none; }
.tabs { display: flex; border-bottom: 1px solid var(--line); flex: none; }
.tabs button {
  flex: 1; height: 44px; background: none; border: 0; border-bottom: 2px solid transparent; color: var(--text-3); cursor: pointer;
  font: 600 11px/1 var(--f-sans); letter-spacing: .12em; text-transform: uppercase; transition: color var(--t-fast), border-color var(--t-fast);
}
.tabs button:hover { color: var(--text-1); }
.tabs button[aria-selected="true"] { color: var(--text-1); border-bottom-color: var(--signal); }
.tabpanels { flex: 1; overflow-y: auto; min-height: 0; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.tabpanel { padding: 20px; display: flex; flex-direction: column; gap: 28px; }
#inspect-card { display: flex; flex-direction: column; gap: 12px; }
.ws.solving .tabpanels { opacity: .35; pointer-events: none; }
.tabpanels { transition: opacity var(--t-med) var(--ease); }
.group { display: flex; flex-direction: column; gap: 12px; }
.group-h { display: flex; justify-content: space-between; align-items: center; font: 600 11px/1 var(--f-sans); letter-spacing: .14em; text-transform: uppercase; color: var(--text-3); padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.group-h .src { font: 500 10px/1 var(--f-mono); letter-spacing: .04em; text-transform: none; color: var(--text-3); }
.src.go { color: var(--go); } .src.hold { color: var(--hold); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 0; font-size: 12.5px; line-height: 18px; margin: 0; }
.kv dt { color: var(--text-3); padding: 7px 0; border-bottom: 1px solid var(--line); }
.kv dt.tip { cursor: help; text-decoration: underline dotted var(--line-strong); text-underline-offset: 3px; }
.kv dd { margin: 0; text-align: right; font-family: var(--f-mono); font-size: 12px; color: var(--text-1); padding: 7px 0; border-bottom: 1px solid var(--line); white-space: nowrap; }
.meter { height: 4px; background: var(--line); position: relative; }
.meter i { position: absolute; inset: 0 auto 0 0; background: var(--go); transition: width var(--t-slow) var(--ease); }
.meter.hold i { background: var(--hold); } .meter.fault i { background: var(--fault); }
.toggles { display: flex; flex-direction: column; }
.toggle { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.toggle:last-child { border-bottom: 0; }
.toggle .tt { display: block; font-size: 14px; line-height: 20px; } .toggle .td { display: block; font-size: 12px; color: var(--text-3); line-height: 16px; }
.switch { -webkit-appearance: none; appearance: none; width: 34px; height: 18px; border: 1px solid #666E79; background: var(--void); position: relative; cursor: pointer; margin: 0; transition: background var(--t-fast), border-color var(--t-fast); }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 10px; height: 10px; background: var(--text-3); transition: transform var(--t-med) var(--ease), background var(--t-fast); }
.switch:checked { border-color: var(--signal); }
.switch:checked::after { transform: translateX(16px); background: var(--signal); }
.slider-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 4px 12px; }
.slider-row label { font-size: 13px; color: var(--text-2); }
.slider-row output { font: 500 12px/1 var(--f-mono); color: var(--text-1); }
.slider-row input { grid-column: 1 / -1; }
.feature-card { border: 1px solid var(--line); background: var(--void); padding: 18px; }
.feature-card .ty { font: 500 10px/1 var(--f-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--tele); }
.feature-card h3 { font: 700 26px/1 var(--f-display); text-transform: uppercase; letter-spacing: .02em; margin: 10px 0 12px; }
.feature-card p { color: var(--text-2); font-size: 14px; line-height: 21px; margin: 0 0 12px; }
.reality { border-left: 2px solid var(--sol); padding: 10px 12px; background: rgba(255,194,75,.06); font-size: 13px; line-height: 19px; color: var(--text-2); }
.reality b { color: var(--sol); font-weight: 600; }
.list { display: flex; flex-direction: column; }
.list button { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 9px 0; border: 0; border-bottom: 1px solid var(--line); background: none; text-align: left; cursor: pointer; font-size: 13.5px; color: var(--text-1); }
.list button:hover { color: var(--signal); }
.list button .r { font: 500 11px/1.6 var(--f-mono); color: var(--text-3); }
.alts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.alts button { height: 54px; border: 1px solid var(--line-strong); background: var(--void); color: var(--text-2); font: 500 11px/14px var(--f-mono); cursor: pointer; }
.alts button:hover { border-color: var(--signal); color: var(--text-1); }
.hint { font-size: 12.5px; line-height: 18px; color: var(--text-3); }
.hint kbd { font: 500 10.5px/1 var(--f-mono); border: 1px solid var(--line-strong); padding: 2px 5px; color: var(--text-2); }
.search-pop { position: absolute; z-index: 8; width: 260px; background: var(--panel); border: 1px solid var(--line-strong); box-shadow: 0 16px 48px rgba(0,0,0,.6); }
.search-pop .input { border: 0; border-bottom: 1px solid var(--line); height: 42px; font-family: var(--f-sans); }
.search-pop ul { list-style: none; margin: 0; padding: 4px 0; max-height: 240px; overflow-y: auto; }
.search-pop li { padding: 8px 12px; font-size: 13.5px; cursor: pointer; display: flex; justify-content: space-between; gap: 8px; }
.search-pop li span { font: 500 10.5px/1.7 var(--f-mono); color: var(--text-3); }
.search-pop li[aria-selected="true"], .search-pop li:hover { background: var(--raised); color: var(--signal); }

.find { position: relative; }
.find input[type=search]::-webkit-search-cancel-button { filter: invert(.7); }
.find ul { list-style: none; margin: 0; padding: 4px 0; border: 1px solid var(--line-strong); border-top: 0; background: var(--void); max-height: 300px; overflow-y: auto; }
.find li { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 9px 12px; font-size: 13.5px; cursor: pointer; }
.find li span { font: 500 10.5px/1.7 var(--f-mono); color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; }
.find li[aria-selected="true"], .find li:hover { background: var(--raised); color: var(--signal); }
.find .none { padding: 10px 12px; font-size: 13px; color: var(--text-3); cursor: default; }
.ws-keys { position: absolute; right: 64px; top: 12px; z-index: 6; width: 330px; padding: 16px 18px; background: rgba(14,16,19,.96); border: 1px solid var(--line-strong); box-shadow: 0 16px 48px rgba(0,0,0,.55); }
.ws-keys dl { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; margin: 12px 0 0; font-size: 12.5px; line-height: 18px; }
.ws-keys dt { color: var(--text-2); white-space: nowrap; font-size: 12px; }
.ws-keys dd { margin: 0; color: var(--text-1); }
.ws-keys kbd { font: 500 10.5px/1 var(--f-mono); border: 1px solid var(--line-strong); padding: 2px 5px; color: var(--text-1); }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); z-index: 100; padding: 12px 18px; background: var(--raised); border: 1px solid var(--line-strong); font-size: 14px; opacity: 0; transition: opacity var(--t-med) var(--ease), transform var(--t-med) var(--ease); pointer-events: none; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }

@media (hover: none) { .chip .k, .btn .kbd { display: none; } }
@media (max-width: 860px) {
  .ws-chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; max-width: calc(100% - 70px); }
  .ws-chips::-webkit-scrollbar { display: none; }
  .ws-chips .chip { height: 36px; flex: none; }
  .ws { grid-template-columns: 1fr; grid-template-rows: 52px minmax(0, 1fr) 30px; grid-template-areas: "top" "view" "rail"; }
  .ws-file .nm { max-width: 38vw; }
  .poll .p span { display: none; } .poll .p { padding: 0 8px; }
  .ws-actions .btn .lbl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .ws-rail span:nth-child(n+3) { display: none; }
  .ws-side {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 7; height: 62vh; transform: translateY(calc(62vh - 132px));
    border-left: 0; border-top: 1px solid var(--line-strong); transition: transform var(--t-med) var(--ease); box-shadow: 0 -20px 60px rgba(0,0,0,.6);
  }
  .ws-side.open { transform: none; }
  .ws-grip { display: flex; justify-content: center; align-items: center; height: 26px; flex: none; background: none; border: 0; cursor: pointer; width: 100%; }
  .ws-grip::before { content: ""; width: 44px; height: 4px; background: var(--line-strong); }
  .ws-chips { max-width: calc(100% - 70px); }
  .ws-banner { bottom: 150px; }
}

/* ---------- print worksheet ---------- */
.print-sheet { display: none; }
@media print {
  @page { margin: 14mm; }
  body.printing { background: #fff; color: #000; }
  body.printing > *:not(.print-sheet) { display: none !important; }
  body.printing .print-sheet { display: block !important; font: 11pt/1.45 var(--f-sans); color: #000; }
  body:not(.printing) .site-header, body:not(.printing) .ws, body:not(.printing) .drop-veil, body:not(.printing) .toast { display: none !important; }
  .print-sheet h1 { font: 700 20pt/1.1 var(--f-display); text-transform: uppercase; letter-spacing: .04em; margin: 0 0 4pt; }
  .print-sheet .meta { font: 9pt/1.4 var(--f-mono); color: #333; margin-bottom: 10pt; }
  .print-sheet img { display: block; margin: 0 auto 8pt; max-width: 100%; max-height: 160mm; object-fit: contain; border: 1px solid #000; }
  .print-sheet ol { columns: 2; column-gap: 12mm; font-size: 10.5pt; padding-left: 20pt; }
  .print-sheet ol li { min-height: 18pt; }
  .print-sheet ol li { padding: 3pt 0; border-bottom: 0.5pt solid #999; break-inside: avoid; }
  .print-sheet .key { page-break-before: always; }
  .print-sheet .key ol li { border-bottom: 0; }
}

/* ---------- small screens, notches, touch ---------- */
@media (max-width: 400px) {
  .site-header { gap: 12px; }
  .brand-word { letter-spacing: .1em; font-size: 15px; }
  .site-header .btn { padding: 0 10px; }
}
@supports (padding: env(safe-area-inset-top)) {
  .site-header { padding-left: max(var(--gutter), env(safe-area-inset-left), calc((100vw - var(--max)) / 2 + var(--gutter))); padding-right: max(var(--gutter), env(safe-area-inset-right), calc((100vw - var(--max)) / 2 + var(--gutter))); }
  .ws { padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left); }
  .ws-rail { padding-bottom: env(safe-area-inset-bottom); }
  .toast { bottom: calc(28px + env(safe-area-inset-bottom)); }
}
@media (pointer: coarse) { .input, select.input, .find input { font-size: 16px; } }
.ws-actions .btn svg { width: 15px; height: 15px; }
#ws-canvas:focus-visible { outline: 2px solid var(--tele); outline-offset: -2px; }
