/* Lunde site: shared tokens and components for the conjugator and the grammar page.
   Layout: a linguist's workbench; Gentium for every Lunde word and all IPA, Archivo for the interface. */

/* Base reset (the grammar page is served without the host's skeleton) */
:root { color-scheme: light; padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
body { margin: 0; }
img { max-width: 100%; }
[hidden] { display: none !important; }

:root {
  /* paper and ink */
  --bg: #ECEFED;
  --panel: #F8FAF9;
  --ink: #15202A;
  --ink-2: #43515B;
  --ink-3: #5E6C75;
  --line: #C8D1CF;
  --line-soft: #DDE3E1;
  /* the three verb forms: ochre for the event, lapis for what is felt inside, madder for what is aimed outward */
  --samon: #8A5604;
  --namon: #2C5BA0;
  --exmon: #B23C2C;
  --samon-wash: #F1E3C8;
  --namon-wash: #DAE4F3;
  --exmon-wash: #F4DCD6;
  /* cases (nouns and adjectives): a slate green, separate from the three verb forms */
  --case: #2D6A5F;
  --case-wash: #D8EAE5;
  /* open questions and check results */
  --q: #6E44A0;
  --q-wash: #E8DFF3;
  --ok: #2E7A4B;
  --bad: #B3261E;
  --shadow: 0 1px 2px rgba(21, 32, 42, .06), 0 10px 28px rgba(21, 32, 42, .10);
  --f-lx: "Gentium Book Plus", "Gentium Plus", "Charis SIL", "Noto Serif", Georgia, serif;
  --f-ui: "Archivo", "Helvetica Neue", Arial, system-ui, sans-serif;
  --mc: var(--ink-2);
  --mw: var(--line-soft);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0D1316;
    --panel: #141C20;
    --ink: #E2E8E5;
    --ink-2: #A9B6BB;
    --ink-3: #7F8E95;
    --line: #2C383E;
    --line-soft: #1F292E;
    --samon: #E2AE55;
    --namon: #8FB3EE;
    --exmon: #F0907F;
    --samon-wash: #372B16;
    --namon-wash: #1A273A;
    --exmon-wash: #3A201C;
    --case: #74C7B5;
    --case-wash: #17302B;
    --q: #C4A2EE;
    --q-wash: #281E39;
    --ok: #6FCB91;
    --bad: #FF8A80;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 14px 34px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0D1316;
  --panel: #141C20;
  --ink: #E2E8E5;
  --ink-2: #A9B6BB;
  --ink-3: #7F8E95;
  --line: #2C383E;
  --line-soft: #1F292E;
  --samon: #E2AE55;
  --namon: #8FB3EE;
  --exmon: #F0907F;
  --samon-wash: #372B16;
  --namon-wash: #1A273A;
  --exmon-wash: #3A201C;
  --case: #74C7B5;
  --case-wash: #17302B;
  --q: #C4A2EE;
  --q-wash: #281E39;
  --ok: #6FCB91;
  --bad: #FF8A80;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 14px 34px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

.m-samon { --mc: var(--samon); --mw: var(--samon-wash); }
.m-namon { --mc: var(--namon); --mw: var(--namon-wash); }
.m-exmon { --mc: var(--exmon); --mw: var(--exmon-wash); }
.m-case { --mc: var(--case); --mw: var(--case-wash); }

/* ---------- base ---------- */
html { -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body { background: var(--bg); color: var(--ink); font: 400 15px/1.55 var(--f-ui); }
.page {
  max-width: 1560px;
  margin-inline: auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 18px 56px;
}
button, input, select { font: inherit; color: inherit; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--namon); outline-offset: 2px; }
.lx { font-family: var(--f-lx); }
i.lx, em.lx, .lxi { font-family: var(--f-lx); font-style: italic; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.g { width: 14px; height: 14px; flex: none; color: var(--mc); }
.eyebrow { margin: 0; font: 600 11px/1.3 var(--f-ui); letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); }
.ipa { font-family: var(--f-lx); color: var(--ink-2); }

/* ---------- masthead ---------- */
.mast {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
  gap: 16px 32px; padding-bottom: 18px; margin-bottom: 22px; border-bottom: 1px solid var(--line);
}
.mast-l { min-width: 0; max-width: 74ch; display: grid; gap: 8px; }
.mast h1 {
  margin: 0; font: 800 clamp(27px, 3.6vw, 40px)/1 var(--f-ui); font-stretch: 122%;
  letter-spacing: -.015em; text-wrap: balance;
}
.lede { margin: 0; color: var(--ink-2); max-width: 64ch; }
.key { display: flex; flex-wrap: wrap; gap: 6px 20px; margin: 2px 0 0; padding: 0; list-style: none; font-size: 13px; color: var(--ink-2); }
.key li { display: inline-flex; align-items: center; gap: 7px; }
.key b { font: 700 11.5px/1 var(--f-ui); letter-spacing: .1em; text-transform: uppercase; color: var(--mc); }
.mast-r { display: grid; justify-items: start; gap: 10px; }
.sitenav { display: flex; gap: 4px; padding: 3px; border-radius: 10px; background: var(--line-soft); }
.sitenav a { text-decoration: none; padding: 7px 14px; border-radius: 8px; font: 600 13.5px/1 var(--f-ui); color: var(--ink-2); }
.sitenav a:hover { color: var(--ink); }
.sitenav a[aria-current="page"] { background: var(--panel); color: var(--ink); box-shadow: 0 1px 2px rgba(21, 32, 42, .08); }
.badge {
  display: inline-flex; align-items: center; gap: 9px; text-decoration: none;
  font: 600 13px/1.2 var(--f-ui); padding: 8px 13px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--panel); font-variant-numeric: tabular-nums;
}
.badge:hover { border-color: var(--ink-3); }
.badge .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: none; }
.badge.bad .dot { background: var(--bad); }
.badge .pend { color: var(--q); font-weight: 600; }
.toplinks { display: flex; flex-wrap: wrap; gap: 6px 16px; font: 500 13px/1.2 var(--f-ui); }
.toplinks a { text-decoration: none; color: var(--ink-2); border-bottom: 1px solid var(--line); padding-bottom: 2px; }
.toplinks a:hover { color: var(--ink); border-color: var(--ink-2); }
@media (max-width: 600px) {
  .mast { gap: 12px; padding-bottom: 14px; margin-bottom: 16px; }
  .mast-l { gap: 6px; }
  .lede { font-size: 14px; }
  .key { font-size: 12.5px; gap: 4px 14px; }
}

/* ---------- section scaffolding ---------- */
.blk { display: grid; gap: 12px; min-width: 0; }
.blk > *, .ref > *, .rule-blk > * { min-width: 0; }
.blk-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 16px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.blk-head h3, .rule-blk h3 { margin: 0; font: 700 13px/1.2 var(--f-ui); font-stretch: 112%; letter-spacing: .12em; text-transform: uppercase; }
.blk-note { margin: 0; color: var(--ink-3); font-size: 13px; }
.blk-note a, .q-inline { color: var(--q); }
.q-mark { color: var(--q); font-weight: 700; }
.legend { margin: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 12.5px; color: var(--ink-3); }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.lg-dot { display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: var(--ink-2); }
.lg-fade { font: italic 400 15px/1 var(--f-lx); color: var(--ink-3); opacity: .6; }

/* segmented control */
.seg { display: inline-flex; flex-wrap: wrap; gap: 3px; padding: 3px; border-radius: 9px; background: var(--line-soft); }
.seg button { border: 0; background: none; border-radius: 7px; padding: 6px 11px; font: 600 12.5px/1.1 var(--f-ui); color: var(--ink-2); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--panel); color: var(--ink); box-shadow: 0 1px 2px rgba(21, 32, 42, .08); }

/* īmon switch */
.tog { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-size: 14px; }
.tog input {
  appearance: none; -webkit-appearance: none; margin: 0; flex: none;
  width: 36px; height: 21px; border-radius: 999px; background: var(--line); position: relative; cursor: pointer; transition: background-color .15s;
}
.tog input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 15px; height: 15px; border-radius: 50%; background: var(--panel); transition: transform .15s; }
.tog input:checked { background: var(--ink); }
.tog input:checked::after { transform: translateX(15px); }
.tog .lx { font-style: italic; font-size: 17px; }
.tog small { color: var(--ink-3); font-size: 12.5px; }

/* ---------- paradigm tables ---------- */
.tw { overflow-x: auto; min-width: 0; }
.par { border-collapse: collapse; width: 100%; }
.par th, .par td { padding: 0; text-align: left; vertical-align: middle; }
.par thead th {
  font: 600 10.5px/1.2 var(--f-ui); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3);
  padding: 7px 8px 7px; border-bottom: 1.5px solid var(--mc);
}
.par tbody tr + tr > * { border-top: 1px solid var(--line-soft); }
.par tbody th { padding: 0 8px 0 2px; white-space: nowrap; width: 1%; font-weight: 400; }
.pn { display: inline-block; min-width: 2.3em; font: 600 11.5px/1 var(--f-ui); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.pp { font: italic 400 14px/1 var(--f-lx); color: var(--ink-3); }
.pg { font-size: 12px; color: var(--ink-3); }
.row-unused > th, .row-unused > td { opacity: .5; }
.th-mode { display: inline-flex; align-items: center; gap: 6px; color: var(--mc); }
.th-word { display: block; margin-top: 4px; font: italic 400 16px/1.2 var(--f-lx); letter-spacing: 0; text-transform: none; color: var(--ink); }

/* a form you can click */
.fm {
  display: block; position: relative; width: 100%; text-align: left; border: 0; background: none;
  border-radius: 4px; padding: 6px 8px; color: var(--ink); cursor: pointer; white-space: nowrap;
  font: italic 400 18px/1.25 var(--f-lx); transition: background-color .12s, opacity .12s;
}
.fm:hover { background: var(--mw); }
.fm.ch .fm-t::after {
  content: ""; display: inline-block; width: 5px; height: 5px; margin-left: 3px; border-radius: 50%;
  background: var(--mc); vertical-align: .62em;
}
.fm-q { margin-left: 2px; font: 700 10.5px/1 var(--f-ui); font-style: normal; color: var(--q); vertical-align: .75em; }
.fm.sel { background: var(--mw); box-shadow: inset 0 0 0 1.5px var(--mc); }
.fm.hit { background: var(--mw); }
.fm.dim { opacity: .24; }
.fm.unused { color: var(--ink-3); }
.fm:focus-visible { outline-color: var(--mc); outline-offset: 0; }
.fm-none { display: block; padding: 6px 8px; color: var(--ink-3); font: 400 15px/1.25 var(--f-ui); }
a.q-link { color: var(--q); font-weight: 700; text-decoration: none; }

/* ---------- derivation chain ---------- */
.chain { list-style: none; margin: 16px 0 0; padding: 0; }
.chain > li { position: relative; padding-left: 26px; }
.chain > li::before { content: ""; position: absolute; left: 7px; top: 0; bottom: 0; width: 2px; background: var(--line); }
.chain > li:first-child::before { top: 16px; }
.chain > li:last-child::before { bottom: calc(100% - 16px); }
.c-node { padding: 4px 0; }
.c-node::after {
  content: ""; position: absolute; left: 2px; top: 11px; width: 8px; height: 8px; border-radius: 50%;
  border: 2px solid var(--mc); background: var(--panel);
}
.c-node.final::after { background: var(--mc); }
.c-form { font: italic 400 23px/1.3 var(--f-lx); overflow-wrap: anywhere; }
.c-node.final .c-form { font-weight: 700; }
.c-under { font: 400 20px/1.3 var(--f-lx); color: var(--ink); }
.c-cap { display: block; font-size: 11.5px; color: var(--ink-3); letter-spacing: .02em; }
.c-form mark, .p-form mark, .syl mark { background: none; color: var(--mc); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }
.c-form mark.gap, .p-form mark.gap {
  display: inline-block; width: 2px; height: .8em; margin: 0 1.5px; vertical-align: -.05em;
  background: var(--mc); border-radius: 1px; text-decoration: none;
}
.c-rule { display: grid; gap: 2px; padding: 3px 0 9px; }
.c-rule::after {
  content: ""; position: absolute; left: 4px; bottom: 1px;
  border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 6px solid var(--line);
}
.c-rbtn {
  display: grid; gap: 1px; width: 100%; text-align: left; border: 0; background: none;
  padding: 5px 8px; margin-left: -8px; border-radius: 6px; cursor: pointer; font-size: 13.5px; line-height: 1.35;
}
.c-rbtn small { font-size: 11.5px; color: var(--ink-3); }
.c-rbtn:hover { background: var(--mw); }
.c-rbtn[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.c-rbtn[aria-pressed="true"] small { color: inherit; opacity: .7; }
.c-rnote { display: grid; gap: 1px; padding: 5px 0; font-size: 13.5px; line-height: 1.35; }
.c-rnote small { font-size: 11.5px; color: var(--ink-3); }
.c-none span { display: block; padding: 5px 0; font-size: 13.5px; color: var(--ink-3); }
@media (prefers-reduced-motion: no-preference) {
  .chain.anim > li { animation: step-in .28s ease both; animation-delay: calc(var(--i, 0) * 55ms); }
  @keyframes step-in { from { opacity: .3; transform: translateY(3px); } to { opacity: 1; transform: none; } }
}

/* ---------- reference sections ---------- */
.vchip {
  border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 2px 10px;
  font: italic 400 15px/1.3 var(--f-lx); cursor: pointer; color: var(--ink); text-decoration: none; display: inline-block;
}
.vchip:hover { border-color: var(--ink-3); }
.qgroup { margin: 8px 0 -4px; font: 700 12px/1.2 var(--f-ui); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }
.qs { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr)); gap: 14px 18px; }
.qc {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 14px; align-content: start;
  padding: 15px 16px 16px; background: var(--panel); border: 1px solid var(--line-soft); border-radius: 10px; scroll-margin-top: 16px;
}
.qc:target { box-shadow: 0 0 0 2px var(--q); }
.qc-n { grid-row: span 3; font: 800 30px/1 var(--f-ui); font-stretch: 112%; color: var(--q); font-variant-numeric: tabular-nums; min-width: 1.2em; }
.qc h4 { margin: 0; font: 700 15.5px/1.3 var(--f-ui); text-wrap: balance; }
.qc p { margin: 0; color: var(--ink-2); font-size: 14px; }
.qc p i, .settled i, .plain i { font-family: var(--f-lx); font-size: 1.08em; color: var(--ink); }
.see { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12.5px; color: var(--ink-3); padding-top: 2px; }
.settled { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap: 0 28px; }
.settled li { display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 8px; padding: 7px 0; border-top: 1px solid var(--line-soft); font-size: 14px; color: var(--ink-2); }
.settled li::before { content: "✓"; color: var(--ok); font-weight: 700; }
.docopen { margin: 0; padding-left: 18px; display: grid; gap: 4px; color: var(--ink-2); font-size: 14px; max-width: 80ch; }

.rule-blk { display: grid; gap: 12px; margin-top: 10px; }
.rule-blk h3 { padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.pipe { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); gap: 12px 22px; }
.pipe li { position: relative; display: grid; gap: 4px; align-content: start; padding-top: 10px; border-top: 2px solid var(--line); min-width: 0; }
.pipe li.on { border-top-color: var(--mc); }
.pipe li + li::before { content: "→"; position: absolute; left: -18px; top: 6px; color: var(--ink-3); font-size: 14px; }
.p-name { font: 600 11px/1.2 var(--f-ui); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); }
.p-form { font: italic 400 21px/1.25 var(--f-lx); overflow-wrap: anywhere; }
.pipe li:not(.on) .p-form { color: var(--ink-3); }
.p-rule { font-size: 12.5px; color: var(--ink-3); }

.vc-wrap { border: 1px solid var(--line-soft); border-radius: 8px; background: var(--panel); }
.vc { border-collapse: collapse; width: 100%; min-width: 700px; }
.vc th, .vc td { border-right: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); padding: 7px 9px; text-align: left; vertical-align: top; }
.vc tr > :last-child { border-right: 0; }
.vc tbody tr:last-child > * { border-bottom: 0; }
.vc thead th { font: italic 400 19px/1 var(--f-lx); text-align: left; }
.vc thead th.corner { font: 600 10.5px/1.35 var(--f-ui); letter-spacing: .04em; color: var(--ink-3); width: 1%; white-space: nowrap; }
.vc tbody th { font: italic 400 19px/1 var(--f-lx); }
.vc-o { display: flex; align-items: baseline; gap: 5px; white-space: nowrap; }
.vc-r { font: italic 400 18px/1.35 var(--f-lx); }
.vc-o.keep .vc-r { color: var(--ink-3); }
.vc-c { font: 600 9.5px/1 var(--f-ui); letter-spacing: .06em; color: var(--ink-3); text-transform: uppercase; }
.vc-keepnote { font-style: normal; color: var(--ink-3); }

.rgroups { columns: 3 300px; column-gap: 32px; }
.rg { margin-bottom: 20px; }
.rg h4 { margin: 0 0 4px; font: 600 11.5px/1.2 var(--f-ui); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); break-after: avoid; }
.rg ul { list-style: none; margin: 0; padding: 0; }
.rg li { display: grid; gap: 5px; padding: 8px 0; border-top: 1px solid var(--line-soft); break-inside: avoid; }
.rt { font-size: 14px; }
.rv { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.rv .vchip { font-size: 14px; padding: 1px 8px; }
.rv-n { font-size: 12px; color: var(--ink-3); margin-right: 2px; }
.plain { margin: 0; padding-left: 18px; display: grid; gap: 6px; max-width: 76ch; }
.plain .lx { font-style: italic; font-size: 16px; }

.ck-sum { margin: 0; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.ck-g { border-top: 1px solid var(--line); }
.ck-g summary { cursor: pointer; padding: 11px 0; display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: baseline; }
.ck-src { font-weight: 600; }
.ck-c { color: var(--ink-3); font-size: 13px; font-variant-numeric: tabular-nums; }
.ck-list { list-style: none; margin: 0 0 14px; padding: 0; columns: 2 340px; column-gap: 32px; font-size: 13px; }
.ck-list li { break-inside: avoid; display: grid; grid-template-columns: 16px minmax(0, 1fr); gap: 8px; padding: 3px 0; }
.ck-ok { color: var(--ok); font-weight: 700; }
.ck-bad { color: var(--bad); font-weight: 700; }
.ck-pend { color: var(--q); font-weight: 700; }
.ck-l { color: var(--ink-2); }
.ck-forms { font: italic 400 14.5px/1.35 var(--f-lx); color: var(--ink); }
.ck-got { display: block; color: var(--bad); }
.ck-got.pend { color: var(--q); }

.foot { margin-top: 56px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--ink-3); display: flex; flex-wrap: wrap; gap: 6px 22px; }
.foot a { color: var(--ink-2); }

/* ---------- small declension table (derivation panel, tools) ---------- */
.mini { border-collapse: collapse; width: 100%; font-size: 13px; }
.mini th, .mini td { text-align: left; padding: 4px 6px; border-top: 1px solid var(--line-soft); vertical-align: baseline; }
.mini thead th { border-top: 0; font: 600 10px/1.2 var(--f-ui); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.mini tbody th { font: 600 11px/1.2 var(--f-ui); color: var(--ink-2); white-space: nowrap; }
.mini td { font: italic 400 15.5px/1.25 var(--f-lx); }
.mini td.na { color: var(--ink-3); font-style: normal; font-family: var(--f-ui); font-size: 12px; }
.mini td.exc { color: var(--q); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
