/* ============================================
   Error Pages (401, 403, 404) - Default Theme
   Matches Skies of the Lost Cause sky/sea canvas,
   calligraphic typography, and light/dark palettes
   ============================================ */

body.error-page {
  --error-surface: rgba(255, 255, 255, 0.80);
  --error-ink: #0f172a;
  --error-muted: #334155;
  --error-btn-text: #ffffff;
  --error-shadow: 0 18px 46px rgba(0, 42, 88, 0.16);
}

body.error-page.error-401 {
  --error-accent: #5b21b6;
  --error-accent-strong: #4c1d95;
  --error-accent-soft: rgba(91, 33, 182, 0.12);
  --error-border: rgba(91, 33, 182, 0.34);
  --error-wash: rgba(109, 40, 217, 0.16);
  --bg-gradient: linear-gradient(135deg, #c4b5fd 0%, #3b1d7a 100%);
  --sea-sun-dark: #b46cff;
  --sea-sun-light: #b980ff;
  --sea-horizon-dark: #6b359c;
}

body.error-page.error-403 {
  --error-accent: #9d174d;
  --error-accent-strong: #831843;
  --error-accent-soft: rgba(157, 23, 77, 0.12);
  --error-border: rgba(157, 23, 77, 0.35);
  --error-wash: rgba(190, 24, 93, 0.16);
  --bg-gradient: linear-gradient(135deg, #f5b8d0 0%, #6b143b 100%);
  --sea-sun-dark: #ff4f93;
  --sea-sun-light: #ff7aa8;
  --sea-horizon-dark: #9e2a5b;
}

body.error-page.error-404 {
  --error-accent: #9a2b2b;
  --error-accent-strong: #7f1d1d;
  --error-accent-soft: rgba(154, 43, 43, 0.12);
  --error-border: rgba(154, 43, 43, 0.34);
  --error-wash: rgba(215, 79, 79, 0.16);
  --bg-gradient: linear-gradient(135deg, #f7c5b8 0%, #7a2323 100%);
  --sea-sun-dark: #ff453a;
  --sea-sun-light: #ff6b6b;
  --sea-horizon-dark: #a62b26;
}

body.error-page.error-40x {
  --error-accent: #9a5408;
  --error-accent-strong: #783f05;
  --error-accent-soft: rgba(154, 84, 8, 0.12);
  --error-border: rgba(154, 84, 8, 0.35);
  --error-wash: rgba(217, 119, 6, 0.16);
  --bg-gradient: linear-gradient(135deg, #fde68a 0%, #7c3f08 100%);
  --sea-sun-dark: #ffbe2e;
  --sea-sun-light: #ffc145;
  --sea-horizon-dark: #b36b14;
}

body.error-page.error-50x {
  --error-accent: #0f5c6e;
  --error-accent-strong: #0a4452;
  --error-accent-soft: rgba(15, 92, 110, 0.12);
  --error-border: rgba(15, 92, 110, 0.35);
  --error-wash: rgba(14, 116, 144, 0.16);
  --bg-gradient: linear-gradient(135deg, #99d5e2 0%, #0e3a4d 100%);
  --sea-sun-dark: #4de8ff;
  --sea-sun-light: #56e4ff;
  --sea-horizon-dark: #1d6b7d;
}

@media (prefers-color-scheme: dark) {
  body.error-page {
    --error-surface: rgba(11, 25, 46, 0.82);
    --error-ink: #e6f1ff;
    --error-muted: #b8cbe0;
    --error-btn-text: #0a192f;
    --error-shadow: 0 20px 52px rgba(0, 0, 0, 0.45);
  }

  body.error-page.error-401 {
    --error-accent: #c4b5fd;
    --error-accent-strong: #ddd6fe;
    --error-accent-soft: rgba(196, 181, 253, 0.14);
    --error-border: rgba(196, 181, 253, 0.34);
    --error-wash: rgba(139, 92, 246, 0.22);
    --bg-gradient: linear-gradient(135deg, #120d2b 0%, #1d1b42 100%);
  }

  body.error-page.error-403 {
    --error-accent: #f9a8d4;
    --error-accent-strong: #fbcfe8;
    --error-accent-soft: rgba(249, 168, 212, 0.14);
    --error-border: rgba(249, 168, 212, 0.34);
    --error-wash: rgba(219, 39, 119, 0.20);
    --bg-gradient: linear-gradient(135deg, #240c1d 0%, #1d1734 100%);
  }

  body.error-page.error-404 {
    --error-accent: #fca5a5;
    --error-accent-strong: #fecaca;
    --error-accent-soft: rgba(252, 165, 165, 0.14);
    --error-border: rgba(252, 165, 165, 0.34);
    --error-wash: rgba(239, 68, 68, 0.18);
    --bg-gradient: linear-gradient(135deg, #231018 0%, #151e36 100%);
  }

  body.error-page.error-40x {
    --error-accent: #fcd34d;
    --error-accent-strong: #fde68a;
    --error-accent-soft: rgba(252, 211, 77, 0.14);
    --error-border: rgba(252, 211, 77, 0.34);
    --error-wash: rgba(245, 158, 11, 0.20);
    --bg-gradient: linear-gradient(135deg, #24190a 0%, #1a2238 100%);
  }

  body.error-page.error-50x {
    --error-accent: #67e8f9;
    --error-accent-strong: #a5f3fc;
    --error-accent-soft: rgba(103, 232, 249, 0.14);
    --error-border: rgba(103, 232, 249, 0.34);
    --error-wash: rgba(6, 182, 212, 0.20);
    --bg-gradient: linear-gradient(135deg, #091d2b 0%, #12263a 100%);
  }
}

/* Non-destructive atmospheric horizon tint layered above sea/sky canvas & sea-overlay */
body.error-page::after {
  position: fixed;
  inset: 0;
  z-index: -9996;
  background: radial-gradient(circle at 50% 22%, var(--error-wash), transparent 70%);
  content: "";
  pointer-events: none;
}

body.error-page #content.error-shell {
  width: min(800px, calc(100% - 24px));
  padding: 0;
}

.error-card {
  max-width: 740px;
  margin: 0 auto 2rem;
  padding: clamp(1.5rem, 4vw, 2.75rem) clamp(1.25rem, 4vw, 2.5rem);
  border: 1px solid var(--error-border);
  border-top: 3px solid var(--error-accent);
  border-radius: 12px;
  background: var(--error-surface);
  box-shadow: var(--error-shadow);
  color: var(--error-ink);
  text-align: center;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

@supports not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .error-card {
    background: rgba(255, 255, 255, 0.94);
  }

  @media (prefers-color-scheme: dark) {
    .error-card {
      background: rgba(11, 25, 46, 0.94);
    }
  }
}

#content .error-card,
#content .error-card *,
html.sea-theme #content .error-card,
html.sea-theme #content .error-card *,
html.sea-theme #content .error-card a {
  text-shadow: none;
}

.error-eyebrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  max-width: 100%;
  padding: 0.3rem 0.9rem;
  border: 1px solid var(--error-border);
  border-radius: 999px;
  background: var(--error-accent-soft);
  color: var(--error-accent);
  font-family: "Philosopher", Georgia, serif;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.11em;
  line-height: 1.3;
  text-transform: uppercase;
}

.error-eyebrow-icon {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
}

.error-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 1rem;
}

.error-code {
  font-family: "CFJackStory", "Philosopher", Georgia, serif;
  font-size: clamp(4rem, 12vw, 6.75rem);
  font-weight: 400;
  line-height: 0.92;
  letter-spacing: 0.04em;
  color: var(--error-accent);
  user-select: none;
}

.error-visual {
  width: min(440px, 100%);
  margin: 0.85rem auto 0;
  padding: 6px;
  border: 1px solid var(--error-border);
  border-radius: 12px;
  background: var(--error-accent-soft);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.16);
  overflow: hidden;
  box-sizing: border-box;
}

#content .error-art {
  display: block;
  width: 100%;
  height: auto;
  margin: 0 auto;
  border-radius: 8px;
}

.error-title {
  margin: 0.9rem 0 0.6rem;
  color: var(--error-ink);
  font-family: "CFJackStory", "Philosopher", Georgia, serif;
  font-size: clamp(1.85rem, 4.6vw, 2.85rem);
  font-weight: 400;
  line-height: 1.1;
  text-wrap: balance;
}

.error-divider {
  width: min(260px, 72%);
  height: 12px;
  margin: 0.85rem auto 1.25rem;
  background-color: var(--error-accent);
  opacity: 0.72;
  -webkit-mask: url("../images/hr-line.png") no-repeat center / 100% 100%;
  mask: url("../images/hr-line.png") no-repeat center / 100% 100%;
}

#content .error-card p {
  max-width: 52ch;
  margin: 0 auto;
  text-align: center;
  text-justify: auto;
}

#content .error-card p.error-message {
  color: var(--error-ink);
  font-size: clamp(1.05rem, 2.1vw, 1.22rem);
  line-height: 1.6;
}

#content .error-card p.error-detail {
  margin-top: 0.75rem;
  color: var(--error-muted);
  font-size: clamp(0.92rem, 1.7vw, 1.02rem);
  line-height: 1.55;
}

.error-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1.75rem;
}

.error-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0.55rem 1.25rem;
  border-radius: 999px;
  font-family: "Philosopher", Georgia, serif;
  font-size: 0.98rem;
  font-weight: 700;
  line-height: 1.25;
  text-decoration: none !important;
  transition: transform 160ms ease, background-color 160ms ease, color 160ms ease, border-color 160ms ease;
}

.error-btn-primary {
  border: 1px solid var(--error-accent);
  background: var(--error-accent);
  color: var(--error-btn-text);
}

.error-btn-primary:hover,
.error-btn-primary:focus-visible {
  border-color: var(--error-accent-strong);
  background: var(--error-accent-strong);
  color: var(--error-btn-text);
  transform: translateY(-2px);
}

.error-btn-secondary {
  border: 1px solid var(--error-border);
  background: transparent;
  color: var(--error-ink);
}

.error-btn-secondary:hover,
.error-btn-secondary:focus-visible {
  border-color: var(--error-accent);
  background: var(--error-accent-soft);
  color: var(--error-accent);
  transform: translateY(-2px);
}

.error-card a:focus-visible {
  outline: 3px solid #f59e0b;
  outline-offset: 3px;
}

#content .error-card p.error-footnote {
  max-width: none;
  margin-top: 1.75rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--error-border);
  color: var(--error-muted);
  font-family: "CFJackStory", "Philosopher", Georgia, serif;
  font-size: 1.1rem;
}

@media (max-width: 600px) {
  body.error-page #content.error-shell {
    width: calc(100% - 20px);
  }

  .error-eyebrow {
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    padding: 0.28rem 0.72rem;
  }
}

@media (max-width: 480px) {
  .error-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .error-btn {
    width: 100%;
    box-sizing: border-box;
  }
}

@media (prefers-reduced-motion: reduce) {
  .error-btn,
  .error-btn:hover,
  .error-btn:focus-visible {
    transform: none;
    transition: none;
  }
}
