/* MCDDD web shell.
 *
 * Accessibility is a requirement here, not a polish pass: dark by default,
 * text that scales with the browser's own font size, contrast measured against
 * WCAG AAA (7:1 for body text), visible focus on every interactive element,
 * and nothing conveyed by colour alone.
 *
 * The report itself is rendered by mcddd/htmlreport.py, which brings its own
 * theme switch, text-size controls and read-aloud panel. This file styles only
 * the shell around it, and deliberately uses the same palette so the two do not
 * fight each other.
 */

:root {
  color-scheme: dark light;

  --bg: #0d1117;
  --panel: #161b22;
  --panel-edge: #30363d;
  --ink: #e6edf3;          /* 14.6:1 on --bg */
  --ink-dim: #b6c2cf;      /*  9.4:1 on --bg */
  --accent: #7ee787;       /* 12.1:1 on --bg */
  --accent-ink: #0d1117;
  --error: #ff9492;        /*  8.6:1 */
  --warning: #f0b72f;      /*  9.9:1 */
  --focus: #58a6ff;

  --gap: 1.25rem;
  --radius: 10px;
}

:root[data-theme="light"] {
  --bg: #ffffff;
  --panel: #f6f8fa;
  --panel-edge: #d0d7de;
  --ink: #1f2328;          /* 15.3:1 on white */
  --ink-dim: #4a5259;      /*  8.1:1 */
  --accent: #0f5132;       /*  8.9:1 */
  --accent-ink: #ffffff;
  --error: #a40e26;
  --warning: #7a4b00;
  --focus: #0969da;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #ffffff;
    --panel: #f6f8fa;
    --panel-edge: #d0d7de;
    --ink: #1f2328;
    --ink-dim: #4a5259;
    --accent: #0f5132;
    --accent-ink: #ffffff;
    --error: #a40e26;
    --warning: #7a4b00;
    --focus: #0969da;
  }
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  /* rem throughout, so the browser's own text-size setting scales the page --
     a zoom-only design breaks for anyone who has raised their default. */
  font: 1rem/1.6 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 0.75rem 1rem;
  z-index: 10;
}
.skip:focus { left: 0; }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.masthead, main, footer {
  max-width: 62rem;
  margin: 0 auto;
  padding: 0 var(--gap);
}

.masthead { padding-top: 2.5rem; padding-bottom: 0.5rem; }
h1 { font-size: 2.25rem; margin: 0; letter-spacing: -0.01em; }
.tagline { color: var(--ink-dim); margin: 0.25rem 0 1rem; font-size: 1.1rem; }

.privacy {
  border-left: 4px solid var(--accent);
  background: var(--panel);
  padding: 0.75rem 1rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 0 0 1.5rem;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: var(--gap);
}
.panel h2 { margin-top: 0; font-size: 1.25rem; }

.help { color: var(--ink-dim); margin: 0.5rem 0 0; }
.help code, .code {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
}

/* --- drop zone ---------------------------------------------------------- */
.drop {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 9rem;
  border: 2px dashed var(--panel-edge);
  border-radius: var(--radius);
  background: var(--bg);
  cursor: pointer;
  text-align: center;
  padding: 1rem;
}
.drop.over { border-color: var(--accent); border-style: solid; }
.drop-icon { font-size: 2rem; color: var(--accent); }
.drop-text { color: var(--ink-dim); }
/* The input stays in the accessibility tree and is reachable, but the whole
   zone is the click target. */
.drop input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.chosen { list-style: none; padding: 0; margin: 0.75rem 0 0; }
.chosen li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--panel-edge);
  border-radius: 6px;
  margin-bottom: 0.4rem;
  background: var(--bg);
}

/* --- options ------------------------------------------------------------ */
.options { border: 0; padding: 0; margin: 1rem 0 0; }
.opt {
  display: flex;
  gap: 0.7rem;
  align-items: flex-start;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--panel-edge);
  cursor: pointer;
}
.opt:last-child { border-bottom: 0; }
.opt input { margin-top: 0.35rem; width: 1.1rem; height: 1.1rem; }
.size {
  display: inline-block;
  margin-left: 0.4rem;
  padding: 0.05rem 0.4rem;
  border: 1px solid var(--panel-edge);
  border-radius: 999px;
  font-size: 0.85rem;
  color: var(--ink-dim);
  white-space: nowrap;
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1rem;
  align-items: center;
  margin-top: 1rem;
}
.row label { color: var(--ink-dim); }
select, button {
  font: inherit;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--panel-edge);
  border-radius: 6px;
  padding: 0.45rem 0.7rem;
}
button { cursor: pointer; }
button:hover:not(:disabled) { border-color: var(--focus); }

.run {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
  font-weight: 650;
  font-size: 1.05rem;
  padding: 0.65rem 1.6rem;
}
.run:disabled { opacity: 0.5; cursor: not-allowed; }
.remove { padding: 0.25rem 0.6rem; font-size: 0.9rem; }

.status { margin: 0.9rem 0 0; color: var(--ink-dim); min-height: 1.6em; }

.progress {
  height: 6px;
  background: var(--panel-edge);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 0.6rem;
}
.bar {
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 0.25s ease;
}

/* --- result ------------------------------------------------------------- */
.result-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
}
.result-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
#report {
  width: 100%;
  /* A fallback only -- app.js grows the frame to its content so the report
     scrolls with the page rather than inside a window of its own. */
  height: 42rem;
  border: 1px solid var(--panel-edge);
  border-radius: var(--radius);
  background: var(--bg);
  margin-top: 0.75rem;
}

.badges { margin-top: 1rem; }
.badges h3 { margin: 0 0 0.35rem; font-size: 1.05rem; }
.badge-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0;
  border-top: 1px solid var(--panel-edge);
}
.badge-row img {
  max-width: 100%;
  height: auto;
  image-rendering: pixelated;   /* it is pixel art; do not smear it */
  border-radius: 6px;
}

pre.code {
  background: var(--bg);
  border: 1px solid var(--panel-edge);
  border-radius: 6px;
  padding: 0.9rem 1rem;
  overflow-x: auto;
}

footer {
  padding: 1rem var(--gap) 3rem;
  color: var(--ink-dim);
}
a { color: var(--focus); }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
