/* ── ImtihanPK error & status pages ── */
.error-page-main {
  flex: 1;
  position: relative;
  overflow: hidden;
  min-height: calc(100vh - 68px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(48px, 8vw, 100px) clamp(20px, 5vw, 48px);
  background: var(--ink);
  color: #fff;
}

.error-page-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.error-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.45;
  animation: error-orb-drift 18s ease-in-out infinite alternate;
}
.error-orb--gold {
  width: min(420px, 55vw);
  height: min(420px, 55vw);
  background: radial-gradient(circle, rgba(200, 147, 58, 0.55) 0%, transparent 70%);
  top: -12%;
  right: -8%;
}
.error-orb--teal {
  width: min(360px, 48vw);
  height: min(360px, 48vw);
  background: radial-gradient(circle, rgba(13, 110, 110, 0.5) 0%, transparent 70%);
  bottom: -15%;
  left: -10%;
  animation-delay: -6s;
}
.error-orb--soft {
  width: 280px;
  height: 280px;
  background: radial-gradient(circle, rgba(240, 217, 142, 0.2) 0%, transparent 70%);
  top: 40%;
  left: 35%;
  animation-duration: 22s;
}

.error-grid-lines {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 80% 70% at 50% 50%, #000 20%, transparent 75%);
  opacity: 0.6;
}

.error-float-paper {
  position: absolute;
  width: 44px;
  height: 56px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  animation: error-paper-float 12s ease-in-out infinite;
}
.error-float-paper::after {
  content: '';
  position: absolute;
  top: 10px;
  left: 8px;
  right: 8px;
  height: 3px;
  background: rgba(200, 147, 58, 0.25);
  border-radius: 2px;
  box-shadow: 0 8px 0 rgba(255, 255, 255, 0.06), 0 16px 0 rgba(255, 255, 255, 0.04);
}
.error-float-paper:nth-child(1) { top: 18%; left: 8%; animation-delay: 0s; transform: rotate(-12deg); }
.error-float-paper:nth-child(2) { top: 62%; right: 10%; animation-delay: -4s; transform: rotate(8deg); width: 36px; height: 46px; }
.error-float-paper:nth-child(3) { bottom: 22%; left: 18%; animation-delay: -8s; transform: rotate(15deg); opacity: 0.7; }

.error-page-inner {
  position: relative;
  z-index: 2;
  max-width: 1100px;
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(32px, 6vw, 72px);
  align-items: center;
}

.error-page-copy {
  animation: error-fade-up 0.8s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.error-page-visual {
  display: flex;
  align-items: center;
  justify-content: center;
  animation: error-fade-up 0.8s cubic-bezier(0.22, 1, 0.36, 1) 0.15s both;
}

.error-code {
  font-family: 'Playfair Display', serif;
  font-size: clamp(4.5rem, 12vw, 7.5rem);
  font-weight: 900;
  line-height: 0.95;
  letter-spacing: -0.04em;
  margin-bottom: 8px;
  background: linear-gradient(135deg, #fff 0%, var(--gold-lt) 45%, var(--gold) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.error-page--danger .error-code {
  background: linear-gradient(135deg, #fff 0%, #f5b4ae 40%, var(--red) 100%);
  -webkit-background-clip: text;
  background-clip: text;
}
.error-page--teal .error-code {
  background: linear-gradient(135deg, #fff 0%, #a8e0e0 40%, var(--teal) 100%);
  -webkit-background-clip: text;
  background-clip: text;
}
.error-page--soon .error-code {
  font-size: clamp(2.2rem, 6vw, 3.4rem);
  background: linear-gradient(135deg, #fff 0%, var(--gold-lt) 50%, var(--gold) 100%);
  -webkit-background-clip: text;
  background-clip: text;
}

.error-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding: 6px 14px;
  border-radius: 20px;
  background: rgba(200, 147, 58, 0.15);
  border: 1px solid rgba(200, 147, 58, 0.35);
  color: var(--gold-lt);
  margin-bottom: 20px;
  animation: error-badge-pulse 3s ease-in-out infinite;
}
.error-page--danger .error-badge {
  background: rgba(192, 57, 43, 0.15);
  border-color: rgba(192, 57, 43, 0.4);
  color: #f5b4ae;
}
.error-page--teal .error-badge {
  background: rgba(13, 110, 110, 0.2);
  border-color: rgba(13, 110, 110, 0.45);
  color: #a8e0e0;
}

.error-title {
  font-family: 'Playfair Display', serif;
  font-size: clamp(1.5rem, 3.5vw, 2.2rem);
  font-weight: 900;
  line-height: 1.15;
  margin-bottom: 16px;
}
.error-title em {
  font-style: italic;
  color: var(--gold);
}
.error-page--teal .error-title em { color: #7ecece; }

.error-desc {
  font-size: clamp(0.92rem, 1.8vw, 1.05rem);
  color: rgba(255, 255, 255, 0.55);
  line-height: 1.7;
  max-width: 440px;
  margin-bottom: 28px;
}

.error-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 28px;
}
.error-actions .btn-primary,
.error-actions .btn-teal,
.error-actions .btn-outline {
  padding: 12px 24px;
  font-size: 0.9rem;
}
.error-actions .btn-outline {
  border-color: rgba(255, 255, 255, 0.35);
  color: #fff;
}
.error-actions .btn-outline:hover {
  background: #fff;
  color: var(--ink);
  border-color: #fff;
}

.error-quick-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.error-quick-links span {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.3);
  width: 100%;
  margin-bottom: 4px;
}
.error-quick-links a {
  font-size: 0.85rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.5);
  text-decoration: none;
  transition: color 0.2s;
}
.error-quick-links a:hover { color: var(--gold); }

/* SVG scene */
.error-svg-wrap {
  width: min(100%, 420px);
  aspect-ratio: 1;
  position: relative;
}
.error-svg-wrap svg {
  width: 100%;
  height: auto;
  display: block;
  filter: drop-shadow(0 24px 48px rgba(0, 0, 0, 0.35));
}

.error-svg-glow {
  position: absolute;
  inset: 10%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(200, 147, 58, 0.12) 0%, transparent 65%);
  animation: error-glow-pulse 4s ease-in-out infinite;
}

/* SVG animation classes */
.anim-float { animation: error-svg-float 5s ease-in-out infinite; }
.anim-float-delay { animation: error-svg-float 5s ease-in-out infinite; animation-delay: -2.5s; }
.anim-spin-slow { transform-origin: center; animation: error-spin 20s linear infinite; }
.anim-scan { animation: error-scan 2.5s ease-in-out infinite; }
.anim-blink { animation: error-blink 1.2s step-end infinite; }
.anim-shake { animation: error-shake 0.6s ease-in-out infinite; }
.anim-progress { animation: error-progress 2.8s ease-in-out infinite; }
.anim-rocket { animation: error-rocket 3s ease-in-out infinite; }
.anim-hourglass { animation: error-hourglass 2.4s ease-in-out infinite; }

/* Coming soon extras */
.error-countdown {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  max-width: 360px;
  margin-bottom: 24px;
}
.error-countdown-unit {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 14px 8px;
  text-align: center;
}
.error-countdown-unit strong {
  display: block;
  font-family: 'Playfair Display', serif;
  font-size: 1.75rem;
  font-weight: 900;
  color: var(--gold-lt);
  line-height: 1;
}
.error-countdown-unit span {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.35);
  margin-top: 6px;
  display: block;
}

.error-notify {
  display: flex;
  gap: 8px;
  max-width: 400px;
  margin-bottom: 8px;
}
.error-notify input {
  flex: 1;
  padding: 12px 16px;
  border: 1.5px solid rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  font-family: inherit;
  font-size: 0.88rem;
}
.error-notify input::placeholder { color: rgba(255, 255, 255, 0.35); }
.error-notify input:focus {
  outline: none;
  border-color: var(--gold);
  background: rgba(255, 255, 255, 0.1);
}
.error-notify-hint {
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.35);
  margin-bottom: 20px;
}

/* 500 glitch */
.error-glitch-wrap { position: relative; display: inline-block; }
.error-glitch-wrap::before,
.error-glitch-wrap::after {
  content: attr(data-code);
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  font-family: 'Playfair Display', serif;
  font-size: inherit;
  font-weight: 900;
  line-height: inherit;
  letter-spacing: inherit;
  opacity: 0.7;
  pointer-events: none;
}
.error-glitch-wrap::before {
  color: var(--teal);
  animation: error-glitch-1 3s infinite linear alternate-reverse;
  clip-path: polygon(0 0, 100% 0, 100% 35%, 0 35%);
}
.error-glitch-wrap::after {
  color: var(--gold);
  animation: error-glitch-2 2.5s infinite linear alternate-reverse;
  clip-path: polygon(0 65%, 100% 65%, 100% 100%, 0 100%);
}

/* Status bar (503) */
.error-status-bar {
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  overflow: hidden;
  max-width: 280px;
  margin-bottom: 24px;
}
.error-status-bar-fill {
  height: 100%;
  width: 40%;
  background: linear-gradient(90deg, var(--teal), var(--gold));
  border-radius: 6px;
  animation: error-progress 2.8s ease-in-out infinite;
}

/* Hub page */
.error-hub {
  flex: 1;
  padding: 48px clamp(20px, 5vw, 60px) 80px;
  background: var(--cream);
}
.error-hub-header {
  max-width: 720px;
  margin-bottom: 40px;
}
.error-hub-header h1 {
  font-family: 'Playfair Display', serif;
  font-size: clamp(2rem, 4vw, 2.8rem);
  font-weight: 900;
  margin-bottom: 12px;
}
.error-hub-header h1 em { color: var(--gold); font-style: italic; }
.error-hub-header p { color: var(--ink-soft); font-size: 1rem; }
.error-hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
  max-width: 1100px;
}
.error-hub-card {
  display: block;
  padding: 24px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  transition: transform 0.25s, box-shadow 0.25s, border-color 0.25s;
}
.error-hub-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(13, 13, 15, 0.08);
  border-color: var(--gold);
}
.error-hub-card-code {
  font-family: 'Playfair Display', serif;
  font-size: 2rem;
  font-weight: 900;
  color: var(--gold);
  margin-bottom: 8px;
}
.error-hub-card h3 {
  font-family: 'Playfair Display', serif;
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 6px;
}
.error-hub-card p {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.5;
}

@keyframes error-orb-drift {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(30px, -20px) scale(1.08); }
}
@keyframes error-paper-float {
  0%, 100% { transform: translateY(0) rotate(var(--r, -12deg)); }
  50% { transform: translateY(-18px) rotate(calc(var(--r, -12deg) + 6deg)); }
}
@keyframes error-fade-up {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes error-badge-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(200, 147, 58, 0); }
  50% { box-shadow: 0 0 0 6px rgba(200, 147, 58, 0.08); }
}
@keyframes error-svg-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}
@keyframes error-spin {
  to { transform: rotate(360deg); }
}
@keyframes error-scan {
  0%, 100% { transform: translateX(-8px); opacity: 0.6; }
  50% { transform: translateX(8px); opacity: 1; }
}
@keyframes error-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.2; }
}
@keyframes error-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-3px) rotate(-1deg); }
  75% { transform: translateX(3px) rotate(1deg); }
}
@keyframes error-progress {
  0% { width: 15%; margin-left: 0; }
  50% { width: 70%; margin-left: 15%; }
  100% { width: 25%; margin-left: 75%; }
}
@keyframes error-rocket {
  0%, 100% { transform: translateY(0); }
  40% { transform: translateY(-16px); }
  60% { transform: translateY(-8px); }
}
@keyframes error-hourglass {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(180deg); }
}
@keyframes error-glow-pulse {
  0%, 100% { opacity: 0.6; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.05); }
}
@keyframes error-glitch-1 {
  0%, 90%, 100% { transform: translate(0); }
  92% { transform: translate(-4px, 2px); }
  94% { transform: translate(4px, -2px); }
}
@keyframes error-glitch-2 {
  0%, 88%, 100% { transform: translate(0); }
  90% { transform: translate(3px, -1px); }
  93% { transform: translate(-3px, 1px); }
}

@media (max-width: 900px) {
  .error-page-inner {
    grid-template-columns: 1fr;
    text-align: center;
  }
  .error-desc { margin-left: auto; margin-right: auto; }
  .error-actions { justify-content: center; }
  .error-quick-links { justify-content: center; }
  .error-countdown { margin-left: auto; margin-right: auto; }
  .error-notify { margin-left: auto; margin-right: auto; }
  .error-status-bar { margin-left: auto; margin-right: auto; }
  .error-page-visual { order: -1; }
  .error-svg-wrap { max-width: 280px; margin: 0 auto; }
}

@media (prefers-reduced-motion: reduce) {
  .error-orb,
  .error-float-paper,
  .error-badge,
  .anim-float,
  .anim-float-delay,
  .anim-spin-slow,
  .anim-scan,
  .anim-blink,
  .anim-shake,
  .anim-progress,
  .anim-rocket,
  .anim-hourglass,
  .error-svg-glow,
  .error-glitch-wrap::before,
  .error-glitch-wrap::after,
  .error-status-bar-fill {
    animation: none !important;
  }
  .error-page-copy,
  .error-page-visual {
    animation: none;
    opacity: 1;
  }
}
