/* ═══════════════════════════════════════════════════════════
   hackÜ · Pop quiz interno
   Committed brand · single-family · slide lateral
   ═══════════════════════════════════════════════════════════ */

:root {
  /* Brand */
  --purple:       #4B1E9E;
  --purple-deep:  #2E0F6B;
  --purple-soft:  #7A4FD1;
  --purple-glow:  #8B5FE0;
  --magenta:      #EE2E6A;
  --magenta-hot:  #F0114E;

  /* Warm neutrals, tinted toward brand hue */
  --cream:        #FBF6F0;
  --cream-2:      #F3EBDD;
  --ink:          #160532;
  --ink-2:        #4A3E6E;

  /* Text over drenched purple */
  --on-purple:        #FBF6F0;
  --on-purple-dim:    #D8CFE4;  /* verified ~7:1 on --purple */
  --on-purple-muted:  #A594C4;  /* decorative only */

  /* Type */
  --font: 'Nunito', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  /* Motion */
  --ease-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-quart: cubic-bezier(0.25, 1, 0.5, 1);

  /* Fluid space */
  --gutter: clamp(1.25rem, 4vw, 3.5rem);
  --gutter-y: clamp(1.5rem, 3vh, 2.5rem);

  /* Z */
  --z-rail:   10;
  --z-topbar: 20;
  --z-nav:    20;
}

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

html, body {
  height: 100%;
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  color: var(--ink);
  background: var(--cream);
  overflow: hidden;
}

body {
  min-height: 100dvh;
  overflow-x: hidden;
}

::selection { background: var(--magenta); color: var(--cream); }

/* ═══════════════════════════════════════════════════════════
   Screens (crossfade root layer)
   ═══════════════════════════════════════════════════════════ */
.screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 380ms var(--ease-expo);
}
.screen.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* ═══════════════════════════════════════════════════════════
   INTRO (crema)
   ═══════════════════════════════════════════════════════════ */
.screen-intro {
  background: var(--cream);
  padding: var(--gutter-y) var(--gutter);
  justify-content: space-between;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.brand {
  display: inline-flex;
  text-decoration: none;
  outline-offset: 6px;
  border-radius: 12px;
}
.logo-mark {
  height: clamp(44px, 4vw, 56px);
  width: clamp(44px, 4vw, 56px);
  display: block;
  border-radius: 12px;
  object-fit: cover;
}
/* On the drenched purple screen, the mark's purple bg matches the screen,
   creating a bezel-less floating ü. Keep it clean, don't force a border. */
.brand-inverse .logo-mark {
  /* subtle bump so the mark's edge doesn't fully vanish into the bg */
  box-shadow: 0 0 0 1px rgba(255,255,255,0.06);
}

.pill {
  font-weight: 800;
  font-size: 13px;
  color: var(--purple-deep);
  background: rgba(75,30,158,0.08);
  padding: 8px 16px;
  border-radius: 999px;
  letter-spacing: 0.01em;
}
.pill em { font-style: normal; color: var(--magenta); font-weight: 900; }

.intro-main {
  max-width: 1080px;
  margin: auto 0;
  padding-block: clamp(2rem, 6vh, 5rem);
}

.hero-meta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 14px;
  color: var(--ink-2);
  margin-bottom: clamp(1.25rem, 3vh, 2rem);
}
.hero-meta .dot {
  width: 8px; height: 8px; border-radius: 999px;
  background: var(--magenta);
  box-shadow: 0 0 0 4px rgba(238,46,106,0.15);
}

.hero-title {
  font-weight: 900;
  font-size: clamp(2.5rem, 6.5vw, 5.5rem);
  line-height: 0.98;
  letter-spacing: -0.045em;
  color: var(--purple-deep);
  text-wrap: balance;
  margin-bottom: clamp(1.25rem, 3vh, 2rem);
  max-width: 18ch;
}
.title-accent {
  color: var(--magenta);
  position: relative;
  display: inline-block;
}
.title-accent::after {
  content: "";
  position: absolute;
  left: 0; right: 4%;
  bottom: 0.02em;
  height: 0.11em;
  background: var(--magenta);
  border-radius: 999px;
  opacity: 0.22;
}

.hero-lede {
  font-weight: 500;
  font-size: clamp(1rem, 1.4vw, 1.2rem);
  line-height: 1.55;
  color: var(--ink-2);
  max-width: 58ch;
  text-wrap: pretty;
  margin-bottom: clamp(2rem, 5vh, 3rem);
}

.hero-cta {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}
.kbd-hint {
  font-weight: 600;
  font-size: 13px;
  color: var(--ink-2);
}
.kbd-hint kbd {
  font-family: var(--font);
  font-weight: 800;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(75,30,158,0.10);
  border: 1px solid rgba(75,30,158,0.18);
  color: var(--purple-deep);
  margin: 0 2px;
}

.intro-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  font-size: 13px;
  color: var(--ink-2);
  opacity: 0.7;
}
.foot-mark {
  font-size: 24px;
  color: var(--magenta);
  font-weight: 900;
}

/* ═══════════════════════════════════════════════════════════
   QUIZ (drenched purple)
   ═══════════════════════════════════════════════════════════ */
.screen-quiz {
  background: var(--purple);
  color: var(--on-purple);
  padding: var(--gutter-y) var(--gutter);
  justify-content: space-between;
  overflow: hidden;
}

/* Vignette to give the drench depth */
.screen-quiz::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 100% 0%, rgba(238,46,106,0.15), transparent 60%),
    radial-gradient(ellipse 90% 70% at 0% 100%, rgba(139,95,224,0.25), transparent 65%);
  pointer-events: none;
  z-index: 0;
}

.screen-quiz > * { position: relative; z-index: 1; }

/* Rail (top progress) */
.rail {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: transparent;
  z-index: var(--z-rail);
}
.rail-track {
  position: absolute; inset: 0;
  background: rgba(255,255,255,0.10);
}
.rail-fill {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 0;
  background: linear-gradient(90deg, var(--purple-glow), var(--magenta));
  transition: width 620ms var(--ease-expo);
}
.rail-dot {
  position: absolute;
  top: 50%;
  left: 0;
  width: 12px; height: 12px;
  border-radius: 999px;
  background: var(--magenta);
  transform: translate(-50%, -50%);
  transition: left 620ms var(--ease-expo);
  box-shadow:
    0 0 0 4px rgba(238,46,106,0.28),
    0 0 20px rgba(238,46,106,0.6);
}

.quiz-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.quiz-counter {
  font-weight: 900;
  font-size: 14px;
  letter-spacing: 0.02em;
  color: var(--on-purple-dim);
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  font-variant-numeric: tabular-nums;
}
.q-current { color: var(--on-purple); }
.q-sep { opacity: 0.5; }

/* Stage — watermark + slides */
.stage {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  min-height: 0;
}

.watermark {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -55%);
  font-weight: 900;
  font-size: clamp(14rem, 32vw, 30rem);
  line-height: 1;
  color: rgba(251,246,240,0.05);
  letter-spacing: -0.08em;
  pointer-events: none;
  user-select: none;
  z-index: 0;
  transition: opacity 500ms var(--ease-expo);
  font-variant-numeric: tabular-nums;
}

.slides {
  position: relative;
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  z-index: 1;
}

.slide {
  position: absolute;
  top: 50%;
  left: 0; right: 0;
  transform: translate(0, -50%);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.slide.is-current {
  position: relative;
  top: auto;
  transform: none;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  animation: slide-in 520ms var(--ease-expo) both;
}

.slide.is-leaving {
  animation: slide-out 320ms var(--ease-quart) both;
}
.slide.is-back .slide-content {
  animation-name: slide-in-back;
}
.slide.is-leaving.is-back {
  animation-name: slide-out-back;
}

@keyframes slide-in {
  from { opacity: 0; transform: translateX(60px); filter: blur(4px); }
  to   { opacity: 1; transform: translateX(0);    filter: blur(0); }
}
@keyframes slide-out {
  from { opacity: 1; transform: translateX(0);     filter: blur(0); }
  to   { opacity: 0; transform: translateX(-60px); filter: blur(6px); }
}
@keyframes slide-in-back {
  from { opacity: 0; transform: translateX(-60px); filter: blur(4px); }
  to   { opacity: 1; transform: translateX(0);     filter: blur(0); }
}
@keyframes slide-out-back {
  from { opacity: 1; transform: translateX(0);    filter: blur(0); }
  to   { opacity: 0; transform: translateX(60px); filter: blur(6px); }
}

/* Slide content */
.q-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.02em;
  color: var(--on-purple-dim);
  margin-bottom: clamp(1rem, 2.5vh, 1.5rem);
}
.q-eyebrow-line {
  width: 40px;
  height: 2px;
  background: var(--magenta);
  border-radius: 2px;
}

.q-title {
  font-weight: 900;
  font-size: clamp(1.8rem, 4.2vw, 3.4rem);
  line-height: 1.05;
  letter-spacing: -0.035em;
  color: var(--on-purple);
  text-wrap: balance;
  margin-bottom: clamp(1.5rem, 3.5vh, 2.5rem);
  max-width: 22ch;
}

.q-input-wrap {
  position: relative;
  max-width: 780px;
}

.q-input {
  display: block;
  width: 100%;
  min-height: 3.2em;
  max-height: 220px;
  padding: 0 0 12px 0;
  font-family: var(--font);
  font-weight: 500;
  font-size: clamp(1.05rem, 1.5vw, 1.35rem);
  line-height: 1.45;
  color: var(--on-purple);
  background: transparent;
  border: 0;
  border-bottom: 3px solid rgba(255,255,255,0.22);
  outline: none;
  resize: none;
  transition: border-color 260ms var(--ease-expo),
              box-shadow 260ms var(--ease-expo);
  caret-color: var(--magenta);
}
.q-input::placeholder {
  color: rgba(216,207,228,0.5);
  font-weight: 400;
}
.q-input:focus {
  border-bottom-color: var(--magenta);
  box-shadow: 0 4px 0 -3px rgba(238,46,106,0.35);
}

.q-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  font-weight: 700;
  font-size: 12px;
  color: var(--on-purple-dim);
  letter-spacing: 0.02em;
}
.q-meta .hint {
  opacity: 0.7;
}
.q-count { font-variant-numeric: tabular-nums; }

/* Quiz footer */
.quiz-bottom {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-top: 1rem;
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px; height: 46px;
  background: transparent;
  color: var(--on-purple);
  border: 2px solid rgba(255,255,255,0.22);
  border-radius: 999px;
  cursor: pointer;
  transition: background 220ms var(--ease-expo),
              border-color 220ms var(--ease-expo),
              transform 180ms var(--ease-expo);
}
.nav-btn:hover:not(:disabled) {
  background: rgba(255,255,255,0.10);
  border-color: rgba(255,255,255,0.42);
  transform: translateX(-2px);
}
.nav-btn:disabled { opacity: 0.28; cursor: not-allowed; }

.kbd-hint-inverse { color: var(--on-purple-dim); margin-left: auto; }
.kbd-hint-inverse kbd {
  background: rgba(255,255,255,0.10);
  border-color: rgba(255,255,255,0.22);
  color: var(--on-purple);
}

/* ═══════════════════════════════════════════════════════════
   Buttons
   ═══════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font);
  font-weight: 800;
  font-size: 15px;
  padding: 13px 24px;
  border-radius: 999px;
  border: 0;
  cursor: pointer;
  text-decoration: none;
  color: var(--cream);
  transition: transform 200ms var(--ease-expo),
              box-shadow 260ms var(--ease-expo),
              background 220ms var(--ease-expo),
              color 200ms;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-lg { padding: 16px 30px; font-size: 17px; }

.btn-primary {
  background: var(--magenta);
  color: var(--cream);
  box-shadow: 0 18px 40px -14px rgba(238,46,106,0.55);
}
.btn-primary:hover:not(:disabled) {
  background: var(--magenta-hot);
  transform: translateY(-2px);
  box-shadow: 0 24px 50px -14px rgba(238,46,106,0.7);
}
.btn-primary:active:not(:disabled) { transform: translateY(0); }

.btn-ghost {
  background: transparent;
  color: var(--purple-deep);
  border: 2px solid rgba(75,30,158,0.25);
}
.btn-ghost:hover:not(:disabled) {
  background: rgba(75,30,158,0.06);
  border-color: var(--purple);
  transform: translateY(-1px);
}

/* ═══════════════════════════════════════════════════════════
   DONE / ERROR
   ═══════════════════════════════════════════════════════════ */
.screen-done, .screen-error {
  background: var(--cream);
  padding: var(--gutter-y) var(--gutter);
  align-items: center;
  justify-content: center;
  text-align: center;
}
.screen-done > *, .screen-error > * {
  max-width: 640px;
}
.done-mark, .err-mark {
  font-weight: 900;
  font-size: clamp(6rem, 14vw, 10rem);
  line-height: 1;
  color: var(--magenta);
  margin-bottom: clamp(1rem, 2vh, 1.5rem);
  transform-origin: center;
  animation: bloom 700ms var(--ease-expo) 100ms both;
}
.err-mark {
  color: var(--purple);
  font-size: clamp(5rem, 12vw, 8rem);
}
@keyframes bloom {
  from { opacity: 0; transform: scale(0.4) rotate(-20deg); }
  to   { opacity: 1; transform: scale(1) rotate(0); }
}

.done-title { max-width: none; }
.done-lede { margin-inline: auto; text-align: center; }

/* ═══════════════════════════════════════════════════════════
   Slide entrance orchestration on active screens
   ═══════════════════════════════════════════════════════════ */
.screen-intro.is-active .hero-meta,
.screen-intro.is-active .hero-title,
.screen-intro.is-active .hero-lede,
.screen-intro.is-active .hero-cta {
  animation: rise 620ms var(--ease-expo) both;
}
.screen-intro.is-active .hero-meta  { animation-delay: 40ms; }
.screen-intro.is-active .hero-title { animation-delay: 120ms; }
.screen-intro.is-active .hero-lede  { animation-delay: 220ms; }
.screen-intro.is-active .hero-cta   { animation-delay: 320ms; }

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

/* ═══════════════════════════════════════════════════════════
   Responsive
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 720px) {
  .pill { display: none; }
  .kbd-hint, .kbd-hint-inverse { display: none; }
  .quiz-bottom { justify-content: space-between; }
  .watermark { font-size: 30vw; opacity: 1; }
  .q-title { max-width: none; }
}

@media (max-height: 620px) {
  .hero-title { font-size: clamp(1.75rem, 5vh, 3rem); }
  .intro-main { padding-block: 1rem; }
  .watermark { font-size: 22vh; }
}

/* ═══════════════════════════════════════════════════════════
   Reduced motion
   ═══════════════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 150ms !important;
  }
  .slide.is-current, .slide.is-leaving,
  .screen-intro.is-active .hero-meta,
  .screen-intro.is-active .hero-title,
  .screen-intro.is-active .hero-lede,
  .screen-intro.is-active .hero-cta,
  .done-mark, .err-mark {
    animation: none !important;
  }
  .slide.is-current { opacity: 1; }
}

/* ═══════════════════════════════════════════════════════════
   Focus styles (visible for keyboard)
   ═══════════════════════════════════════════════════════════ */
:focus { outline: none; }
:focus-visible {
  outline: 3px solid var(--magenta);
  outline-offset: 4px;
  border-radius: 6px;
}
.q-input:focus-visible {
  outline: none;
}
