/* ============================================
   badge.bar - Institutional Credentialing Archive
   Frutiger Aero reborn through authority
   ============================================ */

/* CSS Custom Properties for Dynamic Theming */
@property --aurora-x {
  syntax: '<percentage>';
  inherits: false;
  initial-value: 30%;
}

@property --aurora-y {
  syntax: '<percentage>';
  inherits: false;
  initial-value: 20%;
}

:root {
  /* Aurora Palette */
  --abyssal-indigo: #0B0E2A;
  --borealis-green: #00E5CC;
  --polar-violet: #7B2FBE;
  --solar-magenta: #FF2D95;
  --celestial-cyan: #00B4D8;
  --glacial-white: #F0F4FF;
  --certification-amber: #FFB627;
  --void-black: #050714;
  --frost-line: rgba(255, 255, 255, 0.15); /* #FFFFFF at 15% opacity */

  /* Depth Shadows */
  --shadow-z1: 0 8px 32px rgba(0, 0, 0, 0.12);
  --shadow-z2: 0 16px 48px rgba(0, 0, 0, 0.25);
  --shadow-z3: 0 4px 16px rgba(0, 0, 0, 0.3);

  /* Aurora position custom properties */
  --aurora-x: 30%;
  --aurora-y: 20%;

  /* Divide position */
  --divide-position: 55%;
}

/* ============================================
   Reset & Base
   ============================================ */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--abyssal-indigo);
  color: var(--glacial-white);
  font-family: 'Source Sans 3', sans-serif;
  font-weight: 400;
  font-size: clamp(0.95rem, 1.5vw, 1.1rem);
  line-height: 1.7;
  letter-spacing: 0.015em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   Split Container
   ============================================ */
#split-container {
  display: flex;
  width: 100%;
  height: 100vh;
  position: relative;
  overflow: hidden;
  perspective: 1200px;
}

/* ============================================
   Left Zone: Credential Theater
   ============================================ */
#credential-theater {
  width: var(--divide-position);
  height: 100vh;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}

/* Aurora Background */
#aurora-bg {
  position: absolute;
  inset: 0;
  background: radial-gradient(
    ellipse at var(--aurora-x) var(--aurora-y),
    var(--borealis-green) 0%,
    var(--polar-violet) 35%,
    var(--solar-magenta) 65%,
    var(--abyssal-indigo) 100%
  );
  animation: auroraShift 20s ease-in-out infinite;
  z-index: 0;
}

@keyframes auroraShift {
  0% {
    --aurora-x: 30%;
    --aurora-y: 20%;
  }
  25% {
    --aurora-x: 55%;
    --aurora-y: 40%;
  }
  50% {
    --aurora-x: 70%;
    --aurora-y: 80%;
  }
  75% {
    --aurora-x: 45%;
    --aurora-y: 60%;
  }
  100% {
    --aurora-x: 30%;
    --aurora-y: 20%;
  }
}

/* Aurora Particles Layer (Z-0.5) */
#aurora-particles {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  mix-blend-mode: screen;
  opacity: 0.4;
  overflow: hidden;
}

.aurora-wisp {
  position: absolute;
  border-radius: 50%;
  filter: blur(40px);
  animation: wispDrift linear infinite;
  opacity: 0;
}

@keyframes wispDrift {
  0% {
    opacity: 0;
    transform: translateX(-10%) translateY(0);
  }
  15% {
    opacity: 0.6;
  }
  85% {
    opacity: 0.6;
  }
  100% {
    opacity: 0;
    transform: translateX(110%) translateY(-20%);
  }
}

/* Aurora Streaks SVG (progressive draw on scroll) */
#aurora-streaks {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.1;
}

#aurora-streaks-svg {
  width: 100%;
  height: 100%;
}

.aurora-path {
  fill: none;
  stroke: var(--borealis-green);
  stroke-width: 1;
  stroke-dasharray: 1200;
  stroke-dashoffset: 1200;
  transition: stroke-dashoffset 1.5s ease-out;
}

.aurora-path.visible {
  stroke-dashoffset: 0;
}

/* Badge Display (Z-2) */
#badge-display {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.badge-object {
  position: absolute;
  width: clamp(200px, 35vw, 340px);
  height: clamp(230px, 40vw, 390px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 600ms ease-in, transform 600ms ease-in;
  filter: drop-shadow(0 16px 48px rgba(5, 7, 20, 0.25));
}

.badge-object.active {
  opacity: 1;
  transform: translateY(0) rotateY(0deg);
  transition: opacity 600ms ease-out, transform 600ms ease-out;
}

.badge-object.exiting {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 600ms ease-out, transform 600ms ease-out;
}

.badge-svg {
  width: 100%;
  height: 100%;
  animation: badgeFloat 6s ease-in-out infinite;
}

@keyframes badgeFloat {
  0%, 100% {
    transform: translateY(0) rotateY(0deg);
  }
  50% {
    transform: translateY(-8px) rotateY(3deg);
  }
}

/* Burst particles (credential state change) */
.burst-particle {
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 3;
  animation: burstOut 800ms ease-out forwards;
}

@keyframes burstOut {
  0% {
    opacity: 1;
    transform: translate(0, 0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(var(--bx), var(--by)) scale(0.2);
  }
}

/* Scroll Indicator Dots */
#theater-scroll-indicator {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  z-index: 4;
}

.scroll-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(240, 244, 255, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.15);
  transition: all 400ms ease;
  cursor: pointer;
}

.scroll-dot.active {
  background: var(--borealis-green);
  box-shadow: 0 0 12px rgba(0, 229, 204, 0.5);
  transform: scale(1.3);
}

/* ============================================
   The Divide
   ============================================ */
#divide {
  width: 40px;
  height: 100vh;
  position: relative;
  flex-shrink: 0;
  background: linear-gradient(
    to right,
    transparent 0%,
    rgba(11, 14, 42, 0.3) 30%,
    rgba(240, 244, 255, 0.04) 50%,
    rgba(11, 14, 42, 0.3) 70%,
    transparent 100%
  );
  z-index: 5;
  pointer-events: none;
}

#divide::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    transparent 0%,
    rgba(0, 229, 204, 0.08) 30%,
    rgba(123, 47, 190, 0.08) 60%,
    transparent 100%
  );
}

/* ============================================
   Right Zone: Authority Panel
   ============================================ */
#authority-panel {
  flex: 1;
  height: 100vh;
  overflow-y: auto;
  position: relative;
  z-index: 3;
  background: rgba(11, 14, 42, 0.7);
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
}

/* Custom Scrollbar */
#authority-panel::-webkit-scrollbar {
  width: 2px;
}

#authority-panel::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.03);
}

#authority-panel::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 1px;
}

#panel-content {
  padding: clamp(2rem, 5vw, 5rem);
  position: relative;
}

/* ============================================
   Site Header / Identity
   ============================================ */
#site-header {
  margin-bottom: 2rem;
}

#site-wordmark {
  font-family: 'Playfair Display', serif;
  font-weight: 900;
  font-size: clamp(2.8rem, 6vw, 5.5rem);
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--glacial-white);
  text-shadow:
    0 0 20px rgba(0, 229, 204, 0.3),
    0 0 60px rgba(123, 47, 190, 0.15);
}

#site-tagline {
  font-family: 'Lora', serif;
  font-weight: 400;
  font-style: italic;
  font-size: clamp(1.1rem, 2vw, 1.5rem);
  line-height: 1.45;
  letter-spacing: 0.01em;
  color: rgba(240, 244, 255, 0.6);
  margin-top: 0.5rem;
}

/* ============================================
   Panel Dividers
   ============================================ */
.panel-divider {
  width: 100%;
  height: 1px;
  background: var(--frost-line);
  margin: 4rem 0;
}

/* ============================================
   Credential Sections
   ============================================ */
.credential-section {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 600ms ease-out, transform 600ms ease-out;
}

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

.credential-category {
  display: inline-block;
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 400;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  color: var(--borealis-green);
  text-transform: uppercase;
  padding: 4px 12px;
  background: rgba(0, 229, 204, 0.08);
  border: 1px solid rgba(0, 229, 204, 0.15);
  border-radius: 100px;
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.1), 0 4px 12px rgba(0, 0, 0, 0.2);
  margin-bottom: 1.2rem;
}

.credential-title {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-size: clamp(1.6rem, 3vw, 2.8rem);
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--glacial-white);
  margin-bottom: 1.2rem;
}

.credential-description {
  font-family: 'Lora', serif;
  font-weight: 400;
  font-size: clamp(1.1rem, 2vw, 1.5rem);
  line-height: 1.45;
  letter-spacing: 0.01em;
  color: rgba(240, 244, 255, 0.85);
  margin-bottom: 1rem;
}

.credential-body {
  font-family: 'Source Sans 3', sans-serif;
  font-weight: 300;
  font-size: clamp(0.95rem, 1.5vw, 1.1rem);
  line-height: 1.7;
  letter-spacing: 0.015em;
  color: rgba(240, 244, 255, 0.65);
  margin-bottom: 1.5rem;
}

/* Credential Metadata */
.credential-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.6rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.meta-label {
  font-family: 'Source Sans 3', sans-serif;
  font-weight: 300;
  font-size: 0.9rem;
  color: rgba(240, 244, 255, 0.45);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.meta-value {
  font-family: 'Lora', serif;
  font-weight: 600;
  font-size: 0.95rem;
  color: rgba(240, 244, 255, 0.8);
}

/* Credential ID */
.credential-id {
  margin-top: 1.2rem;
  padding: 0.8rem 1rem;
  background: rgba(0, 229, 204, 0.05);
  border: 1px solid rgba(0, 229, 204, 0.1);
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.id-label {
  font-family: 'Source Sans 3', sans-serif;
  font-weight: 300;
  font-size: 0.8rem;
  color: rgba(240, 244, 255, 0.4);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.id-value {
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 400;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  color: var(--borealis-green);
}

/* ============================================
   Verify Credential Link
   ============================================ */
.verify-link-container {
  margin-top: 2rem;
  text-align: center;
}

/* Verify link: underline draws in from left to right on hover (400ms ease) */
.verify-link {
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 400;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  color: var(--celestial-cyan);
  text-decoration: none;
  position: relative;
  padding-bottom: 2px;
  display: inline-block;
}

/* underline that draws in from left to right on hover (400ms ease) */
.verify-link::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  width: 0;
  height: 1px;
  background: var(--celestial-cyan);
  transition: width 400ms ease;
}

.verify-link:hover::after {
  width: 100%;
}

.verify-link:hover {
  color: #FFFFFF;
}

/* ============================================
   Footer
   ============================================ */
#site-footer {
  padding: 2rem 0;
  text-align: center;
}

.footer-text {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-size: 1rem;
  color: rgba(240, 244, 255, 0.4);
  letter-spacing: -0.01em;
}

.footer-meta {
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 400;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  color: rgba(240, 244, 255, 0.25);
  margin-top: 0.5rem;
}

/* ============================================
   Frosted Glass Panels (on hover/interactive sections)
   ============================================ */
.credential-section {
  padding: 1.5rem;
  border-radius: 16px;
  background: rgba(240, 244, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: background 300ms ease, opacity 600ms ease-out, transform 600ms ease-out;
}

.credential-section:hover {
  background: rgba(240, 244, 255, 0.10);
}

/* ============================================
   Aurora color emphasis states (driven by JS)
   ============================================ */
#aurora-bg.emphasis-green {
  animation: auroraGreen 20s ease-in-out infinite;
}

#aurora-bg.emphasis-violet {
  animation: auroraViolet 20s ease-in-out infinite;
}

#aurora-bg.emphasis-magenta {
  animation: auroraMagenta 20s ease-in-out infinite;
}

#aurora-bg.emphasis-cyan {
  animation: auroraCyan 20s ease-in-out infinite;
}

#aurora-bg.emphasis-amber {
  animation: auroraAmber 20s ease-in-out infinite;
}

@keyframes auroraGreen {
  0% { --aurora-x: 30%; --aurora-y: 20%; }
  50% { --aurora-x: 60%; --aurora-y: 70%; }
  100% { --aurora-x: 30%; --aurora-y: 20%; }
}

@keyframes auroraViolet {
  0% { --aurora-x: 40%; --aurora-y: 30%; }
  50% { --aurora-x: 70%; --aurora-y: 60%; }
  100% { --aurora-x: 40%; --aurora-y: 30%; }
}

@keyframes auroraMagenta {
  0% { --aurora-x: 50%; --aurora-y: 25%; }
  50% { --aurora-x: 30%; --aurora-y: 75%; }
  100% { --aurora-x: 50%; --aurora-y: 25%; }
}

@keyframes auroraCyan {
  0% { --aurora-x: 25%; --aurora-y: 35%; }
  50% { --aurora-x: 65%; --aurora-y: 55%; }
  100% { --aurora-x: 25%; --aurora-y: 35%; }
}

@keyframes auroraAmber {
  0% { --aurora-x: 35%; --aurora-y: 40%; }
  50% { --aurora-x: 55%; --aurora-y: 65%; }
  100% { --aurora-x: 35%; --aurora-y: 40%; }
}

/* Aurora gradient emphasis color variants */
#aurora-bg.emphasis-violet {
  background: radial-gradient(
    ellipse at var(--aurora-x) var(--aurora-y),
    var(--polar-violet) 0%,
    var(--borealis-green) 35%,
    var(--solar-magenta) 65%,
    var(--abyssal-indigo) 100%
  );
}

#aurora-bg.emphasis-cyan {
  background: radial-gradient(
    ellipse at var(--aurora-x) var(--aurora-y),
    var(--celestial-cyan) 0%,
    var(--borealis-green) 35%,
    var(--polar-violet) 65%,
    var(--abyssal-indigo) 100%
  );
}

#aurora-bg.emphasis-magenta {
  background: radial-gradient(
    ellipse at var(--aurora-x) var(--aurora-y),
    var(--solar-magenta) 0%,
    var(--polar-violet) 35%,
    var(--celestial-cyan) 65%,
    var(--abyssal-indigo) 100%
  );
}

#aurora-bg.emphasis-amber {
  background: radial-gradient(
    ellipse at var(--aurora-x) var(--aurora-y),
    var(--certification-amber) 0%,
    var(--borealis-green) 35%,
    var(--polar-violet) 65%,
    var(--abyssal-indigo) 100%
  );
}

/* ============================================
   Transition pulse (credential state change)
   ============================================ */
.transition-pulse {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 0;
  height: 0;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 229, 204, 0.3) 0%, transparent 70%);
  pointer-events: none;
  z-index: 2;
  animation: pulseExpand 800ms ease-out forwards;
}

@keyframes pulseExpand {
  0% {
    width: 0;
    height: 0;
    opacity: 1;
  }
  100% {
    width: 300px;
    height: 300px;
    opacity: 0;
  }
}

/* ============================================
   Mobile Collapse (below 768px)
   ============================================ */
@media (max-width: 768px) {
  #split-container {
    flex-direction: column;
  }

  #credential-theater {
    width: 100%;
    height: 60vh;
    flex-shrink: 0;
  }

  #divide {
    width: 100%;
    height: 20px;
    background: linear-gradient(
      to bottom,
      transparent 0%,
      rgba(240, 244, 255, 0.04) 50%,
      transparent 100%
    );
  }

  #divide::before {
    background: linear-gradient(
      to right,
      transparent 0%,
      rgba(0, 229, 204, 0.08) 30%,
      rgba(123, 47, 190, 0.08) 60%,
      transparent 100%
    );
  }

  #authority-panel {
    flex: 1;
    height: auto;
    min-height: 40vh;
  }

  #panel-content {
    padding: clamp(1.5rem, 4vw, 3rem);
  }

  #site-wordmark {
    font-size: clamp(2rem, 8vw, 3.5rem);
  }

  .badge-object {
    width: clamp(160px, 50vw, 260px);
    height: clamp(180px, 55vw, 300px);
  }

  .credential-title {
    font-size: clamp(1.3rem, 5vw, 2rem);
  }

  .credential-description {
    font-size: clamp(1rem, 3vw, 1.3rem);
  }

  #theater-scroll-indicator {
    bottom: 1rem;
  }

  .credential-meta {
    flex-direction: column;
    gap: 0.2rem;
  }
}

/* ============================================
   Reduced motion preference
   ============================================ */
@media (prefers-reduced-motion: reduce) {
  .badge-svg {
    animation: none;
  }

  #aurora-bg {
    animation: none;
  }

  .aurora-wisp {
    animation: none;
    display: none;
  }

  .aurora-path {
    stroke-dashoffset: 0;
    transition: none;
  }
}
