/*
 * 404 PAGE
 * ========
 * Concept: "Broken type." The number 404 is rendered massive, with each
 * digit slightly displaced and rotated — as if the page literally fell
 * apart. The digits react subtly to mouse movement (parallax), reinforcing
 * the feeling of debris floating in space.
 *
 * Hook: The broken, floating digits + the tone of the copy. It's human,
 * wry, unbothered. Not apologetic. Not cute. Just honest.
 *
 * Why Playfair Display at 900 weight? Because the 404 needs to be
 * MASSIVE and sculptural. At this size and weight, Playfair becomes
 * almost architectural — thick strokes, dramatic contrast. The digits
 * become objects, not just text.
 */

:root {
  --font-display: 'Playfair Display', Georgia, serif;
  --font-mono:    'IBM Plex Mono', 'Consolas', monospace;

  --bg:      #161214;
  --text:    #e0d8ce;
  --text-mid:#8a7e72;
  --text-quiet:#4e4640;
  --accent:  #b88a6e;

  --ease: cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

@media (prefers-color-scheme: light) {
  :root {
    --bg:      #f2ede6;
    --text:    #2a2420;
    --text-mid:#8a7e72;
    --text-quiet:#c0b8ae;
    --accent:  #8a6240;
  }
}

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

html, body { height: 100%; overflow: hidden; }

body {
  font-family: var(--font-mono);
  background: var(--bg);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--accent); color: var(--bg); }

main {
  text-align: center;
  padding: 2rem;
  position: relative;
}

/* THE BROKEN NUMBER — massive, displaced digits */
.broken-number {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 2rem;
  height: clamp(12rem, 35vw, 22rem);
  user-select: none;
}

.digit {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(10rem, 28vw, 20rem);
  line-height: 1;
  color: var(--text);
  opacity: 0.08;
  position: relative;
  transition: transform 0.4s var(--ease);
  will-change: transform;
}

/*
 * Each digit is displaced differently — rotation + offset.
 * This creates the "fallen apart" effect. The values are
 * asymmetric and feel organic, not mathematically precise.
 */
.d1 {
  transform: rotate(-6deg);
  top: -0.2em;
  left: 0.05em;
}

.d2 {
  transform: rotate(3deg);
  top: 0.15em;
}

.d3 {
  transform: rotate(-4deg);
  top: -0.1em;
  right: 0.05em;
}

/* MESSAGE */
.message {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 3vw, 2rem);
  font-weight: 400;
  font-style: italic;
  color: var(--text);
  margin-bottom: 0.6rem;
}

.sub {
  font-size: 0.82rem;
  color: var(--text-mid);
  max-width: 360px;
  margin: 0 auto 2rem;
  line-height: 1.6;
}

.home-link {
  font-size: 0.78rem;
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  padding-bottom: 2px;
  transition: border-color 0.2s var(--ease);
}

.home-link:hover {
  border-color: var(--accent);
}

/* Entrance animation */
@keyframes driftIn {
  from { opacity: 0; transform: translateY(30px) rotate(0deg); }
  to   { opacity: 0.08; }
}

.digit {
  animation: driftIn 1.2s var(--ease) both;
}

.d1 { animation-delay: 0s; }
.d2 { animation-delay: 0.15s; }
.d3 { animation-delay: 0.3s; }

.message {
  animation: fadeUp 0.6s var(--ease) 0.5s both;
}

.sub {
  animation: fadeUp 0.6s var(--ease) 0.65s both;
}

.home-link {
  animation: fadeUp 0.6s var(--ease) 0.8s both;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Store initial rotations as data attributes for JS parallax */
.d1 { --rot: -6; }
.d2 { --rot: 3; }
.d3 { --rot: -4; }

/* RESPONSIVE */
@media (max-width: 480px) {
  .broken-number { height: 10rem; }
}

@media (prefers-reduced-motion: reduce) {
  .digit, .message, .sub, .home-link {
    animation: none;
    opacity: 0.08;
  }
  .message, .sub, .home-link { opacity: 1; }
  .digit { transition: none; }
}
