/* Sky — observatory plate.
   A deliberately committed dark instrument aesthetic: ink ground, hairline
   rules, one cold accent for what is measured and one warm accent for what was
   chosen by people. Print mode inverts to a black-on-white almanac sheet. */

:root {
  --ink:        #0a0b0d;
  --ink-raise:  #101216;
  --panel:      #121419;
  --panel-2:    #171a20;
  --hair:       #242831;
  --hair-soft:  #1b1e25;

  --text:       #e9e6e0;
  --text-dim:   #9aa0ab;
  --text-faint: #6b7280;

  /* The two load-bearing colours of the whole design. */
  --measured:      #74d0e8;   /* astronomy: cold, precise */
  --measured-dim:  #2e5a68;
  --chosen:        #e3a955;   /* convention: warm, human */
  --chosen-dim:    #6b4f27;
  --unfalsifiable: #a08fc4;   /* meaning: muted violet */
  --unfalsifiable-dim: #4a4060;

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  /* Astrological symbols are not in ordinary text faces; without this
     stack the wheel and the table render as notdef boxes. */
  --glyph: "Segoe UI Symbol","Segoe UI Historic","Apple Symbols","Noto Sans Symbols 2","Noto Sans Symbols2","DejaVu Sans","FreeSerif",sans-serif;

  --wrap: 1120px;
  --r: 3px;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  /* A faint field of stars that never distracts: two tiny radial dots tiled. */
  background-image:
    radial-gradient(circle at 20% 30%, rgba(116,208,232,.05) 0 1px, transparent 1.5px),
    radial-gradient(circle at 70% 80%, rgba(233,230,224,.04) 0 1px, transparent 1.5px);
  background-size: 140px 140px, 190px 190px;
}

.wrap { width: min(100% - 2.5rem, var(--wrap)); margin-inline: auto; }

.skip {
  position: absolute; left: -9999px;
  background: var(--measured); color: var(--ink); padding: .6rem 1rem; z-index: 50;
}
.skip:focus { left: 1rem; top: 1rem; }

a { color: var(--measured); text-underline-offset: 2px; }
a:hover { color: #a6e4f4; }

.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.small { font-size: .82rem; }
.hint { color: var(--text-faint); font-weight: 400; font-size: .8em; }

/* ---------------------------------------------------------------- masthead */

.masthead {
  border-bottom: 1px solid var(--hair);
  padding: clamp(2.5rem, 7vw, 5rem) 0 2.25rem;
  background:
    linear-gradient(180deg, rgba(116,208,232,.045), transparent 70%);
}

.wordmark { display: flex; align-items: baseline; gap: .6rem; }
.wordmark-glyph { font-family: var(--glyph); font-size: clamp(1.8rem, 4vw, 2.6rem); color: var(--chosen); line-height: 1; }
.wordmark-text {
  font-family: var(--serif);
  font-size: clamp(2.6rem, 8vw, 4.4rem);
  letter-spacing: -.02em;
  line-height: .95;
}

.tagline {
  font-family: var(--serif);
  font-size: clamp(1.1rem, 2.4vw, 1.5rem);
  color: var(--text);
  margin: .5rem 0 1.1rem;
  font-style: italic;
}

.lede { max-width: 62ch; color: var(--text-dim); margin: 0 0 1.5rem; }
.lede em { color: var(--text); font-style: normal; border-bottom: 1px solid var(--hair); }

.badge-row { display: flex; flex-wrap: wrap; gap: .6rem; }
.badge {
  display: inline-flex; align-items: center; gap: .55rem;
  border: 1px solid var(--measured-dim);
  background: rgba(116,208,232,.07);
  border-radius: 100px; padding: .35rem .95rem;
  font-size: .8rem;
}
.badge-k { color: var(--measured); letter-spacing: .04em; text-transform: uppercase; font-size: .72rem; }
.badge-v { font-family: var(--mono); color: var(--text); }

/* ------------------------------------------------------------------ legend */

.legend {
  border-bottom: 1px solid var(--hair);
  background: var(--ink-raise);
  position: sticky; top: 0; z-index: 20;
  backdrop-filter: blur(6px);
}
/* On a phone the three layers stack, and a sticky three-row bar would eat a
   third of the viewport. Below the breakpoint it scrolls away like normal
   content; the colour coding is still carried by every tag on the page. */
@media (max-width: 860px) {
  .legend { position: static; }
  .legend-item span:last-child { display: none; }
}
.legend-inner {
  display: grid; gap: .25rem 2rem;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  padding: .8rem 0;
}
.legend-item { display: flex; gap: .6rem; align-items: flex-start; font-size: .78rem; }
.legend-item strong { display: block; font-size: .8rem; letter-spacing: .03em; }
.legend-item span:last-child { color: var(--text-faint); }
.legend-swatch {
  width: 10px; height: 10px; flex: 0 0 10px; margin-top: .38rem; border-radius: 2px;
}
.layer-measured      .legend-swatch { background: var(--measured); }
.layer-measured      strong { color: var(--measured); }
.layer-chosen        .legend-swatch { background: var(--chosen); }
.layer-chosen        strong { color: var(--chosen); }
.layer-unfalsifiable .legend-swatch { background: var(--unfalsifiable); border: 1px dashed var(--unfalsifiable); background: transparent; }
.layer-unfalsifiable strong { color: var(--unfalsifiable); }

/* ------------------------------------------------------------------ panels */

.panel {
  scroll-margin-top: 5.5rem;
  border-top: 1px solid var(--hair-soft);
  padding: clamp(2rem, 5vw, 3.25rem) 0;
}
.panel:first-of-type { border-top: 0; }

.panel-title {
  font-family: var(--serif);
  font-size: clamp(1.35rem, 3vw, 1.9rem);
  font-weight: 400;
  margin: 0 0 .75rem;
  letter-spacing: -.01em;
}

.panel-note { max-width: 68ch; color: var(--text-dim); margin: 0 0 1.75rem; font-size: .93rem; }
.panel-note em { color: var(--text); font-style: italic; }

.layer-measured-note { border-left: 2px solid var(--measured-dim); padding-left: 1rem; }

.panel-feature {
  background: linear-gradient(180deg, rgba(227,169,85,.05), transparent 60%);
  border-top: 1px solid var(--chosen-dim);
}

/* -------------------------------------------------------------------- form */

.form-grid {
  display: grid; gap: 1rem 1.25rem;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  align-items: end;
}
.field { display: flex; flex-direction: column; gap: .35rem; min-width: 0; }
.field-wide { grid-column: span 2; }
.field-actions { flex-direction: row; gap: .6rem; align-items: center; flex-wrap: wrap; }

label { font-size: .78rem; letter-spacing: .05em; text-transform: uppercase; color: var(--text-dim); }

input[type=date], input[type=time], input[type=text], input[type=number], select {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--hair);
  border-radius: var(--r);
  color: var(--text);
  padding: .6rem .7rem;
  font-family: var(--mono);
  font-size: .95rem;
  color-scheme: dark;
}
input:focus-visible, select:focus-visible, button:focus-visible {
  outline: 2px solid var(--measured); outline-offset: 1px;
}

.btn {
  background: var(--panel-2);
  border: 1px solid var(--hair);
  color: var(--text);
  border-radius: var(--r);
  padding: .62rem 1.1rem;
  font: inherit; font-size: .9rem;
  cursor: pointer;
}
.btn:hover { border-color: var(--text-faint); }
.btn-primary {
  background: var(--measured); border-color: var(--measured); color: #06222b; font-weight: 600;
}
.btn-primary:hover { background: #8fdcf0; }
.btn-quiet { background: transparent; }

.resolved {
  margin-top: 1.75rem; border: 1px solid var(--hair); border-radius: var(--r);
  background: var(--panel); padding: .3rem 1rem;
}
.resolved-row {
  display: flex; justify-content: space-between; gap: 1rem;
  padding: .55rem 0; border-bottom: 1px solid var(--hair-soft);
  font-size: .87rem; flex-wrap: wrap;
}
.resolved-row:last-child { border-bottom: 0; }
.resolved-row .k { color: var(--text-dim); }
.resolved-row .v { color: var(--measured); }

/* ------------------------------------------------------------------- wheel */

.chart-layout {
  display: grid; gap: 2rem;
  grid-template-columns: minmax(0, 1fr) 260px;
  align-items: start;
}
@media (max-width: 860px) { .chart-layout { grid-template-columns: 1fr; } }

.wheel-holder { margin: 0; }
#wheel svg { width: 100%; height: auto; display: block; }
.wheel-caption {
  display: flex; gap: 1.25rem; flex-wrap: wrap;
  margin-top: .9rem; font-size: .76rem;
}
.wheel-caption .layer-measured { color: var(--measured); }
.wheel-caption .layer-chosen { color: var(--chosen); }

.wheel-controls { display: grid; gap: 1rem; }
fieldset {
  border: 1px solid var(--hair); border-radius: var(--r);
  background: var(--panel); margin: 0; padding: .75rem 1rem 1rem;
}
legend {
  font-size: .72rem; letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-dim); padding: 0 .4rem;
}
fieldset label {
  display: flex; align-items: center; gap: .5rem;
  text-transform: none; letter-spacing: 0; font-size: .88rem;
  color: var(--text); padding: .2rem 0; cursor: pointer;
}
fieldset label.sub { flex-direction: column; align-items: stretch; gap: .3rem; margin-top: .5rem; }
fieldset input[type=radio], fieldset input[type=checkbox] { accent-color: var(--measured); margin: 0; }
.fieldset-note { font-size: .74rem; color: var(--chosen); margin: .6rem 0 0; min-height: 1em; }

.tag {
  font-size: .62rem; letter-spacing: .08em; text-transform: uppercase;
  border-radius: 100px; padding: .1rem .45rem; border: 1px solid currentColor;
  white-space: nowrap;
}
.tag-chosen { color: var(--chosen); }
.tag-measured { color: var(--measured); }
.tag-unfalsifiable { color: var(--unfalsifiable); }

/* --------------------------------------------------------------- positions */

.table-scroll { overflow-x: auto; border: 1px solid var(--hair); border-radius: var(--r); }
table.positions { width: 100%; border-collapse: collapse; font-size: .88rem; min-width: 660px; }
table.positions th, table.positions td {
  text-align: left; padding: .65rem .85rem; border-bottom: 1px solid var(--hair-soft);
  white-space: nowrap;
}
table.positions thead th {
  background: var(--panel-2); color: var(--text-dim);
  font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; font-weight: 500;
  position: sticky; top: 0;
}
table.positions tbody tr:last-child td { border-bottom: 0; }
table.positions tbody tr:hover { background: rgba(116,208,232,.04); }
.body-cell { display: flex; align-items: center; gap: .55rem; }
.body-glyph { color: var(--chosen); font-family: var(--glyph); font-size: 1.15rem; line-height: 1; width: 1.2em; text-align: center; }
td.num { font-family: var(--mono); font-variant-numeric: tabular-nums; color: var(--measured); }
td.sign { font-family: var(--mono); }
.retro { color: var(--chosen); font-size: .76rem; letter-spacing: .04em; }
.check-link { font-size: .78rem; }

/* ------------------------------------------------------------ disagreement */

.disagree-grid {
  display: grid; gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(255px, 1fr));
  margin-bottom: 1.5rem;
}
.disagree-card {
  border: 1px solid var(--hair); border-radius: var(--r);
  background: var(--panel); padding: 1rem 1.1rem;
}
.disagree-card h3 {
  margin: 0 0 .15rem; font-size: .76rem; letter-spacing: .07em;
  text-transform: uppercase; color: var(--text-dim); font-weight: 500;
}
.disagree-card .q { font-size: .82rem; color: var(--text-faint); margin: 0 0 .9rem; }
.disagree-pair { display: grid; gap: .5rem; }
.disagree-opt {
  display: flex; justify-content: space-between; align-items: baseline; gap: .75rem;
  padding: .45rem .6rem; border-radius: var(--r);
  background: var(--panel-2); border-left: 2px solid var(--hair);
}
.disagree-opt .name { font-size: .78rem; color: var(--text-dim); }
.disagree-opt .val { font-family: var(--mono); font-size: .95rem; }
.disagree-opt.is-differing { border-left-color: var(--chosen); }
.disagree-opt.is-differing .val { color: var(--chosen); }
.disagree-opt.is-agreeing .val { color: var(--text-dim); }

.disagree-verdict {
  margin-top: .85rem; padding-top: .7rem; border-top: 1px dashed var(--hair);
  font-size: .8rem; color: var(--text-dim);
}
.disagree-verdict strong { color: var(--chosen); }

.disagree-summary {
  border: 1px solid var(--chosen-dim); border-radius: var(--r);
  background: rgba(227,169,85,.06); padding: 1.1rem 1.25rem;
  font-size: .95rem;
}
.disagree-summary strong { color: var(--chosen); }

/* ------------------------------------------------------------------ ledger */

.ledger-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); }
.ledger-col { border: 1px solid var(--hair); border-radius: var(--r); background: var(--panel); padding: 1rem 1.15rem; }
.ledger-col h3 { margin: 0 0 .2rem; font-size: .8rem; letter-spacing: .07em; text-transform: uppercase; }
.ledger-col .col-note { font-size: .78rem; color: var(--text-faint); margin: 0 0 .9rem; }
.ledger-col ul { margin: 0; padding-left: 1.05rem; display: grid; gap: .55rem; }
.ledger-col li { font-size: .85rem; color: var(--text-dim); }
.ledger-col li strong { color: var(--text); font-weight: 600; }
.ledger-measured      { border-color: var(--measured-dim); }
.ledger-measured h3   { color: var(--measured); }
.ledger-measured ul   { list-style: square; }
.ledger-chosen        { border-color: var(--chosen-dim); }
.ledger-chosen h3     { color: var(--chosen); }
.ledger-unfalsifiable { border-color: var(--unfalsifiable-dim); border-style: dashed; }
.ledger-unfalsifiable h3 { color: var(--unfalsifiable); }

/* --------------------------------------------------------------- colophon */

.colophon {
  border-top: 1px solid var(--hair);
  padding: 2.5rem 0 4rem; color: var(--text-faint); font-size: .9rem;
}
.colophon p { max-width: 70ch; }
.colophon strong { color: var(--text); }

.err {
  border: 1px solid #a24a4a; background: rgba(162,74,74,.1); color: #f0b4b4;
  padding: .8rem 1rem; border-radius: var(--r); margin-top: 1rem; font-size: .88rem;
}

/* ------------------------------------------------------------------- print */

@media print {
  :root { --text: #000; --text-dim: #333; --text-faint: #555; }
  body { background: #fff; color: #000; font-size: 11pt; background-image: none; }
  .legend { position: static; background: #fff; }
  .wheel-controls, .form-grid, .skip, .btn, #btn-print { display: none !important; }
  .panel, .masthead, .colophon { border-color: #bbb; page-break-inside: avoid; }
  .panel-feature, .disagree-summary, .badge { background: #fff !important; }
  .panel { padding: .9rem 0; }
  .wordmark-text { font-size: 24pt; }
  a { color: #000; text-decoration: none; }
  .check-link::after { content: " (" attr(href) ")"; font-size: 7pt; color: #555; word-break: break-all; }
  table.positions { min-width: 0; font-size: 9pt; }
  .disagree-card, .ledger-col, .resolved { background: #fff; border-color: #bbb; }
  #wheel svg { max-width: 15cm; margin-inline: auto; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* --------------------------------------------------------------- sharing */

.share-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: .6rem;
  margin-top: 1.25rem;
}
.share-note { font-size: .82rem; color: var(--measured); min-height: 1em; }
.share-fallback {
  display: block; width: 100%; margin-top: .6rem;
  background: var(--panel); color: var(--text); border: 1px solid var(--hair);
  border-radius: var(--r); padding: .6rem .7rem;
  font-family: var(--mono); font-size: .82rem; resize: vertical;
}
.share-privacy {
  margin: .9rem 0 0; max-width: 68ch;
  font-size: .78rem; color: var(--text-faint);
  border-left: 2px solid var(--hair); padding-left: .9rem;
}
@media print { .share-row, .share-privacy, .share-fallback { display: none !important; } }
