/* ==========================================================================
   TREKKRRHOLYMOUNTAIN
   --------------------------------------------------------------------------
   Type scale note: every font-size below is derived from real Michroma metrics
   (measured from the .woff2), so each line fills its column without wrapping.
   Natural widths, in em, at letter-spacing 0:
     TREKKRRHOLYMOUNTAIN ............ 18.825em  (19 chars)
     2D37372E3731372C3136322E323637 . 28.693em  (30 chars)
     YOUTUBE (TOPIC) ................ 12.340em  (15 chars, longest link)
   Add (chars x letter-spacing) to each, then divide the column width by the
   total to get the font-size that fills it. The divisors below do exactly that.
   ========================================================================== */

@font-face {
  font-family: "Michroma";
  src: url("../fonts/Michroma-Regular.woff2") format("woff2"),
       url("../fonts/Michroma-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #000;
  --fg: #fff;

  /* Ethereal glow ramp: white core -> cool blue halo */
  --glow-1: rgba(255, 255, 255, .95);
  --glow-2: rgba(226, 236, 255, .55);
  --glow-3: rgba(150, 178, 255, .38);
  --glow-4: rgba(96, 132, 255, .22);

  /* #99c4cd -- the glow behind the name and behind the portrait. Held as bare
     channels so one value drives every alpha below it. */
  --accent-rgb: 153, 196, 205;
  --accent-1: rgba(var(--accent-rgb), .95);
  --accent-2: rgba(var(--accent-rgb), .60);
  --accent-3: rgba(var(--accent-rgb), .40);
  --accent-4: rgba(var(--accent-rgb), .24);

  /* Links and social icons. Built as a stack of many near-opaque layers at
     stepped radii rather than a few faint wide ones: shadow layers composite
     additively, and a wide blur spreads its light so thin that raising its
     alpha barely registers. Brightness comes from the tight and mid layers
     piling up; the wide ones only carry the falloff. */
  --accent-soft-1: rgba(var(--accent-rgb), 1);
  --accent-soft-2: rgba(var(--accent-rgb), .78);
  --accent-soft-3: rgba(var(--accent-rgb), .55);

  --rule: rgba(255, 255, 255, .26);
  --rule-glow: rgba(190, 210, 255, .30);

  --ease: cubic-bezier(.22, .61, .36, 1);
}

*,
*::before,
*::after { box-sizing: border-box; }

html {
  background-color: var(--bg);

  /* The top glow rides on the root background rather than the fixed .bloom
     layer. This is not what fixed the iOS status-bar seam -- that turned out to
     be the theme-color meta tag, see index.html -- but the root background is
     the most robust place for it either way, since it is painted across the
     whole canvas rather than a positioned box. Measured from the document's top
     edge so it lands where .bloom used to put it. */
  background-image:
    radial-gradient(62vw 40vh at 50% 10vh, rgba(122, 152, 255, .11), transparent 70%);
  background-repeat: no-repeat;

  overflow-x: clip;           /* atmosphere layers must never create h-scroll */
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100svh;

  /* Deliberately no background. The root carries it (colour and top glow), and
     a background on body would paint over that inside body's box while the
     strip under the status bar kept the root's -- reinstating the same seam,
     inverted. */
  color: var(--fg);
  font-family: "Michroma", "Eurostile", "Avenir Next", "Segoe UI", Arial, sans-serif;
  font-weight: 400;
  text-transform: uppercase;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection {
  background: rgba(150, 178, 255, .30);
  color: #fff;
}

/* --------------------------------------------------------------- atmosphere */

/* Soft cool bloom sitting behind everything.

   Bled 25vh past the top and bottom so the layer's own edges can never fall
   inside the viewport on any browser. Vertical only: horizontal bleed would
   risk the h-scroll this file fixed earlier.

   The gradients are in vw/vh rather than percentages precisely because the
   element is taller than the viewport -- percentages would resolve against the
   overscanned box and drag the bloom out of position. The centres carry the
   +25vh offset so the result lands where it did before. */
.bloom {
  position: fixed;
  inset: -25vh 0;
  z-index: 0;
  pointer-events: none;
  /* Top glow lives on the root background now -- see html above. These two sit
     well inside the viewport, where the clipping never showed. */
  background:
    radial-gradient(50vw 30vh at 50% 69vh, rgba(196, 212, 255, .045), transparent 72%),
    radial-gradient(70vw 45vh at 50% 121vh, rgba(120, 150, 255, .07), transparent 72%);
  animation: drift 16s var(--ease) infinite alternate;
}

/* Fine analogue grain so the glow reads as light, not as a gradient. */
.grain {
  position: fixed;
  inset: -25vh 0;      /* same overscan, same reason */
  z-index: 3;
  pointer-events: none;
  opacity: .035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.82' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: shimmer 700ms steps(3, end) infinite;
}

@keyframes drift {
  from { opacity: .75; transform: scale(1); }
  to   { opacity: 1;   transform: scale(1.07); }
}

@keyframes shimmer {
  0%   { background-position: 0 0; }
  33%  { background-position: -37px 21px; }
  66%  { background-position: 23px -41px; }
  100% { background-position: 0 0; }
}

/* -------------------------------------------------------------------- shell */

.page {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 768px;          /* 720px of content inside the 24px gutters */
  margin-inline: auto;
  padding-block: clamp(48px, 11vh, 104px) clamp(56px, 12vh, 120px);
  padding-inline: clamp(14px, 5vw, 24px);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  container-type: inline-size;   /* 100cqw == the column width used below */
}

/* ---------------------------------------------------------------- masthead */

.masthead {
  position: relative;
  width: 100%;
  margin-bottom: clamp(34px, 7cqw, 58px);
}

/* Breathing halo behind the name. */
.masthead::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 42%;
  width: 112%;
  aspect-ratio: 5 / 2;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(ellipse at center, rgba(var(--accent-rgb), .26), rgba(var(--accent-rgb), .08) 45%, transparent 72%);
  filter: blur(22px);
  transform: translate(-50%, -50%) scale(1);
  animation: breathe 9s ease-in-out infinite;
}

@keyframes breathe {
  0%, 100% { opacity: .55; transform: translate(-50%, -50%) scale(1); }
  50%      { opacity: 1;   transform: translate(-50%, -50%) scale(1.07); }
}

.name {
  margin: 0;
  /* 18.825em + (19 x .02em) = 19.205em -> /19.8 fills ~96% of the column */
  font-size: calc(100cqw / 19.8);
  letter-spacing: .02em;
  line-height: 1.12;
  white-space: nowrap;
  text-shadow:
    0 0 .03em var(--accent-1),
    0 0 .26em var(--accent-2),
    0 0 .70em var(--accent-3),
    0 0 1.7em var(--accent-4);
}

.code {
  /* 28.693em + (30 x .06em) = 30.49em -> /36 leaves it just inside the name */
  margin: clamp(18px, 4.2cqw, 34px) 0 0;
  font-size: clamp(8px, calc(100cqw / 36), 19px);
  letter-spacing: .06em;
  line-height: 1.3;
  white-space: nowrap;
  color: rgba(255, 255, 255, .92);
  text-shadow:
    0 0 .04em var(--glow-1),
    0 0 .34em var(--glow-2),
    0 0 .95em var(--glow-3);
}

/* ------------------------------------------------------------------- links */

.links {
  width: 100%;
  display: flex;
  flex-direction: column;
}

.link {
  position: relative;
  display: block;
  padding: clamp(20px, 4.4cqw, 34px) 8px;
  color: var(--fg);
  text-decoration: none;
  /* 12.340em + (15 x .08em) = 13.54em for the longest label */
  font-size: clamp(12px, calc(100cqw / 27), 24px);
  letter-spacing: .08em;
  line-height: 1.2;
  white-space: nowrap;
  text-shadow:
    0 0 .06em var(--accent-soft-1),
    0 0 .18em var(--accent-soft-1),
    0 0 .40em var(--accent-soft-1),
    0 0 .80em var(--accent-soft-1),
    0 0 1.60em var(--accent-soft-2),
    0 0 3.00em var(--accent-soft-3);
  transition:
    letter-spacing .45s var(--ease),
    text-shadow .45s var(--ease),
    color .45s var(--ease);
}

/* Hairline rules, softly faded at both ends. */
.link::before,
.links .link:last-child::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--rule) 7%, var(--rule) 93%, transparent);
  box-shadow: 0 0 7px var(--rule-glow);
}

.link::before { top: 0; }
.links .link:last-child::after { bottom: 0; }

@media (hover: hover) {
  .link:hover {
    letter-spacing: .14em;
    text-shadow:
      0 0 .06em var(--accent-soft-1),
      0 0 .20em var(--accent-soft-1),
      0 0 .50em var(--accent-soft-1),
      0 0 1.00em var(--accent-soft-1),
      0 0 2.10em var(--accent-soft-1),
      0 0 3.80em var(--accent-soft-2);
  }
}

.link:focus-visible,
.social:focus-visible {
  outline: 1px solid rgba(255, 255, 255, .75);
  outline-offset: 6px;
  border-radius: 2px;
}

/* ----------------------------------------------------------------- socials */

.socials {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(30px, 7cqw, 46px);
  margin: clamp(40px, 8cqw, 62px) 0 0;
}

.social {
  display: inline-flex;
  width: clamp(24px, 4.2cqw, 30px);
  color: var(--fg);
  /* Chained drop-shadows compound -- each one sees the previous result, halo
     included -- so these climb fast. Deliberately quieter than the links: the
     icons are small and solid, and the same ladder overwhelms them. */
  filter:
    drop-shadow(0 0 1px rgba(var(--accent-rgb), .95))
    drop-shadow(0 0 4px rgba(var(--accent-rgb), .70))
    drop-shadow(0 0 12px rgba(var(--accent-rgb), .45));
  transition: filter .45s var(--ease), transform .45s var(--ease);
}

.social--x { width: clamp(21px, 3.7cqw, 27px); }

.social svg {
  width: 100%;
  height: auto;
  display: block;
}

.social .s {                 /* stroked parts  */
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
}

.social .f { fill: currentColor; }   /* solid parts */

@media (hover: hover) {
  .social:hover {
    transform: translateY(-2px);
    filter:
      drop-shadow(0 0 2px rgba(var(--accent-rgb), 1))
      drop-shadow(0 0 6px rgba(var(--accent-rgb), .85))
      drop-shadow(0 0 18px rgba(var(--accent-rgb), .60));
  }
}

/* ---------------------------------------------------------------- portrait */

.portrait {
  width: 100%;
  max-width: 440px;
  margin: clamp(52px, 11cqw, 96px) auto 0;
  filter:
    drop-shadow(0 0 18px rgba(var(--accent-rgb), .30))
    drop-shadow(0 0 60px rgba(var(--accent-rgb), .40));
}

.portrait img {
  width: 100%;
  height: auto;
  display: block;
}

/* ----------------------------------------------------------------- motion */

/* Staggered arrival: everything condenses out of the haze. Scoped inside
   no-preference so reduced-motion users are never left at opacity 0. */
@media (prefers-reduced-motion: no-preference) {
  .masthead,
  .links,
  .socials,
  .portrait {
    animation: rise 1.3s var(--ease) both;
  }

  .masthead { animation-delay: .05s; }
  .links    { animation-delay: .30s; }
  .socials  { animation-delay: .55s; }

  /* `rise` settles on filter: blur(0), and an animated filter outranks the
     declared one -- on .portrait that would overwrite its drop-shadow glow.
     So the portrait arrives on a variant that leaves filter alone. */
  .portrait {
    animation-name: rise-soft;
    animation-delay: .70s;
  }
}

@keyframes rise {
  from { opacity: 0; transform: translateY(16px); filter: blur(10px); }
  to   { opacity: 1; transform: none;             filter: blur(0); }
}

@keyframes rise-soft {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  /* Stop the ambient loops. .grain keeps its own low opacity here -- forcing
     opacity:1 on it would slam an opaque noise sheet over the whole page. */
  .bloom,
  .grain,
  .masthead::before {
    animation: none;
  }

  /* These start at opacity 0 only inside the no-preference block, but pin
     them visible anyway so nothing can strand them hidden. */
  .masthead,
  .links,
  .socials,
  .portrait {
    animation: none;
    opacity: 1;
    transform: none;
    filter: none;
  }

  *,
  *::before,
  *::after {
    transition-duration: .01ms !important;
  }
}

/* Sub-pixel glyph advances round up at small sizes, so give the code line
   back some room rather than letting it reach the gutters. */
@media (max-width: 400px) {
  .name { letter-spacing: 0; }
  .code { letter-spacing: .035em; }
}
