/* site.css (danielwmorgan.town, loaded first) sets the page, header, footer, fonts and link colours.
   These tokens map its colours onto the converter's controls. Its .dark/.light classes (set by theme.js) beat
   the system setting, so every dark value is set twice: system dark without .light, and .dark. */
:root {
  --bg: var(--background-color);  --fg: var(--text-color);  --accent: var(--text-color-link);  --accent-fg: #ffffff;
  --surface: #f4f4f5;  --panel: #f6f8fa;  --muted: #5c5c5c;  --line: #d4d4d4;  --border: #8c8c8c;
  --err: #b3261e;     --ok: #1a6b34;       --warn: #7a5200;
  --font: var(--font-family);
  --text: 1rem;  --small: .875rem;  --h2: 1.125rem;  --h1: 1.75rem;  --lh: 1.5;
  --s1: 4px;  --s2: 8px;  --s3: 16px;  --s4: 24px;  --s5: 40px;
  --radius: 6px;
}
@media (prefers-color-scheme: dark) {
  :root:not(.light) {
    --surface: #1c2a38;  --panel: #22303f;  --muted: #a6b0bb;  --line: #2e3d4d;  --border: #7a8899;  --accent-fg: #15202b;
    --err: #ffb4ab;   --ok: #7dd69a;       --warn: #f0c674;
  }
}
.dark {
  --surface: #1c2a38;  --panel: #22303f;  --muted: #a6b0bb;  --line: #2e3d4d;  --border: #7a8899;  --accent-fg: #15202b;
  --err: #ffb4ab;   --ok: #7dd69a;       --warn: #f0c674;
  color-scheme: dark;
}
/* site.css repeats its system-dark :root block after its .light rule, so .light alone loses on a dark system:
   restate the site's light values (from its .light rule) with a stronger selector. */
:root.light {
  --color-gray-90: #333;  --background-color: #fff;  --text-color-link: #082840;  --text-color-link-active: #5f2b48;
  --text-color-link-visited: #17050F;  --code-bg: #c6c6d7;  --code-text: #333;  --code: #333;
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { font: var(--text)/var(--lh) var(--font); }
h1 { font-size: var(--h1); font-weight: 700; line-height: 1.2; margin: 0 0 var(--s2); }
h2 { font-size: var(--h2); font-weight: 600; margin: 0 0 var(--s2); }
.lead { font-size: var(--text); }
.muted { font-size: var(--small); color: var(--muted); }
.vh { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
main > section, #app, .fine { margin-top: var(--s5); }
#convert { margin-top: var(--s4); }
#who, #file-label, #result-text, .q-name { overflow-wrap: anywhere; }

/* controls */
:focus-visible, .drop:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
label { display: block; font-weight: 600; margin-bottom: var(--s1); }
input[type=text] { display: block; width: 100%; min-height: 44px; padding: 0 var(--s2); font: inherit; color: var(--fg); background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); }
main button { min-height: 44px; padding: 0 var(--s3); font: inherit; font-weight: 600; background: var(--accent); color: var(--accent-fg); border: 1px solid var(--accent); border-radius: var(--radius); cursor: pointer; }
main button:hover:not(:disabled) { filter: brightness(1.1); }
main button:disabled { opacity: .5; cursor: not-allowed; }
main button.secondary { background: transparent; color: var(--accent); }
main button.link { background: none; border: 0; color: var(--accent); text-decoration: underline; padding: 0 var(--s1); }
#code-form button { margin-top: var(--s2); }

.drop { position: relative; display: block; margin: 0; padding: var(--s4) var(--s3); text-align: center; font-weight: 400; border: 1px dashed var(--border); border-radius: var(--radius); background: var(--surface); cursor: pointer; }
#file-label, #file-hint { display: block; }
#file-label { font-weight: 600; }
.drop.over { border-style: solid; border-color: var(--accent); }

/* the batch list */
/* the batch list: its own panel, lighter than the page in dark mode, a soft tint in light mode */
#queue { list-style: none; margin: var(--s3) 0 0; padding: 0 var(--s3); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
#queue li { padding: var(--s3) 0; border-bottom: 1px solid var(--line); }
#queue li:last-child { border-bottom: 0; }
#queue li[draggable=true] { cursor: grab; }
#queue li.dragging { opacity: .5; }
#queue button.secondary { background: var(--bg); }
.q-name { font-weight: 600; }
.q-name .muted { font-weight: 400; }
.q-st.err { color: var(--err); }
.q-pre, .q-pre summary { font-size: var(--small); color: var(--muted); }
#queue .q-pre li { padding: 0; border: 0; }
.q-pre ul { margin: var(--s1) 0 0; padding-left: var(--s4); }
.q-range { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s2); align-items: center; margin-top: var(--s2); }
.q-range label { margin: 0; font-weight: 400; font-size: var(--small); color: var(--muted); }
#queue .q-range input[type=text] { width: 9rem; min-height: 36px; }
.q-range .err { color: var(--err); }
.q-ctl { display: flex; flex-wrap: wrap; gap: var(--s2); margin-top: var(--s2); }
#queue button { width: auto; }
.check { display: flex; gap: var(--s2); align-items: flex-start; min-height: 44px; margin: var(--s3) 0 0; font-weight: 400; }
.check input { flex: none; width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--accent); }
#font-map { margin-top: var(--s3); }
#font-map summary { cursor: pointer; font-weight: 600; padding: 10px 0; min-height: 44px; box-sizing: border-box; }
.fm-row { margin: var(--s2) 0; }
.fm-row label { display: block; margin: 0 0 var(--s1); font-weight: 400; overflow-wrap: anywhere; }
.fm-row input { display: block; width: 100%; max-width: 24rem; min-height: 44px; padding: 0 var(--s2); font: inherit; color: var(--fg); background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); }
#more-opts { margin-top: var(--s3); }
#more-opts summary { cursor: pointer; font-weight: 600; padding: 10px 0; min-height: 44px; box-sizing: border-box; }
#more-opts select { display: block; width: 100%; max-width: 24rem; min-height: 44px; padding: 0 var(--s2); font: inherit; color: var(--fg); background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); }
#more-opts label:not(.check) { margin: var(--s3) 0 var(--s1); }
progress { display: block; width: 100%; height: 8px; margin-top: var(--s3); accent-color: var(--accent); }

.msg { margin-top: var(--s3); padding: var(--s2) var(--s3); border-left: 3px solid var(--border); background: var(--surface); border-radius: 0 var(--radius) var(--radius) 0; }
.msg:empty { display: none; }
.msg.error { border-left-color: var(--err); }
.msg.warn { border-left-color: var(--warn); }
.msg.ok { border-left-color: var(--ok); }

#account { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s3); align-items: baseline; }
#balance { font-weight: 600; }
#result { margin-top: var(--s3); }

.actions { display: flex; flex-wrap: wrap; gap: var(--s2); }

/* reference, not part of the tool: a rule and extra space set it apart */
#compare { padding-top: var(--s5); border-top: 1px solid var(--border); }
#compare table { width: 100%; border-collapse: collapse; font-size: var(--small); margin: var(--s3) 0; }
#compare th, #compare td { text-align: left; vertical-align: top; padding: var(--s2); border-bottom: 1px solid var(--line); overflow-wrap: break-word; }
#compare thead th { border-bottom-color: var(--border); }

.fine p { margin: 0 0 var(--s1); }
.legal h2 { margin-top: var(--s4); }

/* screenshot: zooms into a full-size dialog */
.shot { display: block; margin-top: var(--s3); cursor: zoom-in; border-radius: var(--radius); }
.shot img, #zoom img { display: block; height: auto; }
.shot img { width: 100%; }
#zoom { width: 100vw; height: 100vh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; overflow: auto; background: transparent; cursor: zoom-out; }
#zoom::backdrop { background: rgb(0 0 0 / .85); }
#zoom img { width: 2000px; max-width: none; margin: 0 auto; }
#zoom-close { position: sticky; top: var(--s2); left: 100%; z-index: 1; margin: var(--s2); }

@media (max-width: 479px) {
  h1 { font-size: 1.5rem; }
  main button:not(.link), input[type=text] { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
