/* TBI UI Fieldnotes adoption · 2026-09-23. Original implementation.
   Task-first navigation: Stripe Docs / TBI task-finder.
   Readable references: TBI evidence-note. Explicit controls: GOV.UK Design System.
   Scope by page family: never change simulator geometry or canvas transforms. */
:root:has(body.tbi-ui) {
  --tbi-bg:#f5f7f5; --tbi-paper:#fff; --tbi-ink:#19392f;
  --tbi-body:#465b53; --tbi-muted:#596c63; --tbi-line:#cad5ce;
  --tbi-line-soft:#e1e8e3; --tbi-accent:#b2d45c; --tbi-accent-soft:#edf4db;
  --tbi-dark:#19392f; --tbi-dark-2:#234c3e;
  --tbi-radius:8px; --tbi-shadow:0 8px 24px #183b320b;
}
body.tbi-ui { --ui-generation:20260923; }
.tbi-ui [hidden] { display:none!important; }
.tbi-ui :where(h1,h2,h3,p,li,a,label) { overflow-wrap:anywhere; }
.tbi-ui :where(button,input,select,textarea) { font-family:inherit; }
.tbi-ui :where(a,button,input,select,textarea,summary,[tabindex]):focus-visible {
  outline:3px solid #b45a16!important; outline-offset:3px;
}
.tbi-ui :where(button,[role=button]):disabled { cursor:not-allowed; opacity:.6; }
.tbi-ui .tbi-orbit-mini { display:none; }
.tbi-ui .tbi-sitebar { background:#f5f7f5f5; border-bottom-color:#cad5ce; }
.tbi-ui .tbi-brand { font-size:.9375rem; letter-spacing:-.03em; }
.tbi-ui .tbi-home-link { border:0; background:transparent; font-size:.75rem; padding-inline:6px; white-space:nowrap; overflow-wrap:normal; }
.tbi-ui :where(.tbi-language-nav,.language-switch) { flex-wrap:wrap; overflow:visible; }
.tbi-ui :where(.tbi-language-nav,.language-switch) a { font-size:.75rem; }
.tbi-ui :where(.tbi-language-nav,.language-switch) a[aria-current] { box-shadow:inset 0 -2px 0 #426440; }
.tbi-ui .tbi-sitebar-inner { min-width:0; }
.tbi-ui.learning-page .tbi-sitebar { background:#1e202bf5; }
.tbi-ui.learning-page .tbi-sitebar-meta { color:#c5ccca; }
.tbi-skip { position:absolute;top:-100px;left:12px;z-index:10001;padding:10px 16px;background:white;color:#19392f!important; }
.tbi-skip:focus { top:8px; }

/* A compact directory: the first screen offers search and usable destinations. */
body.tbi-ui.home-page {
  --home-bg:#f5f7f5;--home-paper:#fff;--home-ink:#19392f;--home-body:#465b53;
  --home-muted:#596c63;--home-line:#cad5ce;--home-line-soft:#e1e8e3;
  --home-accent:#b2d45c;--home-dark:#19392f;
  font-family:system-ui,-apple-system,"Noto Sans JP",sans-serif;
}
.tbi-ui.home-page *, .tbi-ui.home-page *::before, .tbi-ui.home-page *::after { box-sizing:border-box; }
.tbi-ui .home-shell { width:min(100% - 48px,1180px); }
.tbi-ui.home-page > .language-switch { width:min(100% - 48px,1180px); }
.tbi-ui.home-page > .language-switch a { font-family:system-ui,sans-serif;letter-spacing:0; }
.tbi-ui .home-topbar { background:#f5f7f5f5; border-color:#cad5ce; }
.tbi-ui .home-brand { font-size:1rem; letter-spacing:-.04em; }
.tbi-ui .home-brand-mark { box-shadow:none; background:#19392f; width:12px;height:12px; }
.tbi-ui .home-nav a { font-size:.75rem; color:#465b53; }
.tbi-ui .home-hero { display:grid;grid-template-columns:1fr 1fr;gap:16px 60px;padding:40px 0 28px;overflow:visible; }
.tbi-ui .home-path { grid-column:1 / -1;margin:0;font-size:.75rem!important; }
.tbi-ui .home-hero h1 { grid-column:1;margin:0;font-size:clamp(2rem,4vw,3.65rem);line-height:1.12;letter-spacing:-.055em; }
.tbi-ui .home-hero-copy { grid-column:1;margin:0;font-size:1rem;max-width:54ch;line-height:1.8; }
.tbi-ui .home-finder { grid-column:2;grid-row:2 / span 2;align-self:center;background:white;padding:24px;border:1px solid var(--home-line);border-top:3px solid #19392f;border-radius:8px; }
.tbi-ui .home-finder label { display:block;margin-bottom:10px;font-size:1rem;font-weight:700; }
.tbi-ui .home-search-row { display:flex;gap:8px; }
.tbi-ui #home-search { min-width:0;flex:1;width:100%;min-height:44px;padding:10px 12px;border:1px solid #7b9082;border-radius:5px;background:#fff;color:#19392f;font:inherit; }
.tbi-ui #home-search::placeholder { color:#627169;opacity:1;font-size:.875rem; }
.tbi-ui #home-reset { flex:0 0 auto;max-width:35%;padding:8px 10px;border:1px solid #cad5ce;border-radius:5px;background:#f5f7f5;color:#19392f;font:600 .8125rem/1.5 system-ui;cursor:pointer; }
.tbi-ui .home-purpose-filters { display:flex;flex-wrap:wrap;gap:7px;margin-top:16px; }
.tbi-ui .home-purpose-filters button { padding:7px 10px;min-height:36px;font:500 .875rem/1.4 system-ui;border:1px solid #cad5ce;border-radius:5px;color:#465b53;background:#fff;cursor:pointer; }
.tbi-ui .home-purpose-filters button[aria-pressed=true] { color:#fff;background:#19392f;border-color:#19392f; }
.tbi-ui .home-purpose-filters button:hover { border-color:#19392f; }
.tbi-ui #home-search-status { margin:12px 0 0;font-size:.8125rem;color:#465b53; }
.tbi-ui .home-empty { padding:24px;background:#edf4db;border-left:3px solid #426440; }
.tbi-ui .home-section { margin-bottom:32px;scroll-margin-top:85px; }
.tbi-ui .home-section-head { align-items:baseline;flex-wrap:wrap;gap:4px 20px;margin-bottom:12px; }
.tbi-ui .home-section-head h2 { font-size:1.125rem;letter-spacing:-.025em; }
.tbi-ui .home-section-head p { font-size:.875rem!important; }
.tbi-ui .home-collection-grid { display:flex;flex-wrap:wrap;gap:12px; }
.tbi-ui .home-collection-card { flex:1 1 calc(25% - 9px);min-width:0;display:block;min-height:130px;border-radius:8px;padding:16px;background:#fff;overflow:visible; }
.tbi-ui .home-collection-card.knowledge { background:#edf4db; }
.tbi-ui .home-collection-card.learning { background:#e7eeeb; }
.tbi-ui .home-collection-card.tools { background:#fff; }
.tbi-ui .home-collection-card.projects { background:#fff; }
.tbi-ui .home-card-label { display:block;position:static;margin-bottom:24px;font-size:.75rem!important; }
.tbi-ui .home-collection-card strong { margin-top:0;font-size:1.0625rem; }
.tbi-ui .home-collection-card p { font-size:.875rem;line-height:1.55; }
.tbi-ui .home-resource-list { border-radius:8px; }
.tbi-ui .home-resource-item { padding:14px 16px; }
.tbi-ui .home-resource-item strong { font-size:.9375rem; }
.tbi-ui .home-item-type { font-size:.75rem!important; }
.tbi-ui .home-experiment { border-radius:8px;padding:20px;background:#19392f; }
.tbi-ui .home-experiment strong { font-size:1.0625rem; }
.tbi-ui .home-experiment p { font-size:.9375rem;color:#e0e9e2; }
.tbi-ui .home-experiment-tag { font-size:.75rem;color:#d5ee81; }
.tbi-ui .home-experiment-arrow { color:#d5ee81; }
.tbi-ui .home-tool-grid { grid-template-columns:repeat(3,minmax(0,1fr));gap:12px; }
.tbi-ui .home-tool-card { border-radius:8px;padding:18px; }
.tbi-ui .home-tool-card .home-label { font-size:.75rem!important;margin-bottom:8px; }
.tbi-ui .home-tool-card strong { font-size:1rem;line-height:1.6; }
.tbi-ui a.home-detail-card { padding:18px;border-radius:8px; }
.tbi-ui a.home-detail-card h3 { font-size:1rem;line-height:1.6; }
.tbi-ui a.home-detail-card::after { color:#426440; }
.tbi-ui .home-footer { font-size:.875rem; }

/* Reading surfaces: a clear contents block, bounded prose, local table scrolling. */
.tbi-ui :where(.knowledge-article,.buddhist-knowledge,.dc-article,.cccd-article) { min-width:0; }
.tbi-ui :where(.knowledge-article,.buddhist-knowledge) > .hero h1 { line-height:1.3;overflow-wrap:anywhere; }
.tbi-ui :where(.knowledge-article,.buddhist-knowledge) :where(p,li) { line-height:1.9; }
.tbi-ui :where(.knowledge-article,.buddhist-knowledge) > section { min-width:0; }
.tbi-ui :where(.knowledge-article,.buddhist-knowledge) :where(.kicker,small) { font-size:.8125rem; }
.tbi-ui :where(.knowledge-article,.buddhist-knowledge) :where(.note,.answer,.position) { border-radius:4px;border-left:3px solid #426440;box-shadow:none; }
.tbi-ui :where(.table-scroll,.table-wrap,.dc-table,.sql-table-scroll) { max-width:100%;min-width:0;overscroll-behavior-inline:contain; }
.tbi-ui :where(.knowledge-article,.buddhist-knowledge) a { overflow-wrap:anywhere; }
.tbi-ui :where(.toc,.dc-toc) { border-radius:6px!important;border:1px solid #cad5ce!important;background:#fff!important; }
.tbi-ui :where(.toc,.dc-toc) a { display:inline-block;padding-block:5px;text-decoration:none;line-height:1.7; }
.tbi-ui :where(.toc,.dc-toc) a:hover { text-decoration:underline; }
.tbi-ui :where(.knowledge-article,.buddhist-knowledge,.dc-article,.cccd-article) section[id] { scroll-margin-top:110px; }
.tbi-ui .knowledge-article .architecture-figure { width:100%;max-width:100%;margin:2rem 0;transform:none; }
.tbi-ui .buddhist-knowledge .mental-table td small { color:#54665b; }
.tbi-ui .buddhist-knowledge .mental-table .presence.no { color:#66746b; }
body.tbi-ui.site-page:not(.tool-page):not(.learning-page):not(.experimental-page):not(.domain-canvas-page):not(.cccd-page) { box-sizing:border-box;max-width:100%; }
body.tbi-ui.domain-canvas-page .dc-hero { border-bottom:2px solid #19392f; }
body.tbi-ui.domain-canvas-page .dc-toc ol { columns:2;column-gap:32px; }
body.tbi-ui.domain-canvas-page .dc-toc li { break-inside:avoid; }
body.tbi-ui.domain-canvas-page .dc-outputs { border-left-color:#426440; }

/* Reference learning: preserve dark code surfaces and keep controls distinct. */
.tbi-ui.git-story-page .git-story-hero { border-bottom:1px solid #56596d;margin-bottom:24px; }
.tbi-ui.git-story-page :where(.git-story-card,.git-story-section) { border-radius:8px; }
.tbi-ui.sql-page .sql-toolbar { border-top:3px solid #19392f;border-radius:6px; }
.tbi-ui.sql-page :where(.sql-search-wrap label,.sql-dialects legend) { font-size:.875rem; }
.tbi-ui.sql-page .sql-index a { font-size:.9375rem; }
.tbi-ui.sql-page .sql-group>summary:hover { background:#edf4db; }
.tbi-ui.sql-page .sql-example { background:#fff; }

/* Workspaces: distinguish pane boundaries and selected/secondary controls. */
.tbi-ui.markdown-page .pane-header,
.tbi-ui.hierarchy-page .pane-header { background:#eef3ee;border-bottom:1px solid #cad5ce; }
.tbi-ui.markdown-page .pane,
.tbi-ui.hierarchy-page .pane { box-shadow:0 4px 16px #19392f08; }
.tbi-ui.tool-page :where(.header-button,.copy-button,.view-button)[aria-pressed=false] { background:#fff!important;color:#19392f!important;border-color:#7b9082!important; }
.tbi-ui.tool-page :where(.header-button,.copy-button):not(:disabled) { border-color:#7b9082!important; }
.tbi-ui.tool-page :where(.settings-section,.control-group) { border-radius:6px; }
.tbi-ui.operator-simulator-page .sim-panel { box-shadow:none;border-right-color:#cad5ce; }
.tbi-ui.operator-simulator-page .sim-panel::after { display:none; }
.tbi-ui.url-capture-page { background:#f5f7f5!important; }
.tbi-ui.url-capture-page .panel { border-radius:8px;box-shadow:none;border-color:#cad5ce; }
.tbi-ui.url-capture-page :where(input[type=text],input[type=url],input[type=number],select) { min-height:44px; }
.tbi-ui.url-capture-page button:not(.primary) { background:#edf2ec!important;color:#19392f!important;border:1px solid #7b9082!important; }
.tbi-ui.url-capture-page #runButton { background:#19392f!important;color:white!important; }

/* The finder itself retains its editorial identity with legible metadata. */
.tbi-ui .entry :where(p,.entry-links) { font-size:.875rem; }
.tbi-ui .entry .meta,.tbi-ui .entry .fine { font-size:.75rem; }
.tbi-ui .toolbar label { font-size:.875rem; }
.tbi-ui .entry { border-bottom-color:#b6c4b8; }

@media(max-width:900px) {
  .tbi-ui .home-hero { gap:16px 28px; }
  .tbi-ui .home-finder { padding:18px; }
  .tbi-ui .home-tool-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
@media(max-width:720px) {
  .tbi-ui .home-shell,.tbi-ui.home-page>.language-switch { width:calc(100% - 32px); }
  .tbi-ui .home-hero { grid-template-columns:1fr;padding:24px 0;gap:12px; }
  .tbi-ui .home-hero h1 { font-size:clamp(2rem,8vw,3rem);max-width:18ch; }
  .tbi-ui .home-finder { grid-column:1;grid-row:auto;margin-top:8px; }
  .tbi-ui .home-collection-card { flex-basis:calc(50% - 6px);min-height:148px; }
  .tbi-ui .home-topbar-inner { gap:12px; }
  .tbi-ui .home-nav ul { gap:8px; }
  .tbi-ui .home-nav li:nth-child(n) { display:block; }
  .tbi-ui .home-nav a { font-size:.75rem; }
  .tbi-ui .home-resource-item { gap:10px; }
  .tbi-ui :where(.tbi-language-nav,.language-switch) a { padding-inline:5px; }
  body.tbi-ui.domain-canvas-page .dc-toc ol { columns:1; }
}
@media(max-width:480px) {
  .tbi-ui .home-tool-grid,.tbi-ui .home-detail-grid { grid-template-columns:1fr; }
  .tbi-ui .home-nav li:nth-child(2) { display:none; }
  .tbi-ui .home-collection-card { padding:13px; }
  .tbi-ui .home-collection-card p { font-size:.875rem; }
  .tbi-ui .home-card-label { left:13px; }
  .tbi-ui .home-item-type { white-space:normal;max-width:9ch; }
  .tbi-ui .home-search-row { flex-wrap:wrap; }
  .tbi-ui #home-search { flex-basis:100%; }
  .tbi-ui #home-reset { max-width:100%;min-height:32px;padding:4px 0;border:0;background:transparent;text-decoration:underline;text-underline-offset:3px; }
}
@media(prefers-reduced-motion:reduce) {
  .tbi-ui *, .tbi-ui *::before, .tbi-ui *::after { scroll-behavior:auto!important; }
  .tbi-ui :where(a,button) { transition:none!important; }
}
@media print { .tbi-ui .home-finder,.tbi-ui .tbi-sitebar,.tbi-ui .tbi-skip { display:none!important; } }
