/* Fluid scale: sizes shrink smoothly from desktop (≥1250px wide, unchanged)
   down to phones (~375px wide), so the text keeps its line breaks and weight. */
:root {
  --edge:  clamp(24px, 18.3px + 3.66vw, 64px);           /* page margin: 64px → 32px */
  /* 20px desktop → ~14.5px phone; the last term shrinks it on narrow screens
     so the longest line (~19.6em) never wraps. Text is left-aligned, so only
     20px is kept free on the right. */
  --text:  clamp(11px, min(12.1px + 0.63vw, 3vh, (100vw - var(--edge) - 20px) / 20), 20px);
  --title: clamp(28px, 19.1px + 4.23vw, 72px);           /* 72px → 35px */
}

/* --page-bg is updated by main.js so the area under the browser bars
   (and the bars themselves in Safari) match what is on screen. */
html, body { margin: 0; height: 100%; background: var(--page-bg, #05070f); overflow: hidden; overscroll-behavior: none; }
body {
  color: #e8ebf3;
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 200;
  -webkit-font-smoothing: antialiased;
}
a { color: #e8ebf3; }

#ray { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

@keyframes lineIn {
  from { opacity: 0; transform: translate3d(0, 18px, 0); filter: blur(10px); }
  to   { opacity: 1; transform: translate3d(0, 0, 0);    filter: blur(0); }
}
.line {
  display: block;
  animation: lineIn 1.8s cubic-bezier(.2, .7, .2, 1) var(--d, 0s) both;
  will-change: transform, opacity, filter;
  backface-visibility: hidden;
}

.intro {
  position: fixed; left: var(--edge); bottom: var(--edge);
  max-width: min(28em, calc(100% - var(--edge) - 20px));
  display: flex; flex-direction: column; gap: 1.2em;
  font-size: var(--text); line-height: 1.5; color: #9aa3b8;
  transition: opacity .6s ease, filter .6s ease;
}
.intro p { margin: 0; }
.intro.leaving { opacity: 0; filter: blur(8px); pointer-events: none; }

/* The underline is its own drawn line (::after), not text-decoration: Chrome
   drops a text-decoration underline for a frame while text-shadow animates. */
.hl {
  position: relative;
  color: #e8ebf3; text-decoration: none;
  text-shadow: 0 0 12px rgba(190, 210, 245, .35);
  -webkit-tap-highlight-color: transparent; /* no grey box flash on tap */
  transition: color .6s ease, text-shadow .6s ease;
}
.hl::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px;
  background: rgba(232, 235, 243, .45);
  box-shadow: 0 0 6px rgba(200, 220, 255, 0);
  pointer-events: none;
  transition: background-color .6s ease, box-shadow .6s ease;
}
/* Lit (hover, press or keyboard focus): the underline lights up and the text
   glows. Hover only counts on devices with a real pointer, so it doesn't
   stick after a tap on phones. */
@media (hover: hover) {
  .hl:hover {
    color: #fff;
    text-shadow: 0 0 6px rgba(235, 242, 255, .9), 0 0 16px rgba(200, 220, 255, .65), 0 0 34px rgba(170, 200, 255, .4);
    transition-duration: .12s;
  }
  .hl:hover::after {
    background: #fff;
    box-shadow: 0 0 6px rgba(235, 242, 255, .9), 0 0 14px rgba(200, 220, 255, .6);
    transition-duration: .12s;
  }
}
.hl.lit, .hl:active, .hl:focus-visible {
  outline: none;
  color: #fff;
  text-shadow: 0 0 6px rgba(235, 242, 255, .9), 0 0 16px rgba(200, 220, 255, .65), 0 0 34px rgba(170, 200, 255, .4);
  transition-duration: .12s;
}
.hl.lit::after, .hl:active::after, .hl:focus-visible::after {
  background: #fff;
  box-shadow: 0 0 6px rgba(235, 242, 255, .9), 0 0 14px rgba(200, 220, 255, .6);
  transition-duration: .12s;
}

/* The work page scrolls on its own (the canvas, and so the dither, stays put
   behind it). The heading starts bottom-left; scrolling moves it up until it
   reaches the top margin, where it sticks. */
.work {
  position: fixed; inset: 0; padding: 0 var(--edge); box-sizing: border-box;
  overflow-y: auto; overscroll-behavior: none; /* no rubber-band bounce at the top or bottom */
  scrollbar-width: none;
  color: #fff;
}
.work::-webkit-scrollbar { display: none; }
.work[hidden] { display: none; }
.work .line { animation-duration: 1.6s; }
/* Pushes the heading down so it first sits one margin above the bottom edge. */
.work-lead { height: calc(100% - var(--edge) - var(--title) * 1.05); }
.work h1 {
  position: sticky; top: var(--edge); z-index: 1;
  margin: 0; text-transform: uppercase; font-weight: 200; font-size: var(--title); letter-spacing: -.02em; line-height: 1.05;
}
/* Room below the heading for the work itself; one screen tall for now. */
.work-body { height: 100%; }
