@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 300 900;
  font-display: swap;
  src: url("/fonts/fraunces.woff2") format("woff2");
}
@font-face {
  font-family: "Fraunces";
  font-style: italic;
  font-weight: 300 900;
  font-display: swap;
  src: url("/fonts/fraunces-italic.woff2") format("woff2");
}
@font-face {
  font-family: "Spline Sans Mono";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("/fonts/spline-sans-mono.woff2") format("woff2");
}

:root {
  --paper: #f4eee1;
  --ink: #201b16;
  --faint: rgba(32, 27, 22, 0.52);
  --hairline: rgba(32, 27, 22, 0.22);
  --accent: #c2431f;
  --bloom-blend: multiply;
  --bloom-alpha: 0.4;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #191512;
    --ink: #ede4d3;
    --faint: rgba(237, 228, 211, 0.5);
    --hairline: rgba(237, 228, 211, 0.2);
    --accent: #e86a3c;
    --bloom-blend: screen;
    --bloom-alpha: 0.33;
  }
}

* {
  box-sizing: border-box;
  margin: 0;
}

html,
body {
  height: 100%;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: "Fraunces", "Iowan Old Style", Georgia, serif;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

.mono {
  font-family: "Spline Sans Mono", ui-monospace, "SF Mono", monospace;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: lowercase;
  color: var(--faint);
}

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

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

.blooms {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.bloom {
  position: absolute;
  width: 55vmax;
  height: 55vmax;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    oklch(0.75 0.14 var(--h)) 0%,
    transparent 62%
  );
  mix-blend-mode: var(--bloom-blend);
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.55);
  transition:
    opacity 1.9s ease-out,
    transform 2.6s cubic-bezier(0.2, 0.6, 0.3, 1);
  will-change: opacity, transform;
}

.bloom.on {
  opacity: var(--bloom-alpha);
  transform: translate(-50%, -50%) scale(1);
}

.bloom.off {
  opacity: 0;
  transform: translate(-50%, -50%) scale(1.18);
  transition:
    opacity 3.4s ease-in,
    transform 3.4s ease-in;
}

@media (prefers-reduced-motion: reduce) {
  .bloom,
  .bloom.on,
  .bloom.off {
    transform: translate(-50%, -50%) scale(1);
    transition: opacity 2s ease;
  }
}

.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 3;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- the card ---------- */

.card {
  position: relative;
  z-index: 1;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(1.25rem, 3.5vw, 3rem);
}

/* print-proof crop marks */
.card::before,
.card::after,
.topline::before,
.footline::after {
  content: "";
  position: fixed;
  width: 18px;
  height: 18px;
  pointer-events: none;
  z-index: 2;
}
.card::before {
  top: 12px;
  left: 12px;
  border-top: 1px solid var(--hairline);
  border-left: 1px solid var(--hairline);
}
.card::after {
  top: 12px;
  right: 12px;
  border-top: 1px solid var(--hairline);
  border-right: 1px solid var(--hairline);
}
.topline::before {
  bottom: 12px;
  left: 12px;
  border-bottom: 1px solid var(--hairline);
  border-left: 1px solid var(--hairline);
}
.footline::after {
  bottom: 12px;
  right: 12px;
  border-bottom: 1px solid var(--hairline);
  border-right: 1px solid var(--hairline);
}

.topline {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.middle {
  display: flex;
  flex-direction: column;
  gap: clamp(0.75rem, 2vh, 1.5rem);
}

/* ---------- the name ---------- */

.name {
  font-size: clamp(3.4rem, 15.5vw, 12.5rem);
  font-weight: 620;
  font-variation-settings:
    "opsz" 144,
    "SOFT" 60,
    "WONK" 1;
  line-height: 0.95;
  letter-spacing: -0.015em;
  display: flex;
  flex-wrap: wrap;
  column-gap: 0.28em;
  user-select: none;
  -webkit-user-select: none;
}

.word {
  display: inline-flex;
  white-space: nowrap;
}

.l {
  display: inline-block;
  cursor: grab;
  touch-action: none;
  will-change: transform;
}

.l.held {
  cursor: grabbing;
}

/* load-in: letters hide only when JS is around to bring them in with
   physics (the GL press-in or the DOM spring drop). No JS → instant name. */
html.js .name .l {
  opacity: 0;
}

html.js .name .l.in {
  opacity: 1;
  transition: opacity 0.18s ease;
}

/* ---------- tagline ---------- */

.tagline {
  align-self: flex-start;
  background: none;
  border: none;
  padding: 0.1em 0;
  font: inherit;
  font-family: "Fraunces", Georgia, serif;
  font-style: italic;
  font-weight: 430;
  font-variation-settings:
    "opsz" 40,
    "SOFT" 40,
    "WONK" 0;
  font-size: clamp(1.15rem, 2.6vw, 1.7rem);
  color: var(--faint);
  cursor: pointer;
  border-bottom: 1px dashed var(--hairline);
  transition: color 0.25s ease;
}

.tagline:hover,
.tagline:focus-visible {
  color: var(--accent);
  border-bottom-color: currentColor;
}

.tagline:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 6px;
}

.tagline-text {
  display: inline-block;
}

@media (prefers-reduced-motion: no-preference) {
  .tagline-text.rolling {
    animation: roll 0.4s ease;
  }
  @keyframes roll {
    0% {
      opacity: 1;
      transform: translateY(0);
    }
    45% {
      opacity: 0;
      transform: translateY(-0.7em);
    }
    55% {
      opacity: 0;
      transform: translateY(0.7em);
    }
    100% {
      opacity: 1;
      transform: translateY(0);
    }
  }
}

/* ---------- footer ---------- */

.footline {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
}

.links {
  display: flex;
  gap: 1.5rem;
}

.links a {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--hairline);
  padding-bottom: 2px;
  transition:
    color 0.2s,
    border-color 0.2s;
}

.links a:hover,
.links a:focus-visible {
  color: var(--accent);
  border-bottom-color: currentColor;
}

.colophon {
  text-align: right;
}

/* ---------- hint ---------- */

.hint {
  position: fixed;
  left: 50%;
  bottom: clamp(3.5rem, 9vh, 5.5rem);
  transform: translateX(-50%);
  z-index: 2;
  opacity: 0;
  transition: opacity 1.2s ease;
  pointer-events: none;
}

.hint.show {
  opacity: 1;
}

.hint-coarse {
  display: none;
}
@media (pointer: coarse) {
  .hint-fine {
    display: none;
  }
  .hint-coarse {
    display: inline;
  }
}

/* ---------- burger rain ---------- */

.burger {
  position: fixed;
  top: -8vh;
  z-index: 4;
  font-size: clamp(1.4rem, 4vw, 2.6rem);
  pointer-events: none;
  animation: fall linear both;
}

@keyframes fall {
  to {
    transform: translateY(115vh) rotate(var(--spin));
  }
}

/* ---------- small screens ---------- */

@media (max-width: 640px) {
  .colophon {
    text-align: left;
  }
  .middle {
    margin-bottom: 4vh;
  }
}

/* ---------- GL sorts layer ---------- */

#sorts-stage {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

#sorts-stage canvas {
  display: block;
}

html.gl .name .l {
  visibility: hidden;
  animation: none;
}

/* single-finger drags become pointer events; pinch still zooms */
html.gl .card,
html.gl .middle,
html.gl .name {
  touch-action: pinch-zoom;
}

html.gl a,
html.gl button {
  touch-action: manipulation;
}

/* ---------- print ---------- */

.print-note {
  display: none;
}

@media print {
  body {
    overflow: visible;
  }
  html.gl .name .l {
    visibility: visible;
  }
  #sorts-stage,
  .blooms,
  .grain,
  .hint {
    display: none;
  }
  .card {
    height: auto;
    min-height: 95vh;
  }
  .print-note {
    display: block;
    margin-top: 2rem;
    padding: 0 clamp(1.25rem, 3.5vw, 3rem) 2rem;
  }
}

/* ---------- 404 ---------- */

.oops {
  font-size: clamp(3rem, 12vw, 9rem);
  font-weight: 620;
  font-variation-settings:
    "opsz" 144,
    "SOFT" 60,
    "WONK" 1;
  line-height: 1;
}

.oops-note {
  font-style: italic;
  font-weight: 430;
  font-size: clamp(1.1rem, 2.4vw, 1.6rem);
  color: var(--faint);
  max-width: 34ch;
}

.oops-note a {
  color: var(--accent);
}
