/* ═══════════════════════════════════════════════════════════════
   reisinger engineering · Haptik Assessment · style.css
   Brand: Dark Grey #262626 · Ice Grey #AAB4B8 · Warm White #FEFCEF
         Walnut Brown #5E5147 · Almost Black #0d0d0d
   Font: Montserrat (300/400/500/700/900)
   ═══════════════════════════════════════════════════════════════ */

/* ─── RESET & BASE ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --dark:    #0d0d0d;
  --grey:    #262626;
  --ice:     #AAB4B8;
  --warm:    #FEFCEF;
  --walnut:  #5E5147;
  --white:   #ffffff;
  --font:    'Montserrat', sans-serif;
}

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  background: var(--dark);
  color: var(--warm);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ─── SCREENS ───────────────────────────────────────────────────── */
.screen { display: none; min-height: 100vh; position: relative; overflow: hidden; }
.screen.active { display: flex; flex-direction: column; }

/* ─── RIPPLE BACKGROUND ─────────────────────────────────────────── */
.ripple-bg {
  position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 0;
}
.ripple {
  position: absolute; bottom: -8%; left: 50%;
  transform: translateX(-50%);
  border-radius: 50%;
  border: 1px solid var(--ice);
  animation: rpl 9s ease-in-out infinite;
}
.r1 { width: 26%; padding-bottom: 13%; opacity: 0.037; animation-delay: 0s; }
.r2 { width: 52%; padding-bottom: 26%; opacity: 0.044; animation-delay: 1.6s; }
.r3 { width: 78%; padding-bottom: 39%; opacity: 0.037; animation-delay: 3.2s; }
.r4 { width: 104%; padding-bottom: 52%; opacity: 0.030; animation-delay: 4.8s; }
.r5 { width: 130%; padding-bottom: 65%; opacity: 0.023; animation-delay: 6.4s; }

@keyframes rpl {
  0%, 100% { opacity: 0.025; }
  50%       { opacity: 0.075; }
}

.deco-lines {
  position: absolute; inset: 0; width: 100%; height: 100%;
}

/* ─── TOPBAR ────────────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(13,13,13,0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(170,180,184,0.12);
  padding: 0 24px;
  display: flex; justify-content: space-between; align-items: center;
  height: 54px; flex-shrink: 0;
}
.logo-wrap { width: 160px; height: 26px; }
.logo-small { width: 120px; height: 20px; }
.logo-svg { width: 100%; height: 100%; }
.topbar-label {
  font-size: 9px; letter-spacing: 0.15em; color: var(--walnut);
  text-transform: uppercase; text-align: right; max-width: 200px;
}

/* ─── INTRO CONTENT ─────────────────────────────────────────────── */
.intro-content {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; flex: 1;
  padding: 40px 24px 60px;
}

.intro-hero { text-align: center; max-width: 620px; }

.intro-eyebrow {
  font-size: 8px; letter-spacing: 0.3em; color: var(--ice);
  text-transform: uppercase; margin-bottom: 16px;
}

.intro-title {
  font-size: clamp(26px, 5vw, 48px);
  font-weight: 900; color: var(--warm);
  text-transform: lowercase; letter-spacing: -0.02em;
  line-height: 1.05; margin-bottom: 18px;
}

.divider-line {
  display: flex; align-items: center; justify-content: center;
  gap: 10px; margin: 0 0 18px;
}
.divider-line::before,
.divider-line::after {
  content: ''; flex: 1; max-width: 60px; height: 1px;
}
.divider-line::before { background: linear-gradient(to right, transparent, var(--walnut)); }
.divider-line::after  { background: linear-gradient(to left,  transparent, var(--walnut)); }
.divider-text {
  font-size: 7.5px; letter-spacing: 0.2em; color: var(--walnut);
  text-transform: uppercase; white-space: nowrap; text-align: center;
  padding: 0 4px;
}

.intro-sub {
  color: rgba(170,180,184,0.65); font-size: 12px;
  line-height: 1.8; font-weight: 300;
}

/* ─── CATEGORY GRID ─────────────────────────────────────────────── */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px; max-width: 680px; width: 100%; margin-top: 32px;
}
.cat-card {
  padding: 12px 14px;
  border: 1px solid rgba(170,180,184,0.12);
  background: rgba(170,180,184,0.04);
  display: flex; flex-direction: column; gap: 5px;
}
.cat-icon { font-size: 15px; }
.cat-name { font-size: 10px; color: rgba(254,252,239,0.8); font-weight: 500; line-height: 1.4; }

/* ─── NAME INPUT ────────────────────────────────────────────────── */
.name-block {
  width: 100%; max-width: 400px; margin-top: 36px;
  display: flex; flex-direction: column; gap: 10px;
}
.name-label {
  font-size: 8px; letter-spacing: 0.25em; color: var(--ice);
  text-transform: uppercase;
}
.name-input {
  width: 100%; padding: 14px 18px;
  background: transparent;
  border: 1px solid rgba(170,180,184,0.18);
  color: var(--warm); font-size: 14px;
  font-family: var(--font); font-weight: 400;
  outline: none; transition: border-color 0.2s;
  border-radius: 0;
}
.name-input:focus { border-color: rgba(170,180,184,0.55); }
.name-input::placeholder { color: rgba(170,180,184,0.4); }

/* ─── BUTTONS ───────────────────────────────────────────────────── */
.btn-primary {
  width: 100%; padding: 15px 20px;
  background: var(--warm); border: none;
  color: var(--dark); font-size: 10px;
  letter-spacing: 0.22em; text-transform: uppercase;
  font-weight: 700; cursor: pointer;
  font-family: var(--font); transition: all 0.2s;
  border-radius: 0;
}
.btn-primary:disabled {
  background: transparent;
  border: 1px solid rgba(170,180,184,0.2);
  color: rgba(170,180,184,0.28);
  cursor: not-allowed;
}
.btn-primary:not(:disabled):hover { background: rgba(254,252,239,0.88); }

.btn-secondary {
  flex: 1; min-width: 140px; padding: 14px 20px;
  background: transparent;
  border: 1px solid rgba(170,180,184,0.18);
  color: var(--ice); font-size: 9px;
  letter-spacing: 0.22em; text-transform: uppercase;
  font-weight: 700; cursor: pointer;
  font-family: var(--font); transition: all 0.2s;
  border-radius: 0;
}
.btn-secondary:hover { border-color: rgba(170,180,184,0.45); }

/* ─── FOOTER CLAIM ──────────────────────────────────────────────── */
.footer-claim {
  position: absolute; bottom: 20px; left: 50%;
  transform: translateX(-50%);
  font-size: 8px; color: rgba(170,180,184,0.22);
  letter-spacing: 0.2em; white-space: nowrap; z-index: 1;
}

/* ─── ANIMATIONS ────────────────────────────────────────────────── */
.fade-up {
  animation: fadeUp 0.9s ease both;
}
.delay-1 { animation-delay: 0.15s; opacity: 0; }
.delay-2 { animation-delay: 0.30s; opacity: 0; }
.delay-3 { animation-delay: 0.45s; opacity: 0; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── PROGRESS BAR ──────────────────────────────────────────────── */
#progress-bar-wrap {
  height: 2px; background: rgba(170,180,184,0.1); flex-shrink: 0;
}
#progress-bar {
  height: 100%; width: 0;
  background: linear-gradient(90deg, var(--walnut), var(--ice));
  transition: width 0.5s ease;
}

/* ─── QUIZ CONTENT ──────────────────────────────────────────────── */
.quiz-content {
  flex: 1; display: flex; flex-direction: column;
  padding: 24px 24px 28px;
  max-width: 700px; margin: 0 auto; width: 100%;
  transition: opacity 0.22s ease, transform 0.22s ease;
}
.quiz-content.anim-out {
  opacity: 0; transform: translateY(-12px);
}

.quiz-meta {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 18px;
}
.q-num {
  font-size: 8px; letter-spacing: 0.2em;
  color: rgba(170,180,184,0.45); text-transform: uppercase;
}
.q-counter { font-size: 9px; color: rgba(170,180,184,0.35); }

.quiz-question {
  font-size: clamp(14px, 2.5vw, 19px);
  font-weight: 700; color: var(--warm);
  line-height: 1.55; margin-bottom: 22px; letter-spacing: -0.01em;
}

/* ─── QUIZ OPTIONS ──────────────────────────────────────────────── */
.quiz-options {
  display: flex; flex-direction: column; gap: 8px;
}

.quiz-opt {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 13px 15px;
  background: transparent;
  border: 1px solid rgba(170,180,184,0.11);
  text-align: left; cursor: pointer;
  transition: all 0.16s;
  font-family: var(--font);
  width: 100%;
  border-radius: 0;
}
.quiz-opt:hover:not(:disabled) {
  background: rgba(170,180,184,0.06);
  border-color: rgba(170,180,184,0.45);
}
.quiz-opt:disabled { cursor: default; }

.opt-letter {
  font-size: 8px; font-weight: 700; letter-spacing: 0.12em;
  color: rgba(170,180,184,0.4); text-transform: uppercase;
  margin-top: 3px; min-width: 12px; flex-shrink: 0;
}
.opt-text {
  font-size: 12px; color: rgba(254,252,239,0.7);
  line-height: 1.55; font-weight: 400;
}

/* States after reveal */
.quiz-opt.correct {
  background: rgba(94,81,71,0.12);
  border-color: var(--walnut);
}
.quiz-opt.correct .opt-letter { color: var(--walnut); }
.quiz-opt.correct .opt-text   { color: var(--warm); }

.quiz-opt.wrong {
  border-color: rgba(170,180,184,0.14);
}
.quiz-opt.wrong .opt-text { color: rgba(170,180,184,0.28); }

.quiz-opt.selected-wrong {
  border-color: rgba(170,180,184,0.2);
}

/* ─── EXPLANATION ───────────────────────────────────────────────── */
.quiz-explain {
  margin-top: 14px; padding: 12px 15px;
  border-left: 2px solid var(--walnut);
  background: rgba(170,180,184,0.05);
  display: none;
  animation: fadeUp 0.3s ease;
}
.quiz-explain.visible { display: block; }
.quiz-explain.wrong-reveal { border-left-color: var(--ice); }

.explain-label {
  font-size: 7.5px; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--walnut); margin-bottom: 5px;
}
.quiz-explain.wrong-reveal .explain-label { color: var(--ice); }

.explain-text {
  font-size: 11px; color: rgba(254,252,239,0.72);
  line-height: 1.65; font-weight: 300;
}

/* ─── NEXT BUTTON ───────────────────────────────────────────────── */
.btn-next {
  margin-top: 16px; align-self: flex-end;
  padding: 11px 28px;
  background: transparent;
  border: 1px solid rgba(254,252,239,0.18);
  color: var(--warm); font-size: 9px;
  letter-spacing: 0.2em; text-transform: uppercase;
  font-weight: 700; cursor: pointer;
  font-family: var(--font); transition: all 0.2s;
  animation: fadeUp 0.3s 0.1s ease both;
  border-radius: 0;
}
.btn-next:hover {
  background: rgba(254,252,239,0.08);
  border-color: rgba(254,252,239,0.45);
}

/* ─── RESULT CONTENT ────────────────────────────────────────────── */
.result-content {
  position: relative; z-index: 1;
  max-width: 720px; margin: 0 auto;
  padding: 32px 24px 60px; width: 100%;
}

.result-score { text-align: center; margin-bottom: 40px; }
.result-eyebrow {
  font-size: 8px; letter-spacing: 0.3em; color: var(--ice);
  text-transform: uppercase; margin-bottom: 12px;
}
.result-pct {
  font-size: clamp(68px, 11vw, 96px);
  font-weight: 900; color: var(--warm);
  line-height: 1; letter-spacing: -0.04em;
}
.res-unit { font-size: 36%; color: rgba(170,180,184,0.8); font-weight: 300; }
.result-correct {
  font-size: 11px; color: rgba(170,180,184,0.7); margin-top: 6px;
}
.level-divider {
  display: flex; align-items: center; justify-content: center;
  gap: 10px; margin: 16px 0;
}
.level-divider::before,
.level-divider::after {
  content: ''; flex: 1; max-width: 60px; height: 1px;
}
.level-divider::before { background: linear-gradient(to right, transparent, var(--walnut)); }
.level-divider::after  { background: linear-gradient(to left,  transparent, var(--walnut)); }
.level-divider span {
  font-size: 8px; letter-spacing: 0.25em; color: var(--walnut);
  text-transform: uppercase;
}
.res-level-title {
  font-size: clamp(18px, 3.5vw, 26px);
  font-weight: 700; color: var(--warm);
  text-transform: lowercase; letter-spacing: -0.01em;
}
.res-level-desc {
  font-size: 12px; color: rgba(254,252,239,0.5);
  line-height: 1.7; margin-top: 10px; font-weight: 300;
  max-width: 440px; margin-left: auto; margin-right: auto;
}

.section-label {
  font-size: 8px; letter-spacing: 0.22em; color: var(--ice);
  text-transform: uppercase; margin-bottom: 16px;
}

/* ─── CAT BARS ──────────────────────────────────────────────────── */
.cat-bars { margin-bottom: 30px; }
.bar-row { margin-bottom: 12px; }
.bar-header {
  display: flex; justify-content: space-between; margin-bottom: 4px;
}
.bar-name {
  font-size: 11px; color: rgba(254,252,239,0.8); font-weight: 500;
}
.bar-pct {
  font-size: 10px; font-weight: 700;
}
.bar-track { height: 2px; background: rgba(170,180,184,0.1); }
.bar-fill  { height: 100%; transition: width 1.2s ease; }

/* ─── GAPS ──────────────────────────────────────────────────────── */
.gaps-block { margin-bottom: 28px; padding: 18px; border: 1px solid rgba(170,180,184,0.1); }
.gap-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0; border-bottom: 1px solid rgba(170,180,184,0.07);
}
.gap-name { font-size: 11px; color: rgba(254,252,239,0.7); }
.gap-badge {
  font-size: 7.5px; padding: 3px 9px;
  border: 1px solid rgba(170,180,184,0.3);
  color: var(--ice); letter-spacing: 0.1em; text-transform: uppercase;
}
.gaps-reco {
  font-size: 10px; color: rgba(170,180,184,0.5);
  margin-top: 12px; line-height: 1.65; font-weight: 300;
}

/* ─── RESULT BUTTONS ────────────────────────────────────────────── */
.result-btns {
  display: flex; gap: 10px; flex-wrap: wrap;
}
.result-btns .btn-primary { flex: 1; min-width: 180px; }

/* ─── CERTIFICATE MODAL ─────────────────────────────────────────── */
.cert-modal {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.cert-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.94);
}
.cert-wrap {
  position: relative; z-index: 1;
  max-width: 720px; width: 100%;
  max-height: 90vh; overflow-y: auto;
  animation: fadeUp 0.3s ease;
}

/* ─── CERTIFICATE PAPER ─────────────────────────────────────────── */
.cert-paper {
  background: #FEFCEF;
  padding: 48px 52px 42px;
  font-family: var(--font);
  position: relative; overflow: hidden;
  color: var(--grey);
}
.cert-deco {
  position: absolute; width: 100%;
}
.cert-deco-top { top: 0; left: 0; height: 100px; }
.cert-deco-bot { bottom: 0; right: 0; height: 65px; }

.cert-logo { width: 200px; height: 34px; margin-bottom: 36px; }

.cert-type-label {
  font-size: 7.5px; letter-spacing: 0.32em; color: var(--walnut);
  text-transform: uppercase; margin-bottom: 8px;
}
.cert-rule { width: 22px; height: 1px; background: var(--walnut); margin-bottom: 20px; }
.cert-intro { font-size: 10px; color: var(--ice); margin-bottom: 5px; }
.cert-name {
  font-size: clamp(20px, 3.5vw, 30px);
  font-weight: 900; color: var(--dark);
  text-transform: lowercase; letter-spacing: -0.02em; margin-bottom: 14px;
}
.cert-body { font-size: 10.5px; color: var(--ice); line-height: 1.85; margin-bottom: 24px; }
.cert-body strong { color: var(--dark); }

.cert-badge {
  display: inline-flex; align-items: center; gap: 20px;
  padding: 10px 24px; border: 1px solid var(--dark);
  margin-bottom: 22px;
}
.cert-badge-left { display: flex; flex-direction: column; gap: 2px; }
.cert-badge-sublabel {
  font-size: 7px; letter-spacing: 0.2em; color: var(--ice);
  text-transform: uppercase;
}
.cert-badge-title {
  font-size: 14px; font-weight: 700; color: var(--dark); text-transform: lowercase;
}
.cert-badge-sep { width: 1px; height: 30px; background: rgba(170,180,184,0.4); }
.cert-badge-right { display: flex; flex-direction: column; }
.cert-big-pct { font-size: 28px; font-weight: 900; color: var(--dark); line-height: 1; }
.cert-small-score { font-size: 8.5px; color: var(--ice); }

.cert-cat-badges {
  display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 22px;
}
.cert-cat-badge {
  font-size: 7px; padding: 2px 6px;
  border: 1px solid rgba(170,180,184,0.35);
  letter-spacing: 0.05em; color: var(--grey);
}
.cert-cat-badge.good { border-color: var(--dark); color: var(--dark); }

.cert-sig-row {
  display: flex; justify-content: space-between; align-items: flex-end; margin-top: 22px;
}
.cert-sig-line { width: 95px; height: 1px; background: var(--dark); margin-bottom: 5px; }
.cert-sig-name { font-size: 9px; color: var(--dark); font-weight: 700; }
.cert-sig-detail { font-size: 7.5px; color: var(--ice); letter-spacing: 0.06em; }
.cert-claim {
  font-size: 6.5px; color: rgba(170,180,184,0.8);
  text-align: right; line-height: 1.8;
}

/* ─── PRINT / CLOSE BUTTONS ─────────────────────────────────────── */
.btn-print {
  width: 100%; padding: 13px;
  background: #FEFCEF; border: none;
  color: var(--dark); font-size: 9px;
  letter-spacing: 0.22em; text-transform: uppercase;
  font-weight: 700; cursor: pointer;
  font-family: var(--font); margin-top: 2px;
  border-radius: 0;
}
.btn-print:hover { background: rgba(254,252,239,0.88); }

.btn-cert-close {
  width: 100%; padding: 11px;
  background: transparent;
  border: 1px solid rgba(170,180,184,0.2);
  color: var(--ice); font-size: 9px;
  letter-spacing: 0.15em; text-transform: uppercase;
  font-weight: 700; cursor: pointer;
  font-family: var(--font); margin-top: 4px;
  border-radius: 0;
}

/* ─── PRINT STYLES ──────────────────────────────────────────────── */
@media print {
  body { background: #FEFCEF; }
  .cert-modal { position: static; padding: 0; }
  .cert-backdrop, .btn-print, .btn-cert-close { display: none; }
  .cert-wrap { max-height: none; overflow: visible; }
  .cert-paper { page-break-inside: avoid; }
}

/* ─── RESPONSIVE ────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .topbar { padding: 0 16px; }
  .logo-wrap { width: 130px; }
  .intro-content { padding: 28px 16px 50px; }
  .cat-grid { grid-template-columns: 1fr 1fr; gap: 6px; }
  .quiz-content { padding: 18px 16px 20px; }
  .result-content { padding: 24px 16px 50px; }
  .cert-paper { padding: 32px 28px 28px; }
  .cert-logo { width: 150px; }
  .divider-text { font-size: 6.5px; letter-spacing: 0.12em; }
}

@media (max-width: 360px) {
  .cat-grid { grid-template-columns: 1fr; }
}

/* ─── FOCUS STYLES (ACCESSIBILITY) ─────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--walnut);
  outline-offset: 2px;
}
button:focus-visible { outline: 2px solid var(--ice); outline-offset: 2px; }

/* ─── SCROLLBAR ─────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: var(--dark); }
::-webkit-scrollbar-thumb { background: rgba(170,180,184,0.3); }
