/* US Presidents (spec §6): the control bar, the presidency list (two tables: one column on mobile, side by side
   from 1024 px so all 47 rows show at once), the result and the page text. Scoped under .q-presidents.
   Functional layout before the design pass; existing tokens only, following the capitals quizzes. */

.q-presidents { padding-block: var(--s5) var(--s7); }
.q-presidents__intro { display: grid; gap: var(--s2); margin-bottom: var(--s5); max-width: 60ch; }
.q-presidents__intro h1 { font-size: 28px; }

.q-presidents__game { max-width: none; display: grid; gap: var(--s3); padding: var(--s3); }
.q-presidents__game:focus { outline: none; }

/* ---------- control bar: sticky on mobile, so the input and the "Last named" line stay in view ---------- */
.q-presidents__bar {
  position: sticky; top: 0; z-index: 4;
  display: grid; gap: var(--s2);
  margin: calc(-1 * var(--s3)) calc(-1 * var(--s3)) 0; padding: var(--s3);
  background: var(--surface); border-radius: var(--r-card) var(--r-card) 0 0;
  border-bottom: 1px solid var(--line);
}
.q-presidents__row { display: flex; align-items: center; gap: var(--s4); flex-wrap: wrap; }
.q-presidents__actions { display: flex; gap: var(--s2); margin-left: auto; }
.q-presidents__input {
  width: 100%; min-height: 48px; padding: 0 var(--s4);
  font-size: 18px; /* 16 px or more keeps iOS from zooming on focus */
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line-strong); border-radius: var(--r-pill);
}
.q-presidents__input:disabled { opacity: .5; }
/* "Last named: …" / "Already named: …": one line, reserved so nothing shifts */
.q-presidents__feedback {
  min-height: 1.5em; margin-top: var(--s1); padding-inline: var(--s4); font-size: 15px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* After the game: the details of the presidency under the pointer or focus */
.q-presidents__caption { min-height: 1.5em; font-size: 15px; font-weight: 600; }
.q-presidents__table tr.is-revealed { cursor: pointer; }
.q-presidents__table tr.is-revealed:hover, .q-presidents__table tr.is-revealed:focus-visible { background: var(--surface-2); }
.q-presidents__table tr.is-revealed:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; }
.q-presidents__stats .q-presidents__table thead { display: table-header-group; }
.q-presidents__stats .q-presidents__table td:nth-child(2) { width: auto; }

.q-presidents__result { display: grid; gap: var(--s3); padding-block: var(--s2); }
.q-presidents__result .fig dd { font-size: 24px; }

/* ---------- the list ---------- */
.q-presidents__board { position: relative; min-width: 0; }
/* The rows are drawn by JS; their space is reserved so nothing below shifts (CLS): 47 rows of 34 px plus the
   header in one column, the first table's 24 rows of 30 px plus the header side by side (tests check the counts) */
.q-presidents__lists { display: grid; gap: 0 var(--s5); --rows: 47; --rows-a: 24; min-height: calc(var(--rows) * 34px + 35px); }
.q-presidents__table { width: 100%; border-collapse: collapse; font-size: 15px; }
.q-presidents__table thead th { text-align: left; font-size: 12px; font-weight: 600; color: var(--ink-2); padding: var(--s2); }
.q-presidents__lists .q-presidents__table + .q-presidents__table thead { display: none; } /* one column on mobile: one header */
.q-presidents__table tbody th, .q-presidents__table td { padding: 5px var(--s2); border-bottom: 1px solid var(--line); height: 34px; text-align: left; }
.q-presidents__table tbody th { width: 3em; font-weight: 400; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.q-presidents__table td:nth-child(2) { width: 7.5em; color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.q-presidents__table td:last-child { font-weight: 600; }
.q-presidents__table tr.is-new { background: color-mix(in srgb, var(--state-correct) 16%, var(--surface)); }
.q-presidents__table tr { transition: background-color 1s var(--ease); }
.q-presidents__missed { color: var(--state-wrong); font-style: italic; }
.q-presidents__extra { display: block; font-size: 13px; font-weight: 400; color: var(--ink-2); }

/* ---------- pause: cover the list ---------- */
.q-presidents__pause { inset: 0; padding: var(--s4); align-content: start; }
.q-presidents__pause p { font-size: 18px; }
.q-presidents.is-paused .q-presidents__lists { visibility: hidden; }

/* ---------- your stats and the page text ---------- */
.q-presidents__stats { max-width: none; display: grid; gap: var(--s4); margin-top: var(--s5); padding: var(--s4); }
.q-presidents__stats .figs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.q-presidents__stats .fig dd { font-size: 24px; }
.q-presidents__recent { overflow-x: auto; }
.q-presidents__recent caption { text-align: left; padding-bottom: var(--s2); }
.q-presidents__about { display: grid; gap: var(--s3); max-width: 72ch; margin-top: var(--s7); }
.q-presidents__about h2 { margin-top: var(--s4); }
.q-presidents__about h3 { margin-top: var(--s2); }
.q-presidents__more { display: grid; gap: var(--s3); }
.q-presidents__more summary { cursor: pointer; font-weight: 600; padding-block: 10px; } /* about 44 px tall, as .q-capitals__more */
.q-presidents__names th[scope="row"] { width: 45%; font-weight: 600; color: inherit; }
.q-presidents__names td:nth-child(2) { width: auto; color: inherit; font-weight: 400; }
.q-presidents__about ol, .q-presidents__about ul { margin: 0; padding-left: 1.4em; display: grid; gap: var(--s1); }

@media (min-width: 720px) {
  .q-presidents__game { padding: var(--s5); }
  .q-presidents__bar { margin: calc(-1 * var(--s5)) calc(-1 * var(--s5)) 0; padding: var(--s4) var(--s5); }
  .q-presidents__entry { max-width: 560px; }
}
@media (min-width: 1024px) {
  .q-presidents__lists { grid-template-columns: 1fr 1fr; align-items: start; min-height: calc(var(--rows-a) * 30px + 35px); }
  .q-presidents__lists .q-presidents__table + .q-presidents__table thead { display: table-header-group; }
  .q-presidents__table tbody th, .q-presidents__table td { height: 30px; padding-block: 3px; }
}
