/* ===================================== */
/*            THEME VARIABLES            */
/* ===================================== */

:root {
  --primary-blue: #3a7f9d;
  --highlight-gold: #d6a24a;
  --dark-bg: #0d171e;
  --page-bg: #111d25;
  --panel-bg: rgba(14, 24, 31, 0.86);
  --panel-bg-soft: rgba(18, 31, 40, 0.88);
  --panel-border: rgba(214, 162, 74, 0.18);
  --light-text: #f4f7f8;
  --mid-text: #aebdc6;
  --muted-text: #d4dde2;
  --glow-cyan: rgba(65, 153, 193, 0.24);
  --fade-bg: rgba(255, 255, 255, 0.055);
  --shadow-blue-soft: 0 18px 34px rgba(0, 0, 0, 0.28);
  --shadow-blue-strong: 0 24px 52px rgba(0, 0, 0, 0.38);
  --radius-card: 8px;
  --content-width: 1180px;
  --accent-green: #73a78f;
  --ink: #0f171e;
  --surface-warm: #efe2c8;
  --surface-teal: #284a4f;
  --surface-blue: #172a39;
}

/* ===================================== */
/*              BASE STYLES              */
/* ===================================== */

/* Set background color on html and body for instant paint */
html,
body {
  height: 100%;
  margin: 0;
  padding: 0;
  background:
    linear-gradient(180deg, rgba(8, 14, 19, 0.98), rgba(17, 29, 37, 0.99) 430px),
    radial-gradient(circle at 18% 0%, rgba(45, 109, 143, 0.24), transparent 27rem),
    radial-gradient(circle at 86% 8%, rgba(214, 162, 74, 0.12), transparent 23rem),
    var(--page-bg);
  color: var(--light-text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow-x: hidden;
}

body.has-splash {
  overflow: hidden;
}

a {
  color: var(--primary-blue);
  text-underline-offset: 3px;
}

a:hover {
  color: var(--highlight-gold);
}

/* Wrapper div to handle fade-in animation without white flash */
#page-wrapper {
  margin: auto;
  max-width: var(--content-width);
  opacity: 0;
  min-height: calc(100vh - 90px);
  transition: opacity 0.2s ease;
  pointer-events: none;
}

#page-wrapper.visible {
  opacity: 1;
  transition: opacity 0.35s ease;
  pointer-events: auto;
}

.card-section {
  background:
    linear-gradient(145deg, rgba(214, 162, 74, 0.1), transparent 44%),
    linear-gradient(180deg, rgba(255,255,255,0.055), rgba(255,255,255,0)),
    var(--panel-bg);
  border: 1px solid rgba(214, 162, 74, 0.18);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-blue-soft);
  color: var(--light-text);
  overflow: hidden;
  padding: 1.08rem;
  position: relative;
  margin-bottom: 24px;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.card-section::before {
  background: linear-gradient(180deg, var(--highlight-gold), rgba(45, 109, 143, 0.15));
  content: "";
  height: 100%;
  left: 0;
  position: absolute;
  top: 0;
  width: 4px;
}

.card-section::after {
  background: rgba(255, 255, 255, 0.045);
  content: "";
  height: 1px;
  left: 0.82rem;
  position: absolute;
  right: 0.82rem;
  top: 0.6rem;
}

.card-section > * {
  position: relative;
  z-index: 1;
}

.card-section:hover {
  border-color: rgba(214, 162, 74, 0.38);
  box-shadow: var(--shadow-blue-strong);
  transform: translateY(-2px);
}

.card-section p,
.card-section li {
  color: var(--muted-text);
  line-height: 1.65;
}

.card-section h2,
.card-section h4,
.card-section h5,
.card-section strong {
  color: var(--light-text);
}

.card-section h4,
.card-section h5 {
  color: var(--highlight-gold);
  font-size: 0.95rem;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

.text-white {
  color: var(--light-text) !important;
}

.text-light {
  color: var(--light-text) !important;
}

.badge.bg-success {
  background-color: var(--accent-green) !important;
}

.badge.bg-danger {
  background-color: #a24f45 !important;
}

footer {
  color: var(--mid-text);
}

.badge {
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-weight: 800;
}

.card-section .small,
.card-section small {
  color: var(--mid-text) !important;
}

.card-section a.text-white,
.modal-body a.text-light {
  color: var(--highlight-gold) !important;
}

.card-section a.text-white:hover,
.modal-body a.text-light:hover {
  color: #efc269 !important;
}

.card-section h5 {
  color: var(--highlight-gold);
  font-weight: 850;
}

.container {
  position: relative;
  z-index: 1;
}

.btn-primary,
.btn-primary:focus {
  background: linear-gradient(135deg, var(--highlight-gold), #efc269);
  border-color: rgba(255, 255, 255, 0.14);
  box-shadow: 0 12px 24px rgba(214, 162, 74, 0.18);
  color: var(--ink);
  font-weight: 850;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #f3cf80, var(--highlight-gold));
  border-color: rgba(255, 255, 255, 0.18);
  color: var(--ink);
}

.btn-outline-secondary {
  color: var(--light-text);
  border-color: rgba(244, 247, 248, 0.22);
}

.btn-outline-secondary:hover {
  background: var(--surface-warm);
  border-color: var(--surface-warm);
  color: var(--ink);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

/* ===================================== */
/*           SPLASH SCREEN               */
/* ===================================== */

#splash-screen {
  position: fixed;
  top: 0; left: 0; width: 100vw; height: 100vh; /* Use viewport units for full coverage */
  background: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  z-index: 9999;
  overflow: hidden;
  -webkit-backface-visibility: hidden; /* Fix rendering flicker on mobile */
  backface-visibility: hidden;
  -webkit-transform: translateZ(0); /* Promote to GPU layer to reduce flicker */
  transform: translateZ(0);
}

#splash-avatar {
  width: 150px;
  height: 150px;
  max-width: 80vw;   /* Make responsive */
  max-height: 80vw;
  border-radius: 50%;
  animation: pulse 1.5s ease-in-out 3;
  box-shadow: 0 18px 45px rgba(0,0,0,0.24);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}

/* Make sure the fadeout transition in JS is smooth */
#splash-screen.fade-out {
  transition: opacity 0.8s ease-out;
  opacity: 0;
  pointer-events: none;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.15); opacity: 0.7; }
}
