@font-face { font-family: "Newsreader"; src: url("fonts/newsreader-latin-opsz-normal.woff2") format("woff2"); font-weight: 200 800; font-style: normal; font-display: swap; }
@font-face { font-family: "Newsreader"; src: url("fonts/newsreader-latin-opsz-italic.woff2") format("woff2"); font-weight: 200 800; font-style: italic; font-display: swap; }
/* Arabic in the same family name: the browser picks it per character */
@font-face { font-family: "Newsreader"; src: url("fonts/noto-naskh-arabic-arabic-wght-normal.woff2") format("woff2"); font-weight: 400 700; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+200C-200E, U+FB50-FDFF, U+FE70-FEFC; }

:root {
  --ground: #e8e5de;
  --ink: #1a1918;
  --soft: rgb(26 25 24 / 0.6);
  --rule: rgb(26 25 24 / 0.85);
  --hair: rgb(26 25 24 / 0.18);
  --del: #c8102e;
  --ins: #1846c8;
  --ins-wash: rgb(24 70 200 / 0.1);
  --serif: "Newsreader", "Noto Naskh Arabic", Georgia, "Times New Roman", serif;
  --display: var(--serif);
  --muted: var(--soft);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --ground: #1b1a18; --ink: #e8e5de; --soft: rgb(232 229 222 / 0.62); --rule: rgb(232 229 222 / 0.8); --hair: rgb(232 229 222 / 0.18); --del: #ff6b6b; --ins: #7fa7ff; --ins-wash: rgb(127 167 255 / 0.14); color-scheme: dark; }
}
:root[data-theme="dark"] { --ground: #1b1a18; --ink: #e8e5de; --soft: rgb(232 229 222 / 0.62); --rule: rgb(232 229 222 / 0.8); --hair: rgb(232 229 222 / 0.18); --del: #ff6b6b; --ins: #7fa7ff; --ins-wash: rgb(127 167 255 / 0.14); color-scheme: dark; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--ground); color: var(--ink); font: 400 17px/1.5 var(--serif); font-optical-sizing: auto; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-underline-offset: 3px; text-decoration-color: var(--soft); }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: 0.35; }
:focus-visible { outline: 2px solid var(--ins); outline-offset: 2px; }

.app { display: flex; flex-direction: column; min-height: 100dvh; max-width: 1280px; margin: 0 auto; padding: 0 32px; }

/* A newspaper masthead: thick rule, name, thin rule */
.masthead { display: flex; align-items: baseline; gap: 6px 22px; flex-wrap: wrap; padding: 14px 0 10px; border-bottom: 3px double var(--rule); }
.brand { margin: 0; font: 700 40px/1 var(--serif); letter-spacing: -0.02em; }
.brand i { font-weight: 400; color: var(--del); }
.purpose { flex: 1; margin: 0; font-style: italic; font-size: 18px; color: var(--soft); }
.bar-meta { font-size: 13px; color: var(--soft); }

/* Two steps, each with a numbered heading: paste, then read what changed */
.step-title { display: flex; align-items: center; gap: 10px; margin: 0; font: 700 19px/1.2 var(--serif); }
.step-title .num { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--ink); color: var(--ground); font-size: 14px; }
.step:first-of-type { padding-top: 14px; }
.inputs { display: grid; grid-template-columns: 1fr 1fr; margin-top: 8px; border-top: 1px solid var(--hair); }
.under { display: flex; align-items: center; gap: 8px 20px; flex-wrap: wrap; padding: 8px 0 14px; border-bottom: 1px solid var(--rule); font-size: 15px; }
.results { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.box { display: flex; flex-direction: column; padding: 10px 0 12px; }
.box + .box { padding-inline-start: 24px; border-inline-start: 1px solid var(--hair); }
.box:first-child { padding-inline-end: 24px; }
.label { font-size: 12px; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase; }
.label small { margin-inline-start: 8px; font-weight: 500; letter-spacing: 0.04em; text-transform: none; color: var(--soft); }
textarea { height: 150px; margin-top: 6px; padding: 8px 0; border: 0; border-top: 1px solid var(--hair); background: none; resize: vertical; font-size: 16px; line-height: 1.5; }
textarea:focus { outline: none; border-top-color: var(--ink); }
textarea::placeholder { color: var(--soft); font-style: italic; }

/* The verdict line: one big number, then the tally and the tools */
.verdict { display: flex; align-items: baseline; gap: 6px 18px; flex-wrap: wrap; padding: 14px 0 6px; }
.score { display: flex; align-items: baseline; gap: 8px; margin: 0; }
.score b { font: 700 40px/0.9 var(--serif); letter-spacing: -0.03em; font-variant-numeric: lining-nums; }
.score span { font-size: 17px; color: var(--soft); }
.tally { margin: 0; font-size: 16px; color: var(--soft); }
.tools { display: flex; align-items: center; gap: 10px 22px; flex-wrap: wrap; padding: 6px 0 10px; border-bottom: 1px solid var(--rule); font-size: 15px; }
.tools .link { margin-inline-start: auto; }
.seg { display: flex; border: 1px solid var(--rule); }
.seg button { padding: 4px 12px; border: 0; background: none; }
.seg button + button { border-inline-start: 1px solid var(--rule); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--ground); }
.ignore { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 0; padding: 0; border: 0; }
.ignore legend { float: inline-start; margin-inline-end: 2px; font-style: italic; color: var(--soft); }
.ignore label { display: flex; align-items: center; gap: 4px; cursor: pointer; }
.ignore input { accent-color: var(--ink); }
.nav { display: flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }
.nav button { width: 30px; height: 30px; border: 1px solid var(--rule); background: none; }
.link { padding: 0; border: 0; background: none; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--soft); }
.link:hover { text-decoration-color: var(--ink); }

/* The list of changes: one per line, numbered, easy to scan */
.changes { max-width: 72ch; margin: 0 auto; padding: 0; list-style: none; }
.changes li + li { border-top: 1px solid var(--hair); }
.item { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; width: 100%; padding: 10px 4px; border: 0; background: none; text-align: start; font-size: 19px; line-height: 1.45; }
.item:hover { background: var(--ins-wash); }
.item .num { min-width: 1.6em; color: var(--soft); font-size: 14px; font-variant-numeric: tabular-nums; }
.item .arrow { color: var(--soft); }
.item small { color: var(--soft); font-size: 14px; font-style: italic; }
.item ins { background: none; }

/* The page: a printed column with pencil marks */
.page { flex: 1; min-height: 0; overflow-y: auto; padding: 22px 0 28px; }
.result { max-width: 72ch; margin: 0 auto; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 20px; line-height: 1.9; }
del { color: var(--del); text-decoration: line-through 2px; text-decoration-color: var(--del); }
ins { color: var(--ins); text-decoration: underline 2px; text-underline-offset: 4px; background: var(--ins-wash); }
del + ins { margin-inline-start: 0.35em; }
.change { padding-inline: 0.1em; }
.change.current, del.current, ins.current { outline: 2px solid var(--ink); outline-offset: 3px; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 0 40px; }
.split .result { max-width: none; margin: 0; font-size: 18px; }
.split .result + .result { padding-inline-start: 40px; border-inline-start: 1px solid var(--hair); }
.empty { max-width: 60ch; margin: 24px auto 0; text-align: center; font-size: 20px; font-style: italic; color: var(--soft); }
.empty p { margin: 0 0 8px; }
.examples { font-style: normal; font-size: 17px; }
.demo { margin-bottom: 14px !important; font: 400 clamp(28px, 6vw, 44px)/1.3 var(--serif); font-style: normal; color: var(--ink); }
.key { margin-bottom: 26px !important; font-style: normal; font-size: 17px; }
.key .cut { color: var(--del); font-weight: 600; }
.key .add { color: var(--ins); font-weight: 600; }
.examples .link { color: var(--ink); }
.note { max-width: 72ch; margin: 0 auto 14px; padding-bottom: 8px; border-bottom: 1px solid var(--hair); font-style: italic; color: var(--soft); }

.foot { padding: 8px 0 12px; border-top: 1px solid var(--hair); font-size: 13px; font-style: italic; color: var(--soft); }
.toast { position: fixed; left: 50%; bottom: 24px; margin: 0; padding: 8px 16px; background: var(--ink); color: var(--ground); transform: translate(-50%, 12px); opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast button { margin-inline-start: 6px; padding: 2px 10px; border: 1px solid var(--ground); background: none; color: var(--ground); font: inherit; cursor: pointer; }
.ignore small, .nav .keys { color: var(--soft); font-size: 12.5px; }
.bar-meta .lang { margin-inline-start: 12px; unicode-bidi: isolate; }
:lang(ar) :is(.label, .brand) { letter-spacing: 0; }

@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }
@media (min-width: 900px) and (min-height: 640px) { .app { height: 100dvh; } }
@media (max-width: 899px) {
  .app { padding: 0 16px; }
  .brand { font-size: 32px; }
  .purpose { flex-basis: 100%; order: 3; font-size: 16px; }
  .inputs { grid-template-columns: 1fr; }
  .box:first-child { padding-inline-end: 0; }
  .box + .box { padding-inline-start: 0; border-inline-start: 0; border-top: 1px solid var(--hair); }
  textarea { height: 110px; }
  .tools .link { margin-inline-start: 0; }
  .item { font-size: 17px; }
  .result { font-size: 18px; }
  .split { grid-template-columns: 1fr; gap: 18px; }
  .split .result + .result { padding: 18px 0 0; border-inline-start: 0; border-top: 1px solid var(--hair); }
}

/* Questions under the tool: for people who scroll, and for search engines */
.faq { max-width: 920px; margin: 0 auto; padding: 56px 20px 64px; }
.faq h2 { margin: 0 0 20px; font: 700 22px/1.2 var(--display); letter-spacing: -0.02em; }
.faq-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 22px 32px; }
.faq h3 { margin: 0 0 6px; font-size: 15px; font-weight: 700; }
.faq p { margin: 0; color: var(--muted); line-height: 1.6; }

/* Light/dark button (theme.js): follows the device until the visitor picks */
.theme { display: inline-grid; place-items: center; width: 28px; height: 28px; margin-inline-start: 8px; padding: 0; border: 0; border-radius: 8px; background: none; color: var(--ink); cursor: pointer; vertical-align: middle; }
.theme:hover { background: var(--hair); }
.theme svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.theme .sun, .theme[data-dark="true"] .moon { display: none; }
.theme[data-dark="true"] .sun { display: block; }
