/*
 * Critical boot splash – paints before the Meteor/React bundle arrives.
 * Uses hex fallbacks (tokens.css is not loaded yet). React replaces #react-target.
 * Served as an external stylesheet so CSP can eventually tighten style-src (AA-132 / SEC-04).
 */
html,
body {
  margin: 0;
  min-height: 100%;
  min-height: 100dvh;
  background: #f4f5f7;
}

html[data-theme='dark'],
html[data-theme='dark'] body {
  background: #0e0e11;
}

#react-target {
  min-height: 100vh;
  min-height: 100dvh;
}

.aa-boot {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 1.5rem;
  text-align: center;
  font-family:
    system-ui,
    -apple-system,
    'Segoe UI',
    sans-serif;
  color: #5c6370;
  background:
    radial-gradient(120% 80% at 50% 18%, rgba(214, 35, 17, 0.12) 0%, transparent 52%),
    radial-gradient(90% 70% at 82% 88%, rgba(36, 163, 155, 0.1) 0%, transparent 55%), #f4f5f7;
}

html[data-theme='dark'] .aa-boot {
  color: #b3b3ba;
  background:
    radial-gradient(120% 80% at 50% 18%, rgba(214, 35, 17, 0.18) 0%, transparent 52%),
    radial-gradient(90% 70% at 82% 88%, rgba(36, 163, 155, 0.12) 0%, transparent 55%), #0e0e11;
}

.aa-boot__stage {
  position: relative;
  display: grid;
  place-items: center;
  width: 5.5rem;
  height: 5.5rem;
}

.aa-boot__orbit {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  border: 2px solid transparent;
  border-top-color: #d62311;
  border-right-color: rgba(214, 35, 17, 0.35);
  animation: aa-boot-spin 1.6s linear infinite;
  pointer-events: none;
}

.aa-boot__orbit--mid {
  inset: 0.45rem;
  border-top-color: transparent;
  border-right-color: transparent;
  border-bottom-color: #3d6fa8;
  border-left-color: rgba(61, 111, 168, 0.4);
  animation: aa-boot-spin-reverse 2.1s linear infinite;
}

.aa-boot__mark {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 0.5rem;
  background: #ffffff;
  box-shadow: 0 4px 14px rgba(18, 21, 26, 0.12);
}

html[data-theme='dark'] .aa-boot__mark {
  background: #16161a;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}

.aa-boot__mark img {
  display: block;
  height: 1.5rem;
  width: auto;
}

.aa-boot__label {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.aa-boot__escape {
  box-sizing: border-box;
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  max-width: 22rem;
  margin: 0;
  padding: 0 0.5rem;
}

.aa-boot__escape.is-visible {
  display: flex;
}

.aa-boot__escape-copy {
  margin: 0;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: inherit;
}

.aa-boot__escape-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}

.aa-boot__escape-link,
.aa-boot__escape-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0.625rem 1rem;
  border-radius: 0.5rem;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.aa-boot__escape-link {
  border: none;
  background: #d62311;
  color: #ffffff;
}

.aa-boot__escape-button {
  border: 1px solid #d7d7db;
  background: #ffffff;
  color: #1d1d21;
}

html[data-theme='dark'] .aa-boot__escape-button {
  border-color: #46464e;
  background: #1d1d21;
  color: #f6f6f7;
}

@keyframes aa-boot-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes aa-boot-spin-reverse {
  to {
    transform: rotate(-360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .aa-boot__orbit,
  .aa-boot__orbit--mid {
    animation: none;
    border-color: rgba(214, 35, 17, 0.35);
    border-top-color: #d62311;
  }

  .aa-boot__orbit--mid {
    border-color: rgba(61, 111, 168, 0.35);
    border-bottom-color: #3d6fa8;
  }
}
