/* NEC Navigation Practice Test - styles
   Self-contained; scoped under .app so it can be embedded in WordPress without clashing.
   v3 (2026-07-03, Polish Wk1): question out-transition, deeper selected state,
   graduated timer (amber->red), tabular numerals, next-button settle cue.
   v6 (2026-07-03, Polish Wk4): dark mode — all colors routed through variables
   with a prefers-color-scheme override block at the end of this file. */

/* Self-hosted fonts (no external Google Fonts dependency) */
@font-face { font-family: "Source Sans Pro"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/SourceSansPro-400.woff2") format("woff2"); }
@font-face { font-family: "Source Sans Pro"; font-style: normal; font-weight: 600; font-display: swap; src: url("fonts/SourceSansPro-600.woff2") format("woff2"); }
@font-face { font-family: "Source Sans Pro"; font-style: normal; font-weight: 700; font-display: swap; src: url("fonts/SourceSansPro-700.woff2") format("woff2"); }
@font-face { font-family: "Volkhov"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/Volkhov-400.woff2") format("woff2"); }
@font-face { font-family: "Volkhov"; font-style: normal; font-weight: 700; font-display: swap; src: url("fonts/Volkhov-700.woff2") format("woff2"); }

:root {
  /* electricianauthority.com brand palette (Astra global colors) */
  --navy: #316cb6;       /* brand primary blue */
  --navy-2: #2a5d9e;     /* darker blue for hover */
  --amber: #f49516;      /* brand accent orange */
  --amber-dark: #d97f06; /* darker orange for hover */
  --cyan: #06b6d4;       /* brand secondary accent */
  --ink: #1f2937;        /* brand text */
  --muted: #6b7b8c;
  --line: #e2e8f0;
  --bg: #f8fafc;         /* brand light background */
  --card: #ffffff;
  --good: #1f9d57;
  --good-bg: #e7f6ee;
  --bad: #d2453b;
  --bad-bg: #fbeae8;
  --bad-strong: #d2453b; /* filled backgrounds (timer.low) - separate so dark can tune it */
  /* surfaces & states (light defaults; overridden wholesale in dark mode) */
  --surface: #ffffff;         /* choice buttons, length cards, timer chip */
  --code-bg: #eef2f6;
  --choice-hover-bg: #f6f9fc;
  --choice-selected-bg: #eef3f9;
  --track: #e3e9f0;           /* progress track + passline */
  --row-bg: #fcfdfe;          /* review rows */
  --skel-a: #edf1f5;          /* skeleton shimmer stops */
  --skel-b: #f7fafc;
  --timer-warn-ink: #8a5a00;
  --timer-warn-bg: #fff7e8;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(49, 108, 182, 0.10);
  --font-head: "Volkhov", Georgia, "Times New Roman", serif;
  --font-body: "Source Sans Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  /* shared motion language — same curve + timing everywhere so it feels designed */
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --dur: 0.22s;
}

* { box-sizing: border-box; }

/* the page behind the centered app column must follow the scheme too */
html, body { background: var(--bg); }
:root { color-scheme: light dark; }

.app {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--bg);
  max-width: 760px;
  margin: 0 auto;
  padding: 20px 16px 48px;
  line-height: 1.5;
}

.hidden { display: none !important; }

/* headings use the brand serif */
.masthead h1, .card h2, .question-text, .result-score { font-family: var(--font-head); }

.masthead { text-align: center; margin: 8px 0 22px; }
.masthead .logo { width: 72px; height: 72px; display: block; margin: 0 auto 10px; }
.masthead h1 { color: var(--navy); font-size: 1.6rem; font-weight: 700; margin: 0 0 6px; }
.tagline { color: var(--amber-dark); font-weight: 600; margin: 0; }

.card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 18px;
}
/* two-tone accent bar echoing the logo's blue + orange ring */
.card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--navy) 0%, var(--amber) 100%);
  border-radius: var(--radius) var(--radius) 0 0;
}
.card h2 { color: var(--navy); font-size: 1.05rem; margin: 0 0 6px; }
.card h2 + p { margin-top: 0; }
.intro p { margin: 0 0 14px; }
.intro p:last-child { margin-bottom: 0; }
.intro code, .question-meta code { background: var(--code-bg); padding: 1px 6px; border-radius: 5px; font-size: .92em; }

.muted { color: var(--muted); font-size: .9rem; }

/* length selection */
.length-options { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; }
.length-btn {
  flex: 1 1 80px;
  border: 1.5px solid var(--line);
  background: var(--surface);
  border-radius: 10px;
  padding: 14px 8px;
  cursor: pointer;
  text-align: center;
  transition: border-color .15s, transform .05s, background .15s;
}
.length-btn:hover { border-color: var(--amber); }
.length-btn:active { transform: translateY(1px); }
.length-btn .num { display: block; font-size: 1.5rem; font-weight: 700; color: var(--navy); }
.length-btn .lbl { display: block; font-size: .78rem; color: var(--muted); }

/* buttons */
.btn {
  font: inherit;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  padding: 12px 22px;
  cursor: pointer;
  transition: background .15s, transform .05s, opacity .15s;
}
.btn-primary { background: var(--amber); color: #2a1c00; }
.btn-primary:hover { background: var(--amber-dark); }
.btn-primary:disabled { opacity: .45; cursor: not-allowed; }
.btn:active { transform: translateY(1px); }

/* test bar */
.testbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.testbar-left { display: flex; align-items: center; gap: 9px; }
.logo-sm { width: 28px; height: 28px; display: block; }
.progress { font-weight: 600; color: var(--navy); }
.timer { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 1.1rem; color: var(--navy); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 4px 12px; }
.timer.low { color: #fff; background: var(--bad-strong); border-color: var(--bad-strong); }
.progress-track { height: 6px; background: var(--track); border-radius: 99px; overflow: hidden; margin-bottom: 16px; }
.progress-fill { height: 100%; width: 0; background: var(--amber); transition: width .25s; }

.question-meta { color: var(--muted); font-size: .85rem; margin: 0 0 6px; text-transform: uppercase; letter-spacing: .03em; }
.question-text { font-size: 1.2rem; color: var(--ink); margin: 0 0 18px; }

.choices { display: grid; gap: 10px; }
.choice {
  text-align: left;
  font: inherit;
  color: var(--ink); /* buttons don't inherit text color; without this they render UA black */
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
  transition: border-color .15s, background .15s;
}
.choice:hover { border-color: var(--amber); }
.choice.selected { border-color: var(--navy); background: var(--choice-selected-bg); }
.choice .key { display: inline-block; width: 24px; font-weight: 700; color: var(--navy); }

.test-actions { margin-top: 18px; text-align: right; }

/* results */
.result-summary { text-align: center; }
.result-badge { font-weight: 700; letter-spacing: .05em; text-transform: uppercase; font-size: .8rem; display: inline-block; padding: 5px 14px; border-radius: 99px; margin-bottom: 8px; }
.result-badge.pass { background: var(--good-bg); color: var(--good); }
.result-badge.fail { background: var(--bad-bg); color: var(--bad); }
.result-score { font-size: 2.4rem; margin: 4px 0; color: var(--navy); }
.result-line { color: var(--muted); margin: 0 0 18px; }

.review-list { list-style: none; counter-reset: r; margin: 10px 0 0; padding: 0; }
.review-item { border-left: 4px solid var(--line); padding: 10px 14px; margin-bottom: 10px; background: var(--row-bg); border-radius: 0 8px 8px 0; }
.review-item.correct { border-left-color: var(--good); }
.review-item.incorrect { border-left-color: var(--bad); }
.review-q { font-weight: 600; margin: 0 0 6px; }
.review-line { font-size: .9rem; margin: 2px 0; }
.review-line .tag { font-weight: 700; }
.review-item.correct .tag { color: var(--good); }
.review-item.incorrect .tag { color: var(--bad); }
.review-answer { font-variant-numeric: tabular-nums; }
.review-correct { color: var(--good); font-weight: 600; }

@media (max-width: 480px) {
  .masthead h1 { font-size: 1.4rem; }
  .question-text { font-size: 1.08rem; }
  .length-btn { flex-basis: 60px; }
}

/* ============================================================
   Premium polish — subtle, consistent micro-interactions.
   All built on --ease / --dur so the motion feels unified.
   ============================================================ */

/* shared transition curve */
.btn, .length-btn, .choice { transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease), background var(--dur) var(--ease); }

/* 1 + 2: buttons lift on hover, press down on click */
.btn-primary:not(:disabled):hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(244, 149, 22, 0.32); }
.btn-primary:not(:disabled):active { transform: translateY(0); box-shadow: 0 2px 6px rgba(244, 149, 22, 0.28); }

/* 3: length cards lift + brand-orange border + shadow on hover */
.length-btn:hover { transform: translateY(-3px); border-color: var(--amber); box-shadow: 0 8px 18px rgba(49, 108, 182, 0.14); }
.length-btn:active { transform: translateY(-1px); }

/* 4: answer choices — highlight slide on hover, eased selection + pop on pick */
.choice:hover { transform: translateX(3px); background: var(--choice-hover-bg); }
.choice.selected { transform: translateX(3px); }
@keyframes pickPop {
  0%   { transform: translateX(3px) scale(0.995); }
  55%  { transform: translateX(3px) scale(1.015); }
  100% { transform: translateX(3px) scale(1); }
}
.choice.selected.just-picked { animation: pickPop 0.18s var(--ease); }

/* 5: screen entrance transition */
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.screen.animate-in { animation: fadeUp 0.30s var(--ease) both; }

/* 6: each question fades up as it appears */
@keyframes qIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.question-card.q-in { animation: qIn 0.26s var(--ease) both; }

/* 7: results review rows stagger in (delay set inline by JS); skip clears them */
@keyframes reviewIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.review-item.reveal { opacity: 0; animation: reviewIn 0.45s var(--ease) forwards; }
.review-list.skip .review-item.reveal { animation: none !important; opacity: 1 !important; transform: none !important; }
.result-summary.animate-in { animation: fadeUp 0.32s var(--ease) both; }
.result-skip-hint { text-align: center; font-size: 0.8rem; color: var(--muted); margin: 6px 0 16px; min-height: 1.4em; line-height: 1.4; transition: opacity var(--dur) var(--ease); }

/* 8: timer pulses when time is low */
@keyframes timerPulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }
.timer.low { animation: timerPulse 1s var(--ease) infinite; }

/* progress fill already eases via width transition; nudge to shared curve */
.progress-fill { transition: width 0.3s var(--ease); }

/* Accessibility: respect reduced-motion — tone everything down */
@media (prefers-reduced-motion: reduce) {
  *, .screen.animate-in, .question-card.q-in, .review-item.reveal, .timer.low {
    animation: none !important;
    transition-duration: 0.001ms !important;
  }
  .review-item.reveal { opacity: 1 !important; transform: none !important; }
  .btn-primary:hover, .length-btn:hover, .choice:hover, .choice.selected { transform: none; }
}

/* free-tier launch bits */
.coming-soon { margin-top: 10px; font-style: italic; opacity: 0.85; }
.app-disclaimer { margin-top: 22px; padding-top: 14px; border-top: 1px solid var(--line); }
.app-disclaimer p { font-size: 0.72rem; color: var(--muted); line-height: 1.45; margin: 0; text-align: center; }

/* ============================================================
   Polish Wk1 (v3) — refined micro-interactions.
   All motion here is covered by the prefers-reduced-motion
   kill-switch above (the `*` rule zeroes every animation).
   ============================================================ */

/* 1: brief fade-out before the next question fades in (paced by JS) */
@keyframes qOut { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(-6px); } }
.question-card.q-out { animation: qOut 0.14s var(--ease) both; }

/* 2: deeper selected-choice state — soft inset ring + amber key */
.choice.selected {
  box-shadow: inset 0 0 0 1.5px var(--navy), 0 1px 6px rgba(49, 108, 182, 0.10);
}
.choice.selected .key { color: var(--amber-dark); }

/* 3: graduated timer — amber heads-up (~25% time left) before the red 30s state.
   Pulse stays reserved for .low so urgency still escalates. */
.timer.warn { color: var(--timer-warn-ink); background: var(--timer-warn-bg); border-color: var(--amber); }

/* 4: tabular numerals everywhere numbers change — nothing shifts mid-count */
.progress, .result-score, .review-item { font-variant-numeric: tabular-nums; }

/* 5: next-button settles when it becomes enabled (state change without color alone) */
@keyframes btnSettle { 0% { transform: scale(1); } 45% { transform: scale(1.045); } 100% { transform: scale(1); } }
.btn.settle { animation: btnSettle 0.22s var(--ease); }

/* ============================================================
   Polish Wk2 (v4) — perceived speed & momentum.
   ============================================================ */

/* 6: progress fill warms navy -> amber across the FULL track.
   JS sets background-size so the gradient spans the whole track width
   regardless of the fill's current width. */
.progress-fill {
  background-image: linear-gradient(90deg, var(--navy) 0%, var(--amber) 100%);
  background-repeat: no-repeat;
}
.progress-pct { color: var(--muted); font-weight: 600; font-size: 0.85em; }

/* 7: loading skeleton — only becomes visible if the data load takes >150ms,
   so fast loads never flash it. Shimmer dies under prefers-reduced-motion. */
.skeleton { display: none; }
.skeleton.show { display: block; }
.skeleton .bone {
  height: 56px; border-radius: 10px; margin: 4px 0 10px;
  background: linear-gradient(90deg, var(--skel-a) 25%, var(--skel-b) 45%, var(--skel-a) 65%);
  background-size: 200% 100%;
  animation: shimmer 1.1s linear infinite;
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* 8: pass-line scale on results — your score bar vs. the passing tick */
.passline { position: relative; height: 10px; background: var(--track); border-radius: 99px; margin: 10px 6px 30px; }
.passline-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 99px; width: 0; transition: width 0.6s var(--ease); }
.passline-fill.pass { background: var(--good); }
.passline-fill.fail { background: var(--bad); }
.passline-tick { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--ink); opacity: 0.45; }
.passline-label { position: absolute; top: 14px; transform: translateX(-50%); font-size: 0.72rem; color: var(--muted); white-space: nowrap; }

/* ============================================================
   Polish Wk3 (v5) — the intelligence layer.
   ============================================================ */

/* 9: verdict line — the one-sentence story of the run */
.result-verdict { color: var(--ink); font-size: 0.98rem; margin: 0 0 14px; }

/* 10: per-question timing in review rows */
.review-time { color: var(--muted); font-weight: 400; font-size: 0.85em; white-space: nowrap; }

/* ============================================================
   Polish Wk4 (v6) — dark mode.
   Brand-adapted palette via variable overrides only; no layout
   changes. Key contrast ratios (vs. their actual backgrounds):
   ink 13.3:1, muted 6.2:1, navy 6.1:1, tagline 8.9:1, warn 7.9:1,
   good 6.5:1, bad 4.6:1 — all pass WCAG AA.
   ============================================================ */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #10161f;
    --card: #1a2230;
    --ink: #e5ecf5;
    --muted: #93a4b8;
    --line: #2b3648;
    --navy: #6ea3e6;        /* brand blue, lightened for dark contrast */
    --navy-2: #8ab6ee;
    --amber: #f49516;       /* fills keep the true brand orange */
    --amber-dark: #f0a949;  /* text accents lightened */
    --good: #48c07a;
    --good-bg: #12301f;
    --bad: #e66358;
    --bad-bg: #331b18;
    --bad-strong: #c43f35;  /* timer.low fill: white text = 5.8:1 */
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.45);
    --surface: #1e2836;
    --code-bg: #232e40;
    --choice-hover-bg: #232e40;
    --choice-selected-bg: #24334a;
    --track: #2b3648;
    --row-bg: #1c2534;
    --skel-a: #232e40;
    --skel-b: #2b3850;
    --timer-warn-ink: #f2c063;
    --timer-warn-bg: #33270f;
  }
  /* the logo is a light-background badge; give it a soft plate so it reads on dark.
     The ring is a spread shadow OUTSIDE the box, so the logo keeps its full size
     (padding inside the fixed box shrank it — Scott flagged that). */
  .masthead .logo { background: #f4f7fa; border-radius: 50%; box-shadow: 0 0 0 5px #f4f7fa; }
  .logo-sm { background: #f4f7fa; border-radius: 50%; box-shadow: 0 0 0 2px #f4f7fa; }
  /* hover glows: swap the light-mode colored shadows for neutral dark ones */
  .btn-primary:not(:disabled):hover { box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5); }
  .length-btn:hover { box-shadow: 0 8px 18px rgba(0, 0, 0, 0.5); }
  .choice.selected { box-shadow: inset 0 0 0 1.5px var(--navy), 0 1px 6px rgba(0, 0, 0, 0.35); }
}
