/* Hallmark · shape: Wizard (one question per screen, a progress bar, the next action always in reach) · genre: playful · theme: Hum (deal 1/3, seed free-major-discovery-quiz-indonesian-6af8·6c9a8536·2026-11-17·r0) in KDLY's locked palette and Montserrat · job: try · draw: eda674
 * hero: none (the first question is the page) · nav: the KDLY wordmark and a quiet way out · footer: none, the action bar instead · imagery: none, the answers carry it · signature: the answers as card-stock chips that press down when tapped
 * axes: light/geometric-sans/chromatic-yellow · posture: full-palette (black chosen chips, white open ones) · contrast: pass · fold: pass · v2.0.0 */
/* Hallmark · pre-emit critique: P4 H4 E5 S4 R4 V4 · weakest: H, eight screens share one layout; the question set large and the chips pressing down give each screen one big thing */
/* Hallmark · waive 77 · each screen is one question and its answers (quiz-questions.md, approved 2026-11-17) · a quiz step is a working screen, not a landing section */
/* Hallmark · dismissed F4 · the plain .btn is the quiet "Tambah" action; one filled primary, the Lanjut button */

@import url("./tokens.css");
@import url("./base.css");
@import url("./site.css");

.quit { display: inline-flex; align-items: center; min-height: 44px; color: var(--color-ink); font-weight: 700; }
.quit:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 4px; }

.quiz { max-width: 46rem; margin-inline: auto; padding-block: var(--space-xl) var(--space-3xl); }
.progress { display: none; }
.js .progress { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: var(--space-md); margin-bottom: var(--space-2xl); }
.progress__bar { height: 10px; border-radius: var(--radius-pill); background: var(--color-paper-2); overflow: clip; box-shadow: inset 0 0 0 1px var(--color-rule); }
.progress__bar span { display: block; height: 100%; background: var(--color-ink); transform-origin: left; transform: scaleX(0.1); transition: transform var(--dur-long) var(--ease-out); }
.progress__count { font-weight: 700; font-size: var(--text-sm); font-variant-numeric: tabular-nums; }

.step { display: grid; gap: var(--space-lg); padding-block: var(--space-xl); }
.step + .step { border-top: var(--rule-hair) solid var(--color-rule); }
.js .step { padding: 0; border: 0; }
.js .step:not([data-current]) { display: none; }
.step h2 { font-size: clamp(1.75rem, 2vw + 1rem, 2.5rem); line-height: 1.15; max-width: 24ch; overflow-wrap: break-word; min-width: 0; }
.step h2:focus { outline: none; }
.sub { font-size: var(--text-lg); margin-top: var(--space-sm); }
.hint { color: var(--color-muted); margin-top: calc(-1 * var(--space-2xs)); }

.ask { display: grid; gap: var(--space-xs); margin: 0; padding: 0; border: 0; min-width: 0; }
.ask > span, .ask legend, .why__label { font-weight: 700; padding: 0; margin-bottom: var(--space-xs); }
.field { width: 100%; min-height: 52px; padding: var(--space-sm) var(--space-md); border: 0; border-radius: var(--radius-input); background: var(--color-paper-2); color: var(--color-ink); font: 500 var(--text-md)/1.4 var(--font-body); box-shadow: inset 0 0 0 1.5px var(--color-muted); }
.field::placeholder { color: var(--color-muted); opacity: 0.8; }
.field:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; box-shadow: inset 0 0 0 1.5px var(--color-ink); }
textarea.field { resize: vertical; min-height: 96px; }

/* answers: card-stock chips that press down when chosen */
.choices { display: grid; gap: var(--space-sm); }
.choices--row { display: flex; flex-wrap: wrap; }
.chip { --edge: 4px; position: relative; display: flex; align-items: center; min-height: 52px; padding: var(--space-sm) var(--space-md); border-radius: var(--radius-stock); background: var(--grain), var(--color-card); color: var(--color-ink); font-weight: 600; line-height: 1.35; cursor: pointer; user-select: none; touch-action: manipulation; box-shadow: inset 0 0 0 1px var(--color-rule), 0 var(--edge) 0 0 var(--color-edge); transition: translate var(--dur-micro) var(--ease-snap), box-shadow var(--dur-micro) var(--ease-snap), background-color var(--dur-micro) var(--ease-snap); }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip:has(input:checked) { --edge: 1px; translate: 0 3px; background: var(--grain), var(--color-ink); color: var(--color-yellow); }
.chip:has(input:focus-visible) { outline: 2px solid var(--color-focus); outline-offset: 3px; }
.chip:active { --edge: 1px; translate: 0 3px; }
.chip--other span::before { content: "+ "; }
.other-box { display: block; }
.js .other-box { display: none; }
.js .step:has(.chip--other input:checked) .other-box { display: block; }
.why { display: grid; gap: var(--space-2xs); margin-top: var(--space-sm); }

.pick { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--space-sm); align-items: center; }
.picked { display: flex; flex-wrap: wrap; gap: var(--space-xs); margin: 0; padding: 0; list-style: none; }
.picked:empty { display: none; }
.picked__item { display: inline-flex; align-items: center; gap: var(--space-xs); padding: var(--space-2xs) var(--space-2xs) var(--space-2xs) var(--space-md); border-radius: var(--radius-pill); background: var(--color-ink); color: var(--color-yellow); font-weight: 700; }
.picked__x { display: inline-grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: var(--radius-pill); background: none; color: inherit; font: inherit; cursor: pointer; }
.picked__x:focus-visible { outline: 2px solid var(--color-paper-2); outline-offset: -4px; }
.chip--none { justify-self: start; }

.consent { display: grid; gap: var(--space-md); margin-top: var(--space-sm); padding: var(--space-lg); border-radius: var(--radius-card); background: var(--grain), var(--color-paper-2); }
.tick { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: var(--space-sm); align-items: start; font-size: var(--text-xs); line-height: 1.45; cursor: pointer; }
.tick input { width: 20px; height: 20px; margin: 0; accent-color: var(--color-ink); }
.tick input:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; }
.quiz--asked .tick:has(input[required]:not(:checked)) { color: var(--color-error); }
/* a missing or mistyped email is shown the same way, only after the student tries to finish */
.quiz--asked .ask:has(.field[required]:invalid) > span { color: var(--color-error); }
.quiz--asked .field[required]:invalid { box-shadow: inset 0 0 0 2px var(--color-error); }

.bar { display: flex; justify-content: space-between; align-items: center; gap: var(--space-md); margin-top: var(--space-2xl); }
.bar .btn { min-width: 10rem; }
.back { min-height: 44px; padding: 0 var(--space-xs); border: 0; background: none; color: var(--color-ink); font: 700 var(--text-md)/1 var(--font-body); text-decoration: underline; text-underline-offset: 0.3em; cursor: pointer; }
.back[hidden] { display: block; visibility: hidden; }
.back:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 4px; }

@media (hover: hover) and (pointer: fine) {
  .chip:hover:not(:has(input:checked)) { --edge: 6px; translate: 0 -2px; }
}
@media (prefers-reduced-motion: reduce) {
  .chip, .progress__bar span { transition: none; }
}
@media (max-width: 40rem) {
  /* phone, neater (Arif, 2026-11-18): smaller question, labels hugging their field, more air between groups, slimmer chips */
  .quit { font-size: var(--text-sm); }
  .quiz { padding-block: var(--space-md) var(--space-4xl); }
  .js .progress { margin-bottom: var(--space-lg); gap: var(--space-sm); }
  .progress__bar { height: 6px; }
  .progress__count { font-size: var(--text-xs); }
  .step { gap: var(--space-lg); }
  .step h2 { font-size: var(--text-xl); line-height: 1.2; }
  .hint { font-size: var(--text-sm); margin-top: calc(-1 * var(--space-sm)); }
  .sub { font-size: var(--text-md); margin-top: var(--space-xs); }
  .ask { gap: var(--space-xs); }
  .ask > span, .ask legend, .why__label { margin-bottom: 0; font-size: var(--text-sm); }
  .ask legend { margin-bottom: var(--space-xs); }
  .field { min-height: 48px; padding: var(--space-xs) var(--space-md); }
  textarea.field { min-height: 88px; }
  .choices { gap: var(--space-xs); }
  .chip { --edge: 3px; min-height: 46px; padding: var(--space-xs) var(--space-md); font-size: var(--text-md); line-height: 1.3; }
  /* short answers (grades, subjects) sit in an even grid instead of a ragged row */
  .choices--row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .choices--row .chip { justify-content: center; padding-inline: var(--space-xs); text-align: center; }
  .choices--row .chip:last-child:nth-child(3n+2) { grid-column: span 2; }
  .choices--row[data-max] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .choices--row[data-max] .chip:last-child { grid-column: auto; }
  .pick { gap: var(--space-xs); }
  .picked__item { font-size: var(--text-sm); }
  .consent { gap: var(--space-sm); }
  .tick { font-size: var(--text-2xs); }
  .back { font-size: var(--text-sm); }
  /* phone: the actions sit in a bar fixed to the bottom, within thumb reach */
  .js .bar { position: fixed; inset: auto 0 0; z-index: var(--z-sticky); margin: 0; padding: var(--space-sm) var(--gutter) calc(var(--space-sm) + env(safe-area-inset-bottom)); background: var(--grain), var(--color-paper); box-shadow: 0 -1px 0 var(--color-rule); }
  .bar .btn { flex: 1; min-width: 0; }
  .consent { padding: var(--space-md); }
}

/* preparing the result takes a few seconds: a bar runs along the button so the wait is visibly working (Unslop: progress after ~0.4 s) */
.quiz--sending [data-next] { position: relative; overflow: hidden; cursor: progress; }
.quiz--sending [data-next]::after { content: ""; position: absolute; left: 0; bottom: 0; width: 100%; height: 6px; background: var(--color-yellow); animation: sending 1.4s linear infinite; }
@keyframes sending { from { transform: translateX(-60%) scaleX(0.4); } to { transform: translateX(60%) scaleX(0.4); } }
@media (prefers-reduced-motion: reduce) { .quiz--sending [data-next]::after { animation: none; transform: none; opacity: 0.6; } }
