/* style.css: layout and controls. Colours come from themes.css. */

* { box-sizing: border-box; }

:root { --page-width: 1200px; } /* setup, results and footer */

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}

main { padding: 0 1rem 2rem; }
/* Setup and results keep a comfortable reading width; the comparison uses the whole
   window, so long code lines don't wrap inside two half-width panels. */
.screen:not(#compare) { max-width: var(--page-width); margin: 0 auto; }
h1, h2 { font-weight: 600; margin: 0; }
h1 { font-size: 1.25rem; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.center { text-align: center; }
.row { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin: 0.75rem 0; }
[hidden] { display: none !important; }

/* ---------- header / footer */
.topbar {
  display: flex; align-items: baseline; gap: 1rem; flex-wrap: wrap;
  padding: 0.75rem 1rem; border-bottom: 1px solid var(--border); margin-bottom: 1rem;
}
.tagline { margin: 0; color: var(--muted); flex: 1; }
footer { max-width: var(--page-width); margin: 0 auto; padding: 1rem; color: var(--muted); font-size: 0.85rem; border-top: 1px solid var(--border); }
footer ul { columns: 3 14rem; }

/* ---------- form controls */
button, .button, select, textarea, input[type="file"] {
  font: inherit; color: var(--fg); background: var(--panel);
  border: 1px solid var(--border); border-radius: 6px; padding: 0.4rem 0.8rem;
}
button, .button { cursor: pointer; }
button:hover:not(:disabled), .button:hover { border-color: var(--accent); }
button:disabled { opacity: 0.5; cursor: not-allowed; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--bg); font-weight: 600; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
textarea { width: 100%; display: block; margin: 0.5rem 0; resize: vertical; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); }
label:has(input:disabled) { opacity: 0.55; }

/* ---------- setup */
fieldset { border: 1px solid var(--border); border-radius: 8px; padding: 0.75rem 1rem 1rem; margin: 0 0 1rem; }
legend { font-weight: 600; padding: 0 0.4rem; }
#setup > fieldset > label { display: block; margin: 0.2rem 0; }
.choices { display: flex; flex-wrap: wrap; gap: 0.4rem 1.25rem; }
.sub-choice { display: block; margin-top: 0.75rem; }
.start { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }

/* ---------- compare */
.toolbar { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; align-items: center; margin-bottom: 1rem; }
.arena { --size: 20px; display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 760px) { .arena { grid-template-columns: 1fr; } }

/* The two specimens must be identical except for the font, so layout can't bias the choice. */
.specimen {
  min-height: 16rem; padding: 1.5rem; cursor: pointer;
  background: var(--panel);
  border: 2px solid var(--border); border-radius: 10px;
  font-size: var(--size); line-height: 1.5;
  font-synthesis: none;          /* never show the browser's fake bold/italic */
  overflow-wrap: anywhere;
}
.specimen:hover { border-color: var(--accent); }
.specimen.flash { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--panel)); }
.specimen p { margin: 0 0 0.6em; }
.specimen pre { margin: 0; font: inherit; white-space: pre-wrap; tab-size: 4; }
.specimen .display-line { font-size: 2.4em; line-height: 1.15; margin-bottom: 0.3em; }
.specimen .font-name { font: 600 12px/1.4 system-ui, sans-serif; color: var(--accent); margin-bottom: 0.8em; }
.specimen .label { font: 11px/1.4 system-ui, sans-serif; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; margin-top: 0.8em; }
.specimen table { font-variant-numeric: tabular-nums; }
.specimen td { padding: 0 1.5em 0 0; }
.specimen td:last-child { text-align: right; padding-right: 0; }
.specimen .oldstyle { font-variant-numeric: oldstyle-nums proportional-nums; }

.arena.mod-bold .specimen { font-weight: 700; }
.arena.mod-italic .specimen { font-style: italic; }
.arena.mod-underline .specimen p,
.arena.mod-underline .specimen pre,
.arena.mod-underline .specimen div { text-decoration: underline; }
.arena.no-liga .specimen { font-variant-ligatures: none; font-feature-settings: "liga" 0, "calt" 0; }
.arena.normalize .specimen { font-size-adjust: ex-height 0.5; }

/* syntax colours */
.t-kw { color: var(--kw); }
.t-str { color: var(--str); }
.t-com { color: var(--com); }
.t-num { color: var(--num); }
.t-fn { color: var(--fn); }
.t-type { color: var(--type); }

.controls { display: flex; justify-content: center; gap: 0.75rem; margin: 1rem 0 0.5rem; flex-wrap: wrap; }
.controls button { min-width: 10rem; }
.controls.secondary button { min-width: 0; font-size: 0.9rem; }
.progress { height: 6px; background: var(--panel); border: 1px solid var(--border); border-radius: 3px; overflow: hidden; margin-top: 1rem; }
#progress-bar { height: 100%; width: 0; background: var(--accent); transition: width 0.3s; }

/* ---------- results */
#podium { list-style: none; padding: 0; display: grid; gap: 0.75rem; }
#podium li {
  display: grid; grid-template-columns: 3rem 1fr auto; gap: 0.25rem 1rem; align-items: center;
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 1rem 1.25rem;
}
#podium .place { font-size: 1.6rem; font-weight: 700; color: var(--accent); grid-row: span 2; }
#podium .name { font-size: 1.8rem; line-height: 1.2; }
#podium .preview { font-size: 1.1rem; color: var(--muted); }
#podium .meta { grid-row: span 2; text-align: right; font-size: 0.85rem; color: var(--muted); }
.confidence { width: 8rem; height: 6px; background: var(--bg); border-radius: 3px; overflow: hidden; margin: 0.3rem 0 0.5rem auto; }
.confidence > div { height: 100%; background: var(--accent); }
table { border-collapse: collapse; width: 100%; }
#full-table th, #full-table td { text-align: left; padding: 0.3rem 0.6rem; border-bottom: 1px solid var(--border); }
details { margin: 1rem 0; }
summary { cursor: pointer; }
