/* ===========================
   CSS VARIABLES & RESET
   =========================== */
:root {
  /* PDG Logo palette */
  --navy:        #0e1f3d;
  --navy-mid:    #162d55;
  --navy-light:  #1e3f7a;
  --gold:        #e8b800;
  --gold-dim:    #c99f00;
  --gold-glow:   rgba(232, 184, 0, 0.25);
  --red:         #c0102a;
  --red-glow:    rgba(192, 16, 42, 0.2);
  --white:       #f0f4ff;

  /* UI tokens */
  --bg:          #080f1e;
  --bg-card:     rgba(12, 22, 46, 0.78);
  --bg-card-2:   rgba(8, 16, 36, 0.92);
  --border:      rgba(30, 63, 122, 0.45);
  --border-gold: rgba(232, 184, 0, 0.3);
  --border-hover:rgba(232, 184, 0, 0.55);
  --accent:      var(--gold);
  --accent-2:    #5da8ff;
  --text:        #dde8ff;
  --text-muted:  #7a93c8;
  --text-dim:    #3d5080;
  --success:     #00d68f;
  --warning:     var(--gold);
  --danger:      #ff4060;

  --font-mono:   'Space Mono', monospace;
  --font-body:   'DM Sans', sans-serif;
  --radius:      16px;
  --radius-sm:   10px;
  --shadow:      0 8px 40px rgba(0, 0, 10, 0.55);
  --transition:  0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}

/* ===========================
   ANIMATED BACKGROUND
   =========================== */
.bg-grid {
  position: fixed; inset: 0; z-index: 0;
  background-image:
    linear-gradient(rgba(30,63,122,0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(30,63,122,0.06) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
}

.bg-glow {
  position: fixed; z-index: 0; border-radius: 50%;
  filter: blur(130px); pointer-events: none;
}
.glow-navy {
  width: 700px; height: 700px; opacity: 0.5;
  background: radial-gradient(circle, #0d2a5e 0%, transparent 70%);
  top: -200px; right: -200px;
  animation: floatGlow 9s ease-in-out infinite alternate;
}
.glow-gold {
  width: 400px; height: 400px; opacity: 0.18;
  background: radial-gradient(circle, #e8b800 0%, transparent 70%);
  bottom: 10%; left: 5%;
  animation: floatGlow 12s ease-in-out infinite alternate-reverse;
}
.glow-red {
  width: 300px; height: 300px; opacity: 0.12;
  background: radial-gradient(circle, #c0102a 0%, transparent 70%);
  top: 40%; right: 5%;
  animation: floatGlow 15s ease-in-out infinite alternate;
}

@keyframes floatGlow {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(20px, 25px) scale(1.08); }
}

/* ===========================
   TOP NAV BAR
   =========================== */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  display: none; align-items: center; gap: 12px;
  padding: 12px 32px;
  background: rgba(8, 15, 30, 0.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}
.topbar.visible { display: flex; }
.nav-logo { width: 32px; height: 32px; object-fit: contain; }
.nav-title {
  font-family: var(--font-mono); font-size: 0.75rem;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-muted);
}

/* ===========================
   SECTION MANAGEMENT
   =========================== */
.section {
  position: relative; z-index: 1;
  min-height: 100vh;
  display: none; align-items: center; justify-content: center;
  padding: 40px 24px;
}
.section.active { display: flex; }

/* ===========================
   LANDING
   =========================== */
#landing { gap: 60px; flex-wrap: wrap; }

.landing-inner {
  max-width: 580px;
  animation: fadeUp 0.8s ease both;
}

.org-brand {
  display: flex; align-items: center; gap: 18px;
  margin-bottom: 28px;
}
.hero-logo {
  width: 68px; height: 68px; object-fit: contain;
  filter: drop-shadow(0 4px 18px rgba(232,184,0,0.35));
  transition: transform 0.4s ease;
}
.hero-logo:hover { transform: scale(1.08) rotate(-2deg); }
.org-name { display: flex; flex-direction: column; gap: 2px; }
.org-title {
  font-family: var(--font-mono); font-size: 1.3rem; font-weight: 700;
  color: var(--gold); letter-spacing: 0.12em;
}
.org-sub {
  font-size: 0.75rem; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--text-muted);
}

.divider-line {
  width: 100%; height: 1px;
  background: linear-gradient(90deg, var(--border-gold), transparent);
  margin-bottom: 28px;
}

.badge {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--gold);
  background: rgba(232, 184, 0, 0.08);
  border: 1px solid var(--border-gold);
  padding: 6px 14px; border-radius: 100px;
  margin-bottom: 28px;
}
.badge-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--gold); box-shadow: 0 0 8px var(--gold);
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.5; transform: scale(0.82); }
}

.hero-title {
  font-family: var(--font-mono); font-size: clamp(1.9rem, 4.5vw, 3.2rem);
  font-weight: 700; line-height: 1.15; letter-spacing: -0.02em;
  color: var(--white); margin-bottom: 18px;
}
.hero-title .accent {
  background: linear-gradient(135deg, var(--gold), #ffdd60);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-desc {
  font-size: 1rem; color: var(--text-muted);
  line-height: 1.75; margin-bottom: 34px; max-width: 500px;
}

.hero-stats {
  display: flex; align-items: center; gap: 20px; margin-bottom: 38px;
}
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat-num {
  font-family: var(--font-mono); font-size: 1.5rem;
  font-weight: 700; color: var(--white);
}
.stat-num small { font-size: 0.95rem; }
.stat-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); }
.stat-divider { width: 1px; height: 38px; background: var(--border); }

.hero-note { margin-top: 14px; font-size: 0.77rem; color: var(--text-dim); letter-spacing: 0.04em; }

/* ===========================
   LANDING VISUAL
   =========================== */
.landing-visual {
  display: flex; flex-direction: column; align-items: center; gap: 24px;
  animation: fadeUp 0.8s 0.2s ease both;
}

.shield-frame {
  position: relative; width: 280px; height: 280px;
  display: flex; align-items: center; justify-content: center;
}

.orbit {
  position: absolute; border-radius: 50%;
  border: 1px solid;
  animation: spinOrbit linear infinite;
}
.orbit-1 { width: 170px; height: 170px; border-color: rgba(232,184,0,0.25); animation-duration: 7s; }
.orbit-2 { width: 225px; height: 225px; border-color: rgba(192,16,42,0.15); animation-duration: 13s; animation-direction: reverse; }
.orbit-3 { width: 278px; height: 278px; border-color: rgba(30,63,122,0.3); animation-duration: 22s; }

@keyframes spinOrbit {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

.shield-logo-large {
  width: 130px; height: 130px; object-fit: contain; position: relative; z-index: 2;
  filter: drop-shadow(0 0 30px rgba(232,184,0,0.45)) drop-shadow(0 8px 24px rgba(0,0,0,0.6));
  animation: floatShield 4s ease-in-out infinite alternate;
}
@keyframes floatShield {
  from { transform: translateY(0px); }
  to   { transform: translateY(-10px); }
}

.flag-stripes {
  display: flex; gap: 4px; height: 4px; width: 180px;
  border-radius: 100px; overflow: hidden;
}
.stripe { flex: 1; height: 100%; border-radius: 100px; }
.stripe-blue { background: #1e3f7a; }
.stripe-gold { background: var(--gold); }
.stripe-red  { background: var(--red); }

/* ===========================
   BUTTONS
   =========================== */
.btn-primary {
  display: inline-flex; align-items: center; gap: 10px;
  background: linear-gradient(135deg, #b08800, #e8b800);
  color: var(--navy); font-family: var(--font-body); font-size: 0.95rem;
  font-weight: 700; padding: 14px 28px; border-radius: 12px;
  border: none; cursor: pointer;
  box-shadow: 0 4px 24px rgba(232,184,0,0.35);
  transition: var(--transition); position: relative; overflow: hidden;
  letter-spacing: 0.01em;
}
.btn-primary::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.2), transparent);
  opacity: 0; transition: opacity 0.2s;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 32px rgba(232,184,0,0.5); }
.btn-primary:hover::before { opacity: 1; }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; transform: none; box-shadow: none; }

/* Loading state for PDF export */
.btn-primary.loading {
  opacity: 0.75; cursor: not-allowed; pointer-events: none;
}
.btn-primary.loading svg { animation: spinIcon 1s linear infinite; }
@keyframes spinIcon { to { transform: rotate(360deg); } }

.btn-ghost {
  display: inline-flex; align-items: center; gap: 8px;
  background: transparent; color: var(--text-muted);
  font-family: var(--font-body); font-size: 0.9rem;
  font-weight: 500; padding: 12px 20px; border-radius: 10px;
  border: 1px solid var(--border); cursor: pointer;
  transition: var(--transition);
}
.btn-ghost:hover { border-color: var(--border-gold); color: var(--gold); background: rgba(232,184,0,0.05); }
.btn-ghost:disabled { opacity: 0.35; cursor: not-allowed; }

/* ===========================
   QUIZ SECTION
   =========================== */
#quiz { align-items: flex-start; padding-top: 80px; }

.quiz-container {
  width: 100%; max-width: 680px; margin: 0 auto;
  animation: fadeUp 0.5s ease both;
}

.quiz-brand {
  display: flex; align-items: center; gap: 14px; margin-bottom: 24px;
}
.quiz-logo { width: 40px; height: 40px; object-fit: contain; flex-shrink: 0; }
.quiz-meta { display: flex; flex-direction: column; gap: 3px; }

.quiz-label {
  font-family: var(--font-mono); font-size: 10px;
  text-transform: uppercase; letter-spacing: 0.12em; color: var(--gold);
}
.quiz-counter {
  font-family: var(--font-mono); font-size: 12px; color: var(--text-muted);
}

.quiz-header { margin-bottom: 24px; }
.progress-track {
  width: 100%; height: 3px;
  background: rgba(232,184,0,0.1);
  border-radius: 100px; overflow: hidden; margin-bottom: 6px;
}
.progress-fill {
  height: 100%; width: 0;
  background: linear-gradient(90deg, var(--navy-light), var(--gold));
  border-radius: 100px;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}
.progress-pct {
  font-family: var(--font-mono); font-size: 11px;
  color: var(--text-dim); text-align: right;
}

.question-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-top: 2px solid var(--gold);
  border-radius: var(--radius);
  padding: 40px; margin-bottom: 28px;
  box-shadow: var(--shadow);
}

.question-num {
  font-family: var(--font-mono); font-size: 0.68rem;
  color: var(--gold); letter-spacing: 0.12em; margin-bottom: 10px;
}
.question-text {
  font-size: 1.3rem; font-weight: 600;
  line-height: 1.45; color: var(--white); margin-bottom: 10px;
}
.question-hint {
  font-size: 0.84rem; color: var(--text-muted);
  margin-bottom: 30px; line-height: 1.65;
}

.options-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px;
}

.option-btn {
  position: relative; display: flex; flex-direction: column;
  align-items: center; gap: 6px; padding: 20px 12px;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm); cursor: pointer;
  color: var(--text-muted); transition: var(--transition);
  font-family: var(--font-body); overflow: hidden;
}
.option-btn:hover {
  border-color: var(--border-gold); color: var(--text);
  transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,10,0.35);
}
.option-btn[data-value="2"]:hover,
.option-btn[data-value="2"].selected {
  border-color: var(--gold); background: rgba(232,184,0,0.07); color: var(--gold);
}
.option-btn[data-value="1"]:hover,
.option-btn[data-value="1"].selected {
  border-color: var(--accent-2); background: rgba(93,168,255,0.07); color: var(--accent-2);
}
.option-btn[data-value="0"]:hover,
.option-btn[data-value="0"].selected {
  border-color: var(--red); background: rgba(192,16,42,0.07); color: #ff6070;
}
.option-btn.selected { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,10,0.35); }
.option-icon { font-size: 1.3rem; line-height: 1; }
.option-label { font-size: 0.87rem; font-weight: 600; }
.option-pts { font-family: var(--font-mono); font-size: 0.68rem; color: var(--text-dim); transition: color 0.2s; }
.option-btn.selected .option-pts, .option-btn:hover .option-pts { color: inherit; }

.quiz-nav {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.dot-nav {
  display: flex; gap: 6px; align-items: center;
  flex-wrap: wrap; justify-content: center; flex: 1;
}
.dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--text-dim); transition: var(--transition); cursor: pointer;
}
.dot.answered { background: rgba(232,184,0,0.5); }
.dot.active   { background: var(--gold); transform: scale(1.45); }

/* ===========================
   RESULTS SECTION
   =========================== */
#results { align-items: flex-start; padding-top: 80px; }

.results-container {
  width: 100%; max-width: 820px; margin: 0 auto;
  animation: fadeUp 0.5s ease both;
}

.results-header { margin-bottom: 28px; }
.results-brand { display: flex; align-items: center; gap: 18px; }
.results-logo { width: 52px; height: 52px; object-fit: contain; }
.results-title {
  font-family: var(--font-mono); font-size: clamp(1.3rem, 2.8vw, 1.9rem);
  font-weight: 700; color: var(--white); margin-top: 5px;
}

.results-grid {
  display: grid; grid-template-columns: 1fr 1.6fr;
  gap: 20px; margin-bottom: 20px;
}

.score-card {
  background: var(--bg-card); backdrop-filter: blur(20px);
  border: 1px solid var(--border); border-top: 2px solid var(--gold);
  border-radius: var(--radius); padding: 36px 24px;
  display: flex; flex-direction: column; align-items: center; gap: 20px;
  box-shadow: var(--shadow);
}
.score-ring-wrap { position: relative; width: 140px; height: 140px; }
.score-ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: rgba(30,63,122,0.35); stroke-width: 8; }
.ring-fg {
  fill: none; stroke: url(#ringGrad);
  stroke-width: 8; stroke-linecap: round;
  stroke-dasharray: 314; stroke-dashoffset: 314;
  transition: stroke-dashoffset 1.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.score-center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.score-number {
  font-family: var(--font-mono); font-size: 2.4rem; font-weight: 700;
  color: var(--gold); line-height: 1; transition: color 0.5s;
}
.score-max { font-family: var(--font-mono); font-size: 0.72rem; color: var(--text-dim); }

.level-badge {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 20px; border-radius: 100px;
  border: 1px solid var(--border); background: rgba(255,255,255,0.02);
}
.level-icon { font-size: 1.2rem; }
.level-name {
  font-family: var(--font-mono); font-size: 0.85rem; font-weight: 700;
  letter-spacing: 0.06em; color: var(--white);
}

.info-card {
  background: var(--bg-card); backdrop-filter: blur(20px);
  border: 1px solid var(--border); border-top: 2px solid var(--navy-light);
  border-radius: var(--radius); padding: 36px; box-shadow: var(--shadow);
  display: flex; flex-direction: column;
}
.info-title {
  font-size: 0.75rem; text-transform: uppercase;
  letter-spacing: 0.12em; color: var(--gold);
  font-family: var(--font-mono); margin-bottom: 12px;
}
.info-desc {
  font-size: 0.94rem; color: var(--text-muted);
  line-height: 1.75; margin-bottom: 24px; flex: 1;
}

.maturity-bar-wrap { margin-top: auto; }
.maturity-labels {
  display: flex; justify-content: space-between;
  font-size: 0.65rem; color: var(--text-dim);
  font-family: var(--font-mono); text-transform: uppercase;
  letter-spacing: 0.06em; margin-bottom: 8px;
}
.maturity-track {
  position: relative; height: 5px;
  background: rgba(30,63,122,0.4); border-radius: 100px; overflow: visible;
}
.maturity-fill {
  position: absolute; left: 0; top: 0; height: 100%;
  background: linear-gradient(90deg, var(--red), var(--gold), var(--success));
  border-radius: 100px;
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1) 0.3s;
}
.maturity-marker {
  position: absolute; top: 50%; transform: translate(-50%, -50%);
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--white); border: 2px solid var(--gold);
  box-shadow: 0 0 10px var(--gold-glow);
  transition: left 1s cubic-bezier(0.4, 0, 0.2, 1) 0.3s;
}

.recs-card, .review-card {
  background: var(--bg-card); backdrop-filter: blur(20px);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 36px; margin-bottom: 20px; box-shadow: var(--shadow);
}
.recs-title {
  display: flex; align-items: center; gap: 10px;
  font-size: 0.75rem; text-transform: uppercase;
  letter-spacing: 0.12em; color: var(--gold);
  font-family: var(--font-mono); margin-bottom: 20px;
}

.recs-list { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.recs-list li {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 13px 16px;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.88rem; color: var(--text-muted); line-height: 1.65;
  animation: fadeUp 0.3s ease both;
}
.recs-list li::before {
  content: '→'; color: var(--gold);
  font-family: var(--font-mono); flex-shrink: 0; margin-top: 1px;
}

.review-list { display: flex; flex-direction: column; gap: 8px; }
.review-item {
  display: flex; align-items: center; gap: 14px;
  padding: 11px 16px;
  background: rgba(255,255,255,0.018);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  animation: fadeUp 0.3s ease both;
}
.review-q { flex: 1; font-size: 0.84rem; color: var(--text-muted); }
.review-a {
  font-family: var(--font-mono); font-size: 0.72rem;
  font-weight: 700; padding: 3px 10px; border-radius: 100px;
  border: 1px solid; flex-shrink: 0;
}
.review-a.yes     { color: var(--gold);   border-color: rgba(232,184,0,0.35);  background: rgba(232,184,0,0.07); }
.review-a.partial { color: var(--accent-2); border-color: rgba(93,168,255,0.35); background: rgba(93,168,255,0.07); }
.review-a.no      { color: #ff6070;        border-color: rgba(192,16,42,0.35);  background: rgba(192,16,42,0.07); }

.results-actions {
  display: flex; gap: 14px; justify-content: flex-end;
  margin-top: 8px; margin-bottom: 40px;
}

.site-footer {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  padding: 24px 0 48px; border-top: 1px solid var(--border);
}
.footer-logo { width: 28px; height: 28px; object-fit: contain; opacity: 0.7; }
.footer-text { font-size: 0.72rem; color: var(--text-dim); letter-spacing: 0.05em; font-family: var(--font-mono); }

/* ===========================
   LEVEL OVERRIDES
   =========================== */
body.level-beginner  .score-number { color: #ff6070; }
body.level-beginner  .level-badge  { border-color: rgba(192,16,42,0.4); background: rgba(192,16,42,0.06); }
body.level-intermediate .score-number { color: var(--gold); }
body.level-intermediate .level-badge  { border-color: rgba(232,184,0,0.4); background: rgba(232,184,0,0.06); }
body.level-advanced  .score-number { color: var(--success); }
body.level-advanced  .level-badge  { border-color: rgba(0,214,143,0.4); background: rgba(0,214,143,0.06); }

/* ===========================
   ANIMATIONS
   =========================== */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(22px); }
  to   { opacity: 1; transform: translateY(0); }
}
.card-exit { animation: cardExit 0.22s ease forwards; }
.card-enter { animation: cardEnter 0.28s ease forwards; }
@keyframes cardExit {
  to { opacity: 0; transform: translateX(-18px); }
}
@keyframes cardEnter {
  from { opacity: 0; transform: translateX(18px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ===========================
   RESPONSIVE
   =========================== */
@media (max-width: 720px) {
  #landing { flex-direction: column; text-align: center; gap: 36px; }
  .org-brand    { justify-content: center; }
  .hero-stats   { justify-content: center; }
  .hero-desc    { margin: 0 auto 30px; }
  .landing-inner { display: flex; flex-direction: column; align-items: center; }
  .divider-line { width: 100%; }

  .question-card { padding: 24px 18px; }
  .options-grid  { grid-template-columns: 1fr; gap: 10px; }
  .option-btn    { flex-direction: row; justify-content: flex-start; padding: 13px 16px; }

  .results-grid   { grid-template-columns: 1fr; }
  .results-actions { flex-direction: column; }
  .quiz-nav { flex-wrap: wrap; gap: 10px; }
}
@media (max-width: 480px) {
  .hero-title { font-size: 1.7rem; }
  .quiz-container, .results-container { padding: 0; }
}
