/* Cool office-paper page; the one loud element is the highlighter on the pasted text. */
:root {
  --paper: #f6f8fa;
  --sheet: #ffffff;
  --ink: #18263a;
  --muted: #4d5b6d;
  --rule: #d5dce4;
  --edge: #7d8a9b;   /* input boundary, >= 3:1 on --sheet */
  --faint: #64707f;  /* placeholder: lighter than typed text, still >= 4.5:1 */
  --ink-hover: #2c3d55;
  --marker: #ffe24a;
  --marker-ink: #18263a;
  --high: #b3122a;
  --medium: #9a4a00;
  --low: #3d5a80;
  --none: #1d6b5c;
  --focus: #2457c5;
  /* 4px grid; inner gaps < outer gaps */
  --s1: .25rem; --s2: .5rem; --s3: .75rem; --s4: 1rem; --s6: 1.5rem; --s8: 2rem; --s10: 2.5rem; --s12: 3rem;
  --sans: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --display: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --serif: Charter, "Bitstream Charter", "Iowan Old Style", "Sitka Text", Cambria, Georgia, serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #131a24; --sheet: #1a2330; --ink: #e6ebf1; --muted: #a5b1c0; --rule: #2e3a4a; --edge: #66768b; --faint: #8f9bab; --ink-hover: #c9d2dd;
    --marker: #6b5a00; --marker-ink: #fff6c2;
    --high: #ff7a8a; --medium: #ffb35c; --low: #9cb8e0; --none: #6fd3bd; --focus: #8fb2ff;
  }
}
:root[data-theme="dark"] {
  --paper: #131a24; --sheet: #1a2330; --ink: #e6ebf1; --muted: #a5b1c0; --rule: #2e3a4a; --edge: #66768b; --faint: #8f9bab; --ink-hover: #c9d2dd;
  --marker: #6b5a00; --marker-ink: #fff6c2;
  --high: #ff7a8a; --medium: #ffb35c; --low: #9cb8e0; --none: #6fd3bd; --focus: #8fb2ff;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 1rem/1.55 var(--sans); }
main { max-width: 44rem; margin: 0 auto; padding: var(--s6) var(--s4) 4rem; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 2px; }

.top { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--s10); }
.brand { margin: 0; display: flex; align-items: center; gap: var(--s2); font: 400 1.75rem/1 var(--display); }
.mark { width: 28px; height: 28px; flex: none; }
.langs { display: flex; gap: var(--s2); }
.note { color: var(--muted); font-size: .875rem; max-width: 36rem; margin: 0 0 var(--s8); }
.lang { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; font: inherit; font-weight: 600; background: none; color: var(--ink); border: 1px solid var(--rule); border-radius: 6px; padding: var(--s1) var(--s3); min-height: 44px; min-width: 44px; cursor: pointer; }

h1 { font-family: var(--display); font-size: clamp(2.25rem, 8vw, 3rem); line-height: 1.05; letter-spacing: -0.01em; font-weight: 400; margin: 0 0 var(--s3); text-wrap: balance; }
.lede { color: var(--muted); max-width: 36rem; margin: 0 0 var(--s3); }
h2 { font: 400 1.875rem/1.1 var(--display); margin: 0 0 var(--s4); }

.check { margin-bottom: var(--s10); }
.label { display: block; font-weight: 600; margin-bottom: var(--s2); }
textarea {
  width: 100%; min-height: 12rem; resize: vertical; padding: var(--s3) var(--s4);
  font: 1.0625rem/1.6 var(--serif); color: var(--ink); background: var(--sheet);
  border: 1px solid var(--edge); border-radius: 8px;
}
textarea::placeholder { color: var(--faint); opacity: 1; }
textarea[aria-invalid] { border-color: var(--high); }
.err { color: var(--high); font-weight: 600; margin: var(--s2) 0 0; }
button { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.primary:hover { background: var(--ink-hover); }
.link:hover, a:hover { text-decoration-thickness: 2px; }
.lang:hover { border-color: var(--ink); }
.lang[aria-current="true"] { background: var(--ink); color: var(--paper); }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3) var(--s6); margin-top: var(--s4); }
.primary { font: inherit; font-weight: 600; color: var(--sheet); background: var(--ink); border: 0; border-radius: 8px; padding: 0 var(--s8); min-height: 48px; cursor: pointer; }
.primary:active { transform: translateY(1px); }
@media (max-width: 30rem) { .primary { width: 100%; } }
.examples { color: var(--muted); font-size: .875rem; display: inline-flex; flex-wrap: wrap; gap: var(--s1) var(--s3); align-items: center; }
.link { font: inherit; color: var(--ink); background: none; border: 0; padding: var(--s2) 0; min-height: 44px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

.result { margin-bottom: var(--s12); scroll-margin-top: var(--s4); }
.result:focus { outline: none; }
.verdict { font: 400 clamp(2.75rem, 11vw, 4rem)/1 var(--display); letter-spacing: -0.01em; margin: 0; text-wrap: balance; }
.result[data-level="high"] .verdict { color: var(--high); }
.result[data-level="medium"] .verdict { color: var(--medium); }
.result[data-level="low"] .verdict { color: var(--low); }
.result[data-level="none"] .verdict { color: var(--none); }
.result[data-level="unsupported"] .verdict { color: var(--muted); }
.verdict-note { font-size: 1.125rem; font-weight: 500; margin: var(--s3) 0 var(--s6); max-width: 36rem; }

.marked {
  font: 1.0625rem/1.75 var(--serif); background: var(--sheet); border: 1px solid var(--rule); border-radius: 8px;
  padding: var(--s4); white-space: pre-wrap; overflow-wrap: anywhere; margin-bottom: var(--s8);
}
.marked mark {
  color: var(--marker-ink); padding: .05em .1em; border-radius: .15em;
  background: linear-gradient(100deg, var(--marker), var(--marker)) no-repeat 0 0 / 100% 100%;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}
.ref { font: 700 .75rem/1 var(--sans); color: var(--muted); margin: 0 .1em 0 .05em; }
.ref a { text-decoration: none; padding: .4em 0; }
.ref a:hover { text-decoration: underline; }

.findings { list-style: none; counter-reset: f; margin: 0; padding: 0; border-bottom: 1px solid var(--rule); }
.findings:empty { display: none; }
.findings li { counter-increment: f; display: grid; gap: var(--s2) var(--s6); padding: var(--s4) 0; border-top: 1px solid var(--rule); }
/* arriving from a number in the text: the finding is marked with the highlighter colour */
.findings li { scroll-margin-top: var(--s4); }
.findings li:target { background: var(--sheet); box-shadow: inset 4px 0 0 var(--marker); padding-left: var(--s4); padding-right: var(--s4); }
.findings h3 { font-size: 1rem; line-height: 1.4; margin: 0; }
.findings h3::before { content: counter(f) ". "; color: var(--muted); }
.findings li.strong h3 { color: var(--high); }
.findings p { margin: 0; }
.findings .src { font-size: .875rem; color: var(--muted); }
.findings .src a { text-decoration-color: var(--edge); }
@media (min-width: 42rem) {
  .findings li { grid-template-columns: 12rem 1fr; }
  .findings h3 { grid-row: span 2; }
}

.todo, .checklist { border-top: 1px solid var(--rule); padding-top: var(--s6); margin-bottom: var(--s8); }
.todo ul { padding-left: var(--s6); margin: 0; }
.todo li { margin-bottom: var(--s3); }
.boxes { list-style: none; padding: 0; margin: 0; }
.boxes li { margin-bottom: var(--s1); }
.boxes label { display: flex; gap: var(--s3); align-items: flex-start; min-height: 44px; padding: var(--s2) 0; cursor: pointer; }
.boxes input { width: 1.25rem; height: 1.25rem; margin: .15rem 0 0; flex: none; accent-color: var(--none); }

.fine { border-top: 1px solid var(--rule); padding-top: var(--s6); color: var(--muted); font-size: .875rem; }

/* The single motion moment: the highlighter sweeps across each mark once when a result appears. */
@media (prefers-reduced-motion: no-preference) {
  .marked mark { animation: sweep .45s cubic-bezier(.2, .7, .2, 1) both; }
  @keyframes sweep { from { background-size: 0% 100%; } to { background-size: 100% 100%; } }
}
