/* Nsoniki Mandombe blocks. Ported from the reference site's stylesheet.
   Colours come from the Nsoniki theme's palette when it is active, with the
   same values as fallbacks so the blocks keep their look in any theme. */
@font-face {
  font-family: "Nsoniki Mandombe";
  src: url(MandombeSingle.ttf) format("truetype");
  font-display: block;
}
:root {
  --paper: var(--wp--preset--color--paper, #4A2C1D);
  --surface: var(--wp--preset--color--surface, #3A2216);
  --wash: var(--wp--preset--color--wash, #573525);
  --ink: var(--wp--preset--color--ink, #E8DCC0);
  --ink-soft: var(--wp--preset--color--ink-soft, #D8C8AA);
  --muted: var(--wp--preset--color--muted, #BFA98D);
  --rule: var(--wp--preset--color--rule, #6E4A35);
  --line: var(--wp--preset--color--line, #171512);
  --module: rgba(232, 220, 192, 0.07);
  --gold: var(--wp--preset--color--gold, #D4A72C);
  --gold-2: var(--wp--preset--color--gold-2, #F2D88A);
  --red: var(--wp--preset--color--red, #FF4433);
  --red-2: var(--wp--preset--color--red-2, #FF9C8F);
  --green: var(--wp--preset--color--green, #395E3C);
  --gold-hover: #E6BC48;
  --display: var(--wp--preset--font-family--display, "Alfa Slab One", Rockwell, Georgia, serif);
  --body: var(--wp--preset--font-family--body, Archivo, "Helvetica Neue", Arial, sans-serif);
  --zita: "Nsoniki Mandombe";
}

/* zita: always from the font, never faux-bolded */
.zita { font-family: var(--zita); font-weight: 400; font-style: normal; font-synthesis: none; line-height: 1; }
.nsoniki-missing { font: 600 14px var(--body); color: var(--muted); border: 2px dashed var(--rule); padding: 4px 8px; }
/* the tools toggle parts with the hidden attribute; keep it stronger than their display rules */
[class*="wp-block-nsoniki-"] [hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.hint { font-size: 14px; color: var(--muted); }
.eyebrow { font: 600 15px/1.4 var(--body); color: var(--ink-soft); }

/* brand */
.brand { display: flex; align-items: center; gap: 12px; font: 400 26px var(--display); text-decoration: none; color: var(--gold); }
.brand:hover { color: var(--gold); }
.brand .zita { font-size: 34px; color: var(--gold); }

/* buttons used inside the tools (dialog, quiz) */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 13px 22px; font: 800 17px var(--body);
  text-decoration: none; border: 3px solid var(--line); border-radius: 0; color: var(--line); background: var(--ink); cursor: pointer; box-shadow: 4px 4px 0 var(--line); }
.btn:hover { color: var(--line); background: #FFF6E0; }
.btn:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--line); }
.btn.primary { background: var(--gold); color: var(--line); }
.btn.primary:hover { background: var(--gold-hover); }
.actions { display: flex; gap: 14px; flex-wrap: wrap; }

/* panels: a glyph set into the wall */
.stage { position: relative; padding: 32px 24px 22px; background-color: var(--surface); border: 3px solid var(--line);
  background-image: linear-gradient(var(--module) 1px, transparent 1px), linear-gradient(90deg, var(--module) 1px, transparent 1px);
  background-size: 57px 42px; background-position: -1px -1px; }
.stage .note { position: absolute; top: 10px; right: 14px; font: 500 13px var(--body); color: var(--muted); }

/* the hero's painted sign */
.signboard.stage { background: var(--red); background-image: none; border: 8px solid var(--line); box-shadow: 14px 14px 0 var(--gold); padding: 40px 24px 26px; }
.signboard .word { display: flex; justify-content: center; gap: clamp(6px, 2vw, 18px); flex-wrap: nowrap; }
.signboard figure { margin: 0; display: grid; justify-items: center; gap: 12px; }
.signboard .zita { color: var(--ink); text-shadow: 0.05em 0.05em 0 var(--line); font-size: clamp(44px, 7vw, 96px); display: block; width: 1.4em; text-align: center; }
.signboard figcaption { font: 400 26px var(--display); color: var(--line); }
.signboard .word-gloss { text-align: center; margin-top: 18px; font-size: 15px; color: var(--line); font-weight: 800; }

/* the woven band: zita repeated in the family colours */
.band { display: grid; margin-inline: calc(50% - 50vw); font-family: var(--zita); font-synthesis: none; line-height: 1; white-space: nowrap; overflow: hidden; }
.band div { padding-block: 10px; letter-spacing: 10px; }
.band .b1 { background: var(--gold); color: var(--paper); font-size: 38px; padding-left: 24px; }
.band .b2 { background: var(--line); color: var(--red); font-size: 22px; padding-left: 70px; letter-spacing: 16px; }
.band .b3 { background: var(--green); color: var(--ink); font-size: 38px; padding-left: 130px; }
.band.thin .b1, .band.thin .b3 { font-size: 26px; padding-block: 6px; }
.band.thin .b2 { font-size: 18px; padding-block: 4px; }

/* the two shapes and their zita */
.shapes { display: flex; gap: 10px; align-items: end; min-height: 74px; flex-wrap: wrap; }
.shapes svg { height: 64px; width: auto; }
.shapes .zita { font-size: 62px; color: var(--gold); }
svg .stroke { fill: none; stroke: var(--gold); stroke-width: 0.22; stroke-linecap: square; stroke-linejoin: miter; }
svg .yik { fill: none; stroke: var(--red); stroke-width: 0.22; stroke-linecap: square; }

/* brick wall */
.wall { margin: 0; border: 4px solid var(--line); overflow: hidden; background: var(--surface); }
.wall canvas { display: block; width: 100%; height: auto; aspect-ratio: 640 / 420; }
.wall figcaption { padding: 10px 14px; font-size: 14px; color: var(--ink-soft); border-top: 3px solid var(--line); }

/* tables */
.table-wrap { overflow-x: auto; border: 3px solid var(--line); background: var(--surface); }
.table-wrap table { border-collapse: collapse; width: 100%; margin: 0; }
.table-wrap th, .table-wrap td { border: 0; border-bottom: 1px solid var(--rule); text-align: center; padding: 10px 6px; }
.table-wrap thead th { font: 800 14px var(--body); color: var(--muted); }
.table-wrap tr:last-child th, .table-wrap tr:last-child td { border-bottom: 0; }
.alpha { min-width: 600px; }
.alpha thead tr.fam th { font: 800 16px var(--body); color: var(--ink-soft); padding-top: 14px; padding-bottom: 0; border-bottom: 0; }
.alpha thead tr:not(.fam) th { font: 400 20px var(--display); color: var(--ink); padding-block: 12px 10px; }
.alpha thead .dir { display: block; font: 400 22px var(--body); color: var(--ink-soft); }
.alpha tbody th { text-align: left; padding-left: 16px; font: 400 19px var(--display); white-space: nowrap; }
.alpha tbody th small { display: block; font: 600 14px var(--body); color: var(--ink-soft); margin-top: 2px; }
.alpha td button { background: none; border: 0; cursor: pointer; color: var(--ink); padding: 4px 6px; display: grid; justify-items: center; gap: 2px; margin: 0 auto; }
.alpha td button .zita { font-size: 42px; }
.alpha td button small { font: 800 17px var(--body); color: var(--ink); }
.alpha td button:hover { background: var(--wash); }

/* builder */
.builder { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 36px; align-items: start; }
.controls { display: grid; gap: 22px; }
.ctl { display: grid; gap: 10px; }
.ctl legend, .ctl .label { font: 800 16px var(--body); color: var(--ink); padding: 0; }
.nsoniki-builder fieldset, .nsoniki-learn fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { font: 700 16px var(--body); padding: 8px 14px; border: 2px solid var(--rule); border-radius: 0; background: var(--surface); color: var(--ink); cursor: pointer; min-width: 44px; min-height: 44px; }
.chip:hover { border-color: var(--ink-soft); }
.chip small { display: block; font: 500 12px var(--body); color: var(--muted); }
.chip[aria-pressed="true"] { border: 3px solid var(--line); background: var(--g-ink, var(--gold)); color: var(--line); box-shadow: 3px 3px 0 var(--line); }
.chip[aria-pressed="true"] small, .chip[aria-pressed="true"] .n { color: var(--line); }
.chip:disabled { opacity: 0.4; cursor: not-allowed; }
.chip.group { text-align: left; }
.chip .n { font: 600 13px var(--body); color: var(--muted); margin-left: 4px; }
.toggles { display: grid; gap: 8px; }
.toggle { display: inline-flex; align-items: center; gap: 10px; font-size: 16px; cursor: pointer; }
.toggle input { width: 20px; height: 20px; accent-color: var(--gold); margin: 0; }
.toggle input:disabled + span { color: var(--muted); }
.result { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 16px); }
.admin-bar .result { top: calc(env(safe-area-inset-top, 0px) + 48px); }
.result .stage { padding: 40px 24px 24px; display: grid; justify-items: center; gap: 14px; box-shadow: 10px 10px 0 var(--line); }
.big { font-size: clamp(120px, 20vw, 190px); color: var(--g-ink, var(--ink)); min-height: 1em; }
.reading { font: 400 34px var(--display); }
.meta { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; font: 600 14px var(--body); color: var(--muted); }
.flag { font-size: 15px; color: var(--ink-soft); text-align: center; max-width: 30em; }
.steps { display: flex; justify-content: center; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 18px; }
.steps .s { display: grid; justify-items: center; gap: 4px; }
.steps .zita { font-size: 46px; }
.steps small { font: 600 13px var(--body); color: var(--muted); }
.steps .arrow { color: var(--muted); font-size: 18px; padding-bottom: 18px; }

/* vowels and nkoma-nkoma */
.marks { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border: 3px solid var(--line); background: var(--surface); overflow: hidden; }
.marks div { padding: 14px 8px; text-align: center; border-right: 1px solid var(--rule); display: grid; gap: 6px; justify-items: center; }
.marks div:last-child { border-right: 0; }
.marks .v { font: 400 19px var(--display); }
.marks .m { font: 800 22px var(--body); color: var(--red); letter-spacing: 0.1em; min-height: 30px; }
.marks .zita { font-size: 44px; }
.marks small { font: 500 13px var(--body); color: var(--muted); }

/* glyph examples */
.samples { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0; border: 3px solid var(--line); background: var(--surface); }
.sample { border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); padding: 16px 14px; display: grid; gap: 8px; justify-items: start; }
.sample .zita { font-size: 56px; color: var(--gold); }
.sample b { font: 400 19px var(--display); }
.sample p { font-size: 14px; color: var(--ink-soft); margin: 0; }

/* digits, numbers, punctuation */
.digits { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); border: 3px solid var(--line); background: var(--surface); overflow: hidden; }
.digits div { text-align: center; padding: 12px 4px; border-right: 1px solid var(--rule); display: grid; gap: 4px; }
.digits div:last-child { border-right: 0; }
.digits .zita { font-size: 42px; color: var(--gold); }
.digits small { font: 800 15px var(--body); color: var(--ink-soft); }
body .example-num { display: flex; gap: 32px; flex-wrap: wrap; margin-top: 18px; align-items: end; }
.example-num span.zita { font-size: 42px; letter-spacing: 2px; color: var(--gold); }
.example-num div { display: grid; gap: 4px; }
.example-num small { font: 600 14px var(--body); color: var(--muted); }
body .example-num + p.hint { margin-top: 8px; }
body .numconv { display: flex; gap: 16px 24px; flex-wrap: wrap; align-items: center; margin-top: 24px; }
.numconv input { font: 800 22px var(--body); padding: 10px 12px; border: 3px solid var(--line); border-radius: 0; background: var(--ink); color: var(--line); width: 12ch; font-variant-numeric: tabular-nums; }
.numconv .zita { font-size: 48px; letter-spacing: 3px; min-height: 1em; color: var(--gold); }
.punct { width: 100%; }
.table-wrap .punct td, .table-wrap .punct th { text-align: left; padding: 10px 14px; }
.punct td:first-child { font: 400 19px var(--display); color: var(--ink); }
.punct td:last-child { color: var(--ink-soft); font-size: 16px; }
.punct td .zita { font-size: 32px; color: var(--red); }

/* codex */
.codex-bar { display: flex; gap: 16px 24px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }
.search { flex: 1 1 280px; }
.search input { width: 100%; font: 600 18px var(--body); padding: 13px 16px; border: 3px solid var(--line); border-radius: 0; background: var(--ink); color: var(--line); box-shadow: 4px 4px 0 var(--line); }
.search input::placeholder { color: #6A5A48; }
.size { display: inline-flex; gap: 10px; align-items: center; }
.size input { accent-color: var(--gold); }
#cxCount { margin-top: 12px; }
.cx-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(calc(var(--cx, 48px) + 64px), 1fr)); gap: 10px; margin-top: 16px; }
.cx-card { display: grid; justify-items: center; gap: 6px; padding: 14px 6px 10px; border: 3px solid var(--line); border-radius: 0; background: var(--surface); color: var(--ink); cursor: pointer; font: inherit; }
.cx-card:hover { background: var(--g-tint, var(--wash)); }
.cx-card .zita { font-size: var(--cx, 48px); color: var(--g-ink, var(--ink)); min-height: 1em; }
.cx-card b { font: 400 20px var(--display); color: var(--ink); }
.cx-card small { font: 500 12px var(--body); color: var(--muted); }
.nsoniki-codex dialog { border: 4px solid var(--line); border-radius: 0; padding: 0; background: var(--paper); color: var(--ink); width: min(780px, calc(100vw - 32px)); max-width: none; max-height: calc(100vh - 32px); box-shadow: 12px 12px 0 var(--line); }
.nsoniki-codex dialog::backdrop { background: rgba(23, 21, 18, 0.6); }
.dlg { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; padding: 26px; }
.dlg-stage { display: grid; place-items: center; min-height: 240px; }
.dlg-stage .zita { font-size: 150px; color: var(--g-ink, var(--ink)); }
.dlg-info { display: grid; gap: 14px; align-content: start; min-width: 0; }
.dlg-info h2 { font: 400 40px/1.05 var(--display); margin: 0; color: var(--ink); }
.dlg-info dl { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px 16px; margin: 0; }
.dlg-info dt { font: 800 14px var(--body); color: var(--muted); padding-top: 2px; }
.dlg-info dd { margin: 0; font-size: 16px; }
.dlg-close { position: absolute; top: 8px; right: 10px; border: 0; background: none; font-size: 30px; line-height: 1; color: var(--ink); cursor: pointer; padding: 6px 10px; }

/* learn */
.learn { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: 36px; align-items: start; }
.learn-ctl { display: grid; gap: 22px; justify-items: start; }
.learn-ctl .score { justify-self: stretch; }
.score { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 3px solid var(--line); background: var(--surface); }
.score div { display: grid; justify-items: center; padding: 14px 6px; border-right: 3px solid var(--line); }
.score div:last-child { border-right: 0; }
.score b { font: 400 34px var(--display); font-variant-numeric: tabular-nums; color: var(--gold); }
.score span { font: 600 13px var(--body); color: var(--muted); text-align: center; }
.q-stage { display: grid; place-items: center; min-height: 260px; }
.q-stage #lPrompt { font-size: 150px; }
.q-stage #lPrompt.latin { font: 400 72px var(--display); }
.q-opts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 16px; }
.q-opt { display: grid; place-items: center; min-height: 76px; padding: 10px; border: 3px solid var(--line); border-radius: 0; background: var(--surface); color: var(--ink); cursor: pointer; font: 400 26px var(--display); box-shadow: 4px 4px 0 var(--line); }
.q-opt:hover { background: var(--wash); }
.q-opt .zita { font-size: 56px; }
.q-opt[data-state="right"] { background: var(--green); color: var(--ink); }
.q-opt[data-state="wrong"] { background: var(--red); color: var(--line); }
.q-opt:disabled { cursor: default; }
.q-feedback { min-height: 3em; margin-top: 14px; font-size: 17px; color: var(--ink-soft); }
.q-feedback b { color: var(--ink); }
.quiz #lNext { margin-top: 4px; }

/* Fonts & apps */
.get-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 18px; align-items: start; }
.get { border: 3px solid var(--line); background: var(--surface); padding: 22px; display: grid; gap: 12px; align-content: start; }
.get.soon { grid-column: 1 / -1; }
.get h2 { font: 400 26px/1.05 var(--display); margin: 0; color: var(--ink); }
.get .ver { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.pill { font: 800 13px var(--body); padding: 3px 9px; border: 2px solid var(--rule); color: var(--ink-soft); white-space: nowrap; }
.pill.ok { background: var(--green); border-color: var(--green); color: var(--ink); }
.get p { font-size: 15px; color: var(--ink-soft); margin: 0; }
.get p.hint { margin: 0; }
.files { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.files li { display: flex; justify-content: space-between; gap: 12px; font-size: 15px; border-top: 1px solid var(--rule); padding-top: 6px; }
.files li a { font-weight: 700; }
.files li span:last-child { font: 500 14px var(--body); color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.soon-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 10px 28px; }
.soon-list li { font-size: 15px; color: var(--ink-soft); }
.soon-list b { color: var(--ink); font-weight: 800; }

/* App: full width, full height under the site header */
.nsoniki-app { width: 100vw; margin-left: calc(50% - 50vw); }
.nsoniki-app-frame { display: block; width: 100%; height: calc(100vh - var(--head, 76px)); height: calc(100dvh - var(--head, 76px)); min-height: 520px; border: 0; border-top: 3px solid var(--line); background: var(--paper); }

@media (max-width: 760px) {
  .builder, .learn, .dlg { grid-template-columns: minmax(0, 1fr); }
  .builder { gap: 40px; }
  .result { position: static; }
  .signboard.stage { box-shadow: 8px 8px 0 var(--gold); border-width: 6px; padding-inline: 12px; }
  .signboard figcaption { font-size: 20px; }
  .dlg-stage { min-height: 180px; }
  .dlg-stage .zita { font-size: 110px; }
  .q-stage #lPrompt { font-size: 110px; }
  .digits { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .digits div:nth-child(5) { border-right: 0; }
  .digits div:nth-child(-n+5) { border-bottom: 1px solid var(--rule); }
  .marks .zita { font-size: 34px; }
  .band .b1, .band .b3 { font-size: 28px; }
}
@media (max-width: 480px) {
  .cx-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
}
@media (prefers-reduced-motion: no-preference) {
  .big { transition: color .2s; }
}
