@font-face {
  font-family: "Anton";
  src: url("fonts/anton-latin-400-normal.woff2") format("woff2");
  font-display: swap;
}
@font-face {
  font-family: "Plex Mono";
  src: url("fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2");
  font-display: swap;
}

:root {
  --ink: #08060a;
  --bone: #efe6d8;
  --ash: #a79c90;
  --ember: #ffffff; /* accent is white to match the white fire */
  --display: "Anton", Impact, "Arial Narrow", sans-serif;
  --mono: "Plex Mono", ui-monospace, Consolas, monospace;
  --gutter: clamp(16px, 4vw, 64px);
}

* { box-sizing: border-box; }
html { background: var(--ink); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--bone);
  font: 400 16px/1.65 var(--mono);
  overflow-x: hidden;
}
body:not([data-stage="bio"]) { overflow: hidden; height: 100vh; height: 100dvh; }

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

:focus-visible { outline: 3px solid var(--ember); outline-offset: 3px; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}

/* Gate */
#gate {
  position: fixed; inset: 0; z-index: 40;
  display: grid; place-items: center;
  width: 100%; height: 100%; padding: var(--gutter);
  border: 0; background: transparent; color: var(--bone);
  font: 400 clamp(44px, 11vw, 148px)/1 var(--display);
  text-transform: uppercase; letter-spacing: .01em;
  cursor: pointer;
}
#gate:focus-visible { outline-offset: -14px; }
#gate-label { max-width: 11ch; animation: breathe 2.6s ease-in-out infinite; }
#gate[hidden] { display: none; }
@keyframes breathe { 50% { opacity: .55; } }

/* Intro */
#intro {
  position: fixed; inset: 0; z-index: 20;
  display: none; place-items: center;
  padding: var(--gutter);
  pointer-events: none;
}
body[data-stage="intro"] #intro { display: grid; }
#phrases { display: grid; width: 100%; }
.phrase {
  grid-area: 1 / 1;
  align-self: center;
  margin: 0;
  font: 400 min(15vw, 24vh)/1.02 var(--display);
  text-transform: uppercase;
  text-align: center;
  visibility: hidden;
}
.phrase.current { visibility: visible; }
.word { display: inline-block; margin: 0 .09em; opacity: 0; color: var(--ash); }
.word.on { opacity: 1; }
.word.active { color: var(--bone); animation: slam .17s cubic-bezier(.2, .9, .3, 1); }
.word.accent { color: var(--ember); }
@keyframes slam { from { transform: scale(1.2); } }

/* Cut */
#cut { position: fixed; inset: 0; z-index: 30; overflow: hidden; pointer-events: none; }
#cut[hidden] { display: none; }
.shard {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  padding: var(--gutter);
  will-change: transform;
}
.shard::before {
  content: ""; position: absolute; inset: 0;
  background: var(--ink); opacity: var(--solid, 0);
}
.shard .phrase { position: relative; visibility: visible; width: 100%; }
.shard-top { clip-path: polygon(0 0, 100% 0, 100% 34%, 0 66%); }
.shard-bottom { clip-path: polygon(0 66%, 100% 34%, 100% 100%, 0 100%); }
.slash {
  position: absolute; left: -10%; top: 50%;
  width: 120%; height: 6px;
  background: var(--ember);
  box-shadow: 0 0 28px 4px rgba(255, 255, 255, .6);
  transform-origin: 0 50%;
  transform: rotate(var(--angle, -13deg)) scaleX(0);
  will-change: transform, opacity;
}

/* Bio */
#bio {
  position: relative; z-index: 10;
  min-height: 100vh; min-height: 100dvh;
  padding: clamp(48px, 8vh, 96px) var(--gutter);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center;
  opacity: 0;
  outline: none;
}
body[data-stage="bio"] #bio { opacity: 1; }
.bio-content {
  display: flex; flex-direction: column; align-items: center;
  gap: clamp(32px, 6vh, 72px);
  width: 100%; max-width: 1100px;
  container-type: inline-size;
}
#bio-name {
  margin: 0;
  /* Scales with the container width so the full name always fits on one line. */
  font: 400 min(260px, 14cqi)/.95 var(--display);
  text-transform: uppercase;
  white-space: nowrap;
  max-width: 100%;
}
/* Letters are inline-block so they can move; --ly/--lr/--ls come from main.js and compose
   with Motion's entrance `transform`. --ly is a fraction of the font size. */
.letter {
  display: inline-block;
  white-space: pre;
  translate: 0 calc(var(--ly, 0) * 1em);
  rotate: var(--lr, 0deg);
  scale: var(--ls, 1);
}
#bio-name.glitching { text-shadow: calc(var(--glitch, 0) * 0.02em) 0 rgba(255, 40, 80, .85), calc(var(--glitch, 0) * -0.02em) 0 rgba(0, 230, 255, .85); }
#socials {
  display: flex; flex-wrap: wrap; justify-content: center; align-items: center;
  gap: clamp(4px, 1vw, 8px);
  width: 100%;
  /* Logo size: 56px on a 320px phone up to 72px on wide screens. */
  --logo: clamp(56px, 9vw, 72px);
}
.social {
  display: grid; place-items: center;
  flex: none;
  width: calc(var(--logo) + 12px); height: calc(var(--logo) + 12px);
  min-width: 44px; min-height: 44px; padding: 0;
  border: 0;
  background: none;
  color: var(--bone); text-decoration: none;
  /* Lets taps and drags reach the page's touch handlers without double-tap zoom delays. */
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: border-color .15s, color .15s, transform .15s;
}
/* The evasive card can end up over a neighbour; keep it on top so it stays reachable. */
.social[data-evasive] { position: relative; z-index: 2; }
/* Drift and glitch are driven from main.js via variables; `translate` composes with the
   entrance `transform` (Motion) and the hover transform. */
.social { translate: calc(var(--drift-x, 0px) + var(--glitch-x, 0px) + var(--dodge-x, 0px)) calc(var(--drift-y, 0px) + var(--dodge-y, 0px)); }
.social[hidden] { display: none; }
button.social { font: inherit; cursor: pointer; }
.social.glitching .social-icon { filter: drop-shadow(calc(var(--glitch, 0) * 2.5px) 0 rgba(255, 40, 80, .85)) drop-shadow(calc(var(--glitch, 0) * -2.5px) 0 rgba(0, 230, 255, .85)); }
.social:hover, .social:focus-visible, .social[data-feedback] { color: var(--ember); }
.social:hover { transform: translateY(-3px); }
.social[data-feedback="fail"] { color: rgba(255, 40, 80, .95); }
.social-icon {
  width: var(--logo); height: var(--logo); flex: none;
  fill: currentColor; stroke: none;
}
.motion-ready .letter, .motion-ready .social { opacity: 0; }
#notice { margin: 0; color: var(--ash); font-size: 14px; }

.noscript { position: fixed; inset: auto 0 0; z-index: 60; margin: 0; padding: 16px; text-align: center; }

html { scrollbar-width: thin; scrollbar-color: var(--ember) transparent; }

@media (max-width: 760px) {
  .phrase { font-size: min(21vw, 18vh); }
}

@media (prefers-reduced-motion: reduce) {
  #backdrop { display: none; }
  #gate-label, .word.active { animation: none; }
  .social { transition: none; }
  .social:hover { transform: none; }
  .social { translate: none; }
  .social.glitching .social-icon { filter: none; }
  .letter { translate: none; rotate: none; scale: none; }
  #bio-name.glitching { text-shadow: none; }
}
