/* ═══════════════════════════════════════════════════════
   Fort Aegis — Shared Design System
   ═══════════════════════════════════════════════════════ */

/* ── Google Fonts ── */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

/* ── Design Tokens ── */
:root {
  color-scheme: dark;

  /* Backgrounds */
  --bg-0: #040810;
  --bg-1: #0b1428;
  --bg-2: #111d3a;

  /* Surfaces */
  --surface: rgba(12, 20, 42, 0.88);
  --surface-alt: rgba(8, 14, 30, 0.85);
  --surface-border: rgba(162, 200, 255, 0.12);
  --surface-border-hover: rgba(162, 200, 255, 0.28);

  /* Text */
  --text-main: #ffffff;
  --text-soft: #c8d8f8;
  --text-dim: #8ea4cc;

  /* Accents */
  --accent: #6e9fff;
  --accent-light: #a2c4ff;
  --accent-strong: #d8e6ff;
  --accent-glow: rgba(110, 159, 255, 0.35);
  --accent-glow-subtle: rgba(110, 159, 255, 0.08);

  /* Status */
  --danger: #ff8a8a;
  --danger-glow: rgba(255, 138, 138, 0.15);
  --success: #7dffb3;
  --success-glow: rgba(125, 255, 179, 0.15);

  /* Typography */
  --font-main: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  /* Sizing */
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;

  /* Transitions */
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Cursor glow */
  --mouse-x: 50%;
  --mouse-y: 50%;
}

/* ── Reset ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-0);
  color: var(--text-main);
  font-family: var(--font-main);
  font-weight: 400;
  line-height: 1.6;
  overflow-x: hidden;
  /* Start invisible — JS reveals with a smooth fade */
  opacity: 0;
  transition: opacity 0.6s ease;
}

body.loaded {
  opacity: 1;
}

/* ── Background Layers ── */
.bg-gradient {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse 80% 60% at 10% 5%, rgba(30, 64, 140, 0.5) 0%, transparent 60%),
    radial-gradient(ellipse 70% 50% at 90% 0%, rgba(40, 75, 160, 0.4) 0%, transparent 55%),
    radial-gradient(ellipse 60% 60% at 50% 100%, rgba(15, 35, 80, 0.3) 0%, transparent 70%),
    linear-gradient(175deg, var(--bg-0) 0%, var(--bg-1) 50%, var(--bg-0) 100%);
}

.bg-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(circle at 72% 18%, rgba(110, 159, 255, 0.14) 0%, transparent 45%),
    radial-gradient(circle at 25% 85%, rgba(100, 160, 255, 0.12) 0%, transparent 50%);
  animation: drift 22s ease-in-out infinite alternate;
}

.bg-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(rgba(110, 159, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(110, 159, 255, 0.035) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, black 20%, transparent 100%);
  animation: pulse-grid 10s ease-in-out infinite;
}

/* Cursor glow overlay */
.cursor-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background: radial-gradient(600px circle at var(--mouse-x) var(--mouse-y),
    rgba(110, 159, 255, 0.06) 0%,
    transparent 60%);
  transition: opacity 0.3s ease;
  opacity: 0;
}

body:hover .cursor-glow {
  opacity: 1;
}

/* Particle canvas */
#particles {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

/* ── Typography ── */
h1, h2, h3 {
  font-weight: 700;
  color: var(--text-main);
  text-wrap: balance;
  line-height: 1.2;
}

p {
  margin: 0;
  line-height: 1.65;
}

/* ── Shared Keyframes ── */
@keyframes drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(-2%, 1.6%, 0) scale(1.06); }
}

@keyframes pulse-grid {
  0%, 100% { opacity: 0.45; }
  50%      { opacity: 0.15; }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-8px); }
}

@keyframes glow-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(110, 159, 255, 0.15); }
  50%      { box-shadow: 0 0 0 12px rgba(110, 159, 255, 0.08); }
}

@keyframes shimmer {
  from { background-position: -200% center; }
  to   { background-position: 200% center; }
}

@keyframes border-rotate {
  from { --border-angle: 0deg; }
  to   { --border-angle: 360deg; }
}

@keyframes shine-sweep {
  0%   { transform: translateX(-100%) skewX(-15deg); }
  100% { transform: translateX(200%) skewX(-15deg); }
}

@keyframes glow-breathe {
  0%, 100% { opacity: 0.6; transform: scale(1); }
  50%      { opacity: 1;   transform: scale(1.15); }
}

/* ── Utility ── */
.hidden { display: none !important; }

/* ── Modal Overlay ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(2, 4, 10, 0.75);
  backdrop-filter: blur(8px);
  padding: 1rem;
}

/* ── Card Glow Border ── */
.card-glow-border {
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: conic-gradient(
    from var(--border-angle, 0deg),
    transparent 40%,
    rgba(110, 159, 255, 0.3) 50%,
    transparent 60%
  );
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: border-rotate 6s linear infinite;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.glass-card:hover .card-glow-border {
  opacity: 1;
}

@property --border-angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}

/* ── Card Badges ── */
.card-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(110, 159, 255, 0.15), rgba(110, 159, 255, 0.05));
  border: 1px solid rgba(110, 159, 255, 0.2);
  color: var(--accent);
  margin-bottom: 1rem;
  position: relative;
}

.card-badge::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: inherit;
  background: radial-gradient(circle, rgba(110, 159, 255, 0.12) 0%, transparent 70%);
  animation: glow-breathe 3s ease-in-out infinite;
  z-index: -1;
}

/* ── Glassmorphism Card Base ── */
.glass-card {
  position: relative;
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-lg);
  padding: clamp(1.2rem, 2.5vw, 2rem);
  background: var(--surface);
  backdrop-filter: blur(20px) saturate(1.2);
  -webkit-backdrop-filter: blur(20px) saturate(1.2);
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(255, 255, 255, 0.03) inset,
    0 1px 0 rgba(255, 255, 255, 0.06) inset;
  transition:
    border-color 0.5s ease,
    box-shadow 0.5s ease,
    transform 0.5s var(--ease-out-expo);
  will-change: transform;
}

.glass-card:hover {
  border-color: var(--surface-border-hover);
  box-shadow:
    0 25px 70px rgba(0, 0, 0, 0.5),
    0 0 40px rgba(110, 159, 255, 0.05),
    0 0 0 1px rgba(255, 255, 255, 0.05) inset,
    0 1px 0 rgba(255, 255, 255, 0.08) inset;
}

/* ── Button Base ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  cursor: pointer;
  font-family: var(--font-main);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  text-decoration: none;
  border-radius: var(--radius-md);
  padding: 0.85rem 1.8rem;
  border: 1px solid transparent;
  color: var(--text-main);
  position: relative;
  overflow: hidden;
  will-change: transform;
  transition:
    transform 0.4s var(--ease-out-expo),
    box-shadow 0.4s ease,
    border-color 0.3s ease,
    background 0.3s ease,
    opacity 0.3s ease;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg,
    transparent 30%,
    rgba(255, 255, 255, 0.12) 50%,
    transparent 70%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.btn:hover::after {
  opacity: 1;
  animation: shine-sweep 0.8s ease forwards;
}

.btn:hover {
  transform: translateY(-2px) scale(1.015);
  box-shadow: 0 12px 32px rgba(110, 159, 255, 0.25);
}

.btn:active {
  transform: translateY(1px) scale(0.97);
  transition-duration: 0.12s;
}

.btn:focus-visible {
  outline: 3px solid var(--accent-strong);
  outline-offset: 3px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

.btn-primary {
  border-color: rgba(110, 159, 255, 0.5);
  background: linear-gradient(135deg, rgba(90, 140, 255, 0.8), rgba(60, 115, 255, 0.8));
  box-shadow: 0 4px 20px rgba(110, 159, 255, 0.2);
  animation: glow-pulse 3s ease-in-out infinite;
}

.btn-primary:hover {
  border-color: rgba(110, 159, 255, 0.7);
  box-shadow: 0 12px 40px rgba(110, 159, 255, 0.35);
}

.btn-secondary {
  border-color: rgba(162, 200, 255, 0.2);
  background: linear-gradient(135deg, rgba(130, 160, 220, 0.18), rgba(130, 160, 220, 0.08));
}

.btn-secondary:hover {
  border-color: rgba(162, 200, 255, 0.35);
  background: linear-gradient(135deg, rgba(130, 160, 220, 0.25), rgba(130, 160, 220, 0.14));
}

.btn-tertiary {
  border-color: rgba(162, 200, 255, 0.25);
  background: linear-gradient(135deg, rgba(110, 159, 255, 0.1), rgba(110, 159, 255, 0.04));
}

.btn-tertiary:hover {
  border-color: rgba(162, 200, 255, 0.4);
  background: linear-gradient(135deg, rgba(110, 159, 255, 0.18), rgba(110, 159, 255, 0.08));
}

/* ── Accessibility ── */
/* ── Staff Corner Button ── */
.staff-corner-btn {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 100;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  border-radius: 12px;
  background: rgba(167, 139, 250, 0.1);
  border: 1px solid rgba(167, 139, 250, 0.25);
  color: #a78bfa;
  font-family: var(--font-main);
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  backdrop-filter: blur(12px);
  transition: all 0.3s var(--ease-out-expo);
}
.staff-corner-btn:hover {
  background: rgba(167, 139, 250, 0.2);
  border-color: rgba(167, 139, 250, 0.45);
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(167, 139, 250, 0.2);
}
.staff-corner-btn svg {
  flex-shrink: 0;
}

@media (max-width: 500px) {
  .staff-corner-btn span {
    display: none;
  }
  .staff-corner-btn {
    padding: 0.5rem;
    border-radius: 50%;
  }
}

/* ── Button Sizes ── */
.btn-sm {
  padding: 0.55rem 1rem !important;
  font-size: 0.82rem !important;
}

/* ── Button Icon (left-aligned, must not shrink) ── */
.btn-icon-left {
  flex-shrink: 0;
}

/* ── Status Toast Icon ── */
.status-icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .cursor-glow,
  #particles {
    display: none !important;
  }
}
