/*
  QuizPour shared stylesheet. System fonts only, no images, no external URLs.
  One accent colour (blue) plus neutrals.

  Contrast ratios (WCAG, computed with python3; minimum required 4.5:1 for text, 3:1 for UI edges/focus)
  LIGHT
    text #1b1f24 on page #ffffff ........ 16.56
    text on card #f6f8fb ................ 15.57
    muted #4b5563 on page ............... 7.56 | on card 7.10 | on notice 7.01
    accent link #1d4ed8 on page ......... 6.70 | on card 6.30 | on notice #fff6dc 6.21
    primary button: white on #1d4ed8 .... 6.70 (hover #1e40af: 8.72)
    secondary button: #1d4ed8 on white .. 6.70 (hover bg #e8eefc: 5.77)
    text on notice #fff6dc .............. 15.35
    code text on #eef1f6 ................ 14.63
    disabled text #5b6470 on #e9ecf1 .... 5.06
    input/button border #6b7280 on page . 4.83 (needs 3)
    focus ring = accent #1d4ed8 on page . 6.70 (on card 6.30)
  DARK
    text #e6e9ee on page #0f1419 ........ 15.21
    text on card #171d25 ................ 13.93
    muted #aab3bf on page ............... 8.74 | on card 8.00 | on notice 7.30
    accent link #8fb0ff on page ......... 8.66 | on card 7.93 | on notice #2a2410 7.23
    primary button: #0b1020 on #8fb0ff .. 8.86 (hover #b3c9ff: 11.46)
    secondary button: #8fb0ff on page ... 8.66 (hover bg #1f2a44: 6.67)
    text on notice ...................... 12.70
    code text on #1f2630 ................ 12.52
    disabled text #9aa3af on #232a33 .... 5.68
    border #7d8794 on page .............. 5.08
    focus ring = accent #8fb0ff on page . 8.66 (on card 7.93)
  Focus ring is 3px with a 3px offset, so it sits on the page/card colour and not on the button fill.
*/

:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --card: #f6f8fb;
  --fg: #1b1f24;
  --muted: #4b5563;
  --accent: #1d4ed8;
  --accent-hover: #1e40af;
  --on-accent: #ffffff;
  --tint: #e8eefc;
  --border: #6b7280;
  --rule: #d5dae2;
  --notice-bg: #fff6dc;
  --code-bg: #eef1f6;
  --disabled-bg: #e9ecf1;
  --disabled-fg: #5b6470;
  --measure: 70ch;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1419;
    --card: #171d25;
    --fg: #e6e9ee;
    --muted: #aab3bf;
    --accent: #8fb0ff;
    --accent-hover: #b3c9ff;
    --on-accent: #0b1020;
    --tint: #1f2a44;
    --border: #7d8794;
    --rule: #2c3540;
    --notice-bg: #2a2410;
    --code-bg: #1f2630;
    --disabled-bg: #232a33;
    --disabled-fg: #9aa3af;
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

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

body {
  margin: 0;
  font: 1rem/1.6 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--fg);
  background: var(--bg);
  overflow-wrap: break-word;
}

.site-header, main, footer {
  width: 100%;
  max-width: 48rem;
  margin-inline: auto;
  padding-inline: 1rem;
}

main { padding-bottom: 1rem; }
p, li, dd, details > *:not(summary) { max-width: var(--measure); }

h1 { font-size: 1.9rem; line-height: 1.2; margin: 1.5rem 0 0.5rem; }
h2 { font-size: 1.35rem; line-height: 1.3; margin: 2.25rem 0 0.5rem; }
h3 { font-size: 1.1rem; line-height: 1.35; margin: 1.5rem 0 0.25rem; }
.lead { font-size: 1.15rem; color: var(--muted); max-width: var(--measure); }

a { color: var(--accent); text-underline-offset: 0.15em; }
a:hover { text-decoration-thickness: 2px; }

:focus { outline: none; }
:focus-visible,
a:focus-visible, button:focus-visible, select:focus-visible, textarea:focus-visible,
input:focus-visible, summary:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* Skip link */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 10;
}
.skip-link:focus {
  left: 1rem;
  top: 1rem;
  background: var(--bg);
  color: var(--accent);
  padding: 0.75rem 1rem;
  min-height: 44px;
  border: 2px solid var(--accent);
  border-radius: 6px;
}

/* Header and nav */
.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem 1rem;
  padding-block: 0.5rem;
  border-bottom: 1px solid var(--rule);
}
.brand {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--fg);
  text-decoration: none;
  letter-spacing: -0.01em;
}
.brand:hover { color: var(--accent); }
.site-header nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0 0.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.site-header nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 0.6rem;
  color: var(--fg);
  text-decoration: none;
  border-bottom: 3px solid transparent;
}
.site-header nav a:hover { color: var(--accent); }
.site-header nav a[aria-current="page"] {
  color: var(--accent);
  font-weight: 600;
  border-bottom-color: var(--accent);
}

/* Intro text */
.privacy { font-size: 1rem; }
.small { font-size: 0.9rem; color: var(--muted); }

/* Numbered step cards (the three sections of the tool) */
.step, main > section[aria-labelledby] {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 1rem 1.25rem 1.25rem;
  margin: 1.25rem 0;
}
.step h2, main > section[aria-labelledby] > h2 { margin-top: 0; }

/* Form controls */
label { display: block; font-weight: 600; margin-top: 1rem; }
textarea, select, input[type="file"] {
  display: block;
  width: 100%;
  max-width: 100%;
  margin-top: 0.25rem;
  font: inherit;
  color: var(--fg);
  background: var(--bg);
}
textarea {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.95rem;
  line-height: 1.5;
  padding: 0.6rem;
  border: 2px solid var(--border);
  border-radius: 6px;
  resize: vertical;
}
select {
  min-height: 44px;
  padding: 0.5rem;
  border: 2px solid var(--border);
  border-radius: 6px;
}
input[type="file"] { min-height: 44px; padding: 0.5rem 0; background: transparent; }
input[type="file"]::file-selector-button {
  font: inherit;
  min-height: 44px;
  margin-right: 0.75rem;
  padding: 0.5rem 1rem;
  color: var(--accent);
  background: var(--bg);
  border: 2px solid var(--accent);
  border-radius: 6px;
  cursor: pointer;
}

/* Buttons: secondary is the default; .button-primary is the Convert button */
button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 44px;
  padding: 0.5rem 1.1rem;
  font: inherit;
  font-weight: 600;
  line-height: 1.2;
  color: var(--accent);
  background: var(--bg);
  border: 2px solid var(--accent);
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
}
button:hover:not([disabled]), .button:hover { background: var(--tint); }
button:active:not([disabled]) { transform: translateY(1px); }

.button-primary,
#convert {
  color: var(--on-accent);
  background: var(--accent);
  border-color: var(--accent);
  font-size: 1.1rem;
  padding: 0.65rem 1.75rem;
}
.button-primary:hover:not([disabled]),
#convert:hover:not([disabled]) {
  color: var(--on-accent);
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.button-secondary { /* explicit alias of the default look */
  color: var(--accent);
  background: var(--bg);
  border-color: var(--accent);
}

#download {
  color: var(--on-accent);
  background: var(--accent);
  border-color: var(--accent);
}
#download:hover:not([disabled]) { background: var(--accent-hover); border-color: var(--accent-hover); }

button[disabled], #download:disabled, #download[disabled] {
  color: var(--disabled-fg);
  background: var(--disabled-bg);
  border: 2px dashed var(--border);
  cursor: not-allowed;
}

.button-row { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 1rem 0; }

/* Details / summary */
details { margin-top: 1rem; }
summary {
  display: flex;
  align-items: center;
  min-height: 44px;
  cursor: pointer;
  color: var(--accent);
  font-weight: 600;
}

/* Status, problems, warnings */
#status { min-height: 1.6em; font-weight: 600; }
#problems-heading { margin-top: 1.25rem; }
.list { padding-left: 1.25rem; }
.list li { margin: 0.25rem 0; }
#preview-count { font-weight: 700; }

/* Notice box (and the over-limit box) */
.notice, #limit-box {
  background: var(--notice-bg);
  color: var(--fg);
  border: 1px solid var(--border);
  border-left: 6px solid var(--accent);
  border-radius: 6px;
  padding: 0.75rem 1rem;
  margin: 1rem 0;
}
.notice > :first-child { margin-top: 0; }
.notice > :last-child { margin-bottom: 0; }
.notice .small, #limit-box .small { color: var(--muted); }
#waitlist-link { font-weight: 600; display: inline-block; padding-block: 0.6rem; }

/* Code */
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
code {
  font-size: 0.92em;
  background: var(--code-bg);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}
pre {
  font-size: 0.9rem;
  line-height: 1.5;
  background: var(--code-bg);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 0.75rem 1rem;
  margin: 1rem 0;
  overflow-x: auto;
  max-width: 100%;
  tab-size: 2;
}
pre code { background: none; padding: 0; font-size: inherit; }

table { border-collapse: collapse; display: block; max-width: 100%; overflow-x: auto; }
th, td { text-align: left; padding: 0.4rem 0.75rem; border: 1px solid var(--rule); }

/* Footer */
footer {
  margin-top: 3rem;
  padding-block: 1rem 2rem;
  border-top: 1px solid var(--rule);
}
footer nav ul { display: flex; flex-wrap: wrap; gap: 0 0.5rem; margin: 0; padding: 0; list-style: none; }
footer nav a, footer a.mail { display: inline-flex; align-items: center; min-height: 44px; padding: 0 0.5rem 0 0; }

img, svg, video { max-width: 100%; height: auto; }

@media (max-width: 30rem) {
  h1 { font-size: 1.6rem; }
  .step, main > section[aria-labelledby] { padding: 0.75rem 0.9rem 1rem; }
  .button-row > button, #convert { flex: 1 1 100%; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
