/* Fluid scale: sizes grow smoothly from phones (~375px wide) up to desktop
   (≥1440px wide), so the text keeps its line breaks and weight. Phone sizes
   are unchanged; desktop has bigger text and margins. */
:root {
  --edge:  clamp(24px, 9.46px + 6.01vw, 96px);           /* page margin: 32px phone → 96px desktop */
  /* ~14.5px phone → 24px desktop; the last term shrinks it on narrow screens
     so the longest line (~19.6em) never wraps, and 3vh keeps it in proportion
     on short windows. Text is left-aligned, so only 20px is kept free on the right. */
  --text:  clamp(11px, min(11.15px + 0.892vw, 3vh, (100vw - var(--edge) - 20px) / 20), 24px);
  --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; }

/* The canvas and the work page are absolute, not fixed (the page never scrolls,
   so they look the same). iPhone Safari tints its toolbar from full-screen fixed
   layers and doesn't update it when their colour changes, which left the bottom
   bar light blue after closing the work page; with no fixed layers it follows
   --page-bg instead. */
#ray { position: absolute; 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: absolute; 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 block down so it first sits one margin above the bottom
   edge. Its height: heading line (1.05) + gap (.22) + swatch strip (.3), in
   units of the title size. */
.work-lead { height: calc(100% - var(--edge) - var(--title) * 1.57); }
/* Heading and swatch strip scroll together and stick at the top margin.
   max-content makes the strip exactly as wide as the heading text. */
.work-head { position: sticky; top: var(--edge); z-index: 1; width: max-content; }
.work h1 {
  margin: 0; text-transform: uppercase; font-weight: 200; font-size: var(--title); letter-spacing: -.02em; line-height: 1.05;
}
/* Colour block strip: eight steps from the site's palette, pale dither blue
   through greys and bluish greys down to the page's dark navy. */
.swatches { display: flex; font-size: var(--title); height: .3em; margin-top: .22em; } /* blocks touch, no gaps */
.swatches i { flex: 1; }
.swatches i:nth-child(1) { background: #e2ecff; } /* dither dots */
.swatches i:nth-child(2) { background: #c3cee4; }
.swatches i:nth-child(3) { background: #9aa3b8; } /* intro text grey */
.swatches i:nth-child(4) { background: #7886a6; }
.swatches i:nth-child(5) { background: #56627f; }
.swatches i:nth-child(6) { background: #363f57; }
.swatches i:nth-child(7) { background: #1a2030; }
.swatches i:nth-child(8) { background: #05070f; } /* page navy */
/* Room below the heading for the work itself; one screen tall for now. */
.work-body { height: 100%; }
