/* All sites' styles. Error type colors (.err-<type>, .fg-<type>) come from $error_colors (docheader.inc.php).
   Uses logical properties (margin-inline-start, …) so right-to-left pages (<html dir="rtl">) mirror. */

:root {
    --bg: #f4f5f2;
    --surface: #ffffff;
    --surface-muted: #fafbf9;
    --border: #dfe3dc;
    --border-strong: #c9cec5;
    --text: #1f2421;
    --muted: #5d665f;
    --accent: #1b7a2f;          /* the logo's green */
    --accent-hover: #145c23;
    --link: #17692a;
    --bar: #1d2a21;
    --focus: #f0b400;
    --radius: 10px;
}

/**** Base ****/
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px; line-height: 1.55; -webkit-text-size-adjust: 100%; }
a { color: var(--link); }
a:hover { color: var(--accent-hover); }
h1, h2, h3, h4 { line-height: 1.25; margin: 1.4em 0 .5em; font-weight: 650; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.15rem; }
h4 { font-size: 1rem; }
p { margin: .6em 0; }
img { max-width: 100%; }
hr { border: 0; border-top: 1px solid var(--border); }
button, select, input { font: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/**** Header ****/
#header { background: var(--surface); border-bottom: 1px solid var(--border); }
.header-inner { max-width: 980px; margin: 0 auto; padding: 14px 24px; display: flex; flex-wrap: wrap;
    align-items: center; justify-content: space-between; gap: 8px 24px; }
#logo { display: flex; align-items: center; gap: 6px; color: var(--text); text-decoration: none; font-size: 1.6rem;
    line-height: 1.2; }
#logo img { width: 30px; height: 30px; flex: none; }
#logo span { direction: ltr; overflow-wrap: anywhere; }
#nav ul { display: flex; flex-wrap: wrap; gap: 4px 22px; margin: 0; padding: 0; list-style: none; font-size: 15px; }
#nav a { color: var(--muted); text-decoration: none; padding: 4px 0; border-bottom: 2px solid transparent; }
#nav a:hover { color: var(--text); }
#nav a[aria-current="page"] { color: var(--text); font-weight: 600; border-bottom-color: var(--text); }
#nav .lang-link a { color: var(--link); }

/**** Page ****/
#wrap { max-width: 980px; margin: 0 auto; padding: 28px 24px 40px; }
#content { margin-bottom: 32px; }
#content > :first-child, #explain > :first-child { margin-top: 0; }
/* Text pages (about, privacy, contact, donate) */
.nohome #content { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 24px 28px; }
.nohome #content p, .nohome #content li { max-width: 72ch; }

#explain { margin-bottom: 24px; }
#explain h1 { font-size: 1.6rem; margin: 0 0 .3em; }

.result-title { margin: 0 0 16px; }

/**** The checker card: text, error bar, options ****/
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: 0 1px 2px rgba(0,0,0,.04); }
#text-ui { min-height: 220px; max-height: 60vh; overflow-y: auto; padding: 20px 22px; font-size: 18px; line-height: 1.75;
    white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text); border-radius: var(--radius) var(--radius) 0 0; }
#text-ui:focus { outline: none; }
#checker:focus-within { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(27,122,47,.18); }
#text-ui.clear-on-click { color: var(--muted); font-style: italic; }
#hidden-text { display: none; }

.err { border-radius: 3px; cursor: pointer; }
/* hover: a white layer over the type color makes the background lighter, the text stays as it is */
.err:hover { background-image: linear-gradient(rgba(255,255,255,.4), rgba(255,255,255,.4)); }
.err-current { outline: 2px solid var(--text); outline-offset: 1px; }

#err-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px;
    padding: 10px 14px; background: var(--bar); color: #fff; }
.eb-nav, .eb-actions, #eb-types { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
#err-bar button { height: 36px; min-width: 36px; padding: 0 12px; border: 1px solid rgba(255,255,255,.3);
    background: transparent; color: #fff; border-radius: 8px; font-size: 14px; cursor: pointer; }
#err-bar button:hover:not(:disabled) { background: rgba(255,255,255,.1); }
#err-bar button:disabled { opacity: .4; cursor: default; }
#eb-prev, #eb-next { padding: 0 !important; font-size: 18px !important; }
[dir="rtl"] #eb-prev, [dir="rtl"] #eb-next { transform: scaleX(-1); }   /* arrows point the reading direction */
#err-bar #eb-accept { background: #3ea558; border-color: #3ea558; color: #0b1a0f; font-weight: 600; }
#err-bar #eb-accept:hover { background: #4cb866; }
/* Copy: filled, with an icon, so it doesn't look like the outline navigation buttons */
#err-bar #btn-copy-clipboard { display: inline-flex; align-items: center; gap: 6px; background: #fff; border-color: #fff;
    color: var(--bar); font-weight: 600; }
#err-bar #btn-copy-clipboard:hover { background: #e3e8e1; }
#btn-copy-clipboard .icon { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
#eb-pos { font-size: 14px; font-variant-numeric: tabular-nums; min-width: 6.5em; }
.eb-chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px;
    background: rgba(255,255,255,.1); font-size: 13px; }
.eb-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; filter: saturate(1.6) brightness(1.15); }

.card-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px 20px;
    padding: 14px 18px; border-top: 1px solid var(--border); background: var(--surface-muted);
    border-radius: 0 0 var(--radius) var(--radius); }
.form-options { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; font-size: 15px; }
.ff { display: flex; align-items: center; gap: 8px; }
.ff select { height: 36px; max-width: 100%; padding: 0 8px; border: 1px solid var(--border-strong); border-radius: 6px;
    background: var(--surface); color: var(--text); }
.ff-check input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); flex: none; }

.btn, #fbut { height: 44px; padding: 0 30px; border: 0; border-radius: 8px; background: var(--accent); color: #fff;
    font-size: 16px; font-weight: 600; cursor: pointer; }
.btn:hover, #fbut:hover { background: var(--accent-hover); color: #fff; }   /* also on links (a:hover) */
#fbut:disabled { opacity: .6; cursor: default; }

/**** Error popover; on phones a sheet at the bottom ****/
#err-pop { position: absolute; z-index: 1000; width: 340px; max-width: calc(100vw - 16px); max-height: 60vh; overflow-y: auto;
    background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius);
    box-shadow: 0 8px 24px rgba(0,0,0,.16); padding: 12px 16px 14px; font-size: 17px; line-height: 1.45; }
.ep-head { display: flex; align-items: center; gap: 8px; }
.ep-head strong { flex: 1; }
.ep-pos { color: var(--muted); font-size: 15px; }
.ep-close { width: 32px; height: 32px; border: 0; border-radius: 6px; background: none; color: var(--muted); font-size: 22px;
    cursor: pointer; }
.ep-close:hover { background: var(--bg); }
.ep-msg { margin: 6px 0 10px; }
.ep-reps { display: flex; flex-wrap: wrap; gap: 6px; }
.ep-rep { padding: 6px 14px; border: 1px solid var(--border-strong); border-radius: 999px; background: var(--surface);
    color: var(--text); font-size: 17px; cursor: pointer; }
.ep-rep:hover { border-color: var(--accent); }
.ep-rep:first-child { background: var(--accent); border-color: var(--accent); color: #fff; }
.ep-rep:first-child:hover { background: var(--accent-hover); }
.ep-ignore { display: block; margin-top: 10px; padding: 0; border: 0; background: none; color: var(--link); font-size: 16px;
    text-align: start; cursor: pointer; }
.ep-ignore:hover { text-decoration: underline; }
.ep-nav { display: none; }

/**** Messages ****/
.message, .messagebox, .result-info-container { margin: 0 0 16px; padding: 12px 16px; border: 1px solid var(--border);
    border-inline-start-width: 4px; border-radius: 8px; background: var(--surface); }
.message.success { border-color: #a9d389; border-inline-start-color: var(--accent); background: #f1f8ec; }
.message.note, .messagebox, .result-info-container { border-color: #f1d28a; border-inline-start-color: #e0a100; background: #fff9e8; }
.messagebox.error { border-color: #f0b3b3; border-inline-start-color: #c62828; background: #fdf0f0; color: #7a1717; }
.result-message-list { margin: 0; padding: 0; list-style: none; }
.result-message + .result-message { margin-top: 6px; }
pre.debug { font-size: 80%; overflow-x: auto; }

/**** Lists below the result ****/
.result-list { margin-top: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.result-list summary { padding: 12px 18px; font-weight: 650; cursor: pointer; }
.result-list[open] summary { border-bottom: 1px solid var(--border); }
.result-list > :not(summary) { margin-inline: 18px; }
.result-list > :last-child { margin-bottom: 14px; }
.list-desc { color: var(--muted); font-size: 14px; }
.ed-wrap { padding: 10px 0; border-bottom: 1px solid var(--border); }
.ed-wrap:last-child { border-bottom: 0; }
.ed-context { color: var(--muted); font-style: italic; }
.ed-context span { border-radius: 3px; color: var(--text); font-style: normal; }
.ed-context .err-style, .ed-context .err-register { background: rgba(251,191,69,.45); }
.ignore-words { display: flex; flex-wrap: wrap; gap: 6px; }
.remove-ignore-word { padding: 3px 12px; border: 1px solid var(--border-strong); border-radius: 999px; background: var(--surface);
    color: var(--text); font-size: 14px; cursor: pointer; }
.remove-ignore-word:hover { border-color: #c62828; text-decoration: line-through; }
#remove-all-ignore-words { padding: 0; border: 0; background: none; color: var(--link); text-decoration: underline; cursor: pointer; }

#back-start-button { font-size: 15px; }

/**** Donate page (FW/includes/donate.php) ****/
.donate-paypal { display: block; max-width: 100%; height: auto; }
.donate-stripe { display: inline-flex; align-items: center; text-decoration: none; }
.donate-crypto { display: block; max-width: 100%; height: auto; }
.donate-thanks { margin-top: 2em; }

/**** "Processing" overlay ****/
.modalcontainer { display: none; position: fixed; z-index: 2000; top: 40%; left: 50%; transform: translate(-50%, -50%);
    width: min(320px, calc(100vw - 32px)); background: var(--surface); border: 1px solid var(--border);
    border-radius: 12px; box-shadow: 0 12px 40px rgba(0,0,0,.2); padding: 20px; text-align: center; }
.modal-header h3 { margin: 0 0 14px; }
.modal-footer p { margin: 14px 0 0; color: var(--muted); }
.spinner { width: 34px; height: 34px; margin: 0 auto; border: 4px solid var(--border); border-top-color: var(--accent);
    border-radius: 50%; animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/**** Footer: ad box, other languages ****/
#footer { margin-top: 24px; }
/* The ad box (FW/includes/footer.php): the AdSense ad, or a crosslink tile that FW/js/base.js puts into #xl-slot and
   fades in. No "ad" in the names: ad blockers hide such elements. */
#xl-box { width: 100%; }
#xl-box .adsbygoogle { display: block; width: 100%; height: 100px; }
#xl-slot { opacity: 0; transition: opacity 2s ease-in-out; }
#xl-slot.visible { opacity: 1; }
.xl-image { display: block; width: 100%; height: auto; border-radius: var(--radius); }
#xl-donate { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px;
    padding: 16px 20px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.xl-donate-text { flex: 1 1 300px; }
.xl-donate-text p { margin: 4px 0 0; color: var(--muted); }
#xl-donate .btn { display: inline-flex; align-items: center; text-decoration: none; }
#footer-site-links { margin-top: 24px; font-size: 14px; color: var(--muted); }
#footer-site-links p { margin: 0 0 8px; }
.site-links, #about-site-links { display: flex; flex-wrap: wrap; gap: 6px 20px; }
.flag { padding-inline-start: 22px; background-repeat: no-repeat; background-position: left .3em; }
[dir="rtl"] .flag { background-position: right .3em; }
.flag a { text-decoration: none; }
.flag a:hover { text-decoration: underline; }
/* Footer menu (FW/includes/footer_nav.inc.php): privacy, contact */
#footer-nav { margin-top: 24px; padding-top: 14px; border-top: 1px solid var(--border); }
#footer-nav ul { display: flex; flex-wrap: wrap; gap: 4px 22px; margin: 0; padding: 0; list-style: none; font-size: 14px; }
#footer-nav a { color: var(--muted); text-decoration: none; }
#footer-nav a:hover { color: var(--text); text-decoration: underline; }
#footer-nav a[aria-current="page"] { color: var(--text); font-weight: 600; }

/**** Phones ****/
@media (max-width: 640px) {
    .header-inner { padding: 10px 16px; }
    #logo { font-size: 1.25rem; }
    #logo img { width: 24px; height: 24px; }
    #nav ul { gap: 2px 16px; }
    #nav a { display: inline-block; padding: 8px 0; }
    #wrap { padding: 16px 16px 32px; }
    .nohome #content { padding: 16px; }
    #explain h1, .nohome h1 { font-size: 1.3rem; }
    #text-ui { padding: 14px; font-size: 17px; max-height: none; }
    #err-bar { padding: 8px 10px; }
    #eb-types { display: none; }            /* the counts don't fit; the position text says how many */
    .card-footer { padding: 14px; }
    #fbut { width: 100%; }

    #err-pop { position: fixed; left: 0 !important; right: 0; bottom: 0; top: auto !important; width: auto; max-width: none;
        max-height: 70vh; border-radius: 16px 16px 0 0; padding: 12px 16px 20px; font-size: 18px;
        box-shadow: 0 -8px 24px rgba(0,0,0,.18); }
    .ep-reps { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 8px; }
    .ep-rep { height: 46px; font-size: 19px; border-radius: 8px; }
    .ep-close { width: 44px; height: 44px; }
    .ep-ignore { min-height: 44px; }
    .ep-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 6px; }
    .ep-nav button { height: 44px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--bg);
        color: var(--text); font-size: 17px; cursor: pointer; }
}
