/* Fonts: self-hosted, latin subset, OFL. Licences sit beside the files. */
@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/jetbrains-mono.woff2") format("woff2");
  font-weight: 100 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Archivo";
  src: url("../fonts/archivo.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Cormorant Garamond";
  src: url("../fonts/cormorant-garamond-italic.woff2") format("woff2");
  font-weight: 300 700;
  font-style: italic;
  font-display: swap;
}

/* Tokens */
:root {
  --page: #0A0A0A;
  --window: #0F0F0F;
  --panel: #141414;      /* active tab */
  --hover: #1A1A1A;      /* hovered tab */
  --text: #EDEDED;
  --muted: #8A8A8A;
  --tab: #B8B8B8;        /* inactive tab text */
  --hairline: #2A2A2A;
  --accent: #B59A5E;     /* swap here; alternate to test: #6FD6E8 */
  --on-accent: #0A0A0A;

  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
  --name: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --voice: "Cormorant Garamond", Garamond, Georgia, serif;

  --size-h1: clamp(2.25rem, 10vw, 5rem);        /* 80px */
  --size-voice: clamp(1.375rem, 4vw, 1.875rem); /* 30px */
  --size-tagline: clamp(1.5rem, 4.6vw, 2.125rem); /* 34px */
  --pad: clamp(16px, 3vw, 32px);
}

/* Base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  padding: 24px;
  background: var(--page);
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.9375rem;
  line-height: 1.5;
}
p, h1, h2, ul, dl, dd { margin: 0; }
ul { padding: 0; list-style: none; }
a { color: var(--accent); text-underline-offset: 0.2em; }
a:hover { color: var(--text); }
:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; }
main:focus { outline: none; }

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.voice {
  font-family: var(--voice);
  font-style: italic;
  font-weight: 500;
  font-size: var(--size-voice);
  line-height: 1.3;
}
.muted { color: var(--muted); }

/* Skip link */
.skip {
  position: absolute;
  left: 24px;
  top: -100px;
  z-index: 10;
  padding: 12px 16px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 500;
}
.skip:focus { top: 8px; }

/* The window */
.window {
  max-width: 1120px;
  margin-inline: auto;
  background: var(--window);
  border: 2px solid var(--accent);
}

.titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--hairline);
  color: var(--muted);
  font-size: 0.8125rem;
}
.controls { display: flex; gap: 6px; flex: none; }
.controls span {
  width: 10px;
  height: 10px;
  border: 1px solid var(--accent);
}
.titlebar__path {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--hairline);
}
.tabs a {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  padding: 0 20px;
  border-top: 2px solid transparent;
  border-right: 1px solid var(--hairline);
  color: var(--tab);
  text-decoration: none;
  font-size: 0.875rem;
}
.tabs a:hover { background: var(--hover); color: var(--text); }
.tabs a[aria-current="page"] {
  border-top-color: var(--accent);
  background: var(--panel);
  color: var(--text);
}
.tabs a:focus-visible { outline-offset: -4px; }
.tabs a.tabs__home { min-width: 48px; justify-content: center; }
.tabs__label { margin-left: 1ch; }

.screen {
  padding: var(--pad);
  display: flex;
  flex-direction: column;
  gap: 40px;
}
.screen section { display: flex; flex-direction: column; gap: 16px; }

/* Prompt lines */
.prompt { color: var(--muted); overflow-wrap: anywhere; }
.prompt b { color: var(--accent); font-weight: 400; margin-right: 1ch; }
.cursor-line { display: flex; align-items: center; }
.cursor {
  display: inline-block;
  width: 10px;
  height: 20px;
  background: var(--accent);
}

/* Hero */
.name {
  font-family: var(--name);
  font-weight: 800;
  font-size: var(--size-h1);
  line-height: 0.96;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}
.tagline { font-size: var(--size-tagline); max-width: 30ch; }

/* Rows: ID, text, status */
.rows { border-top: 1px solid var(--hairline); }
.record {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) 56px;
  gap: 0 20px;
  align-items: baseline;
  padding: 14px 0;
  border-bottom: 1px solid var(--hairline);
}
.record__id a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin-block: -10px;
  font-size: 0.875rem;
  text-decoration: none;
}
.record__id a:hover { text-decoration: underline; }
.record__status {
  color: var(--muted);
  font-size: 0.8125rem;
  text-align: right;
  white-space: nowrap;
}
.record__text p + p { margin-top: 0.4em; }

.more a, .back a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

/* Single note */
.meta { color: var(--muted); font-size: 0.875rem; }

/* Key / value listing (colophon) */
.listing { border-top: 1px solid var(--hairline); }
.listing div {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 4px 20px;
  align-items: baseline;
  padding: 12px 0;
  border-bottom: 1px solid var(--hairline);
}
.listing dt { color: var(--muted); font-size: 0.875rem; }
.listing dd { font-size: var(--size-voice); }

.lost { font-family: var(--mono); font-size: 0.9375rem; font-weight: 500; }

/* 404 only: the window has drifted off into space */
.starfield {
  position: fixed;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  max-width: none;
  shape-rendering: crispEdges;
}
/* The one exception to "no motion": a slow drift, brighter (nearer) stars travel further.
   Reduced-motion users keep the still sky. */
@media (prefers-reduced-motion: no-preference) {
  .starfield path { animation: drift 70s ease-in-out infinite alternate; }
  .starfield path:nth-child(1) { --dx: -6px; --dy: 2px; animation-duration: 90s; }
  .starfield path:nth-child(2) { --dx: -10px; --dy: 3px; animation-duration: 80s; }
  .starfield path:nth-child(3) { --dx: -14px; --dy: 5px; animation-duration: 70s; }
  .starfield path:nth-child(4) { --dx: -20px; --dy: 7px; animation-duration: 60s; }
  .starfield path:nth-child(5) { --dx: -24px; --dy: 8px; animation-duration: 55s; }
}
@keyframes drift {
  to { transform: translate(var(--dx), var(--dy)); }
}

/* Status bar */
.statusbar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 0;
  padding: 6px 16px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 0.8125rem;
  font-weight: 500;
}
.statusbar li:not(:last-child)::after { content: "|"; margin-inline: 1ch; }

/* Narrow: rows and listings stack */
@media (max-width: 700px) {
  .record, .listing div { grid-template-columns: minmax(0, 1fr); }
  .record__status { text-align: left; }
  .record__id a { margin-block: -10px 0; }
  .record { gap: 6px 0; }
  body { padding: 12px; }
  .tabs a { padding: 0 8px; }
  /* "~" alone on narrow screens; the word stays for screen readers */
  .tabs__label {
    position: absolute; width: 1px; height: 1px; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
  }
}
