/*
  404-05 — Playful Illustrated 404, standalone HTML/CSS implementation. No
  build step, no framework, no external dependency: copy this file and
  index.html into any project and open it as-is.
*/

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

:root {
  --color-brand: #39ff14;
  --color-brand-foreground: #171717;
  --color-foreground: #171717;
  --color-background: #ffffff;
  --color-border: #e4e4e4;
  --color-muted-foreground: #737373;
  --font-sans:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji",
    "Segoe UI Emoji";
}

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--color-foreground);
  background-color: var(--color-background);
  line-height: 1.5;
}

a {
  text-decoration: none;
  color: inherit;
}

.notfound {
  background-color: var(--color-background);
}

.notfound__section {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 48rem;
  margin: 0 auto;
  padding: clamp(4rem, 3.2rem + 3.6vw, 6rem) clamp(1rem, 0.3rem + 3vw, 2rem);
  text-align: center;
}

.numeral {
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  font-weight: 900;
  font-size: clamp(4.5rem, 3rem + 7vw, 9rem);
  line-height: 1;
  letter-spacing: -0.02em;
  color: #171717;
}

.numeral__accent {
  color: var(--color-brand);
}

.illustration-wrap {
  width: 100%;
  margin-top: -0.5rem;
}

.illustration {
  display: block;
  width: 100%;
  height: auto;
  max-width: 24rem;
  margin: 0 auto;
}

.heading {
  margin: 1rem 0 0;
  max-width: 32rem;
  font-weight: 600;
  font-size: clamp(1.5rem, 1.2rem + 1.4vw, 2.25rem);
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: var(--color-foreground);
}

.description {
  margin: 1rem 0 0;
  max-width: 28rem;
  font-size: 1rem;
  line-height: 1.65;
  color: var(--color-muted-foreground);
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
  margin-top: 2rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0.75rem 1.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  transition:
    background-color 150ms ease,
    opacity 150ms ease,
    border-color 150ms ease;
}

.button--primary {
  color: var(--color-brand-foreground);
  background-color: var(--color-brand);
}

.button--primary:hover {
  opacity: 0.9;
}

.button--secondary {
  color: var(--color-foreground);
  background-color: var(--color-background);
  border: 1px solid var(--color-border);
}

.button--secondary:hover {
  background-color: rgba(0, 0, 0, 0.03);
}

.button:focus-visible {
  outline: 2px solid var(--color-brand);
  outline-offset: 2px;
}

/* Motion — disabled entirely under reduced motion; every element already
   renders at its final, fully visible state outside this media query. */
@media (prefers-reduced-motion: no-preference) {
  @keyframes al-numeral {
    from {
      opacity: 0;
      transform: translateY(10px) scale(0.94);
    }
    to {
      opacity: 1;
      transform: translateY(0) scale(1);
    }
  }

  @keyframes al-character {
    from {
      opacity: 0;
      transform: translateY(18px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  @keyframes al-part {
    from {
      opacity: 0;
      transform: translateY(8px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  @keyframes al-sparkle {
    from {
      opacity: 0;
      transform: scale(0.5);
    }
    to {
      opacity: 1;
      transform: scale(1);
    }
  }

  @keyframes al-up {
    from {
      opacity: 0;
      transform: translateY(14px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  @keyframes al-path {
    from {
      stroke-dashoffset: 1;
    }
    to {
      stroke-dashoffset: 0;
    }
  }

  .numeral {
    animation: al-numeral 620ms cubic-bezier(0.16, 1, 0.3, 1) both;
  }

  .character {
    animation: al-character 700ms cubic-bezier(0.16, 1, 0.3, 1) both;
    transform-box: fill-box;
  }

  .part {
    animation: al-part 500ms cubic-bezier(0.16, 1, 0.3, 1) both;
    transform-box: fill-box;
  }

  .part--cloud {
    animation-delay: 260ms;
  }
  .part--signpost {
    animation-delay: 340ms;
  }

  .sparkle {
    animation: al-sparkle 420ms cubic-bezier(0.16, 1, 0.3, 1) both;
    transform-box: fill-box;
    transform-origin: center;
  }

  .sparkle--1 {
    animation-delay: 640ms;
  }
  .sparkle--2 {
    animation-delay: 720ms;
  }
  .sparkle--3 {
    animation-delay: 800ms;
  }
  .sparkle--4 {
    animation-delay: 680ms;
  }

  .heading,
  .description,
  .actions {
    animation: al-up 620ms cubic-bezier(0.16, 1, 0.3, 1) both;
  }

  .heading {
    animation-delay: 120ms;
  }
  .description {
    animation-delay: 200ms;
  }
  .actions {
    animation-delay: 280ms;
  }

  .trail {
    stroke-dasharray: 1;
    animation: al-path 900ms cubic-bezier(0.65, 0, 0.35, 1) 320ms both;
  }
}

/* Structural breakpoint — reserved for the layout change that genuinely
   needs to happen, not ordinary proportional scaling (handled above via
   clamp). */
@media (min-width: 640px) {
  .actions {
    flex-direction: row;
    width: auto;
  }
}
