/* ── Evident ICU Core — Component Styles ──────────────────────────
   Layout, buttons, focus ring, reduced-motion. Token values
   are sourced from local tokens.css + package design tokens import.
   Do NOT redefine shared token primitives here.
   ──────────────────────────────────────────────────────────────── */

/* ── Skip Link (WCAG 2.4.1) ────────────────────────────────────── */
.skip-to-main {
  position: absolute;
  inset-inline-start: -100vw;
  padding: 0.75rem 1.5rem;
  background: var(--color-primary, #1f3a99);
  color: #fff;
  font-weight: var(--font-weight-semibold, 600);
  font-size: var(--type-sm, 0.8125rem);
  text-decoration: none;
  border-radius: 0 0 var(--radius-sm, 0.5rem) 0;
  z-index: 10000;
}

.skip-to-main:focus {
  inset-inline-start: 0;
  inset-block-start: 0;
  outline: 2px solid var(--color-accent, #c88c00);
  outline-offset: 2px;
}

html {
  scroll-behavior: smooth;
  overflow-x: hidden; /* prevent mobile horizontal scroll from decorative overflow */
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--color-text, #1a2040);
  font-family: var(--font-sans, "Inter", system-ui, sans-serif);
  line-height: var(--line-height-normal, 1.6);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-color: var(--surface-base, #f4f7ff);
  background-image:
    radial-gradient(
      ellipse 1300px 760px at -10% -20%,
      color-mix(in srgb, var(--gem-sapphire-flat, #1f3a99) 18%, transparent),
      transparent 62%
    ),
    radial-gradient(
      ellipse 1160px 700px at 112% -16%,
      color-mix(in srgb, var(--gem-gold-native-flat, #c88c00) 16%, transparent),
      transparent 58%
    ),
    radial-gradient(
      ellipse 980px 620px at 52% 112%,
      color-mix(in srgb, var(--gem-labradorite-flat, #2d3f6e) 14%, transparent),
      transparent 66%
    ),
    linear-gradient(
      158deg,
      color-mix(in srgb, var(--surface-base, #f4f7ff) 90%, white) 0%,
      color-mix(in srgb, var(--surface-base, #f4f7ff) 84%, var(--gem-sapphire-flat, #1f3a99) 16%) 54%,
      color-mix(in srgb, var(--surface-base, #f4f7ff) 82%, var(--gem-gold-native-flat, #c88c00) 18%) 100%
    );
  background-size:
    190% 190%,
    170% 170%,
    160% 160%,
    100% 100%;
  background-position:
    -14% -22%,
    112% -18%,
    50% 112%,
    50% 50%;
  background-attachment: fixed;
  animation: evident-background-drift 20s var(--ease-in-out, ease-in-out) infinite alternate;
}

@keyframes evident-background-drift {
  0% {
    background-position:
      -14% -22%,
      112% -18%,
      50% 112%,
      50% 50%;
  }

  50% {
    background-position:
      -11% -18%,
      109% -14%,
      49% 108%,
      50% 51%;
  }

  100% {
    background-position:
      -8% -14%,
      106% -10%,
      51% 104%,
      50% 49%;
  }
}

img,
video,
iframe,
embed,
object,
svg {
  max-width: 100%;
  height: auto;
}

/* ── Orphan & Widow Prevention ──────────────────────────────────── */
h1,
h2,
h3,
h4,
h5,
h6 {
  text-wrap: balance;
}

p,
li,
blockquote,
figcaption {
  text-wrap: pretty;
}

/* ── Card Orphan Prevention ─────────────────────────────────────── */
.card,
[class*="__card"],
[class*="-card"] {
  break-inside: avoid;
}

/* ── Card Hover Elevation ───────────────────────────────────────── */
.card,
[class*="__card"],
[class*="-card"],
.ev-glass {
  transition:
    transform var(--duration-normal, 250ms) var(--ease-spring, cubic-bezier(0.22, 1, 0.36, 1)),
    box-shadow var(--duration-slow, 400ms) var(--ease-spring, cubic-bezier(0.22, 1, 0.36, 1)),
    border-color var(--duration-fast, 150ms) ease;
}

a:hover > .card,
a:hover > [class*="__card"],
a:hover > [class*="-card"],
a:hover > .ev-glass,
.card:hover,
[class*="__card"]:hover,
[class*="-card"]:hover,
.ev-glass:hover,
.card:focus-visible,
[class*="__card"]:focus-visible,
[class*="-card"]:focus-visible,
.ev-glass:focus-visible {
  transform: translateY(-4px);
  box-shadow:
    0 20px 44px rgb(14 21 40 / 12%),
    0 0 0 1px rgb(31 58 153 / 8%),
    0 0 30px rgb(247 179 43 / 10%);
}

@media (prefers-reduced-motion: reduce) {
  .card,
  [class*="__card"],
  [class*="-card"],
  .ev-glass {
    transition: none;
  }

  a:hover > .card,
  a:hover > [class*="__card"],
  a:hover > [class*="-card"],
  a:hover > .ev-glass,
  .card:hover,
  [class*="__card"]:hover,
  [class*="-card"]:hover,
  .ev-glass:hover,
  .card:focus-visible,
  [class*="__card"]:focus-visible,
  [class*="-card"]:focus-visible,
  .ev-glass:focus-visible {
    transform: none;
  }
}

/* ── Grid Overflow Prevention ───────────────────────────────────── */

/* Prevent grid children from overflowing due to min-width: auto default */
* {
  min-width: 0;
}

a {
  color: inherit;
}

.site-container,
.container {
  width: min(100% - 2rem, var(--site-max-width));
  margin-inline: auto;
}

/* ── Section Eyebrow — gold authority bar ─────────────────────────── */
.section-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0 0 1rem;
  padding: 0.35rem 0.9rem 0.35rem 0;
  font-size: 0.72rem;
  font-weight: var(--font-weight-extrabold, 800);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--color-accent-contrast, #825a1e);
}

.section-eyebrow::before {
  content: "";
  width: 2rem;
  height: 2px;
  background: linear-gradient(
    90deg,
    var(--color-accent-contrast, #825a1e),
    color-mix(in srgb, var(--color-accent-contrast, #825a1e) 30%, transparent)
  );
  border-radius: var(--radius-full, 999px);
}

/* ── Primary CTA Button — deep sapphire authority ─────────────────── */
.btn-primary,
.btn-ghost,
.btn-lg,
.btn-block {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 2.875rem;
  padding: 0.9rem 1.35rem;
  border-radius: var(--radius-full, 999px);
  border: 1px solid transparent;
  font-weight: var(--font-weight-bold, 700);
  text-decoration: none;
  cursor: pointer;
  transition:
    transform var(--duration-fast, 150ms) var(--ease-out),
    box-shadow var(--duration-normal, 250ms) var(--ease-out),
    border-color var(--duration-fast, 150ms) ease,
    background-color var(--duration-fast, 150ms) ease;
}

.btn-primary {
  color: var(--gem-sapphire-text, #d0dcff);
  background: var(--gem-sapphire, linear-gradient(135deg, #0a1a6e 0%, #1f3a99 35%, #3d64cc 60%, #128 100%));
  box-shadow: 0 8px 24px color-mix(in srgb, var(--gem-sapphire-flat, #1f3a99) 20%, transparent);
}

.btn-primary:hover {
  box-shadow:
    0 12px 32px color-mix(in srgb, var(--gem-sapphire-flat, #1f3a99) 28%, transparent),
    var(--shadow-glow-primary, 0 0 32px rgb(31 58 153 / 18%));
}

.btn-ghost {
  color: var(--color-text, #1a2040);
  background: var(--glass-bg-strong, rgb(255 255 255 / 76%));
  border-color: var(--border-subtle);
  backdrop-filter: blur(12px);
}

.btn-ghost:hover {
  border-color: var(--color-primary, #1f3a99);
  box-shadow: 0 4px 20px rgb(31 58 153 / 12%);
}

.btn-lg {
  padding-inline: 1.65rem;
  font-size: 0.95rem;
}

.btn-block {
  width: 100%;
}

.btn-primary:hover,
.btn-ghost:hover,
.site-header__btn:hover,
.flag-hero__cta:hover,
.replay-btn:hover {
  transform: translateY(-2px);
}

.homepage-body section,
.app-page section {
  position: relative;
}

/* ── Focus Visible — branded gold accent ring ─────────────────────── */
:focus-visible {
  outline: 2px solid var(--color-accent, #f7b32b);
  outline-offset: 3px;
  box-shadow: 0 0 0 7px rgb(247 179 43 / 18%);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
[role="button"]:focus-visible {
  outline: 2px solid var(--color-accent, #f7b32b) !important;
  outline-offset: 3px;
  box-shadow: 0 0 0 7px rgb(247 179 43 / 18%) !important;
}

/* Remove glow on non-interactive focus (e.g. scroll containers) */
[tabindex="-1"]:focus-visible {
  outline: none;
  box-shadow: none;
}

/* ── Selection — branded highlight ────────────────────────────────── */
::selection {
  background: color-mix(in srgb, var(--color-primary, #1f3a99) 18%, transparent);
  color: var(--color-text, #1a2040);
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  body {
    animation: none;
    background-attachment: scroll;
  }

  .btn-primary,
  .btn-ghost,
  .site-header__btn,
  .flag-hero__cta,
  .replay-btn {
    transition: none;
  }

  .btn-primary:hover,
  .btn-ghost:hover,
  .site-header__btn:hover,
  .flag-hero__cta:hover,
  .replay-btn:hover {
    transform: none;
  }
}
