/* UCK Assessment - application styles.
 *
 * The --uck-* colour tokens in :root below are FALLBACKS only. brand.css is
 * generated from brand/brand.json and must be loaded AFTER this file, because
 * both define :root at equal specificity and the last one wins. index.html
 * carries that ordering, and tools/build.mjs verifies it on every build.
 * To change the palette, edit brand/brand.json - not these values.
 */

:root {
  --uck-primary: #0b3b6f;
  --uck-primary-dark: #072b52;
  --uck-accent: #c8a44d;
  --uck-ink: #101828;
  --uck-muted: #667085;
  --uck-line: #e4e7ec;
  --uck-bg: #f4f6fa;
  --uck-surface: #ffffff;
  --uck-ok: #067647;
  --uck-ok-bg: #ecfdf3;
  --uck-bad: #b42318;
  --uck-bad-bg: #fef3f2;
  --uck-warn: #b54708;
  --uck-warn-bg: #fffaeb;

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.08);
  --shadow-md: 0 4px 12px rgba(16, 24, 40, 0.08);
  --shadow-lg: 0 18px 40px rgba(11, 59, 111, 0.14);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --maxw: 760px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  font-family: var(--font);
  color: var(--uck-ink);
  background: var(--uck-bg);
  line-height: 1.5;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

[hidden] {
  display: none !important;
}

.skip-link {
  position: absolute;
  left: -9999px;
}
.skip-link:focus {
  left: 12px;
  top: 12px;
  z-index: 50;
  background: var(--uck-surface);
  padding: 10px 14px;
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-md);
}

:focus-visible {
  outline: 3px solid var(--uck-accent);
  outline-offset: 2px;
}

/* ------------------------------------------------------------------ topbar */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--uck-primary);
  background-image: linear-gradient(
    120deg,
    var(--uck-primary-dark) 0%,
    var(--uck-primary) 55%,
    color-mix(in srgb, var(--uck-primary) 82%, var(--uck-accent)) 100%
  );
  color: #fff;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.08), 0 6px 20px rgba(11, 59, 111, 0.22);
}

.topbar__inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand__mark {
  height: 40px;
  width: 40px;
  object-fit: contain;
  flex: none;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.94);
  padding: 3px;
}

/* A wide lockup already contains the wordmark, so the typographic one is
   hidden. The light tile stays: the official UCK Airports mark is near-black
   art, which would disappear against the dark header without it. */
.brand--lockup .brand__mark {
  width: auto;
  max-width: min(260px, 52vw);
  height: 36px;
  padding: 4px 9px;
  border-radius: 6px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.14);
}
.brand--lockup .brand__text {
  display: none;
}

.brand__text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  min-width: 0;
}

.brand__name {
  font-weight: 800;
  font-size: 19px;
  letter-spacing: 0.04em;
}

.brand__sub {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  opacity: 0.78;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ------------------------------------------------------------------- timer */

.timer {
  position: relative;
  flex: none;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
}

.timer__ring {
  position: absolute;
  inset: 0;
  transform: rotate(-90deg);
}

.timer__track,
.timer__progress {
  fill: none;
  stroke-width: 4;
  stroke-linecap: round;
}

.timer__track {
  stroke: rgba(255, 255, 255, 0.24);
}

.timer__progress {
  stroke: var(--uck-accent);
  stroke-dasharray: 119.38;
  stroke-dashoffset: 0;
  transition: stroke 0.3s ease;
}

.timer__value {
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  font-size: 16px;
  letter-spacing: -0.02em;
}

.timer--warn .timer__progress {
  stroke: #fdba74;
}
.timer--warn .timer__value {
  color: #fed7aa;
}
.timer--danger {
  animation: pulse 1s ease-in-out infinite;
}
.timer--danger .timer__progress {
  stroke: #fda29b;
}
.timer--danger .timer__value {
  color: #fecaca;
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.07);
  }
}

@media (prefers-reduced-motion: reduce) {
  .timer--danger {
    animation: none;
  }
  * {
    transition-duration: 0.01ms !important;
  }
}

/* --------------------------------------------------------------------- main */

main {
  flex: 1;
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 24px 20px 96px;
}

.screen {
  animation: rise 0.28s ease both;
}

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

@media (prefers-reduced-motion: reduce) {
  .screen {
    animation: none;
  }
}

/* -------------------------------------------------------------------- card */

.card {
  background: var(--uck-surface);
  border: 1px solid var(--uck-line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  padding: 28px;
}

.card--gate {
  max-width: 480px;
  margin: 6vh auto 0;
}

.eyebrow {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--uck-accent-dark, var(--uck-primary));
}

.title {
  margin: 0 0 10px;
  font-size: clamp(24px, 5.2vw, 30px);
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.lede {
  margin: 0 0 22px;
  color: var(--uck-muted);
  font-size: 15px;
}

/* ------------------------------------------------------------------- field */

.field {
  margin-bottom: 16px;
}

.field__label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--uck-muted);
  margin-bottom: 6px;
}

.field__input {
  width: 100%;
  font: inherit;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-align: center;
  text-transform: uppercase;
  padding: 14px 16px;
  color: var(--uck-ink);
  background: #fff;
  border: 2px solid var(--uck-line);
  border-radius: var(--r-md);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field__input::placeholder {
  color: #b8c0cc;
  letter-spacing: 0.14em;
}

.field__input:focus {
  outline: none;
  border-color: var(--uck-primary);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--uck-primary) 14%, transparent);
}

.field__input:disabled {
  background: #f8f9fb;
  color: var(--uck-muted);
}

/* ------------------------------------------------------------------ alerts */

.alert {
  margin: 10px 0 0;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  font-size: 14px;
  font-weight: 500;
}

.alert--error {
  background: var(--uck-bad-bg);
  color: var(--uck-bad);
  border: 1px solid color-mix(in srgb, var(--uck-bad) 22%, transparent);
}

.alert--warn {
  background: var(--uck-warn-bg);
  color: var(--uck-warn);
  border: 1px solid color-mix(in srgb, var(--uck-warn) 22%, transparent);
}

/* ----------------------------------------------------------------- buttons */

.btn {
  font: inherit;
  font-weight: 700;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  padding: 13px 20px;
  cursor: pointer;
  transition: transform 0.08s ease, background 0.15s ease, box-shadow 0.15s ease,
    opacity 0.15s ease;
  touch-action: manipulation;
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.btn--block {
  display: block;
  width: 100%;
}

.btn--primary {
  background: var(--uck-primary);
  color: #fff;
  font-size: 16px;
  box-shadow: 0 8px 18px color-mix(in srgb, var(--uck-primary) 32%, transparent);
}

.btn--primary:hover:not(:disabled) {
  background: var(--uck-primary-dark);
}

.btn--submit {
  background: var(--uck-accent);
  color: #1c1400;
  font-size: 14px;
  padding: 10px 18px;
  white-space: nowrap;
}

.btn--submit:hover:not(:disabled) {
  background: color-mix(in srgb, var(--uck-accent) 88%, #000);
}

.btn--ghost {
  background: transparent;
  color: var(--uck-primary);
  border-color: var(--uck-line);
  font-size: 14px;
}

.btn--ghost:hover:not(:disabled) {
  background: color-mix(in srgb, var(--uck-primary) 5%, transparent);
}

/* ------------------------------------------------------------------- facts */

.facts {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 24px 0 0;
  padding: 18px 0 0;
  border-top: 1px solid var(--uck-line);
}

.facts__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.facts__value {
  font-size: 20px;
  font-weight: 800;
  color: var(--uck-primary);
  font-variant-numeric: tabular-nums;
}

.facts__label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--uck-muted);
}

/* ------------------------------------------------------------------ quizbar */

.quizbar {
  display: flex;
  align-items: center;
  gap: 18px;
  background: var(--uck-surface);
  border: 1px solid var(--uck-line);
  border-radius: var(--r-md);
  padding: 12px 16px;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 65px;
  z-index: 10;
}

.quizbar__meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.quizbar__label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--uck-muted);
}

.quizbar__value {
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.quizbar .btn--submit {
  margin-left: auto;
}

.progress {
  height: 5px;
  background: var(--uck-line);
  border-radius: 99px;
  overflow: hidden;
  margin: 12px 0 20px;
}

.progress__bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--uck-primary), var(--uck-accent));
  border-radius: 99px;
  transition: width 0.2s ease;
}

/* ---------------------------------------------------------------- questions */

.questions,
.review {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.q {
  background: var(--uck-surface);
  border: 1px solid var(--uck-line);
  border-radius: var(--r-md);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  scroll-margin-top: 120px;
}

.q__head {
  display: flex;
  gap: 12px;
  align-items: baseline;
  margin-bottom: 12px;
}

.q__num {
  flex: none;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: color-mix(in srgb, var(--uck-primary) 10%, transparent);
  color: var(--uck-primary);
  font-size: 12px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.q--answered .q__num {
  background: var(--uck-primary);
  color: #fff;
}

.q__stem {
  font-size: 15.5px;
  font-weight: 600;
  line-height: 1.42;
  margin: 0;
}

.q__options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.opt {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 11px 13px;
  border: 1.5px solid var(--uck-line);
  border-radius: var(--r-sm);
  cursor: pointer;
  background: #fff;
  transition: border-color 0.13s ease, background 0.13s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.opt:hover {
  border-color: color-mix(in srgb, var(--uck-primary) 40%, var(--uck-line));
}

.opt input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.opt__key {
  flex: none;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 1.5px solid var(--uck-line);
  border-radius: 50%;
  font-size: 12px;
  font-weight: 800;
  color: var(--uck-muted);
  transition: all 0.13s ease;
}

.opt__text {
  font-size: 14.5px;
  line-height: 1.4;
  padding-top: 1px;
}

.opt:has(input:checked) {
  border-color: var(--uck-primary);
  background: color-mix(in srgb, var(--uck-primary) 6%, #fff);
}

.opt:has(input:checked) .opt__key {
  background: var(--uck-primary);
  border-color: var(--uck-primary);
  color: #fff;
}

.opt:has(input:focus-visible) {
  outline: 3px solid var(--uck-accent);
  outline-offset: 2px;
}

/* ------------------------------------------------------------ sticky submit */

.sticky-submit {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 12px 20px calc(12px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--uck-surface) 88%, transparent);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--uck-line);
  z-index: 15;
}

.sticky-submit .btn {
  max-width: var(--maxw);
  margin: 0 auto;
}

/* ------------------------------------------------------------------ result */

.card--result {
  max-width: 480px;
  margin: 4vh auto 0;
  text-align: center;
}

.score {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
  margin: 6px 0 2px;
}

.score__value {
  font-size: clamp(52px, 15vw, 76px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--uck-primary);
  font-variant-numeric: tabular-nums;
}

.score__unit {
  font-size: 20px;
  font-weight: 700;
  color: var(--uck-muted);
}

.score__band {
  margin: 0 0 22px;
  font-size: 15px;
  font-weight: 600;
  color: var(--uck-muted);
}

.score__band--ok {
  color: var(--uck-ok);
}
.score__band--mid {
  color: var(--uck-warn);
}
.score__band--bad {
  color: var(--uck-bad);
}

.resultstats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 18px 0;
  margin-bottom: 18px;
  border-top: 1px solid var(--uck-line);
  border-bottom: 1px solid var(--uck-line);
}

.resultstat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.resultstat__value {
  font-size: 19px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.resultstat__label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--uck-muted);
}

/* ------------------------------------------------------------------ review */

.review {
  margin-top: 16px;
}

.rv {
  background: var(--uck-surface);
  border: 1px solid var(--uck-line);
  border-left: 4px solid var(--uck-line);
  border-radius: var(--r-sm);
  padding: 14px 16px;
}

.rv--ok {
  border-left-color: var(--uck-ok);
  background: var(--uck-ok-bg);
}

.rv--bad {
  border-left-color: var(--uck-bad);
  background: var(--uck-bad-bg);
}

.rv__head {
  display: flex;
  gap: 10px;
  align-items: baseline;
  margin-bottom: 10px;
}

.rv__mark {
  flex: none;
  font-size: 15px;
  line-height: 1.2;
}

.rv__stem {
  font-size: 14.5px;
  font-weight: 600;
  margin: 0;
  line-height: 1.4;
}

.rv__line {
  font-size: 13.5px;
  margin: 3px 0 0;
  color: var(--uck-muted);
}

.rv__line strong {
  color: var(--uck-ink);
}

.rv--ok .rv__line strong {
  color: var(--uck-ok);
}

.rv--bad .rv__line strong {
  color: var(--uck-bad);
}

.rv__why {
  font-size: 12.5px;
  color: var(--uck-muted);
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed currentColor;
  opacity: 0.9;
}

/* --------------------------------------------------------------- fineprint */

.fineprint {
  text-align: center;
  font-size: 12.5px;
  color: var(--uck-muted);
  margin: 22px 0 0;
}

.foot {
  border-top: 1px solid var(--uck-line);
  padding: 16px 20px calc(16px + env(safe-area-inset-bottom));
  text-align: center;
  font-size: 12px;
  color: var(--uck-muted);
  background: var(--uck-surface);
}

/* ------------------------------------------------------------------ mobile */

@media (max-width: 520px) {
  main {
    padding: 18px 14px 92px;
  }
  .card {
    padding: 20px 18px;
  }
  .card--gate {
    margin-top: 2vh;
  }
  .topbar__inner {
    padding: 10px 14px;
  }
  .brand__mark {
    height: 34px;
    width: 34px;
  }
  .brand__name {
    font-size: 17px;
  }
  .quizbar {
    gap: 12px;
    padding: 10px 12px;
    top: 58px;
  }
  .quizbar__value {
    font-size: 14px;
  }
  .btn--submit {
    padding: 9px 14px;
    font-size: 13px;
  }
  .q {
    padding: 14px;
  }
  .q__stem {
    font-size: 15px;
  }
}
