/* Visual language: Argentine road signage. Colours are semantic, never decorative:
   motorway-sign green = actions and correct answers, regulatory red = eliminatory / wrong,
   reflective yellow = selection and mistakes to review.
   Type: Overpass (Highway Gothic lineage) for Latin text and digits; Cyrillic falls back to
   the system UI font on purpose (the font files below carry Latin only). */

@font-face {
  font-family: "Overpass";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/overpass-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Overpass";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/overpass-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329,
    U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Overpass";
  font-style: italic;
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/overpass-italic-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Overpass";
  font-style: italic;
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/overpass-italic-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329,
    U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --paper: #ffffff;
  --concrete: #f1f2f2;
  --ink: #26292d;
  --muted: #5f656c;
  --line: #cdd1d4;
  --blue: #00663d; /* links and outlines (motorway-sign green) */
  --fill: #00663d; /* filled buttons: white text must stay >= 4.5:1 */
  --blue-ink: #ffffff;
  --red: #c4161c;
  --green: #00663d;
  --yellow: #ffc20e; /* reflective yellow: selection, review */
  --green-fill: #00663d; /* same in both themes: white letters on top */
  --red-fill: #b3141a;
  --sign-face: #ffffff;
  --sign-ink: #1d2024;

  --font: "Overpass", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  /* Type scale: major third (1.25) from a 17px body */
  --t-sm: 0.875rem;
  --t-base: 1.0625rem;
  --t-md: 1.3125rem;
  --t-lg: 1.625rem;
  --t-xl: 2.0625rem;

  --radius: 6px;
  --gap: 1rem;
  --measure: 40rem;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #23262b;
    --concrete: #2b2f35;
    --ink: #f1f2f0;
    --muted: #aab0b6;
    --line: #464b51;
    --blue: #5fc28f;
    --fill: #00663d;
    --red: #ec4a5b;
    --green: #3fb27a;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --paper: #23262b;
  --concrete: #2b2f35;
  --ink: #f1f2f0;
  --muted: #aab0b6;
  --line: #464b51;
  --blue: #5fc28f;
  --fill: #00663d;
  --red: #ec4a5b;
  --green: #3fb27a;
  color-scheme: dark;
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--t-base);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
p {
  margin: 0;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: var(--blue);
  text-underline-offset: 0.2em;
}

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

.page {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 1rem 3rem;
}

/* ---------- Top bar ---------- */

.bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 3.5rem;
  margin-bottom: 1.5rem;
  border-bottom: 2px solid var(--ink);
}

.bar__home {
  margin-right: auto;
  font-weight: 800;
  font-size: var(--t-base);
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
}

/* License class shown like the class code on the plastic licencia */
.plate {
  background: transparent;
  cursor: pointer;
  display: inline-grid;
  place-items: center;
  min-width: 2rem;
  height: 2rem;
  padding: 0 0.4rem;
  border: 2px solid var(--ink);
  border-radius: 4px;
  font-weight: 800;
  line-height: 1;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  cursor: pointer;
}

.icon-btn:hover,
.plate:hover {
  background: var(--concrete);
}

.icon-btn svg {
  width: 1.25rem;
  height: 1.25rem;
}

/* ---------- Text ---------- */

.title {
  font-size: var(--t-xl);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.title__line {
  display: block;
}

.title__line + .title__line {
  color: var(--muted);
}

.subtitle {
  font-size: var(--t-md);
  font-weight: 700;
  line-height: 1.25;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: var(--t-sm);
}

.stack > * + * {
  margin-top: var(--gap);
}

/* ---------- Readiness: a speed-limit roundel ---------- */

.hero {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1.25rem;
  align-items: center;
  margin-bottom: 2rem;
}

.roundel {
  display: grid;
  place-items: center;
  width: 8.5rem;
  aspect-ratio: 1;
  border: 0.85rem solid #c8102e; /* sign red, same in both themes */
  border-radius: 50%;
  background: var(--sign-face);
  color: var(--sign-ink);
  /* thin white rim outside the red ring, as on a real sign */
  box-shadow: 0 0 0 3px var(--sign-face), 0 0 0 5px var(--line);
}

.roundel__value {
  font-size: 2.6rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}

.roundel__unit {
  font-size: 1.1rem;
  font-weight: 700;
  margin-left: 0.05em;
}

.hero__text > * + * {
  margin-top: 0.5rem;
}

@media (max-width: 26rem) {
  .hero {
    grid-template-columns: 1fr;
  }
}

/* ---------- Main actions: a column of guide signs ---------- */

.actions {
  display: grid;
  gap: 0.5rem;
  margin: 0 0 2.5rem;
  padding: 0;
  list-style: none;
}

.action {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 0.25rem 1rem;
  padding: 0.9rem 1rem;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  text-decoration: none;
}

.action:hover {
  border-color: var(--ink);
}

.action__label {
  font-weight: 800;
  font-size: var(--t-md);
  line-height: 1.2;
}

.action__hint {
  grid-column: 1;
  color: var(--muted);
  font-size: var(--t-sm);
}

.action__count {
  grid-row: 1 / span 2;
  grid-column: 2;
  font-weight: 800;
  font-size: var(--t-md);
  font-variant-numeric: tabular-nums;
}

.action--primary {
  background: var(--fill);
  border-color: var(--fill);
  color: var(--blue-ink);
}

.action--primary .action__hint {
  color: inherit;
  opacity: 0.85;
}

.action--primary:hover {
  border-color: var(--ink);
}

.action--warning {
  border-color: var(--yellow);
  box-shadow: inset 6px 0 0 var(--yellow);
}

/* ---------- Choice lists (onboarding) and settings ---------- */

.choices {
  display: grid;
  gap: 0.5rem;
  margin: 1.25rem 0 2rem;
}

.choice {
  display: grid;
  gap: 0.1rem;
  width: 100%;
  padding: 1rem;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.choice:hover {
  border-color: var(--ink);
}

.choice strong {
  font-size: var(--t-md);
  font-weight: 800;
}

.settings {
  display: grid;
  gap: 1.25rem;
  padding-top: 1.5rem;
  border-top: 2px solid var(--ink);
}

.field {
  display: grid;
  gap: 0.4rem;
}

.field__label {
  font-weight: 700;
}

.segmented {
  display: inline-flex;
  flex-wrap: wrap;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  overflow: hidden;
  justify-self: start;
}

.segmented button {
  min-height: 2.5rem;
  padding: 0 1rem;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.segmented button + button {
  border-left: 2px solid var(--ink);
}

.segmented button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--paper);
  font-weight: 700;
}

.link-btn {
  justify-self: start;
  padding: 0;
  border: 0;
  background: none;
  color: var(--red);
  text-decoration: underline;
  text-underline-offset: 0.2em;
  cursor: pointer;
}

.footer {
  margin-top: 3rem;
  color: var(--muted);
  font-size: var(--t-sm);
}

.footer p + p {
  margin-top: 0.5rem;
}

/* ---------- Question ---------- */

.qhead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.qhead__links {
  display: inline-flex;
  gap: 1rem;
}

.link-btn--plain {
  color: var(--blue);
}

.qhead__n {
  font-size: var(--t-base);
  font-weight: 800;
}

.clock {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.badge-elim {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.75rem;
  color: var(--red);
  font-weight: 700;
  font-size: var(--t-sm);
}

/* tiny prohibition-sign ring */
.badge-elim::before {
  content: "";
  width: 1rem;
  height: 1rem;
  border: 0.22rem solid var(--red);
  border-radius: 50%;
  background: var(--sign-face);
}

.qtext {
  font-size: var(--t-md);
  font-weight: 700;
  line-height: 1.35;
}

/* Spanish original under the translation: the real exam is in Spanish */
.original {
  display: block;
  margin-top: 0.3rem;
  color: var(--muted);
  font-size: var(--t-sm);
  font-style: italic;
}

.qimg {
  margin: 1rem 0 0;
}

.qimg img {
  max-height: 20rem;
  width: auto;
  border-radius: 4px;
}

.multi-hint {
  margin-top: 1rem;
  font-weight: 700;
  font-size: var(--t-sm);
}

.options {
  display: grid;
  gap: 0.5rem;
  margin: 1.25rem 0;
  padding: 0;
  list-style: none;
}

/* An answer row, like the boxes of the paper exam form */
.opt {
  display: grid;
  grid-template-columns: 2rem 1fr;
  gap: 0.75rem;
  align-items: start;
  width: 100%;
  padding: 0.75rem;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.opt:hover:not(:disabled) {
  border-color: var(--ink);
}

.opt:disabled {
  cursor: default;
}

.opt__key {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border: 2px solid var(--ink);
  border-radius: 4px;
  font-weight: 800;
  line-height: 1;
}

.opt--multi .opt__key {
  border-style: dashed;
}

.opt__text {
  padding-top: 0.2rem;
}

.opt[aria-pressed="true"] {
  border-color: var(--ink);
}

.opt[aria-pressed="true"] .opt__key {
  background: var(--yellow);
  border-color: var(--yellow);
  color: #1d1f22;
}

.opt--right {
  border-color: var(--green);
}

.opt--right .opt__key {
  background: var(--green-fill);
  border-color: var(--green-fill);
  color: #fff;
}

.opt--wrong {
  border-color: var(--red);
}

.opt--wrong .opt__key {
  background: var(--red-fill);
  border-color: var(--red-fill);
  color: #fff;
}

.opt--dim {
  opacity: 0.55;
}

.verdict {
  min-height: 1.5rem;
  margin-bottom: 1rem;
  font-weight: 700;
}

.verdict--right {
  color: var(--green);
}

.verdict--wrong {
  color: var(--red);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3rem;
  width: 100%;
  padding: 0 1.5rem;
  border: 2px solid var(--fill);
  border-radius: var(--radius);
  background: var(--fill);
  color: var(--blue-ink);
  font-weight: 800;
  cursor: pointer;
}

a.btn {
  text-decoration: none;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 2rem;
}

.btn:disabled {
  border-color: var(--line);
  background: transparent;
  color: var(--muted);
  cursor: default;
}

.btn--quiet {
  border-color: var(--ink);
  background: transparent;
  color: var(--ink);
}

@media (min-width: 36rem) {
  .btn {
    width: auto;
  }
}

.qfoot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 2px solid var(--line);
  color: var(--muted);
  font-size: var(--t-sm);
}

.footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
}

.notice {
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  border-left: 4px solid var(--yellow);
  background: var(--concrete);
  font-size: var(--t-sm);
}

@media (prefers-reduced-motion: no-preference) {
  .opt,
  .opt__key {
    transition: border-color 120ms ease, background-color 120ms ease;
  }
}

/* ---------- Mock exam ---------- */

/* 40 cells: the exam is a numbered sequence, so numbers carry meaning here */
.exam-nav {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 0.25rem;
  margin-bottom: 1.25rem;
}

.nav-cell {
  min-height: 2rem;
  padding: 0;
  border: 2px solid var(--line);
  border-radius: 4px;
  background: transparent;
  font-size: var(--t-sm);
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}

.nav-cell--done {
  border-color: var(--fill);
  background: var(--fill);
  color: var(--blue-ink);
}

.nav-cell[aria-current="step"] {
  outline: 2px solid var(--yellow);
  outline-offset: 1px;
}

.history {
  padding-top: 1.5rem;
  border-top: 2px solid var(--line);
}

.history__list {
  margin: 0.75rem 0 0;
  padding: 0;
  list-style: none;
}

.history__list li {
  display: grid;
  grid-template-columns: 1fr auto 7rem;
  gap: 1rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}

.history__list li > :last-child {
  font-weight: 700;
  text-align: right;
}

.review-list {
  padding-top: 1.5rem;
  border-top: 2px solid var(--ink);
}

.review-item {
  padding: 1.5rem 0;
  border-bottom: 2px solid var(--line);
}

/* ---------- Glossary ---------- */

.gloss-intro {
  margin: 0.75rem 0 1.25rem;
  color: var(--muted);
}

.search {
  width: 100%;
  min-height: 3rem;
  padding: 0 1rem;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  background: var(--paper);
}

.gloss-section {
  margin-top: 2rem;
}

.terms {
  margin: 0.75rem 0 0;
}

/* Spanish term and its translation side by side, stacked on narrow screens */
.term {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
  gap: 0.25rem 1.5rem;
  padding: 0.6rem 0;
  border-top: 1px solid var(--line);
}

.term dt {
  font-weight: 700;
}

.term dd {
  margin: 0;
}

@media (max-width: 30rem) {
  .term {
    grid-template-columns: 1fr;
  }

  .term dd {
    color: var(--muted);
  }
}

[hidden] {
  display: none !important;
}

.gloss-dialog {
  width: min(40rem, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  padding: 0 1.25rem 1.5rem;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
}

.gloss-dialog::backdrop {
  background: rgba(20, 22, 25, 0.55);
}

/* the head stays put while the terms scroll */
.gloss-dialog__head {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 0 -1.25rem 1rem;
  padding: 0.75rem 1.25rem;
  border-bottom: 2px solid var(--ink);
  background: var(--paper);
}

.gloss-dialog__head .btn {
  width: auto;
  min-height: 2.5rem;
}
