/* Custom Properties */
:root {
  --night: #0a0a12;
  --night-2: #12121e;
  --star: #e8e6e0;
  --star-dim: rgba(232,230,224,0.55);
  --glow: #f5c542;
  --glow-soft: rgba(245,197,66,0.25);
  --cool: #5a9fd4;
  --cool-soft: rgba(90,159,212,0.25);
  --rule: rgba(255,255,255,0.12);
  --rule-strong: rgba(255,255,255,0.25);
  --display: "Space Grotesk", system-ui, sans-serif;
  --body: "Inter", system-ui, sans-serif;
  --mono: "JetBrains Mono", "Consolas", monospace;
}

/* Reset & Base */
* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion) {
  html {
    scroll-behavior: auto;
  }
}

body {
  margin: 0;
  background: var(--night);
  color: var(--star);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

a {
  color: var(--star);
  text-decoration-color: var(--rule-strong);
  text-underline-offset: 2px;
}

a:hover {
  text-decoration-color: var(--glow);
}

/* Layout */
.shell {
  max-width: 46rem;
  margin: 0 auto;
  padding: 0 1.25rem;
}

.shell-wide {
  max-width: 60rem;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* Top bar */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  max-width: 60rem;
  margin: auto;
  padding: 1rem 1.25rem;
  font-family: var(--mono);
  font-size: .8rem;
}

.topbar .brand {
  letter-spacing: .04em;
  text-decoration: none;
}

.langsw a[aria-current] {
  border-bottom: 2px solid var(--glow);
}

/* Hero section */
.hero {
  position: relative;
  min-height: 85vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 3rem 0 2rem;
  overflow: hidden;
}

.hero canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

.hero .shell {
  position: relative;
  z-index: 1;
}

.kicker {
  font-family: var(--mono);
  font-size: .78rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--star-dim);
  margin: 0 0 1rem;
}

h1 {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(2.5rem, 7.5vw, 4.4rem);
  line-height: 1.02;
  margin: 0 0 1.2rem;
  letter-spacing: -.02em;
}

.standfirst {
  font-size: 1.13rem;
  line-height: 1.6;
  max-width: 42rem;
  margin: 0 0 1.5rem;
  color: var(--star-dim);
}

/* Ledger line (stats grid) */
.ledgerline {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--rule-strong);
  border-bottom: 1px solid var(--rule-strong);
  margin: 1.75rem 0;
}

.ledgerline > div {
  padding: .8rem .9rem .8rem 0;
  border-right: 1px solid var(--rule);
}

.ledgerline > div:last-child {
  border-right: 0;
}

.ledgerline .n {
  font-family: var(--mono);
  font-size: 1.35rem;
  font-weight: 500;
  display: block;
  font-variant-numeric: tabular-nums;
  color: var(--glow);
}

.ledgerline .l {
  font-size: .78rem;
  color: var(--star-dim);
  line-height: 1.35;
  display: block;
  margin-top: .2rem;
}

@media (max-width: 700px) {
  .ledgerline {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  
  .ledgerline > div {
    border-right: 1px solid var(--rule);
  }
  
  .ledgerline > div:nth-child(2n) {
    border-right: 0;
  }
  
  .ledgerline > div:nth-child(1),
  .ledgerline > div:nth-child(2) {
    border-bottom: 1px solid var(--rule);
  }
}

/* Sections */
.block {
  padding: 2.4rem 0 1.4rem;
}

h2 {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(1.5rem, 4vw, 2.1rem);
  line-height: 1.12;
  margin: 0 0 1rem;
}

.prose p {
  max-width: 42rem;
  margin: 0 0 1.05rem;
}

.prose .note {
  font-size: .88rem;
  color: var(--star-dim);
}

hr.divider {
  border: 0;
  border-top: 1px solid var(--rule-strong);
  margin: 1.6rem auto;
  max-width: 60rem;
}

.num {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: .94em;
  white-space: nowrap;
}

/* Figures */
figure.fig {
  margin: 1.8rem 0;
}

figure.fig svg {
  display: block;
  width: 100%;
  height: auto;
}

figcaption {
  font-size: .8rem;
  color: var(--star-dim);
  margin-top: .55rem;
  line-height: 1.5;
  max-width: 42rem;
  font-family: var(--mono);
}

.axis text {
  font-family: var(--mono);
  font-size: 11px;
  fill: var(--star-dim);
}

.axis line {
  stroke: var(--rule);
}

/* Instrument section */
.instrument {
  background: var(--night-2);
  border-top: 1px solid var(--rule-strong);
  border-bottom: 1px solid var(--rule-strong);
  padding: 2.2rem 0 2.4rem;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1.4rem 2.2rem;
  align-items: flex-end;
  margin: 1.3rem 0 1.6rem;
}

.ctrl label {
  display: block;
  font-family: var(--mono);
  font-size: .74rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--star-dim);
  margin-bottom: .45rem;
}

select#loc {
  font-family: var(--mono);
  font-size: 1rem;
  padding: .5rem .8rem;
  border: 1px solid var(--rule-strong);
  border-radius: 4px;
  background: var(--night);
  color: var(--star);
  width: 100%;
  max-width: 22rem;
  appearance: auto;
}

select#loc:focus {
  outline: 2px solid var(--cool);
  outline-offset: 1px;
}

/* Instrument star canvas */
.instrument-sky {
  position: relative;
  width: 100%;
  height: 340px;
  border-radius: 8px;
  overflow: hidden;
  background: #060610;
  margin-top: 1rem;
}

.instrument-sky canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* Readouts */
.colgrid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(14rem, 22rem);
  gap: 2rem;
  align-items: start;
}

@media (max-width: 820px) {
  .colgrid {
    grid-template-columns: 1fr;
  }
}

.readouts {
  display: grid;
  gap: 1rem;
}

.readout {
  border-top: 1px solid var(--rule-strong);
  padding-top: .7rem;
}

.readout .r-num {
  font-family: var(--mono);
  font-size: 1.9rem;
  font-weight: 500;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  display: block;
  color: var(--glow);
}

.readout .r-num.lost {
  color: #c25a4a;
}

.readout .r-num.cool {
  color: var(--cool);
}

.readout .r-txt {
  font-size: .92rem;
  color: var(--star-dim);
  line-height: 1.5;
  display: block;
  margin-top: .3rem;
  max-width: 26rem;
}

/* Split view */
.splitview {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin: 1.6rem 0;
}

@media (max-width: 600px) {
  .splitview {
    grid-template-columns: 1fr;
  }
}

.splitview .panel {
  position: relative;
  height: 220px;
  border-radius: 8px;
  overflow: hidden;
  background: #060610;
}

.splitview .panel canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.splitview .panel-label {
  position: absolute;
  bottom: .6rem;
  left: .8rem;
  font-family: var(--mono);
  font-size: .72rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--star-dim);
  z-index: 1;
}

/* EU bars */
.eubars {
  max-width: 42rem;
  margin: 1.6rem 0;
  font-family: var(--mono);
  font-size: .82rem;
}

.eubar {
  display: grid;
  grid-template-columns: 9rem minmax(0,1fr) 3.2rem;
  align-items: center;
  gap: .6rem;
  padding: .17rem 0;
}

.eubar .b {
  height: .78em;
  background: var(--rule-strong);
  min-width: 2px;
  border-radius: 2px;
}

.eubar.is-ro .b {
  background: var(--glow);
}

.eubar.is-ro {
  font-weight: 500;
  color: var(--glow);
}

.eubar .v {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 480px) {
  .eubar {
    grid-template-columns: 6.5rem minmax(0,1fr) 2.8rem;
    font-size: .75rem;
  }
}

/* Sources section */
.ledger .srcrow {
  border-top: 1px solid var(--rule);
  padding: 1rem 0;
  max-width: 42rem;
}

.ledger .tag {
  font-family: var(--mono);
  font-size: .72rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--star-dim);
  margin: 0 0 .35rem;
}

.ledger .srcrow p {
  margin: 0 0 .4rem;
}

.ledger .meta {
  font-size: .85rem;
  color: var(--star-dim);
}

/* Footer */
footer.site {
  border-top: 1px solid var(--rule-strong);
  margin-top: 3rem;
  padding: 1.2rem 0 2.2rem;
  font-family: var(--mono);
  font-size: .78rem;
  color: var(--star-dim);
}

footer.site .shell {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .5rem;
}

/* Return to top */
.totop {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  width: 2.6rem;
  height: 2.6rem;
  display: none;
  align-items: center;
  justify-content: center;
  background: var(--star);
  color: var(--night);
  text-decoration: none;
  border-radius: 4px;
  font-size: 1.1rem;
  z-index: 10;
}

.totop.show {
  display: flex;
}
