/* ═══════════════════════════════════════════════════════════════
   IRON — Initial Loading Screen (Vault Gate)
   Theme-aware: reads html[data-theme] set synchronously in index.html
   ═══════════════════════════════════════════════════════════════ */

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

body {
  margin: 0;
  overflow: hidden;
}

html {
  overflow: hidden scroll;
}

/* ── Theme tokens (mirrors src/plugins/vuetify/theme.js) ───────── */
:root,
html[data-theme='dark'] {
  --iron-bg: #0D0F18;
  --iron-surface: #151823;
  --iron-accent: #666CFF;
  --iron-accent-darken: #5A60E8;
  --iron-title-color: #B8BCCC;
  --iron-status-color: rgba(184, 188, 204, 0.65);
  --iron-pct-color: rgba(184, 188, 204, 0.55);
  --iron-track-color: rgba(184, 188, 204, 0.12);
  --iron-divider-color: rgba(102, 108, 255, 0.28);
  --iron-flash: #9297ff;
  --iron-core-glow: #ffffff;
}

html[data-theme='light'] {
  --iron-bg: #F5F1EE;
  --iron-surface: #FFFFFF;
  --iron-accent: #666CFF;
  --iron-accent-darken: #5A60E8;
  --iron-title-color: #332E2A;
  --iron-status-color: rgba(51, 46, 42, 0.6);
  --iron-pct-color: rgba(51, 46, 42, 0.5);
  --iron-track-color: rgba(51, 46, 42, 0.1);
  --iron-divider-color: rgba(102, 108, 255, 0.3);
  --iron-flash: #ffffff;
  --iron-core-glow: #ffffff;
}

/* ── Root overlay ───────────────────────────────────────────── */
#loading-container {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--iron-bg);
  overflow: hidden;
  perspective: 2000px;
}

/* ── Gate panels ─────────────────────────────────────────────
   Two halves that slide apart (with a slight 3D swing) once
   loading completes, revealing the mounted app underneath. */
.gate-panel {
  position: absolute;
  top: 0;
  z-index: 0;
  height: 100%;
  width: 50%;
  background: radial-gradient(circle at center, var(--iron-surface) 0%, var(--iron-bg) 100%);
  transition: transform 1.2s cubic-bezier(0.7, 0, 0.3, 1), opacity 1s ease;
  will-change: transform;
}

.gate-left {
  left: 0;
}

.gate-right {
  right: 0;
}

#loading-container.gates-open .gate-left {
  transform: translateX(-101%) rotateY(-10deg);
  opacity: 0;
}

#loading-container.gates-open .gate-right {
  transform: translateX(101%) rotateY(10deg);
  opacity: 0;
}

/* ── Content wrapper ────────────────────────────────────────── */
.iron-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  width: min(680px, 90vw);
  transition: opacity 0.5s ease, transform 0.7s cubic-bezier(0.7, 0, 0.3, 1);
}

#loading-container.gates-open .iron-content {
  opacity: 0;
  transform: scale(0.85);
  pointer-events: none;
}

/* ── Vault shield ───────────────────────────────────────────── */
.iron-shield-wrap {
  width: 108px;
  height: 130px;
  margin-bottom: 28px;
}

.iron-shield {
  width: 100%;
  height: 100%;
  overflow: visible;
  transition: transform 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.iron-shield.fill {
  transform: scale(1.06) translateY(-2px);
}

.iron-outline,
.iron-nodes,
.iron-armor-outline {
  fill: none;
  stroke: var(--iron-accent);
  stroke-linejoin: round;
  stroke-linecap: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  transition: stroke-dashoffset 1.1s cubic-bezier(0.22, 1, 0.36, 1);
}

.iron-outline {
  stroke-width: 1.6;
  filter: drop-shadow(0 0 6px var(--iron-accent));
}

.iron-nodes {
  stroke-width: 1;
  stroke-opacity: 0.55;
  transition-delay: 0.15s;
}

.iron-armor-outline {
  stroke-width: 2;
  transition-delay: 0.25s;
}

.iron-shield.draw .iron-outline,
.iron-shield.draw .iron-nodes,
.iron-shield.draw .iron-armor-outline {
  stroke-dashoffset: 0;
}

.iron-facet {
  opacity: 0;
  transform-box: fill-box;
  transform-origin: 50% 50%;
  transform: scale(0.85);
  transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.iron-facet-left {
  fill: var(--iron-accent-darken);
  transition-delay: 0.05s;
}

.iron-facet-right {
  fill: var(--iron-accent);
  fill-opacity: 0.85;
  transition-delay: 0.12s;
}

.iron-shield.fill .iron-facet {
  opacity: 1;
  transform: scale(1);
}

.iron-core {
  fill: var(--iron-core-glow);
  opacity: 0;
  transform-box: fill-box;
  transform-origin: 50% 50%;
  filter: drop-shadow(0 0 8px var(--iron-accent)) drop-shadow(0 0 16px var(--iron-accent));
  transition: opacity 0.4s ease 0.3s;
}

.iron-shield.fill .iron-core {
  opacity: 1;
  animation: iron-core-pulse 2.2s ease-in-out 0.5s infinite;
}

@keyframes iron-core-pulse {
  0%, 100% { transform: scale(0.94); }
  50%      { transform: scale(1.08); }
}

/* ── Brand title ────────────────────────────────────────────── */
.iron-brand-wrap {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
  margin-bottom: 4px;
}

.iron-brand-wrap.iron-visible {
  opacity: 1;
  transform: translateY(0);
}

.iron-title {
  font-family: 'Inter', sans-serif, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 0.35rem;
  color: var(--iron-title-color);
  user-select: none;
}

/* ── Subtitle (scatter-assemble target) ────────────────────── */
.iron-subtitle-wrap {
  margin: 14px 0 20px;
}

.iron-subtitle {
  font-family: 'Inter', sans-serif, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.03rem;
  line-height: 1.5;
  color: var(--iron-title-color);
  user-select: none;
}

.iron-char {
  display: inline-block;
  white-space: pre;
  will-change: transform, opacity;
}

/* ── Decorative divider ─────────────────────────────────────── */
.iron-divider {
  width: 0;
  height: 1px;
  background: var(--iron-divider-color);
  margin-bottom: 24px;
  transition: width 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

.iron-divider.iron-visible {
  width: 240px;
}

/* ── Progress section ───────────────────────────────────────── */
.iron-progress-section {
  width: 100%;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.iron-progress-section.iron-visible {
  opacity: 1;
  transform: translateY(0);
}

.iron-progress-track {
  position: relative;
  width: 100%;
  height: 3px;
  background: var(--iron-track-color);
  border-radius: 9999px;
  overflow: visible;
  margin-bottom: 10px;
}

.iron-progress-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0%;
  background: var(--iron-accent);
  border-radius: 9999px;
  transition: width 0.25s ease;
}

/* Moving dot at tip of progress bar */
.iron-progress-glow {
  position: absolute;
  top: 50%;
  left: 0%;
  transform: translate(-50%, -50%);
  width: 7px;
  height: 7px;
  background: var(--iron-accent);
  border-radius: 50%;
  box-shadow: 0 0 6px var(--iron-accent);
  transition: left 0.25s ease;
}

.iron-progress-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* ── Status text ────────────────────────────────────────────── */
.iron-status {
  font-family: 'Inter', sans-serif, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.65rem;
  letter-spacing: 0.04rem;
  color: var(--iron-status-color);
  animation: iron-blink 2s ease-in-out infinite;
}

/* ── Percentage ─────────────────────────────────────────────── */
.iron-pct {
  font-family: 'Inter', sans-serif, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.65rem;
  letter-spacing: 0.04rem;
  color: var(--iron-pct-color);
  min-width: 36px;
  text-align: right;
}

/* ── Dismiss flash (theme-tinted, not solid white) ─────────── */
.iron-flash {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: radial-gradient(circle at 50% 45%, var(--iron-flash) 0%, transparent 70%);
  opacity: 0;
}

.iron-flash.iron-active {
  animation: iron-flash-burst 0.5s ease-out forwards;
}

@keyframes iron-flash-burst {
  0%   { opacity: 0; }
  35%  { opacity: 0.9; }
  100% { opacity: 0; }
}

/* ── Keyframes ──────────────────────────────────────────────── */
@keyframes iron-blink {
  0%, 100% { opacity: 0.7; }
  50%       { opacity: 0.4; }
}
