/* Shared look of the pitaka.lk Sinhala Unicode tools */
@font-face {
    font-family: 'Abhaya Uni UI';
    src: url(../fonts/AbhayaUni-Regular.woff2) format('woff2');
    font-weight: 400;
    font-display: swap;
    unicode-range: U+0D80-0DFF, U+200C-200D, U+25CC;
}
@font-face {
    font-family: 'Abhaya Uni UI';
    src: url(../fonts/AbhayaUni-Bold.woff2) format('woff2');
    font-weight: 700;
    font-display: swap;
    unicode-range: U+0D80-0DFF, U+200C-200D, U+25CC;
}

:root {
    --bg: #fbf8f3;
    --panel: #ffffff;
    --ink: #2b241c;
    --muted: #6f6253;
    --line: #e4dbcf;
    --accent: #9a5200;
    --accent-ink: #ffffff;
    --accent-soft: #f6ead9;
    --bad: #c62828;
    --bad-soft: #fde7e7;
    --ok: #2e7d32;
    --kept: #6f6253;
    --radius: 10px;
    --ui: 'Abhaya Uni UI', system-ui, -apple-system, 'Segoe UI', sans-serif;
    color-scheme: light;
}
/* dark: from the system setting unless the reader picked light, or picked dark with the header button */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme='light']) {
        --bg: #1b1814; --panel: #24201b; --ink: #ece4d8; --muted: #b3a593; --line: #3b342b;
        --accent: #f0a04b; --accent-ink: #1b1814; --accent-soft: #3a2c1c; --bad: #ff8a80; --bad-soft: #4a2323;
        --ok: #81c784; --kept: #b3a593; color-scheme: dark;
    }
}
:root[data-theme='dark'] {
    --bg: #1b1814; --panel: #24201b; --ink: #ece4d8; --muted: #b3a593; --line: #3b342b;
    --accent: #f0a04b; --accent-ink: #1b1814; --accent-soft: #3a2c1c; --bad: #ff8a80; --bad-soft: #4a2323;
    --ok: #81c784; --kept: #b3a593; color-scheme: dark;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.6 var(--ui); }
a { color: var(--accent); }
main { max-width: 980px; margin: 0 auto; padding: 0 16px 48px; }
h1 { font-size: 1.7rem; line-height: 1.3; margin: 24px 0 6px; }
h2 { font-size: 1.25rem; margin: 32px 0 10px; }
p.lead { color: var(--muted); margin: 0 0 20px; }

/* header */
.site-header { background: var(--panel); border-bottom: 1px solid var(--line); }
.site-header .bar { max-width: 980px; margin: 0 auto; padding: 10px 16px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.site-header .home { font-weight: 700; color: var(--ink); text-decoration: none; margin-right: auto; }
.site-header nav { display: flex; gap: 4px; flex-wrap: wrap; }
.site-header nav a { padding: 6px 12px; border-radius: 999px; text-decoration: none; color: var(--ink); }
.site-header nav a[aria-current='page'] { background: var(--accent); color: var(--accent-ink); }
.site-header nav a:not([aria-current]):hover { background: var(--accent-soft); }
.lang, .theme { border: 1px solid var(--line); background: none; color: var(--ink); border-radius: 999px; padding: 4px 12px; font: inherit; cursor: pointer; }

/* panels and controls */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 16px 0; }
.row { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; }
label { color: var(--muted); }
select, textarea, input[type=text], input[type=number] {
    font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px;
}
textarea { width: 100%; min-height: 9em; resize: vertical; display: block; }
button, .button {
    font: inherit; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); border-radius: 8px;
    padding: 7px 16px; cursor: pointer; text-decoration: none; display: inline-block;
}
button.quiet, .button.quiet { background: none; color: var(--accent); }
button:disabled { opacity: .5; cursor: default; }
.hint { color: var(--muted); font-size: .9rem; }
.badge { display: inline-block; padding: 1px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: .9rem; }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.ok { color: var(--ok); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 8px 18px;
    border-radius: 999px; opacity: 0; transition: opacity .2s; pointer-events: none; }
.toast.show { opacity: 1; }

/* converted output */
.output { min-height: 9em; white-space: pre-wrap; word-wrap: break-word; padding: 10px; border: 1px solid var(--line); border-radius: 8px;
    background: var(--bg); font-size: 1.25rem; line-height: 1.8; }
.output .issue { background: var(--bad-soft); text-decoration: underline wavy var(--bad); text-underline-offset: 4px; }
.output .issue.focus { outline: 2px solid var(--bad); }
.output .kept { color: var(--kept); background: repeating-linear-gradient(135deg, transparent 0 4px, var(--accent-soft) 4px 8px); }
.output .w { cursor: pointer; border-radius: 3px; }
.output .w:hover { outline: 1px dashed var(--muted); }
.issues { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.issues button { background: var(--bad-soft); color: var(--bad); border-color: transparent; padding: 2px 10px; font-size: 1rem; }

.drop { border: 2px dashed var(--line); border-radius: var(--radius); padding: 28px 16px; text-align: center; background: var(--panel); }
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 400; }

.site-footer { border-top: 1px solid var(--line); color: var(--muted); font-size: .9rem; text-align: center; padding: 16px; }
[hidden] { display: none !important; }
