/**
 * Critical styles for root `not-found` / `global-error`.
 * Linked explicitly because Next often omits CSS chunks (`notFoundStyles: []`).
 */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
html.dark,
[data-theme="dark"] {
  color-scheme: dark;
  --error-bg: #08242a;
  --error-heading: #f2f4f3;
  --error-body: #bac7ca;
  --error-gold: #d7b14c;
  --error-gold-text: #0c2d35;
  --error-gold-hover: #b99338;
  --error-btn: #d7b14c;
  --error-radius: 10px;
}

html.light,
[data-theme="light"] {
  color-scheme: light;
  --error-bg: #f2f4f3;
  --error-heading: #0c2d35;
  --error-body: #09262d;
  --error-gold: #b99338;
  --error-gold-text: #0c2d35;
  --error-gold-hover: #9a7a2e;
  --error-btn: #d7b14c;
  --error-radius: 10px;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--error-bg);
  color: var(--error-heading);
  font-family: var(--font-en-body), system-ui, -apple-system, "Segoe UI", Roboto,
    sans-serif;
}

body > main#main {
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.http-error-page {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  margin: 0;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  padding: clamp(1.5rem, 4vh, 3rem) 1.5rem;
  overflow: hidden;
  text-align: center;
  background: var(--error-bg);
  color: var(--error-heading);
}

.http-error-page__inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 26rem;
  margin: 0 auto;
}

.http-error-page__watermark {
  margin: 0;
  font-family: var(--font-en-display), Cinzel, "Times New Roman", serif;
  font-size: clamp(4rem, 12vw, 6.5rem);
  font-weight: 700;
  line-height: 0.92;
  letter-spacing: -0.02em;
  color: color-mix(in srgb, var(--error-gold) 28%, transparent);
  user-select: none;
}

.http-error-page__title {
  margin: 1.25rem 0 0;
  font-family: var(--font-en-display), Cinzel, "Times New Roman", serif;
  font-size: clamp(1.5rem, 3.5vw, 1.875rem);
  font-weight: 500;
  line-height: 1.2;
  color: var(--error-heading);
}

.http-error-page__description {
  margin: 0.75rem 0 0;
  max-width: 22rem;
  font-size: 0.9375rem;
  line-height: 1.65;
  color: var(--error-body);
  text-wrap: pretty;
}

.http-error-page__actions {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1.75rem;
}

.http-error-page__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 2.75rem;
  padding: 0.75rem 2rem;
  border: none;
  border-radius: var(--error-radius);
  background: var(--error-btn);
  color: var(--error-gold-text);
  font-family: var(--font-mono), "Fira Code", ui-monospace, monospace;
  font-size: 0.8125rem;
  font-weight: 300;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.2s ease;
  box-shadow: none;
}

.http-error-page__btn:hover {
  background: var(--error-gold-hover);
  color: var(--error-gold-text);
  text-decoration: none;
}

.http-error-page__btn-text {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.35rem 0.5rem;
  border: none;
  border-radius: var(--error-radius);
  background: transparent;
  color: var(--error-body);
  font-family: var(--font-mono), "Fira Code", ui-monospace, monospace;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
}

.http-error-page__btn-text:hover {
  color: var(--error-gold);
  background: color-mix(in srgb, var(--error-gold) 8%, transparent);
  text-decoration: none;
}

html[lang="ar"] body,
html[dir="rtl"] body {
  font-family: var(--font-ar), system-ui, sans-serif;
}

html[lang="ar"] .http-error-page__btn,
html[lang="ar"] .http-error-page__btn-text,
html[dir="rtl"] .http-error-page__btn,
html[dir="rtl"] .http-error-page__btn-text {
  font-family: var(--font-ar), system-ui, sans-serif;
  letter-spacing: 0;
  text-transform: none;
}

html[lang="ar"] .http-error-page__title,
html[lang="ar"] .http-error-page__watermark,
html[lang="ar"] .http-error-page__description,
html[dir="rtl"] .http-error-page__title,
html[dir="rtl"] .http-error-page__watermark,
html[dir="rtl"] .http-error-page__description {
  font-family: var(--font-ar), system-ui, sans-serif;
}

.http-error-page__btn-icon {
  display: inline-block;
  width: 0.875rem;
  height: 0.875rem;
  flex-shrink: 0;
}

html[dir="rtl"] .http-error-page__btn-icon,
html[lang="ar"] .http-error-page__btn-icon {
  transform: rotate(180deg);
}
