/* Fonts are self-hosted (SIL Open Font License, see fonts-license.txt). Only Latin files are
   served; other scripts such as Urdu, Arabic or Chinese use the device fonts.
   The fallback face is Arial resized to Schibsted Grotesk metrics, so text does not re-wrap
   (and the layout does not jump) when the real font arrives. */
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 400 500; font-display: swap; src: url("/jetbrains-mono-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 400 500; font-display: swap; src: url("/jetbrains-mono-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Schibsted Grotesk"; font-style: normal; font-weight: 400 700; font-display: swap; src: url("/schibsted-grotesk-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Schibsted Grotesk"; font-style: normal; font-weight: 400 700; font-display: swap; src: url("/schibsted-grotesk-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Schibsted Grotesk Fallback"; font-weight: 100 500; src: local("Arial"); size-adjust: 103.99%; ascent-override: 94.24%; descent-override: 25%; line-gap-override: 0%; }
@font-face { font-family: "Schibsted Grotesk Fallback"; font-weight: 501 900; src: local("Arial Bold"), local("Arial"); size-adjust: 100.73%; ascent-override: 97.29%; descent-override: 25.81%; line-gap-override: 0%; }

/* Diffline shared styles. Layout: one working column; inputs as a twin pair, results below in a ruled diff sheet */
:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --fg: #1b2230;
  --muted: #5d6779;
  --line: #dde1e8;
  --accent: #2f5bd3;
  --accent-ink: #ffffff;
  --del-bg: #fde8e8;
  --del-strong: #f6b7b7;
  --del-fg: #a3262a;
  --ins-bg: #e3f5e8;
  --ins-strong: #a8e0b7;
  --ins-fg: #1d6b37;
  --gap-bg: #eef0f4;
  --font-ui: "Schibsted Grotesk", "Schibsted Grotesk Fallback", "Segoe UI", system-ui, sans-serif;
  --font-code: "JetBrains Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12151c; --surface: #1a1f29; --fg: #e4e8ef; --muted: #98a2b4; --line: #2c3342;
    --accent: #7b9cf5; --accent-ink: #0d1220;
    --del-bg: #3a1c20; --del-strong: #6e2a30; --del-fg: #ffb3b6;
    --ins-bg: #173024; --ins-strong: #25603c; --ins-fg: #9be3b2;
    --gap-bg: #161a22; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #12151c; --surface: #1a1f29; --fg: #e4e8ef; --muted: #98a2b4; --line: #2c3342;
  --accent: #7b9cf5; --accent-ink: #0d1220;
  --del-bg: #3a1c20; --del-strong: #6e2a30; --del-fg: #ffb3b6;
  --ins-bg: #173024; --ins-strong: #25603c; --ins-fg: #9be3b2;
  --gap-bg: #161a22; color-scheme: dark;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--font-ui); font-size: 15px; line-height: 1.5; }
a { color: var(--accent); }
.wrap { max-width: 1240px; margin: 0 auto; padding-block: 20px 48px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); display: flex; flex-direction: column; gap: 18px; }

/* Site header and nav */
.site-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 20px; }
.logo { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; color: var(--fg); text-decoration: none; }
.logo span { color: var(--del-fg); }
.logo b { color: var(--ins-fg); font-weight: 700; }
.nav { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 14px; }
.nav a { color: var(--muted); text-decoration: none; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--fg); text-decoration: underline; text-underline-offset: 3px; }

.intro { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 16px; }
.tag { color: var(--fg); font-size: 20px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.3; margin: 0; }
.privacy { font-size: 13px; font-weight: 600; color: var(--ins-fg); background: var(--ins-bg); padding: 4px 12px; border-radius: 999px; display: inline-flex; gap: 7px; align-items: center; }
.privacy i { width: 8px; height: 8px; border-radius: 50%; background: var(--ins-fg); display: inline-block; }

/* Diff tool */
.inputs { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.pane { display: flex; flex-direction: column; min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.pane.drag { outline: 2px dashed var(--accent); outline-offset: -4px; }
.pane-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.pane-title { font-weight: 600; font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.pane-meta { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
textarea { width: 100%; min-height: 240px; resize: vertical; border: 0; padding: 12px; font-family: var(--font-code); font-size: 13px; line-height: 1.6; background: var(--surface); color: var(--fg); tab-size: 4; }
textarea:focus { outline: none; box-shadow: inset 0 0 0 2px var(--accent); }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; justify-content: space-between; }
.group { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
button, .filebtn { font: inherit; font-size: 14px; border: 1px solid var(--line); background: var(--surface); color: var(--fg); padding: 7px 12px; border-radius: 6px; cursor: pointer; }
button:hover, .filebtn:hover { border-color: var(--accent); }
button:focus-visible, .filebtn:focus-within, input:focus-visible + .sw { outline: 2px solid var(--accent); outline-offset: 2px; }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.filebtn { font-size: 12px; padding: 3px 9px; }
.filebtn input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.seg button { border: 0; border-radius: 0; }
.seg button[aria-pressed="true"] { background: var(--fg); color: var(--bg); }
label.opt { display: inline-flex; gap: 7px; align-items: center; font-size: 14px; cursor: pointer; user-select: none; }
label.opt input { accent-color: var(--accent); width: 16px; height: 16px; }
details.helpers summary { cursor: pointer; font-size: 14px; color: var(--muted); list-style: none; display: inline-flex; align-items: center; gap: 6px; }
details.helpers summary::-webkit-details-marker { display: none; }
details.helpers summary::before { content: "\203A"; font-size: 18px; line-height: 1; transition: transform .15s; }
details.helpers[open] summary::before { transform: rotate(90deg); }
details.helpers summary:hover { color: var(--fg); }
details.helpers[open] .group { margin-top: 8px; }

.results { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.summary:empty { display: none; }
.summary { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; font-size: 14px; }
.pill { display: inline-flex; gap: 6px; align-items: center; padding: 2px 10px; border-radius: 999px; font-weight: 600; font-size: 13px; }
.pill.del { background: var(--del-bg); color: var(--del-fg); }
.pill.ins { background: var(--ins-bg); color: var(--ins-fg); }
.pill.chg { background: var(--gap-bg); color: var(--fg); }
.sim { color: var(--muted); margin-left: auto; }
.scroll { overflow-x: auto; }
table.diff { width: 100%; border-collapse: collapse; font-family: var(--font-code); font-size: 13px; line-height: 1.55; table-layout: fixed; min-width: 640px; }
table.diff.uni { min-width: 420px; }
td { vertical-align: top; padding: 1px 10px; white-space: pre-wrap; word-break: break-word; }
td.ln { width: 52px; text-align: right; color: var(--muted); user-select: none; font-variant-numeric: tabular-nums; padding-right: 8px; border-right: 1px solid var(--line); }
td.sign { width: 22px; text-align: center; user-select: none; padding: 1px 0; }
td.split { border-left: 1px solid var(--line); }
tr.del td.txt.l, td.l.del, tr.uni-del td { background: var(--del-bg); }
tr.ins td.txt.r, td.r.ins, tr.uni-ins td { background: var(--ins-bg); }
td.l.chg { background: var(--del-bg); }
td.r.chg { background: var(--ins-bg); }
td.empty { background: repeating-linear-gradient(135deg, transparent 0 6px, var(--gap-bg) 6px 12px); }
mark.d { background: var(--del-strong); color: inherit; border-radius: 2px; }
mark.i { background: var(--ins-strong); color: inherit; border-radius: 2px; }
tr.uni-del .sign { color: var(--del-fg); }
tr.uni-ins .sign { color: var(--ins-fg); }
tr.gap td { background: var(--gap-bg); color: var(--muted); font-family: var(--font-ui); font-size: 12px; text-align: center; padding: 4px; }
.state { padding: 36px 16px; text-align: center; color: var(--muted); }
.state strong { display: block; color: var(--fg); font-size: 17px; margin-bottom: 4px; }
.hint { font-size: 12px; color: var(--muted); }
kbd { font-family: var(--font-code); font-size: 11px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 0 4px; }

/* Content pages and the guide below the tool */
.prose { max-width: 760px; width: 100%; margin: 12px auto 0; font-size: 16px; line-height: 1.7; }
.prose h1 { font-size: 30px; line-height: 1.2; letter-spacing: -0.02em; margin: 8px 0 12px; }
.prose h2 { font-size: 22px; line-height: 1.3; letter-spacing: -0.01em; margin: 48px 0 14px; }
.prose h3 { font-size: 17px; margin: 22px 0 6px; }
.prose p, .prose ul, .prose ol { margin: 0 0 14px; }
.prose li { margin-bottom: 6px; }
.prose .lead { color: var(--muted); font-size: 17px; }
.prose .updated { color: var(--muted); font-size: 14px; }
.prose code { font-family: var(--font-code); font-size: 0.88em; background: var(--gap-bg); padding: 1px 5px; border-radius: 4px; }
details.faq { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 12px 16px; margin-bottom: 10px; }
details.faq summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
details.faq summary::-webkit-details-marker { display: none; }
details.faq summary::after { content: "+"; font-size: 20px; line-height: 1; color: var(--muted); }
details.faq[open] summary::after { content: "\2212"; }
details.faq:hover { border-color: var(--accent); }
details.faq[open] summary { margin-bottom: 8px; }
details.faq p:last-child { margin-bottom: 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 16px; margin: 0 0 14px; }
.email-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.email { font-family: var(--font-code); font-size: 16px; word-break: break-all; }
.big404 { font-size: 64px; font-weight: 700; letter-spacing: -0.03em; margin: 0; line-height: 1; }
.big404 span { color: var(--del-fg); }
.big404 b { color: var(--ins-fg); }

/* Footer */
.site-footer { border-top: 1px solid var(--line); margin-top: 32px; padding-top: 18px; display: flex; flex-wrap: wrap; gap: 10px 24px; justify-content: space-between; align-items: center; font-size: 14px; color: var(--muted); }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--fg); }
.site-footer .support { color: var(--accent); font-weight: 600; }

@media (max-width: 720px) {
  .inputs { grid-template-columns: 1fr; }
  textarea { min-height: 170px; }
  .sim { margin-left: 0; }
  .prose h1 { font-size: 26px; }
  .tag { font-size: 17px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Theme toggle */
.head-right { display: flex; align-items: center; gap: 16px; min-width: 0; }
.head-right .nav { min-width: 0; }
.theme-btn { flex: none; width: 34px; height: 34px; padding: 0; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); }
.theme-btn:hover { color: var(--fg); }
.theme-btn svg { width: 18px; height: 18px; }

/* Home page main landmark keeps the same column spacing as .wrap */
.main { display: flex; flex-direction: column; gap: 18px; min-width: 0; }

/* Copy result button in the summary bar */
.copy-result { font-size: 13px; padding: 3px 10px; }

/* Word count changes in the summary bar */
.words { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* Large texts: background compare note, stale result note, and the "Show more" row */
.busy { font-size: 14px; color: var(--muted); }
.stale { font-size: 13px; font-weight: 600; color: var(--accent); }
tr.more td { text-align: center; padding: 10px; font-family: var(--font-ui); }

/* Guide sections: accordion on mobile (and without JS), tabs from 720px (tabs.js adds .tabbed) */
.guide { margin-top: 40px; }
.guide details.panel { border-bottom: 1px solid var(--line); }
.guide details.panel:first-of-type { border-top: 1px solid var(--line); }
.guide summary { cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 2px; }
.guide summary::-webkit-details-marker { display: none; }
.guide summary::after { content: "+"; font-size: 22px; line-height: 1; color: var(--muted); }
.guide details[open] summary::after { content: "\2212"; }
.guide summary h2 { margin: 0; font-size: 19px; }
.guide .panel-body { padding: 2px 2px 12px; }
.tablist { display: none; }
.guide.tabbed .tablist { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 24px; overflow-x: auto; overflow-y: hidden; }
.guide.tabbed summary { display: none; }
.guide.tabbed details.panel { border: 0; }
.guide.tabbed .panel-body { padding: 0; }
.tab { border: 0; border-radius: 6px 6px 0 0; background: none; padding: 10px 16px; font-size: 15px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.tab:hover { color: var(--fg); background: var(--gap-bg); }
.tab[aria-selected="true"] { color: var(--fg); box-shadow: inset 0 -2px 0 var(--accent); }

/* JSON tools bar on /compare-json */
.json-tools { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; }

/* File name shown next to Original / Changed after a file is opened; long names end in "..." */
.pane-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pane-file { text-transform: none; letter-spacing: 0; font-weight: 500; color: var(--fg); }
.pane-file:not(:empty)::before { content: "\00B7  "; color: var(--muted); }
