/* Shared navigation, accessible states and responsive workspaces. Loaded last. */
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
body :is(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 3px solid #005a9e !important; outline-offset: 3px;
}
body button, body input, body select, body textarea { font-family: inherit; }
body button { min-height: 40px; }
body .card-title { font-size: 13px; color: #505b69; letter-spacing: .2px; }
body .lead { background: transparent; border: 0; border-left: 3px solid #a6cbea; border-radius: 0; padding: 2px 0 2px 14px; font-size: 15px; line-height: 1.65; color: #465365; }
body .info-block p, body .info-block ul { font-size: 14px; line-height: 1.75; color: #465365; }
.intro-context { font-size: 14px; line-height: 1.75; color: #465365; margin-bottom: 18px; padding-bottom: 18px; border-bottom: 1px solid #e5eaf0; }
.field-label { font-size: 13px; color: #555; }
.form-row .field-label { min-width: 90px; flex-shrink: 0; }
body :is(.drop-note, .indent-note, .form-unit, .footnote) { color: #596575; font-size: 13px; }
body .drop-zone { border-color: #9ebbd2; }
body .check-item { min-height: 36px; }
body .check-item input[type=checkbox] { width: 18px; height: 18px; }
body footer a { color: #526174 !important; }
body .related-link:hover, body .result-sub span:not(.cat-badge) { color: #145b94; }
body .form-row input, body .form-row select { min-width: 0; }
.header-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; min-width: 0; }
.header-actions button, .language-menu summary, .category-links a { border: 1px solid #ccd7e3; border-radius: 8px; background: #fff; color: #145b94; font-size: 14px; font-weight: 600; padding: 10px 12px; min-height: 42px; text-decoration: none; cursor: pointer; }
.header-actions button:hover, .language-menu summary:hover, .category-links a:hover { background: #edf5fc; border-color: #74a6d0; }
.language-menu { position: relative; text-align: left; }
.language-menu summary { white-space: nowrap; list-style: none; }
.language-menu summary::-webkit-details-marker { display: none; }
.language-menu summary::after { content: ' ▾'; }
.language-links { position: absolute; top: calc(100% + 8px); right: 0; z-index: 20; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: min(300px, calc(100vw - 32px)); padding: 8px; background: #fff; border: 1px solid #ccd7e3; border-radius: 10px; box-shadow: 0 12px 32px #12263f26; }
.language-links a { padding: 10px; min-height: 42px; font-size: 14px; color: #273c52; text-decoration: none; border-radius: 6px; }
.language-links a:hover, .language-links a[aria-current] { background: #edf5fc; color: #145b94; }
.site-header-inner { flex-wrap: wrap; gap: 10px; padding: 10px 0; }
.site-header .tool-nav { min-height: 42px; font-size: 14px; }
.site-header:has(.tool-search-open:not([hidden])) .header-actions { margin-left: auto; }
.tool-dialog { position: fixed; inset: 0; margin: auto; width: min(640px, calc(100vw - 32px)); max-height: min(780px, calc(100dvh - 32px)); overflow: auto; padding: 22px; border: 1px solid #ccd7e3; border-radius: 14px; color: #273c52; background: #fff; box-shadow: 0 24px 80px #12263f40; }
.tool-dialog::backdrop { background: #10263a80; }
body:has(.tool-dialog[open]) { overflow: hidden; }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.dialog-heading h2 { font-size: 20px; }
.dialog-close { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 42px; width: 42px; height: 42px; min-height: 42px; padding: 0; line-height: 1; border: 1px solid #ccd7e3; border-radius: 8px; background: #fff; color: #273c52; font-size: 24px; cursor: pointer; }
.tool-dialog label, .catalog-search label { display: block; margin-bottom: 8px; font-size: 14px; font-weight: 700; }
#tool-search, #catalog-search { display: block; width: 100%; padding: 12px 14px; min-height: 46px; font-size: 16px; color: #273c52; background: #fff; border: 1px solid #a5b7c9; border-radius: 8px; }
.search-count { min-height: 20px; margin: 10px 0; font-size: 13px; color: #53647a; }
.tool-search-results { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.tool-search-results h3 { grid-column: 1 / -1; font-size: 13px; color: #526174; margin: 14px 0 4px; }
.tool-search-results a { display: flex; align-items: center; min-height: 44px; padding: 10px; border: 1px solid #e1e7ef; border-radius: 7px; font-size: 14px; color: #145b94; text-decoration: none; overflow-wrap: anywhere; }
.tool-search-results a:hover { background: #edf5fc; }
#tool-search-empty, #catalog-empty { padding: 14px 0; font-size: 14px; color: #526174; }
.catalog-search { width: 100%; max-width: 720px; margin: 0 auto 12px; text-align: left; }
.category-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; max-width: 1080px; margin: 0 auto 26px; }
.category-links a { font-size: 13px; min-height: 40px; padding: 10px 12px; }
.section { scroll-margin-top: 20px; }
body:has(.sections) { padding: 24px; }
body:has(.sections) > header { max-width: 1080px; width: 100%; margin: 0 auto 24px; }
body:has(.sections) > header .header-actions { margin-bottom: 14px; }
body:has(.sections) header h1 { font-size: 28px; }
body:has(.sections) header p { font-size: 14px; line-height: 1.7; margin-top: 8px; }
body:has(.sections) .sections { gap: 28px; }
body:has(.sections) .section-title { font-size: 16px; margin-bottom: 12px; padding-left: 10px; }
body:has(.sections) .grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)) !important; gap: 12px; }
body:has(.sections) a.card { padding: 16px; min-height: 92px; align-items: flex-start; border-radius: 10px; box-shadow: 0 2px 5px #183d6610; }
body:has(.sections) .card-title { font-size: 15px; color: #203247; white-space: normal; overflow: visible; line-height: 1.45; }
body:has(.sections) .card-desc { font-size: 13px; color: #526174; white-space: normal; overflow: visible; line-height: 1.55; margin-top: 5px; }
body:has(.sections) .card-icon { display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 8px; background: #f0f6fc; font-size: 21px; }
/* The language gateway uses compact cards with the same spacing as the catalog. */
body:has(.langs) { padding: 32px 24px; }
body:has(.langs) .wrap { max-width: 920px; }
body:has(.langs) .langs { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
body:has(.langs) .lang-card { aspect-ratio: auto; min-height: 104px; border-radius: 10px; padding: 18px; }
body:has(.langs) .lang-card h2 { font-size: 18px; }
body:has(.langs) .lang-tagline { font-size: 13px; }
body:has(.langs) .wrap > p.subtitle { font-size: 15px; line-height: 1.65; margin-bottom: 24px; }
.ui-error { padding: 12px 14px; margin: 12px 0; border: 1px solid #cf908b; border-radius: 8px; color: #8c2420; background: #fff2f0; font-size: 14px; line-height: 1.6; }
.input-changed { margin-top: 12px; padding: 12px; background: #fff8e5; border: 1px solid #d7bd70; border-radius: 8px; color: #6d5010; font-size: 14px; line-height: 1.6; }
.principal-preview { flex-basis: 100%; padding-left: 102px; font-size: 13px; font-variant-numeric: tabular-nums; color: #526174; }
.merge-guidance { margin: 12px 0; font-size: 14px; line-height: 1.6; color: #465365; }
.result-label { font-size: 14px; color: #465365; font-weight: 700; margin-bottom: 8px; }
body #loan-result .result-sub { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
body #loan-result .result-sub span { display: flex; flex-direction: column; justify-content: center; gap: 6px; padding: 12px 8px; margin: 0; color: #465365; font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
body #loan-result .result-sub strong { color: #145b94; font-size: 18px; font-variant-numeric: tabular-nums; }
body #loan-result .result-sub span:first-child { grid-column: 1 / -1; background: #fff; border-color: #8eb5d6; }
body #loan-result .result-sub span:first-child strong { font-size: 26px; }
body #loan-result .result-sub span:not(:first-child) { grid-column: span 1; }
body #loan-result .result-sub { grid-template-columns: repeat(2, minmax(0, 1fr)); }
body #loan-result .result-main { font-size: 25px; }
.loan-schedule-wrap summary { cursor: pointer; padding: 12px 0; color: #145b94; font-size: 14px; font-weight: 700; }
.loan-schedule-wrap .loan-schedule { margin-top: 8px; }
.loan-schedule:focus-visible { outline: 3px solid #005a9e; }
body .ad-placeholder { background: repeating-linear-gradient(135deg, #edf0f4, #edf0f4 10px, #f5f7fa 10px, #f5f7fa 20px); border: 1px dashed #c7d1dd; border-radius: 8px; }
body.workspace-wide { --workspace-width: 1080px; }
body.workspace-wide :is(.container, .site-header-inner, .main-col) { max-width: var(--workspace-width); }
body.workspace-wide .main-col { container: tool-workspace / inline-size; }
.code-workspace { display: grid; gap: 16px; }
.code-workspace > * { min-width: 0; }
body.workspace-wide .code-workspace :is(#json-input, #json-output, #input-text, #output-text, #css-input, #css-output, #js-input, #js-output) { min-height: 280px; font-size: 14px; }
@container tool-workspace (min-width: 900px) {
  .code-workspace.has-output { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .code-workspace > * { grid-column: 1; }
  .code-workspace .workspace-input { grid-column: 1; grid-row: 1; }
  .code-workspace .workspace-output { grid-column: 2; grid-row: 1 / span 3; }
  body.workspace-wide .code-workspace .workspace-output :is(#json-output, #output-text, #css-output, #js-output) { min-height: 360px; }
}
@media (min-width: 1300px) {
  /* Two 300px ad slots, two 24px gaps and 24px outer gutters on each side. */
  body.workspace-wide { --workspace-width: min(1080px, calc(100vw - 696px)); }
  body.workspace-wide .main-col { flex: 0 1 var(--workspace-width); }
}
@media (max-width: 560px) {
  .site-header-inner { gap: 8px; }
  .site-header-inner .brand { font-size: 14px; }
  .site-header-inner .header-actions { flex-basis: 100%; justify-content: space-between; }
  .header-actions button, .language-menu summary { min-height: 40px; font-size: 13px; padding: 9px 12px; }
  .site-header { margin-bottom: 18px; }
  body:has(.sections) { padding: 18px 16px; }
  body:has(.sections) .grid { grid-template-columns: minmax(0, 1fr) !important; }
  body:has(.sections) a.card { min-height: 84px; }
  body:has(.sections) header h1 { font-size: 25px; }
  body:has(.langs) { padding: 24px 16px; }
  body:has(.langs) .langs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  body:has(.langs) .lang-card { min-height: 96px; padding: 14px 8px; }
  .tool-dialog { padding: 16px; }
  .tool-search-results { grid-template-columns: minmax(0, 1fr); }
  body .lead { font-size: 14px; }
  body .form-row { gap: 8px; }
  body .form-row label, body .form-row .field-label { min-width: 88px; }
  body input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]), body select, body textarea { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; } }
