/* ═══════════════════════════════════════════
   404.css — Caveman Cable 404 (by Markus Magnusson)
   ════════════════════════════════════════════ */

.page-404 {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(14px, 2.5vw, 36px);
  box-sizing: border-box;
  background: #ffffff; /* EXACT match with the GIF canvas for seamless blending */
  color: var(--h-ink);
  overflow-x: hidden;
  position: relative;
  user-select: none;
  -webkit-user-select: none;
}

.nav-404 {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  z-index: 20;
}

.nav-right {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.main-404 {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  margin: auto;
  max-width: 1360px;
  width: 100%;
  padding: clamp(6px, 1.2vh, 18px) 12px;
  z-index: 10;
  box-sizing: border-box;
}

.code-badge-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 2px;
}

.big-404 {
  font-family: var(--display);
  font-size: clamp(4rem, 11vw, 7.5rem);
  font-weight: 900;
  line-height: 0.9;
  letter-spacing: -0.04em;
  color: var(--h-ink);
  margin: 0;
  cursor: default;
  user-select: none;
}

.title-404 {
  font-family: var(--display);
  font-size: clamp(1.35rem, 2.8vw, 2.1rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.025em;
  margin: 4px 0 8px;
}

.desc-404 {
  font-family: var(--sans);
  font-size: clamp(0.82rem, 1vw, 0.96rem);
  line-height: 1.5;
  opacity: 0.85;
  max-width: 580px;
  margin: 0 auto 16px;
  letter-spacing: -0.016em;
}

/* ═══════════════════════════════════════════
   CAVEMAN STAGE (ANIMATION BY MARKUS MAGNUSSON)
   ════════════════════════════════════════════ */
.caveman-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 1340px;
  margin: 0 auto 20px;
  position: relative;
  user-select: none;
  -webkit-user-select: none;
}

/* Center Caveman Card: Large & Seamless */
.caveman-center-card {
  position: relative;
  width: min(720px, 94vw);
  flex: 0 0 auto;
  background: transparent;
  border: none;
  box-shadow: none;
  overflow: visible;
  z-index: 10;
  cursor: pointer;
}

.gif-wrap {
  width: 100%;
  border-radius: 0;
  overflow: visible;
  background: transparent;
  line-height: 0;
}

.caveman-gif {
  width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
  background: transparent;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}

/* Situational Speech Bubble above Caveman */
.caveman-speech-bubble {
  position: absolute;
  top: 5%;
  left: 50%;
  transform: translateX(-50%) translateY(8px) scale(0.92);
  background: #141416;
  color: #f7f7f8;
  font-family: var(--sans);
  font-size: clamp(0.78rem, 1.15vw, 0.94rem);
  font-weight: 700;
  letter-spacing: -0.015em;
  padding: 8px 18px;
  border-radius: 999px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.24s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.16);
  z-index: 50;
}

.caveman-speech-bubble::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  border-width: 6px 6px 0;
  border-style: solid;
  border-color: #141416 transparent transparent;
}

.caveman-speech-bubble.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0) scale(1);
}

/* ── Actions Row ── */
.actions-wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.actions-wrap .chip {
  font-size: clamp(0.74rem, 0.9vw, 0.88rem);
  padding: 5px 12px;
}

/* ── Footer ── */
.footer-404 {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 100%;
  font-family: var(--sans);
  font-size: 0.72rem;
  letter-spacing: -0.015em;
  opacity: 0.72;
  padding-top: 14px;
  z-index: 20;
}

.footer-404-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  width: 100%;
  gap: 8px;
}

.footer-404 a.mention {
  color: var(--h-accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.footer-meta-note {
  font-size: clamp(0.58rem, 0.72vw, 0.68rem);
  opacity: 0.65;
  text-align: center;
  line-height: 1.4;
  max-width: 820px;
}

@media (max-width: 1080px) {
  .caveman-center-card {
    width: min(620px, 92vw);
  }
}

@media (max-width: 768px) {
  .caveman-stage {
    margin: 4px auto 16px;
  }
  .caveman-center-card {
    width: 100%;
    max-width: 480px;
  }
  .caveman-speech-bubble {
    top: 2%;
    font-size: 0.76rem;
    padding: 6px 14px;
  }
}

@media (max-width: 640px) {
  .page-404 {
    padding: 16px 14px;
  }
  .title-404 {
    font-size: 1.45rem;
  }
  .desc-404 {
    margin-bottom: 18px;
  }
  .footer-404-row {
    flex-direction: column;
    text-align: center;
    gap: 4px;
  }
}
