/* electricgalaxies.com — paper site for Kirk Bagger, 2026 */
@font-face {
  font-family: "Source Serif 4";
  src: url("fonts/source-serif-4-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("fonts/source-serif-4-latin-400-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("fonts/source-serif-4-latin-600-normal.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("fonts/source-serif-4-latin-700-normal.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Source Sans 3";
  src: url("fonts/source-sans-3-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Source Sans 3";
  src: url("fonts/source-sans-3-latin-600-normal.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Source Sans 3";
  src: url("fonts/source-sans-3-latin-700-normal.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #f6f1e8;
  --bg-card: #fffdf8;
  --ink: #1b1814;
  --muted: #5c564c;
  --line: #d7cdb8;
  --accent: #6b2a1f;
  --accent-hover: #8d3a2a;
  --focus: #1e3a5f;
  --serif: "Source Serif 4", "Iowan Old Style", Palatino, "Palatino Linotype", Georgia, serif;
  --sans: "Source Sans 3", "Source Sans Pro", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --measure: 40rem;
  --wide: 54rem;
  --radius: 6px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.125rem;
  line-height: 1.65;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
}
a:hover { color: var(--accent-hover); }
a:focus-visible, button:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

.skip {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--bg-card);
  color: var(--ink);
  padding: 0.5rem 1rem;
  z-index: 10;
}
.skip:focus { left: 0.75rem; top: 0.75rem; }

.wrap {
  width: min(var(--wide), calc(100% - 2rem));
  margin-inline: auto;
}
.measure { width: min(var(--measure), 100%); }

header.site {
  border-bottom: 1px solid var(--line);
  padding: 0.85rem 0;
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 5;
}
header.site .bar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.brand {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: none;
}
.brand:hover { color: var(--accent); }
nav.toc {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
  font-family: var(--sans);
  font-size: 0.92rem;
}
nav.toc a { color: var(--muted); text-decoration: none; }
nav.toc a:hover { color: var(--accent); text-decoration: underline; }

.hero {
  padding: 3.25rem 0 2.5rem;
  border-bottom: 1px solid var(--line);
}
.kicker {
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 1.1rem;
}
h1 {
  font-size: clamp(1.85rem, 4.2vw, 2.65rem);
  line-height: 1.18;
  font-weight: 700;
  letter-spacing: -0.015em;
  margin: 0 0 0.85rem;
  max-width: 28ch;
}
.subtitle {
  font-size: 1.25rem;
  color: var(--muted);
  margin: 0 0 1.6rem;
  font-weight: 400;
}
.byline {
  font-family: var(--sans);
  font-size: 1rem;
  margin: 0 0 1.5rem;
  color: var(--ink);
}
.byline .name { font-weight: 700; }
.byline .role, .byline .date { color: var(--muted); }
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}
.btn {
  font-family: var(--sans);
  font-size: 0.95rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 0.95rem;
  border-radius: var(--radius);
  border: 1px solid var(--accent);
  text-decoration: none;
}
.btn.primary {
  background: var(--accent);
  color: #fffdf8;
}
.btn.primary:hover { background: var(--accent-hover); color: #fffdf8; }
.btn.ghost {
  background: transparent;
  color: var(--accent);
}
.btn.ghost:hover { background: #efe6d8; color: var(--accent-hover); }

.nowrap { white-space: nowrap; }

section[id] { scroll-margin-top: 4.5rem; }
@media (max-width: 700px) {
  section[id] { scroll-margin-top: 6.25rem; }
}

section {
  padding: 2.6rem 0;
  border-bottom: 1px solid var(--line);
}
section h2 {
  font-size: 1.55rem;
  line-height: 1.25;
  margin: 0 0 1.1rem;
  letter-spacing: -0.01em;
}
section h3 {
  font-size: 1.15rem;
  margin: 1.6rem 0 0.6rem;
}
p { margin: 0 0 1rem; }
p.lead { font-size: 1.18rem; }
ul, ol { margin: 0 0 1rem; padding-left: 1.2rem; }
li { margin: 0 0 0.45rem; }
li ul { margin-top: 0.4rem; }

.note {
  font-size: 0.98rem;
  color: var(--muted);
}

.table-wrap {
  overflow-x: auto;
  margin: 1.1rem 0 1.2rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-card);
  -webkit-overflow-scrolling: touch;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--sans);
  font-size: 0.95rem;
  line-height: 1.4;
  min-width: 36rem;
}
caption {
  text-align: left;
  font-family: var(--serif);
  font-style: italic;
  color: var(--muted);
  padding: 0 0 0.6rem;
  caption-side: bottom;
  margin: 0.6rem 0.2rem 0;
}
th, td {
  padding: 0.7rem 0.85rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}
th {
  font-weight: 600;
  background: #efe8db;
  white-space: nowrap;
}
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr:last-child td { border-bottom: none; }
tr.best td { font-weight: 600; }
tbody tr:hover { background: #f3efe6; }

figure.paper-fig {
  margin: 1.6rem 0 0;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.85rem 0.85rem 0.2rem;
}
figure.paper-fig img {
  width: 100%;
  background: #fff;
  border-radius: 3px;
}
figcaption {
  font-size: 0.95rem;
  color: var(--muted);
  padding: 0.75rem 0.2rem 0.85rem;
  line-height: 1.5;
}
figcaption strong { color: var(--ink); font-weight: 600; }

.credits dt {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.95rem;
  margin: 0.9rem 0 0.15rem;
}
.credits dd {
  margin: 0;
  color: var(--ink);
}
.credits { margin: 0 0 1.2rem; }

cite.block, .citation {
  display: block;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  margin: 0 0 1rem;
}
.citation p { margin: 0; }
pre.bib {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.82rem;
  line-height: 1.5;
  background: #1b1814;
  color: #f6f1e8;
  padding: 1rem 1.1rem;
  border-radius: var(--radius);
  overflow-x: auto;
  margin: 0 0 1rem;
  white-space: pre;
}

.ai, footer.site {
  font-family: var(--sans);
  font-size: 0.95rem;
  color: var(--muted);
}
.ai {
  background: #efe8db;
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  color: var(--ink);
  margin: 0 0 0.2rem;
}
footer.site {
  padding: 1.8rem 0 2.6rem;
}
footer.site p { margin: 0 0 0.55rem; }

@media (max-width: 640px) {
  body { font-size: 1.05rem; }
  .hero { padding: 2.2rem 0 1.8rem; }
  .nowrap { white-space: nowrap; }

section[id] { scroll-margin-top: 4.5rem; }
@media (max-width: 700px) {
  section[id] { scroll-margin-top: 6.25rem; }
}

section { padding: 2rem 0; }
  nav.toc { gap: 0.25rem 0.8rem; font-size: 0.85rem; }
}

@media print {
  header.site { position: static; }
  .btn, nav.toc { display: none; }
  body { background: #fff; }
  a { color: inherit; text-decoration: none; }
  figure.paper-fig { break-inside: avoid; }
}

@media (max-width: 700px) {
  .table-wrap {
    overflow: visible;
    border: none;
    background: transparent;
    border-radius: 0;
  }
  table { min-width: 0; }
  thead { display: none; }
  tbody tr {
    display: block;
    background: var(--bg-card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    margin: 0 0 0.75rem;
    padding: 0.2rem 0;
  }
  tbody tr:hover { background: var(--bg-card); }
  tbody tr:last-child td { border-bottom: 1px solid var(--line); }
  tbody tr td:last-child { border-bottom: none; }
  td, td.num {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    text-align: right;
    border-bottom: 1px solid var(--line);
  }
  td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--muted);
    text-align: left;
    max-width: 60%;
  }
}
