/* CRS Web - EM2 Lab Modern Stylesheet */
:root {
  --bg-primary: #0a0e17;
  --bg-secondary: #111827;
  --bg-card: rgba(17, 24, 39, 0.75);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-accent: #38bdf8;
  
  /* Puzzle Block Theme Colors */
  --block1-accent: #4ade80;
  --block1-glow: rgba(74, 222, 128, 0.45);

  --block2-accent: #fb923c;
  --block2-glow: rgba(251, 146, 60, 0.45);

  --block3-accent: #34d399;
  --block3-glow: rgba(52, 211, 153, 0.45);

  --block4-accent: #c084fc;
  --block4-glow: rgba(192, 132, 252, 0.45);

  --font-family: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --transition-smooth: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-primary);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
  background-image: 
    radial-gradient(circle at 15% 20%, rgba(2, 132, 199, 0.12) 0%, transparent 40%),
    radial-gradient(circle at 85% 25%, rgba(234, 88, 12, 0.1) 0%, transparent 40%),
    radial-gradient(circle at 50% 80%, rgba(124, 58, 237, 0.12) 0%, transparent 50%),
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 100% 100%, 40px 40px, 40px 40px;
}

/* Background Subtle Canvas Animation */
#ambient-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  opacity: 0.6;
}

/* ================= HEADER ================= */
.main-header {
  position: relative;
  z-index: 10;
  width: 100%;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.35);
}

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  text-decoration: none;
  color: inherit;
}

.logo-wrapper {
  background: #ffffff;
  padding: 0.35rem 0.85rem;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25), 0 0 20px rgba(56, 189, 248, 0.2);
  transition: var(--transition-smooth);
}

.logo-wrapper:hover {
  transform: scale(1.04);
  box-shadow: 0 6px 20px rgba(56, 189, 248, 0.4);
}

.header-logo-img {
  height: 48px;
  width: auto;
  object-fit: contain;
  display: block;
}

.brand-info {
  display: flex;
  flex-direction: column;
}

.lab-title {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(120deg, #ffffff 40%, #93c5fd 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.lab-subtitle {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 400;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.nav-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.45rem 0.9rem;
  border-radius: 8px;
  transition: var(--transition-smooth);
  border: 1px solid transparent;
}

.nav-link:hover, .nav-link.active {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
}

/* ================= MAIN CONTENT ================= */
.main-wrapper {
  position: relative;
  z-index: 5;
  flex: 1;
  max-width: 1240px;
  width: 100%;
  margin: 0 auto;
  padding: 2.2rem 1.5rem 3.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Hero Intro Banner */
.hero-section {
  text-align: center;
  margin-bottom: 2rem;
  max-width: 780px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.95rem;
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-accent);
  margin-bottom: 0.9rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.hero-badge-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--text-accent);
  box-shadow: 0 0 10px var(--text-accent);
  animation: pulseDot 2s infinite ease-in-out;
}

@keyframes pulseDot {
  0%, 100% { transform: scale(0.9); opacity: 0.7; }
  50% { transform: scale(1.3); opacity: 1; }
}

.hero-title {
  font-size: 2.5rem;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.03em;
  margin-bottom: 0.8rem;
  background: linear-gradient(135deg, #ffffff 30%, #cbd5e1 70%, #94a3b8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-description {
  font-size: 1.02rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ================= STATIC ASSEMBLED JIGSAW PUZZLE ================= */
.puzzle-arena {
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  display: flex;
  justify-content: center;
  position: relative;
  padding: 0.5rem 0 2rem;
}

/* Container for all 4 interlocking pieces */
.puzzle-assembly {
  position: relative;
  width: 100%;
  aspect-ratio: 990 / 710;
  max-width: 960px;
  filter: drop-shadow(0 20px 45px rgba(0, 0, 0, 0.65));
}

/* Realistic Puzzle Card Structure (Static positioning, NO floating) */
.puzzle-card {
  position: absolute;
  text-decoration: none;
  color: inherit;
  width: 55.556%;
  height: 57.746%;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transform-style: preserve-3d;
  transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1), filter 0.35s ease, z-index 0.2s ease;
}

/* Absolute coordinates for 4 puzzle pieces to assemble together */
.puzzle-card-1 {
  top: 0;
  left: 0;
  z-index: 6;
  --card-glow: var(--block1-glow);
}

.puzzle-card-2 {
  top: 0;
  left: 44.444%;
  z-index: 5;
  --card-glow: var(--block2-glow);
}

.puzzle-card-3 {
  top: 42.254%;
  left: 0;
  z-index: 5;
  --card-glow: var(--block3-glow);
}

.puzzle-card-4 {
  top: 42.254%;
  left: 44.444%;
  z-index: 4;
  --card-glow: var(--block4-glow);
}

/* Hover dynamics on static puzzle piece: subtle lift and highlighted edge */
.puzzle-card:hover {
  transform: scale(1.025);
  z-index: 30;
  filter: drop-shadow(0 0 28px var(--card-glow)) drop-shadow(0 18px 36px rgba(0, 0, 0, 0.85));
}

.puzzle-card:hover .puzzle-svg path {
  stroke-width: 3.8;
  stroke-opacity: 1;
}

/* Disabled / Under Construction Card Styles */
.puzzle-card.disabled {
  cursor: not-allowed;
}

.puzzle-card.disabled:hover {
  transform: none !important;
  filter: drop-shadow(0 16px 28px rgba(0, 0, 0, 0.55)) !important;
}

.puzzle-card.disabled:hover .puzzle-svg path {
  stroke-width: 2.5 !important;
  stroke-opacity: 0.6 !important;
}

/* Under Construction Icon Badge in Top-Right Corner of Cards */
.under-construction-badge {
  position: absolute;
  top: 17%;
  right: 14%;
  z-index: 15;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(18, 12, 6, 0.78);
  border: 1.5px solid rgba(245, 158, 11, 0.65);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.55), 0 0 16px rgba(245, 158, 11, 0.35);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  cursor: pointer;
  pointer-events: auto;
  transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.25s ease, border-color 0.25s ease;
}

.under-construction-badge:hover {
  transform: scale(1.15);
  border-color: #fbbf24;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.7), 0 0 22px rgba(245, 158, 11, 0.65);
}

.under-construction-badge .uc-icon {
  width: 21px;
  height: 21px;
  display: block;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5));
}

.disabled-nav {
  opacity: 0.5;
  cursor: not-allowed !important;
  pointer-events: none;
}

/* The SVG Jigsaw Piece Shape in Background */
.puzzle-svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
  overflow: visible;
  transition: filter 0.35s ease;
}

/* Card Inner Content Safe Zone (Centroid alignment) */
.card-inner {
  position: relative;
  z-index: 3;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  flex: 1;
  text-align: center;
  gap: 1.15rem;
  padding: 3rem;
}

/* Per-piece safe centroid offsets accounting for assembled tabs and sockets */
.puzzle-card-1 .card-inner {
  padding: 2.8rem 4.6rem 4.8rem 3.2rem;
}

.puzzle-card-2 .card-inner {
  padding: 2.8rem 3.2rem 4.8rem 4.8rem;
}

.puzzle-card-3 .card-inner {
  padding: 4.8rem 4.6rem 2.8rem 3.2rem;
}

.puzzle-card-4 .card-inner {
  padding: 4.8rem 3.2rem 2.8rem 4.8rem;
}

.card-icon-box {
  width: 66px;
  height: 66px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: inset 0 2px 5px rgba(255, 255, 255, 0.2), 0 8px 20px rgba(0, 0, 0, 0.3);
  transition: transform 0.35s ease, box-shadow 0.35s ease;
}

.puzzle-card:hover .card-icon-box {
  transform: scale(1.12) rotate(4deg);
  box-shadow: inset 0 2px 6px rgba(255, 255, 255, 0.3), 0 12px 25px rgba(0, 0, 0, 0.4);
}

.card-icon-box svg {
  width: 34px;
  height: 34px;
}

.card-title {
  font-size: 2.1rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.25;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.6rem;
  color: #ffffff;
  width: 100%;
  text-shadow: 0 4px 15px rgba(0, 0, 0, 0.6);
}

.card-title svg {
  vertical-align: middle;
}

.action-label {
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: gap 0.3s ease;
}

.puzzle-card-1 .action-label { color: var(--block1-accent); }
.puzzle-card-2 .action-label { color: var(--block2-accent); }
.puzzle-card-3 .action-label { color: var(--block3-accent); }
.puzzle-card-4 .action-label { color: var(--block4-accent); }

.puzzle-card:hover .action-label {
  gap: 0.75rem;
}

.arrow-icon {
  width: 16px;
  height: 16px;
  transition: transform 0.3s ease;
}

.puzzle-card:hover .arrow-icon {
  transform: translateX(4px);
}

/* ================= FOOTER ================= */
.main-footer {
  position: relative;
  z-index: 10;
  width: 100%;
  margin-top: auto;
  background: rgba(10, 14, 23, 0.95);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: 1.75rem 2rem;
  text-align: center;
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.footer-text {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.footer-links {
  display: flex;
  gap: 1.5rem;
  margin-top: 0.35rem;
}

.footer-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.8rem;
  transition: color 0.2s ease;
}

.footer-links a:hover {
  color: var(--text-accent);
}

/* ================= SUBPAGE STYLING ================= */
.subpage-container {
  max-width: 1000px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

.subpage-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
}

.subpage-breadcrumb a {
  color: var(--text-accent);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.subpage-hero {
  background: rgba(17, 24, 39, 0.8);
  border-radius: 24px;
  padding: 3rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
  position: relative;
  overflow: hidden;
  margin-bottom: 2.5rem;
}

.subpage-hero::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at center, var(--subpage-accent-glow, rgba(56, 189, 248, 0.15)) 0%, transparent 70%);
  pointer-events: none;
}

.subpage-badge {
  display: inline-flex;
  padding: 0.35rem 0.95rem;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 1.25rem;
}

.subpage-title {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
}

.subpage-lead {
  font-size: 1.15rem;
  color: var(--text-muted);
  line-height: 1.7;
  max-width: 800px;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.75rem;
  margin-bottom: 3rem;
}

.feature-box {
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  padding: 1.75rem;
  transition: var(--transition-smooth);
}

.feature-box:hover {
  transform: translateY(-4px);
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(15, 23, 42, 0.9);
}

.feature-box-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
}

.feature-box-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.feature-box-desc {
  font-size: 0.92rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* Quick Nav Bar between blocks */
.quick-nav {
  background: rgba(17, 24, 39, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  padding: 1.5rem;
}

.quick-nav-title {
  font-size: 0.9rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.quick-nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.quick-nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.15rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #ffffff;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: var(--transition-smooth);
}

.quick-nav-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  transform: translateY(-2px);
}

/* Responsive adjustments */
@media (max-width: 860px) {
  .hero-title {
    font-size: 2rem;
  }

  .header-container {
    flex-direction: column;
    align-items: flex-start;
  }

  .card-inner {
    padding: 2.6rem 2.8rem 2.2rem;
  }

  .card-title {
    font-size: 1.15rem;
  }

  .card-desc {
    font-size: 0.76rem;
    max-width: 220px;
  }

  .card-icon-box {
    width: 38px;
    height: 38px;
  }

  .card-icon-box svg {
    width: 20px;
    height: 20px;
  }
}
