/* ─────────────────────────────────────────────────────────────────────────
   Theme tokens.

   Dark is the default: phosphor green on black. Light is a typewriter mode —
   black ink on warm paper — and swaps only these values, so every rule below
   works unchanged in both.
   ───────────────────────────────────────────────────────────────────────── */
:root {
  --fg: #00ff00;
  --fg-rgb: 0, 255, 0;
  --bg: #000000;
  --bg-rgb: 0, 0, 0;
  --font: 'Share Tech Mono', monospace;
  /* Photographs and portraits rest in the phosphor tint of the rest of the UI. */
  --photo-rest: grayscale(100%) brightness(90%) sepia(100%) hue-rotate(70deg);

  /* Myth/OS runs its own near-monochrome palette rather than the phosphor
     green, so it needs its own tokens. */
  --m-text: #ffffff;
  --m-text-rgb: 255, 255, 255;
  --m-dim: #cccccc;
  --m-faint: #666666;
  --m-line: #333333;
  --metal: #e8ecf1;
  --metal-rgb: 226, 232, 240;
}

:root[data-theme="light"] {
  --fg: #1a1512;
  --fg-rgb: 26, 21, 18;
  --bg: #efe9dc;
  --bg-rgb: 239, 233, 220;
  /* Ink on paper: photographs read as a warm duotone rather than phosphor. */
  --photo-rest: grayscale(100%) sepia(32%) contrast(1.04) brightness(0.98);

  --m-text: #17130f;
  --m-text-rgb: 23, 19, 15;
  --m-dim: #443c34;
  --m-faint: #8c8175;
  --m-line: #c9bfae;
  /* Struck metal has to darken on paper or the award badges disappear. */
  --metal: #3f434d;
  --metal-rgb: 63, 67, 77;
}

* {
  box-sizing: border-box;
}

/* Pages scroll; the document does not fix its own height. Only the landing
   screen and the open lightboxes lock scrolling, and each does so itself. */
/* The site's base size, and the one knob that sets the scale of everything
   measured in rem — type, padding, gaps. 15px rather than the browser's 16
   because Share Tech Mono has a tall x-height and a wide advance, so it sets
   noticeably larger than a proportional face at the same nominal size. */
html {
  margin: 0;
  padding: 0;
  width: 100%;
  font-size: 15px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  padding: 0;
  width: 100%;
  min-height: 100%;
  overflow-x: hidden;
  background-color: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.5;
}

body.landing {
  overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* A stable focus owner outside #app. Route changes can safely replace the
   page without removing Chrome's currently focused DOM node. */
#interaction-anchor,
#interaction-reset {
  position: fixed;
  top: -10px;
  left: -10px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
  border: 0;
}

/* Headings carry no rule of their own. A letter-spaced title draws its own
   underline one letter-space too wide, which read as a mistake on every page
   that used it; where a page wants a rule it puts one on the header row. */
h1, h2, h3 {
  color: var(--fg);
  border: none;
  margin: 0;
}

a {
  color: var(--fg);
  text-decoration: none;
  transition: all 0.3s ease;
}

a:is(:hover, .is-hover) {
  color: #ffffff;
  text-shadow: 0 0 10px var(--fg);
  text-decoration: none;
}

/* Images are images. The phosphor tint used to be applied here and then
   undone by every single page that showed a picture; pages that want it now
   ask for it with --photo-rest. */
img, video {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Scrollbar styles */
/* One scrollbar for the whole site rather than a different one per page. */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(var(--fg-rgb), 0.45) transparent;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
  background-color: var(--bg);
}

::-webkit-scrollbar-thumb {
  background-color: rgba(var(--fg-rgb), 0.45);
}

::-webkit-scrollbar-thumb:hover {
  background-color: var(--fg);
}

::selection {
  background: var(--fg);
  color: var(--bg);
}

/* Utility classes */
.hidden {
  display: none !important;
}

/* Cursor animation */
.cursor {
  color: var(--fg);
  animation: blink 1s infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
  0% { opacity: 0.5; }
  50% { opacity: 1; }
  100% { opacity: 0.5; }
}

.loading-text {
  color: var(--fg);
  text-align: center;
  padding: 20px;
  font-style: italic;
  animation: pulse 1.5s infinite;
}
/* Switching theme rewrites the colour tokens, which would otherwise start a
   transition on every element that references them at once — hundreds of
   simultaneous repaints, during which the page stops responding to hover.
   Transitions are suppressed for the duration of the swap. */
html.theme-switching *,
html.theme-switching *::before,
html.theme-switching *::after {
  transition: none !important;
}

/* One-frame pointer reset used after client-side rendering. */
html.hover-retargeting body > * {
  pointer-events: none !important;
}
