:root {
  --page-bg: #1a0a22;
  --page-bg-deep: #090410;
  --plum: #2a1232;
  --plum-soft: #44183d;
  --gold: #e9bd6d;
  --gold-soft: rgba(233, 189, 109, 0.72);
  --gold-muted: #c8954f;
  --gold-faint: rgba(233, 189, 109, 0.20);
  --rose-glow: rgba(145, 50, 83, 0.18);
  --shadow: rgba(0, 0, 0, 0.56);
  --text: #f3d89a;
}

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

html {
  height: 100%;
  min-height: 100%;
  background:
    radial-gradient(circle at 50% 18%, rgba(91, 31, 73, 0.38), transparent 25rem),
    radial-gradient(circle at 54% 88%, rgba(162, 84, 38, 0.13), transparent 28rem),
    linear-gradient(160deg, #14071c 0%, #2a1232 48%, #0a0410 100%);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  height: 100%;
  min-height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background:
    radial-gradient(circle at 50% 18%, rgba(91, 31, 73, 0.38), transparent 25rem),
    radial-gradient(circle at 54% 88%, rgba(162, 84, 38, 0.13), transparent 28rem),
    linear-gradient(160deg, #14071c 0%, #2a1232 48%, #0a0410 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-tap-highlight-color: transparent;
}

.page {
  position: relative;
  isolation: isolate;
  height: 100vh;
  height: 100svh;
  height: 100dvh;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  background:
    radial-gradient(circle at 50% 18%, rgba(91, 31, 73, 0.38), transparent 25rem),
    radial-gradient(circle at 54% 88%, rgba(162, 84, 38, 0.13), transparent 28rem),
    linear-gradient(160deg, #14071c 0%, #2a1232 48%, #0a0410 100%);
  background-attachment: fixed;
}

.page::before {
  content: "";
  position: fixed;
  inset: -20%;
  z-index: -3;
  opacity: 0.12;
  background-image: url("/noise.svg");
  background-size: 220px 220px;
  mix-blend-mode: screen;
  pointer-events: none;
}

.page::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(ellipse at center, transparent 0%, transparent 43%, rgba(0, 0, 0, 0.42) 100%),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.025), transparent 18%, rgba(0, 0, 0, 0.34));
  pointer-events: none;
}

.ambient {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}

.ambient::before,
.ambient::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  filter: blur(42px);
  opacity: 0.34;
}

.ambient::before {
  width: 44rem;
  height: 44rem;
  left: 50%;
  top: 16%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(128, 43, 82, 0.19), transparent 66%);
}

.ambient::after {
  width: 34rem;
  height: 14rem;
  left: 50%;
  bottom: -7rem;
  transform: translateX(-50%);
  background: radial-gradient(ellipse, rgba(203, 112, 52, 0.22), transparent 68%);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

main {
  position: relative;
  z-index: 1;
  flex: 1;
}

.home-main,
.error-main {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: clamp(16px, 4dvh, 72px) 22px clamp(40px, 10dvh, 132px);
}

.home-hero,
.error-hero {
  width: min(100%, 920px);
  text-align: center;
}

.emblem-shell {
  position: relative;
  margin: 0 auto clamp(20px, 5dvh, 86px);
  width: min(52vw, 45dvh, 490px);
}

.emblem-shell::before {
  content: "";
  position: absolute;
  inset: 6% 4%;
  z-index: -1;
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(255, 208, 126, 0.075), rgba(157, 55, 86, 0.045) 46%, transparent 72%);
  filter: blur(24px);
}

.emblem-shell::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(233, 189, 109, 0.055), transparent 66%);
  filter: blur(34px);
}

.emblem {
  display: block;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 28px 44px rgba(0, 0, 0, 0.56));
}

.tagline,
.error-title {
  margin: 0 auto;
  color: var(--text);
  font-family: Georgia, "Times New Roman", Times, serif;
  font-size: clamp(14px, 2.5vmin, 28px);
  font-weight: 400;
  line-height: 1.7;
  letter-spacing: clamp(0.09em, 0.65vw, 0.18em);
  text-transform: uppercase;
  white-space: pre-line;
  text-shadow: 0 10px 26px rgba(0, 0, 0, 0.34);
}

.path-scene {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: -1;
  top: 0;
  height: 100%;
  min-height: 100svh;
  min-height: 100dvh;
  overflow: hidden;
  opacity: 0.80;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, rgba(0,0,0,0.12) 18%, rgba(0,0,0,0.78) 46%, #000 100%);
  mask-image: linear-gradient(to bottom, transparent 0%, rgba(0,0,0,0.12) 18%, rgba(0,0,0,0.78) 46%, #000 100%);
}

.path-scene::before,
.path-scene::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.path-scene::before {
  background:
    radial-gradient(circle at 50% 48%, rgba(233, 189, 109, 0.20), transparent 18rem),
    linear-gradient(to bottom, rgba(21, 7, 29, 0.66), rgba(21, 7, 29, 0.28) 36%, rgba(0, 0, 0, 0.05));
  mix-blend-mode: screen;
  opacity: 0.46;
}

.path-scene::after {
  background:
    linear-gradient(to bottom, rgba(9, 3, 13, 0.72), transparent 34%, transparent 76%, rgba(9, 3, 13, 0.10)),
    radial-gradient(ellipse at center, transparent 25%, rgba(6, 2, 9, 0.54) 100%);
}

.path-scene img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center bottom;
  filter: saturate(0.88) contrast(1.08) brightness(0.94);
}

.error-main {
  align-items: flex-start;
  padding-top: clamp(58px, 11vh, 112px);
}

.error-hero {
  width: min(100%, 760px);
}

.error-code {
  margin: 0;
  color: var(--gold);
  font-family: Georgia, "Times New Roman", Times, serif;
  font-size: clamp(86px, 14vw, 184px);
  font-weight: 400;
  line-height: 0.92;
  letter-spacing: 0.12em;
  text-indent: 0.12em;
  text-shadow: 0 18px 42px rgba(0, 0, 0, 0.5);
}

.error-title {
  max-width: 720px;
  margin-top: clamp(20px, 3.4vh, 34px);
  font-size: clamp(14px, 1.45vw, 20px);
  letter-spacing: clamp(0.08em, 0.52vw, 0.16em);
}

.home-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  margin-top: clamp(24px, 4vh, 40px);
  padding: 13px 30px 12px;
  border: 1px solid rgba(233, 189, 109, 0.74);
  border-radius: 14px;
  color: var(--gold);
  background: rgba(17, 6, 23, 0.28);
  text-decoration: none;
  font-family: Georgia, "Times New Roman", Times, serif;
  font-size: clamp(12px, 1vw, 16px);
  line-height: 1.5;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.home-link:hover,
.home-link:focus-visible {
  color: #ffe1a4;
  border-color: #ffe1a4;
  background: rgba(233, 189, 109, 0.10);
  transform: translateY(-1px);
  outline: 2px solid #ffe1a4;
  outline-offset: 4px;
}

.tagline.is-non-latin,
.error-title.is-non-latin,
.home-link.is-non-latin {
  letter-spacing: 0.04em;
  text-transform: none;
}

.tagline.is-rtl,
.error-title.is-rtl,
.home-link.is-rtl {
  direction: rtl;
  unicode-bidi: isolate;
}

@media (max-height: 760px) and (min-width: 760px) {
  .home-main {
    padding-top: 22px;
    padding-bottom: 56px;
  }

  .emblem-shell {
    width: min(52vw, 45dvh, 450px);
    margin-bottom: 34px;
  }

  .tagline {
    font-size: clamp(14px, 2.5vmin, 22px);
  }
}

@media (max-width: 720px) {
  .home-main,
  .error-main {
    padding-left: 18px;
    padding-right: 18px;
  }

  .home-main {
    padding-top: 42px;
  }

  .emblem-shell {
    width: min(68vw, 45dvh, 380px);
    margin-bottom: 46px;
  }

  .tagline {
    font-size: clamp(14px, 2.5vmin, 19px);
    letter-spacing: 0.10em;
  }

  .error-main {
    padding-top: 54px;
  }

  .error-code {
    font-size: clamp(78px, 25vw, 126px);
    letter-spacing: 0.09em;
    text-indent: 0.09em;
  }

  .error-title,
  .home-link {
    letter-spacing: 0.08em;
  }

  .path-scene {
    height: 100%;
    min-height: 100svh;
    min-height: 100dvh;
    bottom: 0;
  }
}

@media (max-width: 430px) {
  .home-main {
    padding-top: 40px;
  }

  .emblem-shell {
    width: min(68vw, 45dvh, 350px);
    margin-bottom: 44px;
  }

  .tagline {
    font-size: 13px;
    letter-spacing: 0.075em;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* v9: lock both pages to one viewport so no background band appears below the composition. */
.home-page,
.error-page {
  height: 100vh;
  height: 100svh;
  height: 100dvh;
  max-height: 100dvh;
}

.error-page .path-scene {
  top: 0;
  bottom: 0;
  height: auto;
  min-height: 0;
}

@supports (height: 100dvh) {
  html, body, .page {
    height: 100dvh;
  }
}
