:root {
  color-scheme: dark;
  --charcoal: #242624;
  --off-white: #faf7f3;
  --muted: #b9b8b1;
  --copper: #a84f27;
  --copper-hover: #8c3e1e;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 280px;
  min-height: 100svh;
  display: grid;
  grid-template-rows: 1fr auto;
  padding: clamp(24px, 5vw, 64px);
  background: var(--charcoal);
  background-image: linear-gradient(150deg, #30322f 0%, #242624 55%, #1e201e 100%);
  color: var(--off-white);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

main {
  width: min(100%, 640px);
  margin: auto;
  padding: 32px 0 64px;
  text-align: center;
}

.badge {
  display: block;
  width: clamp(128px, 18vw, 160px);
  height: auto;
  margin: 0 auto 32px;
}

h1 { margin: 0; font-size: inherit; }

.wordmark {
  display: block;
  width: min(100%, 512px);
  height: auto;
  margin: 0 auto;
}

.divider {
  display: block;
  width: 40px;
  height: 2px;
  margin: 40px auto 32px;
  background: #a8a9a0;
  opacity: .6;
}

h2 {
  margin: 0;
  font-size: clamp(1.25rem, 3.5vw, 1.5rem);
  line-height: 1.4;
  font-weight: 400;
  letter-spacing: -.015em;
}

.quick-links {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  width: min(100%, 464px);
  margin: 32px auto 0;
}

a {
  color: var(--off-white);
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.quick-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 96px;
  padding: 16px 12px;
  border: 1px solid #c4765199;
  border-radius: 12px;
  background: var(--copper);
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.35;
  transition: background-color 180ms ease, border-color 180ms ease, transform 180ms ease;
}

.quick-link--secondary { background: #3c3e3a; border-color: #555850; }
.quick-link svg { width: 22px; height: 22px; }

.social-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  margin-top: 20px;
  border-radius: 50%;
  color: var(--muted);
  transition: color 180ms ease, background-color 180ms ease, transform 180ms ease;
}

.social-link svg { width: 24px; height: 24px; }

@media (hover: hover) {
  .quick-link:hover { background: var(--copper-hover); border-color: #d99572; transform: translateY(-2px); }
  .quick-link--secondary:hover { background: #484b44; border-color: #767b6e; }
  .social-link:hover { color: var(--off-white); background: #ffffff0d; transform: translateY(-2px); }
}

a:focus-visible { outline: 3px solid var(--off-white); outline-offset: 5px; }
a:active { transform: translateY(0); }

footer {
  text-align: center;
  color: var(--muted);
  font-size: .875rem;
  line-height: 1.6;
}

@media (max-width: 480px) {
  main { padding: 24px 0 48px; }
  .badge { margin-bottom: 24px; }
  .divider { margin: 32px auto 24px; }
  .quick-links { margin-top: 28px; }
  .quick-link { font-size: .9375rem; }
}

@media (max-height: 700px) {
  main { padding: 12px 0; }
  .badge { width: 80px; margin-bottom: 16px; }
  .divider { margin: 16px auto; }
  .quick-links { margin-top: 20px; }
  .quick-link { min-height: 80px; padding-block: 12px; gap: 8px; }
  .social-link { margin-top: 8px; height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  .quick-link, .social-link { transition: none; transform: none; }
}

.brand-home {
  display: inline-flex;
  border-radius: 50%;
  transition: opacity 180ms ease;
}

.brand-home img { display: block; }

.error-code {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: .06em;
  margin: 32px 0 12px;
  font-size: clamp(7rem, 17vw, 10rem);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -.06em;
  font-variant-numeric: lining-nums;
}

.weight-plate { width: .76em; height: .76em; fill: var(--copper); }
.plate-ring { fill: none; stroke: #d88c67; stroke-width: 2; }
.plate-hole { fill: var(--charcoal); }
.plate-grip { fill: none; stroke: #743318; stroke-width: 7; stroke-linecap: round; }

.error-label {
  margin: 0 0 24px;
  font-size: .875rem;
  font-weight: 500;
  color: #e4a181;
  letter-spacing: .04em;
}

.error-heading {
  font-size: clamp(1.75rem, 5vw, 2.5rem);
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -.035em;
  text-wrap: balance;
}

.error-message { margin: 20px 0 0; font-size: 1rem; line-height: 1.6; color: var(--muted); }
.home-link { display: inline-flex; flex-direction: row; min-height: 56px; margin-top: 28px; padding: 16px 24px; }

@media (hover: hover) {
  .brand-home:hover { opacity: .75; }
}

@media (max-height: 700px) {
  .brand-home img { width: 64px; height: 64px; }
  .error-code { margin-top: 20px; font-size: 6rem; }
  .error-label { margin-bottom: 16px; }
  .error-message { margin-top: 16px; }
  .home-link { margin-top: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  .brand-home { transition: none; }
}
