/* ═══════════════════════════════════════════════════════════════════════════
   SCREENS — layout for the four views: landing, register, assessment, success.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ═════════════════════════════ 1 · LANDING ════════════════════════════════ */
.hero {
  text-align: center;
  padding-bottom: var(--s-9);
}

.hero-title {
  font-size: var(--t-display);
  font-weight: 800;
  margin-bottom: var(--s-5);
}

.hero-sub {
  font-size: var(--t-lead);
  color: var(--text-2);
  max-width: 41ch;
  margin: 0 auto var(--s-7);
}
.hero-sub .muted { display: block; margin-top: 0.3rem; font-size: 0.94em; }

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-3);
  justify-content: center;
  margin-bottom: var(--s-7);
}

.hero-meta {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--s-3) var(--s-6);
  font-size: var(--t-sm);
  color: var(--text-3);
}
.hero-meta li { display: flex; align-items: baseline; gap: 0.34rem; }
.hero-meta strong { color: var(--text); font-weight: 700; font-size: 1.02rem; }

/* ── The brief ───────────────────────────────────────────────────────────── */
.brief { scroll-margin-top: 110px; }
.brief-head {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  margin-bottom: var(--s-5);
}
.brief-head h2 { font-size: var(--t-h2); }
.wave {
  font-size: 1.9rem;
  line-height: 1;
  transform-origin: 70% 80%;
  animation: wave 2.6s var(--ease-soft) 600ms 3;
}
@keyframes wave {
  0%, 62%, 100% { transform: rotate(0deg); }
  68%  { transform: rotate(16deg); }
  74%  { transform: rotate(-10deg); }
  80%  { transform: rotate(13deg); }
  86%  { transform: rotate(-6deg); }
}

.brief p {
  color: var(--text-2);
  margin-bottom: var(--s-4);
  max-width: 68ch;
}
.brief p strong { color: var(--text); font-weight: 700; }

.pull {
  margin: var(--s-6) 0;
  padding: var(--s-5) var(--s-5) var(--s-5) calc(var(--s-5) + 4px);
  border-left: 3px solid var(--gold);
  border-radius: 0 var(--r-md) var(--r-md) 0;
  background: color-mix(in srgb, var(--gold) 7%, transparent);
  font-size: var(--t-lead);
  color: var(--text-2);
  max-width: 60ch;
}
.pull strong {
  display: block;
  margin-top: var(--s-3);
  color: var(--text);
  font-weight: 700;
}

/* Part 01 / Part 02 cards */
.parts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--s-4);
  margin: var(--s-6) 0;
}
.part {
  position: relative;
  padding: var(--s-5);
  border-radius: var(--r-lg);
  background: var(--surface-2);
  border: 1px solid var(--line);
  overflow: hidden;
  transition: transform var(--d-base) var(--ease-out),
              border-color var(--d-base) var(--ease-out);
}
.part:hover { transform: translateY(-3px); border-color: var(--line-strong); }
.part::before {
  content: "";
  position: absolute;
  top: -70%; left: -18%;
  width: 78%; height: 200%;
  background: radial-gradient(closest-side, var(--glow-1), transparent 70%);
  pointer-events: none;
}
.part > * { position: relative; }
.part-no {
  display: block;
  font-size: var(--t-xs);
  font-weight: 800;
  letter-spacing: var(--track-wide);
  color: var(--accent);
  margin-bottom: 0.55rem;
}
.part h3 { font-size: var(--t-h3); margin-bottom: 0.55rem; }
.part p { font-size: var(--t-sm); color: var(--text-2); margin-bottom: var(--s-4); }
.part p em { color: var(--text-3); font-style: italic; }
.part-count {
  font-size: var(--t-xs);
  font-weight: 700;
  color: var(--text-3);
}

.brief-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--s-5);
  padding-top: var(--s-5);
  border-top: 1px solid var(--line);
}
.rules h4 {
  font-size: var(--t-sm);
  margin-bottom: 0.55rem;
  letter-spacing: 0;
}
.rules ul {
  list-style: none;
  padding: 0;
  font-size: var(--t-sm);
  color: var(--text-2);
}
.rules li {
  position: relative;
  padding-left: 1.3rem;
  margin-bottom: 0.28rem;
}
.rules li::before {
  content: "";
  position: absolute;
  left: 0; top: 0.66em;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent-solid);
}

/* ═════════════════════ 2 & 3 · STEP SCREENS (shared) ══════════════════════ */
.step { max-width: 720px; }
.step-title {
  font-size: var(--t-h1);
  margin-bottom: var(--s-3);
}
.step-sub {
  font-size: var(--t-lead);
  color: var(--text-2);
  margin-bottom: var(--s-6);
  max-width: 52ch;
}

.form { padding: clamp(1.5rem, 1rem + 2.4vw, 2.5rem); }
.form-foot {
  margin-top: var(--s-4);
  font-size: var(--t-xs);
  color: var(--text-3);
  text-align: center;
}

/* ═════════════════════════ 3 · ASSESSMENT ═════════════════════════════════ */
/* Headroom on the assessment screen: enough to clear the floating nav, not so
   much that it reads as a dead band above the content. */
#view-assessment { padding-top: clamp(6.25rem, 5.25rem + 2.5vw, 7.5rem); }

.q-status {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s-3);
  margin-bottom: var(--s-5);
}
.q-status-right { text-align: right; }

.q-count {
  font-size: var(--t-sm);
  font-weight: 700;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}
/* Deliberately understated — states the rule without making a thing of it. */
.q-lock-note {
  font-size: 0.72rem;
  color: var(--text-3);
  opacity: 0.75;
  margin-top: 0.15rem;
  letter-spacing: 0.01em;
}

/* Re-animate the section chip when the section changes, so the jump from
   hooks to the writing task registers without a blocking interstitial. */
#q-section.is-new { animation: chipPop 620ms var(--ease-out) both; }
@keyframes chipPop {
  0%   { opacity: 0; transform: translateY(-6px) scale(0.94); }
  60%  { transform: translateY(0) scale(1.04); }
  100% { opacity: 1; transform: none; }
}

/* ── Stepper rail: Hook 1 … Hook 6 → Writing task ────────────────────────── */
.stepper { margin-bottom: var(--s-5); }

.stepper-list {
  list-style: none;
  margin: 0;
  padding: 0 0 var(--s-2);
  display: flex;
  align-items: flex-start;
  gap: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.stepper-list::-webkit-scrollbar { display: none; }

.stepper-item {
  position: relative;
  flex: 1 1 0;
  min-width: 62px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.42rem;
  text-align: center;
}

/* The connecting rail, drawn behind each dot. */
.stepper-item::before {
  content: "";
  position: absolute;
  top: 15px;
  left: -50%;
  width: 100%;
  height: 2px;
  background: var(--line);
  z-index: 0;
}
.stepper-item:first-child::before { display: none; }
.stepper-item.is-done::before,
.stepper-item.is-current::before { background: var(--accent-solid); }

.stepper-dot {
  position: relative;
  z-index: 1;
  width: 30px; height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 2px solid var(--line-strong);
  background: var(--bg);
  color: var(--text-3);
  font-size: 0.76rem;
  font-weight: 800;
  cursor: default;
  transition: background var(--d-base) var(--ease-out),
              border-color var(--d-base) var(--ease-out),
              color var(--d-base) var(--ease-out),
              transform var(--d-fast) var(--ease-out);
}
.stepper-icon svg { width: 15px; height: 15px; }

/* Navigable dots (any hook that isn't the current one, once unlocked) invite a
   click; the locked writing-task dot stays inert. */
.stepper-item:not(.is-current):not(.is-locked) .stepper-dot { cursor: pointer; }
.stepper-item:not(.is-current):not(.is-locked) .stepper-dot:hover {
  transform: translateY(-2px) scale(1.06);
  border-color: var(--accent-solid);
  color: var(--text);
}
.stepper-item.is-done:not(.is-current) .stepper-dot:hover { color: #fff; }

.is-locked .stepper-dot { opacity: 0.55; }
.is-locked .stepper-label { opacity: 0.55; }

.is-done .stepper-dot {
  background: var(--accent-solid);
  border-color: var(--accent-solid);
  color: #fff;
}
.is-current .stepper-dot {
  background: var(--cta-bg);
  border-color: var(--cta-bg);
  color: var(--cta-ink);
  transform: scale(1.14);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent-solid) 20%, transparent);
}

.stepper-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--text-3);
  white-space: nowrap;
}
.is-current .stepper-label { color: var(--text); }
.is-done .stepper-label { color: var(--text-2); }

/* ── Version blocks: the three takes on one hook, stacked and gated ──────── */
.versions {
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
  margin-top: var(--s-5);
}

.version {
  padding: var(--s-5);
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  background: var(--surface-2);
  transition: opacity var(--d-base) var(--ease-out),
              border-color var(--d-base) var(--ease-out),
              background var(--d-base) var(--ease-out);
}

.version.is-open {
  border-color: color-mix(in srgb, var(--accent-solid) 42%, transparent);
  background: var(--surface);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent-solid) 16%, transparent),
              var(--shadow-sm);
}
.version.is-done {
  border-left: 3px solid var(--ok);
}
/* Visible, but clearly not your turn yet. */
.version.is-waiting {
  opacity: 0.46;
  filter: saturate(0.5);
}

.version-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-2) var(--s-3);
  margin-bottom: 0.55rem;
}
.version-head-left {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2);
}
.version-no {
  font-size: var(--t-xs);
  font-weight: 800;
  letter-spacing: var(--track-wide);
  text-transform: uppercase;
  color: var(--text-3);
}
.version-status {
  display: inline-flex;
  align-items: center;
  gap: 0.34rem;
  font-size: var(--t-xs);
  font-weight: 700;
  color: var(--text-3);
}
.version-status.is-done { color: var(--ok); }
.version-icon svg { width: 14px; height: 14px; }

.version-note {
  font-size: var(--t-sm);
  color: var(--text-2);
  line-height: 1.55;
  margin-bottom: var(--s-4);
  max-width: 62ch;
}

/* A submitted answer, shown back but not editable. */
.version-locked-answer {
  margin: 0;
  padding: var(--s-4);
  border-radius: var(--r-md);
  background: var(--bg-raise);
  border: 1px solid var(--line);
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text-2);
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.version-form .field { margin-bottom: var(--s-3); }
.version-submit { min-width: 172px; }

/* The question card itself, mounted fresh on every step. */
.qcard {
  padding: clamp(1.4rem, 1rem + 2.4vw, 2.4rem);
}
.qcard.is-entering { animation: qIn 460ms var(--ease-out) both; }
.qcard.is-leaving  { animation: qOut 200ms var(--ease-soft) both; }

@keyframes qIn {
  from { opacity: 0; transform: translate3d(0, 22px, 0) scale(0.985); }
  to   { opacity: 1; transform: none; }
}
@keyframes qOut {
  from { opacity: 1; transform: none; }
  to   { opacity: 0; transform: translate3d(0, -14px, 0) scale(0.99); }
}

.q-mode {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2);
  margin-bottom: var(--s-4);
}
.q-mode-note {
  font-size: var(--t-xs);
  color: var(--text-3);
  line-height: 1.45;
}

.q-title {
  font-size: var(--t-h2);
  margin-bottom: var(--s-3);
}
.q-prompt {
  color: var(--text-2);
  margin-bottom: var(--s-5);
  max-width: 58ch;
}

/* The original hook being improved. */
.q-source {
  margin-bottom: var(--s-5);
  padding: var(--s-4) var(--s-5);
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--gold);
}
.q-source-label {
  font-size: var(--t-xs);
  font-weight: 800;
  letter-spacing: var(--track-wide);
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 0.6rem;
}
.q-source-quote {
  font-size: 1.02rem;
  line-height: 1.55;
  color: var(--text);
  white-space: pre-line;           /* the hook's own line breaks matter */
}
.q-source-more {
  font-size: var(--t-xs);
  color: var(--text-3);
  font-style: italic;
  margin-top: 0.3rem;
}
.q-ref {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: var(--s-3);
  font-size: var(--t-sm);
  font-weight: 700;
}
.ext-icon { display: inline-flex; }
.ext-icon svg { width: 13px; height: 13px; flex: none; }

/* P.S. inspiration links, on the final question only. */
.q-inspo {
  margin: calc(var(--s-5) * -0.4) 0 var(--s-5);
  font-size: var(--t-sm);
  color: var(--text-3);
}
.q-inspo a { font-weight: 600; }

/* The answer field itself — inherits .field styling, plus a touch more room. */
.q-form .field { margin-bottom: 0; }
.answer { display: block; }
textarea.answer { min-height: 118px; }

.q-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  margin-top: var(--s-5);
}
.q-counter {
  font-size: var(--t-xs);
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
.q-counter.is-over { color: var(--warn); font-weight: 700; }
.q-submit { min-width: 200px; }

.kbd-hint {
  margin-top: var(--s-4);
  font-size: var(--t-xs);
  color: var(--text-3);
  text-align: center;
}
.kbd-hint kbd {
  font-family: var(--font);
  font-size: 0.92em;
  font-weight: 700;
  padding: 0.08em 0.42em;
  border-radius: 5px;
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
}

/* Retry panel shown when a submission can't reach Apps Script. */
.q-retry {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-3);
  margin-top: var(--s-4);
  padding: var(--s-4);
  border-radius: var(--r-md);
  background: color-mix(in srgb, var(--err) 9%, transparent);
  border: 1px solid color-mix(in srgb, var(--err) 30%, transparent);
  font-size: var(--t-sm);
  animation: qIn 300ms var(--ease-out) both;
}
.q-retry p { flex: 1; min-width: 180px; color: var(--text-2); }
.q-retry strong { display: block; color: var(--text); }

/* ═════════════════════════ 4 · SUCCESS ════════════════════════════════════ */
.success { text-align: center; }

.success-mark {
  width: 96px; height: 96px;
  margin: 0 auto var(--s-6);
}
.success-mark svg { width: 100%; height: 100%; }

.sm-ring {
  fill: none;
  stroke: var(--accent-solid);
  stroke-width: 3;
  stroke-dasharray: 270;
  stroke-dashoffset: 270;
  animation: drawRing 900ms var(--ease-out) 100ms forwards;
  transform-origin: center;
  transform: rotate(-90deg);
}
.sm-tick {
  fill: none;
  stroke: var(--gold);
  stroke-width: 6.5;
  stroke-dasharray: 62;
  stroke-dashoffset: 62;
  animation: drawTick 520ms var(--ease-out) 700ms forwards;
}
@keyframes drawRing { to { stroke-dashoffset: 0; } }
@keyframes drawTick { to { stroke-dashoffset: 0; } }

/* Soft pulse radiating out once the tick lands. */
.success-mark::after {
  content: "";
  display: block;
  width: 96px; height: 96px;
  margin-top: -96px;
  border-radius: 50%;
  border: 2px solid var(--accent-solid);
  opacity: 0;
  animation: pulseOut 1400ms var(--ease-out) 1000ms 2;
}
@keyframes pulseOut {
  0%   { opacity: 0.55; transform: scale(1); }
  100% { opacity: 0;    transform: scale(1.85); }
}

.success .step-sub { margin-inline: auto; }

.receipt {
  text-align: left;
  margin-bottom: var(--s-6);
  padding: clamp(1.3rem, 1rem + 1.6vw, 1.9rem);
}
.receipt dl { margin: 0; }
.receipt dl > div {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-3);
  padding: 0.72rem 0;
  border-bottom: 1px solid var(--line);
  font-size: var(--t-sm);
}
.receipt dl > div:last-child { border-bottom: 0; }
.receipt dt { color: var(--text-3); }
.receipt dd {
  margin: 0;
  font-weight: 700;
  text-align: right;
  overflow-wrap: anywhere;
}
.ps {
  margin-top: var(--s-6);
  font-size: var(--t-sm);
  color: var(--text-3);
  max-width: 46ch;
  margin-inline: auto;
}

/* ═════════════════════════ RESPONSIVE TWEAKS ══════════════════════════════ */
@media (max-width: 640px) {
  .view { padding-block: 6.5rem var(--s-7); }
  .hero-actions .btn { width: 100%; }
  .q-foot { flex-direction: column-reverse; align-items: stretch; }
  .q-submit { width: 100%; }
  .q-counter { text-align: center; }
  .q-status { flex-direction: column; align-items: flex-start; gap: var(--s-2); }
  .q-status-right { text-align: left; }

  /* Dots only — the labels don't fit, and the card heading says where you are. */
  .stepper-list { gap: 0; }
  .stepper-item { min-width: 44px; }
  .stepper-label { display: none; }
  .version { padding: var(--s-4); }
  .version-submit { width: 100%; }
  .brief-foot .btn { width: 100%; }
  .receipt dl > div { flex-direction: column; gap: 0.15rem; }
  .receipt dd { text-align: left; }
}

/* ═════════════════════════ ADMIN MODE ════════════════════════════════════
   Shown only when a signed-in admin is filling in or correcting responses.
   Deliberately loud: an admin-entered record must never be mistaken for a
   candidate's own sitting. */

#admin-banner[hidden] { display: none; }

.admin-bar {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  flex-wrap: wrap;
  margin-bottom: var(--s-4);
  padding: 0.7rem 1rem;
  border-radius: var(--r-md);
  background: color-mix(in srgb, var(--gold) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--gold) 42%, transparent);
  font-size: var(--t-sm);
  color: var(--text);
}
.admin-dot {
  width: 8px; height: 8px;
  flex: none;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold) 25%, transparent);
}
.admin-who { flex: 1; min-width: 200px; }
.admin-who strong { font-weight: 700; }

.admin-bar .btn-light {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  color: var(--text);
}
.admin-bar .btn-light:hover { background: var(--surface-hover); }

.btn-sm { padding: 0.4rem 0.8rem; min-height: 34px; font-size: var(--t-xs); }

/* Revert sits next to Submit in an answer's footer. */
.btn-revert { margin-right: auto; }

@media (max-width: 640px) {
  .btn-revert { margin-right: 0; width: 100%; }
}
