/* Tamajaq Dictionary, after K.-G. Prasse (2003) */
:root {
  --bg: #f6f1e7;
  --surface: #fffdf8;
  --surface-2: #f0e9da;
  --ink: #1d2433;
  --ink-2: #5b6272;
  --line: #e0d6c2;
  --accent: #27368f;
  --accent-ink: #ffffff;
  --accent-soft: #e4e7fa;
  --w: #b4501f;
  --w-soft: #f8e4d8;
  --y: #176b87;
  --y-soft: #d9eef4;
  --other: #6b4f9a;
  --other-soft: #ebe4f6;
  --mark: #ffe58a;
  --shadow: 0 1px 2px rgba(40,30,10,.06), 0 4px 14px rgba(40,30,10,.05);
  --tam: "Gentium Plus", "Gentium Book Plus", "Charis SIL", "Cambria", "Noto Serif", "Times New Roman", serif;
  --ui: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12151d;
    --surface: #1a1f2b;
    --surface-2: #232938;
    --ink: #ece8dd;
    --ink-2: #9aa1b3;
    --line: #2c3345;
    --accent: #8d9bff;
    --accent-ink: #0f1220;
    --accent-soft: #252c52;
    --w: #f0a47a;
    --w-soft: #3a2619;
    --y: #7ccbe3;
    --y-soft: #163541;
    --other: #c3a8f0;
    --other-soft: #2e2547;
    --mark: #6b5a12;
    --shadow: 0 1px 2px rgba(0,0,0,.4);
  }
}
:root[data-theme="dark"] {
  --bg: #12151d; --surface: #1a1f2b; --surface-2: #232938; --ink: #ece8dd; --ink-2: #9aa1b3;
  --line: #2c3345; --accent: #8d9bff; --accent-ink: #0f1220; --accent-soft: #252c52;
  --w: #f0a47a; --w-soft: #3a2619; --y: #7ccbe3; --y-soft: #163541;
  --other: #c3a8f0; --other-soft: #2e2547; --mark: #6b5a12; --shadow: 0 1px 2px rgba(0,0,0,.4);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.5 var(--ui);
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
.tam { font-family: var(--tam); }

/* ---------- header ---------- */
.top {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.top-in {
  max-width: 1180px; margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.brand { display: flex; flex-direction: column; line-height: 1.15; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand b { font: 700 1.35rem var(--tam); letter-spacing: .2px; }
.brand span { font-size: .72rem; color: var(--ink-2); }
nav.tabs { display: flex; gap: 2px; margin-left: auto; flex-wrap: wrap; }
nav.tabs a {
  padding: 7px 10px; border-radius: 8px; color: var(--ink-2); font-weight: 600; font-size: .92rem;
}
nav.tabs a:hover { background: var(--surface-2); text-decoration: none; color: var(--ink); }
nav.tabs a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.theme-btn {
  border: 1px solid var(--line); background: transparent; border-radius: 8px; padding: 6px 10px; color: var(--ink-2);
}

main { max-width: 1100px; margin: 0 auto; padding: 20px 16px 60px; }
h1, h2, h3 { line-height: 1.2; }
h1 { font-size: 1.6rem; margin: 0 0 .4em; }
h2 { font-size: 1.25rem; margin: 1.6em 0 .5em; }
h3 { font-size: 1.02rem; margin: 1.2em 0 .4em; }
.muted { color: var(--ink-2); }
.small { font-size: .85rem; }

/* ---------- search ---------- */
.searchbox {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 14px; box-shadow: var(--shadow);
}
.qrow { display: flex; gap: 8px; }
.qrow input[type=search] {
  flex: 1; min-width: 0; font: 1.25rem var(--tam); padding: 11px 14px;
  border: 1.5px solid var(--line); border-radius: 10px; background: var(--bg);
}
.qrow input[type=search]:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.btn {
  border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 8px 14px; font-weight: 600;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.1); }
.btn.small { padding: 4px 10px; font-size: .85rem; border-radius: 8px; }

.modes { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.modes label {
  position: relative;
  border: 1px solid var(--line); border-radius: 999px; padding: 5px 13px; cursor: pointer;
  font-size: .9rem; font-weight: 600; color: var(--ink-2); background: var(--surface);
}
.modes input { position: absolute; opacity: 0; pointer-events: none; }
.modes input:checked + span { color: var(--accent); }
.modes label:has(input:checked) { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.modes label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

.keys { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 10px; }
.keys button {
  min-width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); font: 1.1rem var(--tam); padding: 0 6px;
}
.keys button:hover { background: var(--accent-soft); border-color: var(--accent); }
.keys-toggle { font-size: .85rem; background: none; border: none; color: var(--accent); padding: 0; margin-top: 10px; }

.filters { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; margin-top: 12px; font-size: .9rem; }
.filters label { display: flex; align-items: center; gap: 6px; color: var(--ink-2); }
.filters select {
  border: 1px solid var(--line); border-radius: 8px; padding: 4px 8px; background: var(--surface);
}
.filters .chk { cursor: pointer; }

.status { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; margin: 18px 2px 8px; color: var(--ink-2); font-size: .92rem; }

.rootbanner {
  background: var(--accent-soft); border: 1px solid var(--accent); border-radius: 12px; padding: 10px 14px;
  margin: 14px 0 0; display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
}
.rootbanner b { font: 700 1.15rem var(--tam); color: var(--accent); }

/* ---------- entry cards ---------- */
.results { display: grid; gap: 12px; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 14px 16px 12px; box-shadow: var(--shadow);
}
.card.focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.card-top { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; }
.hw { font: 700 1.55rem/1.2 var(--tam); color: var(--ink); word-break: break-word; }
.hw a { color: inherit; }
.badges { display: inline-flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.badge {
  display: inline-block; font-size: .74rem; font-weight: 700; padding: 1px 8px; border-radius: 999px;
  background: var(--surface-2); color: var(--ink-2); letter-spacing: .2px; white-space: nowrap;
}
.badge.pos { background: var(--accent-soft); color: var(--accent); }
.badge.conj { background: var(--accent); color: var(--accent-ink); }
a.badge.conj:hover { text-decoration: none; filter: brightness(1.15); }
.dm {
  display: inline-block; font: 700 .68rem var(--ui); padding: 0 6px; border-radius: 5px; margin: 0 2px 0 3px;
  vertical-align: .12em; letter-spacing: .3px;
}
.dm-W  { background: var(--w-soft); color: var(--w); }
.dm-Y  { background: var(--y-soft); color: var(--y); }
.dm-WY { background: linear-gradient(90deg, var(--w-soft) 50%, var(--y-soft) 50%); color: var(--ink); }
.dm-o  { background: var(--other-soft); color: var(--other); }
.entryline { font: 1.05rem/1.45 var(--tam); color: var(--ink); margin: 4px 0 2px; }
.entryline abbr, .gloss abbr { text-decoration: underline dotted var(--ink-2); text-underline-offset: 3px; cursor: help; }
.sym {
  display: inline-block; font-family: var(--ui); font-weight: 700; font-size: .85em; padding: 0 5px;
  border-radius: 4px; background: var(--surface-2); color: var(--accent); cursor: help;
}
ol.senses { margin: 8px 0 0; padding: 0; list-style: none; counter-reset: s; }
ol.senses li { counter-increment: s; position: relative; padding: 4px 0 4px 28px; }
ol.senses li::before {
  content: counter(s); position: absolute; left: 0; top: 6px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--surface-2); color: var(--ink-2); font: 700 .72rem/20px var(--ui); text-align: center;
}
.en { font-size: 1.02rem; }
.fr { color: var(--ink-2); font-size: .9rem; font-style: italic; }
.fr::before { content: attr(data-l) " "; font: 700 .65rem var(--ui); font-style: normal; letter-spacing: .4px; color: var(--ink-2); opacity: .75; }
.nvnote { color: var(--ink-2); font-style: italic; }
.ex {
  margin: 4px 0 2px; padding: 3px 0 3px 10px; border-left: 3px solid var(--line);
  font: .98rem/1.4 var(--tam); color: var(--ink);
}
.ex .fr { display: block; font-family: var(--ui); }
.ex::before { content: "ex."; font: 700 .65rem var(--ui); color: var(--ink-2); margin-right: 6px; text-transform: uppercase; letter-spacing: .4px; }
.meta { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--line); font-size: .82rem; color: var(--ink-2); }
.meta .chip, .chip {
  border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 1px 10px;
  font-size: .82rem; color: var(--accent); cursor: pointer; font-weight: 600;
}
.chip:hover { background: var(--accent-soft); text-decoration: none; }
.meta .sp { flex: 1; }
.meta button.lnk { background: none; border: none; color: var(--ink-2); padding: 0; font-size: .82rem; }
.meta button.lnk:hover { color: var(--accent); text-decoration: underline; }
mark { background: var(--mark); color: inherit; border-radius: 3px; padding: 0 1px; }
.more { display: flex; justify-content: center; margin: 18px 0; }

/* ---------- home / empty ---------- */
.hero { text-align: center; padding: 26px 0 8px; }
.hero h1 { font: 700 2rem var(--tam); margin-bottom: 4px; }
.stats { display: flex; justify-content: center; gap: 26px; flex-wrap: wrap; margin: 16px 0 6px; }
.stats div { text-align: center; }
.stats b { display: block; font: 700 1.6rem var(--tam); color: var(--accent); }
.stats span { font-size: .8rem; color: var(--ink-2); }
.tryrow { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 8px 0 18px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 4px 18px 16px; box-shadow: var(--shadow); }

/* ---------- roots ---------- */
.letters { display: flex; flex-wrap: wrap; gap: 4px; margin: 12px 0; }
.letters button {
  min-width: 38px; height: 36px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface);
  font: 700 1rem var(--tam);
}
.letters button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.rootgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 6px; }
.rootgrid a {
  display: flex; justify-content: space-between; align-items: baseline; gap: 6px;
  border: 1px solid var(--line); background: var(--surface); border-radius: 9px; padding: 6px 10px; color: var(--ink);
}
.rootgrid a:hover { background: var(--accent-soft); border-color: var(--accent); text-decoration: none; }
.rootgrid b { font: 700 1.05rem var(--tam); }
.rootgrid span { font-size: .74rem; color: var(--ink-2); }
.rootnav { display: flex; justify-content: space-between; gap: 10px; margin: 8px 0 14px; flex-wrap: wrap; }
.rootnav h1 { font: 700 2.2rem var(--tam); margin: 0; letter-spacing: 1px; color: var(--accent); }

/* ---------- guide ---------- */
.guide { display: grid; grid-template-columns: 200px 1fr; gap: 28px; }
.toc { position: sticky; top: 76px; align-self: start; display: flex; flex-direction: column; gap: 2px; font-size: .9rem; }
.toc a { padding: 5px 10px; border-radius: 7px; color: var(--ink-2); font-weight: 600; }
.toc a:hover { background: var(--surface-2); text-decoration: none; }
.doc h2:first-child { margin-top: 0; }
.doc p { max-width: 70ch; }
table.t { border-collapse: collapse; width: 100%; font-size: .93rem; margin: 8px 0; }
table.t th, table.t td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.t th { font-size: .75rem; text-transform: uppercase; letter-spacing: .5px; color: var(--ink-2); }
table.t td:first-child { font: 700 1rem var(--tam); white-space: nowrap; color: var(--accent); }
.cols2 { columns: 2; column-gap: 28px; }
.cols2 tr, .cols2 > div { break-inside: avoid; }
.note { background: var(--surface-2); border-left: 4px solid var(--accent); border-radius: 6px; padding: 8px 14px; margin: 12px 0; font-size: .92rem; }
.warn { border-left-color: var(--w); }
.exbox { font-family: var(--tam); font-size: 1.05rem; background: var(--surface-2); border-radius: 8px; padding: 8px 14px; margin: 8px 0; }

/* ---------- conjugations ---------- */
.conjwrap { display: grid; grid-template-columns: 230px 1fr; gap: 22px; }
.conjnav { position: sticky; top: 76px; align-self: start; max-height: calc(100vh - 96px); overflow: auto; padding-right: 6px; font-size: .88rem; }
.conjnav h4 { margin: 14px 0 4px; font-size: .72rem; text-transform: uppercase; letter-spacing: .6px; color: var(--ink-2); }
.conjnav a { display: flex; justify-content: space-between; gap: 6px; padding: 4px 9px; border-radius: 7px; color: var(--ink); }
.conjnav a:hover { background: var(--surface-2); text-decoration: none; }
.conjnav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.conjnav a small { color: var(--ink-2); }
.pagebar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; }
.pagebar h1 { margin: 0; font-size: 1.3rem; flex: 1; min-width: 200px; }
.sheet { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 6px; overflow: auto; box-shadow: var(--shadow); }
.sheet img { display: block; width: 100%; height: auto; margin: 0 auto; }
.sheet.full img { width: auto; max-width: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .sheet img { filter: invert(.92) hue-rotate(180deg); } .sheet { background: #0c0e14; } }
:root[data-theme="dark"] .sheet img { filter: invert(.92) hue-rotate(180deg); }
:root[data-theme="dark"] .sheet { background: #0c0e14; }

/* examples: Tamajaq sentence, translation below */
.ex .extam { font-weight: 700; }
.ex .exen { display: block; font-family: var(--ui); font-size: .95rem; color: var(--ink); margin-top: 1px; }
.ex .exen .badge { font-size: .65rem; vertical-align: .1em; }

/* ---------- corrections & review ---------- */
.meta .fixbtn { color: var(--w); font-weight: 600; }
dialog#fixdlg {
  border: 1px solid var(--line); border-radius: 14px; padding: 0; width: min(560px, calc(100vw - 32px));
  background: var(--surface); color: var(--ink); box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
dialog#fixdlg::backdrop { background: rgba(20,20,30,.45); }
.fixform { padding: 18px 20px; display: grid; gap: 10px; }
.fixform h3 { margin: 0 0 4px; }
.fixform label { display: grid; gap: 4px; font-size: .88rem; color: var(--ink-2); }
.fixform label.chk { display: flex; align-items: center; gap: 8px; }
.fixform input:not([type=checkbox]), .fixform select {
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: var(--bg); color: var(--ink); font-size: 1rem;
}
.fixform input.tam { font: 1.1rem var(--tam); }
.fixform .keys { margin: 0; }
.fixform .keys button { min-width: 30px; height: 30px; font-size: 1rem; }
#fx-msg { color: var(--w); margin: 0; min-height: 1em; }
.fxbtns { display: flex; justify-content: flex-end; gap: 8px; }
table.rv td:first-child { font: inherit; color: inherit; white-space: normal; }
table.rv td.tam { font-family: var(--tam); font-size: 1.05rem; }
.rvbtns { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
del { color: var(--w); }

.fixline {
  margin-top: 8px; padding: 6px 10px; border-radius: 8px; font-size: .85rem; line-height: 1.7;
  background: var(--w-soft); color: var(--ink);
}
.fixline b { font-size: .72rem; text-transform: uppercase; letter-spacing: .5px; color: var(--w); margin-right: 4px; }
ins { text-decoration: none; font-weight: 700; color: var(--y); }

/* Root labels: in Gentium the capital Ɣ looks like Y, show roots in the interface font, where Ɣ is distinct */
.rl, .rootbanner b, .rootgrid b, .rootnav h1 { font-family: var(--ui) !important; letter-spacing: .5px; }

.fr:not([data-l])::before { content: "FR "; }
.lang-btn { display: inline-flex; gap: 2px; padding: 4px; font-weight: 700; font-size: .8rem; }
.lang-btn span { padding: 2px 7px; border-radius: 6px; color: var(--ink-2); }
.lang-btn span.on { background: var(--accent); color: var(--accent-ink); }

/* ---------- terms with hover explanations ---------- */
.term { cursor: help; text-decoration: underline dotted color-mix(in srgb, var(--ink-2) 70%, transparent); text-underline-offset: 3px; border-radius: 3px; }
.term[data-href] { cursor: pointer; }
.term:hover, .term:focus-visible { background: var(--accent-soft); text-decoration-color: var(--accent); outline: none; }
.dm.term, .badge.term { text-decoration: none; }
.sym.term { text-decoration: none; }
.term.st { color: var(--ink-2); }
.term.cj { color: var(--accent); font-weight: 600; text-decoration-style: solid; }
.term.src { color: var(--other); }
a.xref { text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent); text-underline-offset: 3px; font-weight: 600; }
a.xref:hover { background: var(--accent-soft); }
#tip {
  position: fixed; z-index: 80; pointer-events: none; opacity: 0; transform: translateY(2px);
  transition: opacity .12s, transform .12s;
  background: var(--ink); color: var(--bg); font: .84rem/1.4 var(--ui); padding: 7px 11px; border-radius: 9px;
  box-shadow: 0 6px 24px rgba(0,0,0,.25); max-width: 340px;
}
#tip.on { opacity: 1; transform: none; }
#tip .tipmore { display: block; margin-top: 3px; font-size: .74rem; opacity: .75; }
tr.flash td { animation: flash 2.2s ease-out; }
@keyframes flash { 0%, 40% { background: var(--mark); } 100% { background: transparent; } }

.tw { font-family: var(--tam); font-size: 1.04em; }

/* ---------- misc ---------- */
.loading { position: fixed; inset: 0; background: var(--bg); display: grid; place-items: center; z-index: 50; }
.loading div { text-align: center; color: var(--ink-2); }
.loading b { display: block; font: 700 1.6rem var(--tam); color: var(--ink); margin-bottom: 6px; }
.toast {
  position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--bg);
  padding: 8px 16px; border-radius: 999px; font-size: .9rem; z-index: 60; opacity: 0; transition: opacity .2s; pointer-events: none;
}
.toast.on { opacity: 1; }
footer { max-width: 1100px; margin: 0 auto; padding: 0 16px 40px; color: var(--ink-2); font-size: .8rem; }

@media (max-width: 780px) {
  .guide, .conjwrap { grid-template-columns: 1fr; }
  .toc, .conjnav { position: static; max-height: none; flex-direction: row; flex-wrap: wrap; }
  .conjnav { display: block; }
  .cols2 { columns: 1; }
  .top-in { gap: 8px; }
  nav.tabs { margin-left: 0; width: 100%; }
  .hw { font-size: 1.35rem; }
  .qrow input[type=search] { font-size: 1.1rem; }
}

/* =====================================================================
   Polish: motion, toggles, selects, navigation
   ===================================================================== */
:root { --ease: cubic-bezier(.22, .8, .3, 1); }
html { scroll-behavior: smooth; }
body { transition: background-color .25s, color .25s; }
.public .admin-only { display: none !important; }

/* page transition + staggered cards */
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.97); } to { opacity: 1; transform: none; } }
main.enter > * { animation: rise .45s var(--ease) both; }
main.enter > *:nth-child(2) { animation-delay: .05s; }
main.enter > *:nth-child(3) { animation-delay: .1s; }
main.enter .results:not(.noanim) > .card { animation: rise .5s var(--ease) both; animation-delay: calc(var(--i, 0) * 45ms); }
main.enter .hero .stats > div { animation: rise .6s var(--ease) both; }
main.enter .hero .stats > div:nth-child(2) { animation-delay: .08s; }
main.enter .hero .stats > div:nth-child(3) { animation-delay: .16s; }
main.enter .hero .stats > div:nth-child(4) { animation-delay: .24s; }

/* hover feedback */
.card { transition: box-shadow .25s var(--ease), border-color .25s, transform .25s var(--ease); }
.card:hover { border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); box-shadow: 0 2px 4px rgba(40,30,10,.06), 0 10px 28px rgba(40,30,10,.08); }
.chip, .btn, .letters button, .keys button, nav.tabs a, .modes label, .theme-btn {
  transition: background-color .18s, border-color .18s, color .18s, transform .15s var(--ease), box-shadow .2s;
}
.chip:hover, .rootgrid a:hover { transform: translateY(-1px); }
.btn:active, .chip:active, .rootgrid a:active, .keys button:active, .theme-btn:active { transform: scale(.96); }
.btn.primary:hover { box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 40%, transparent); }
.qrow input[type=search] { transition: border-color .2s, box-shadow .25s; }
.rootgrid a { transition: transform .18s var(--ease), background-color .18s, border-color .18s, box-shadow .2s; }
.rootgrid a:hover { box-shadow: 0 4px 12px rgba(40,30,10,.1); }
.recent { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: center; margin: -6px 0 16px; }
.recent .lnk { background: none; border: none; color: var(--ink-2); font-size: .78rem; padding: 0 4px; }
.recent .lnk:hover { color: var(--accent); text-decoration: underline; }

/* header: shadow on scroll, animated tab underline */
.top { transition: box-shadow .25s, background-color .25s; }
.top.scrolled { box-shadow: 0 4px 18px rgba(40,30,10,.1); }
nav.tabs a { position: relative; display: inline-flex; align-items: center; gap: 6px; }
nav.tabs a svg { display: none; width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
nav.tabs a::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: 2px; height: 2px; border-radius: 2px;
  background: var(--accent); transform: scaleX(0); transform-origin: left; transition: transform .3s var(--ease), opacity .2s;
}
nav.tabs a:hover::after { transform: scaleX(1); opacity: .45; }
nav.tabs a[aria-current="page"]::after { transform: scaleX(1); opacity: 1; }
.brand b { transition: color .2s; }
.brand:hover b { color: var(--accent); }

/* loading screen fades out */
.loading { transition: opacity .35s; }
.loading.done { opacity: 0; pointer-events: none; }
.loading b { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }

/* dialog */
dialog#fixdlg[open] { animation: pop .25s var(--ease); }
dialog#fixdlg::backdrop { animation: fadein .25s; backdrop-filter: blur(3px); }

/* toast slides up */
.toast { transform: translate(-50%, 12px); transition: opacity .25s, transform .3s var(--ease); }
.toast.on { transform: translate(-50%, 0); }

/* back to top */
#totop {
  position: fixed; right: 18px; bottom: 22px; z-index: 40; width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); color: var(--accent);
  display: grid; place-items: center; opacity: 0; transform: translateY(14px); pointer-events: none;
  transition: opacity .25s, transform .3s var(--ease), background-color .2s;
}
#totop svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
#totop.on { opacity: 1; transform: none; pointer-events: auto; }
#totop:hover { background: var(--accent-soft); }

/* checkboxes -> toggle switches */
input[type=checkbox] {
  -webkit-appearance: none; appearance: none; flex: none; margin: 0; position: relative; cursor: pointer;
  width: 36px; height: 21px; border-radius: 999px; background: color-mix(in srgb, var(--ink-2) 28%, var(--surface-2));
  border: 1px solid var(--line); transition: background-color .22s, border-color .22s;
}
input[type=checkbox]::after {
  content: ""; position: absolute; top: 1px; left: 1px; width: 17px; height: 17px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .25s var(--ease);
}
input[type=checkbox]:checked { background: var(--accent); border-color: var(--accent); }
input[type=checkbox]:checked::after { transform: translateX(15px); }
input[type=checkbox]:hover { border-color: var(--accent); }
input[type=checkbox]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.filters label.chk, .fixform label.chk, label.chk { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; }
.filters label.chk:hover { color: var(--ink); }

/* selects */
select, .filters select, .fixform select {
  -webkit-appearance: none; appearance: none; cursor: pointer; padding-right: 30px !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%238a8f9c' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
  transition: border-color .2s, box-shadow .2s;
}
select:hover { border-color: var(--accent); }
select:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* search-mode pills: a little more tactile */
.modes label:has(input:checked) { box-shadow: 0 2px 8px color-mix(in srgb, var(--accent) 22%, transparent); }
.modes label:hover { border-color: var(--accent); color: var(--accent); }

/* mobile: bottom tab bar */
@media (max-width: 780px) {
  body { padding-bottom: 74px; }
  nav.tabs {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 45; width: 100%; margin: 0; gap: 0;
    background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(12px);
    border-top: 1px solid var(--line); padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); justify-content: space-around; flex-wrap: nowrap;
  }
  nav.tabs a { flex: 1; flex-direction: column; gap: 2px; padding: 7px 2px 5px; font-size: .66rem; border-radius: 10px; text-align: center; }
  nav.tabs a svg { display: block; }
  nav.tabs a::after { left: 30%; right: 30%; bottom: 1px; }
  .top-in { flex-wrap: nowrap; }
  .brand { flex: 1; min-width: 0; }
  .brand span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #totop { bottom: 88px; right: 14px; }
  .toast { bottom: 90px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* suggestion / fix dialog: never wider than its box */
.fixform { grid-template-columns: minmax(0, 1fr); }
.fixform input:not([type=checkbox]), .fixform select { width: 100%; min-width: 0; text-overflow: ellipsis; }
dialog#fixdlg { overflow-x: hidden; max-height: calc(100vh - 32px); overflow-y: auto; }

/* ---------- About page ---------- */
.about { max-width: 920px; margin: 0 auto; }
.about-intro h1 { font: 700 2.3rem/1.1 var(--tam); margin: 0 0 14px; }
.about-intro .lead { font-size: 1.14rem; line-height: 1.6; max-width: 66ch; }
.about-intro p { max-width: 66ch; }
.about-stats { justify-content: flex-start !important; gap: 34px !important; margin: 22px 0 4px !important; }
.about-stats div { text-align: left !important; }

/* author card: profile picture next to name and bio */
.about-bio {
  display: flex; gap: 34px; align-items: center; margin: 32px 0 6px; padding: 28px 32px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow);
}
.about-bio .avatar {
  flex: none; width: 224px; height: 224px; border-radius: 50%; object-fit: cover; display: block;
  background: var(--surface-2); box-shadow: 0 0 0 4px var(--surface), 0 0 0 6px var(--accent), 0 14px 34px rgba(40,30,10,.22);
}
.bio-text { min-width: 0; }
.bio-text h2 { font: 700 1.7rem/1.15 var(--tam); margin: 0 0 10px; }
.bio-text p { margin: 0; color: var(--ink); line-height: 1.65; font-size: 1.02rem; }

.about-doc { max-width: none; margin-top: 34px; }
.about-doc h2 { margin-top: 1.9em; font-family: var(--tam); font-size: 1.35rem; }
.about-doc h2::before { content: ""; display: block; width: 34px; height: 3px; border-radius: 3px; background: var(--accent); margin-bottom: 8px; }
.about-doc > p, .about-doc > .note { max-width: 70ch; }
main.enter .about-hero > * { animation: rise .55s var(--ease) both; }
main.enter .about-hero > *:nth-child(2) { animation-delay: .1s; }
@media (max-width: 640px) {
  .about-intro h1 { font-size: 1.8rem; }
  .about-bio { flex-direction: column; text-align: center; padding: 24px 20px; gap: 20px; }
  .about-bio .avatar { width: 180px; height: 180px; }
}
