/* ==================================================================================================================
   usefulweb platform layouts (extends styles.css): header, footer, home & directory, category pages, tool pages,
   results, guides, blog, docs, site/legal pages, feedback, consent dialog, ad slots, print.
   Logical properties throughout (RTL Arabic). No inline styles anywhere (CSP style-src 'self'): colours per category
   come from [data-cat] below, per app from /static/apps/themes.css.
   ================================================================================================================== */

/* ---- category accents (generated from CATEGORIES; light value ≥ 4.5:1 with white text and on its tints) ---- */
[data-cat="everyday"] { --accent: #1652f0; }
[data-cat="money"] { --accent: #0d7f57; }
[data-cat="home-travel"] { --accent: #c2410c; }
[data-cat="internet"] { --accent: #7c3aed; }
[data-cat="high-value"] { --accent: #b91c1c; }
[data-cat="developer"] { --accent: #0e7490; }
[data-cat="web3"] { --accent: #6d28d9; }
[data-cat="infrastructure"] { --accent: #0369a1; }
[data-cat="security"] { --accent: #be123c; }
[data-cat="devcloud"] { --accent: #047857; }
[data-cat="ai-infra"] { --accent: #a21caf; }
[data-cat="public-data"] { --accent: #975c06; }
[data-cat="explorer"] { --accent: #1652f0; }
[data-cat="fun"] { --accent: #be185d; }
[data-cat="calculators"] { --accent: #4d7c0f; }
[data-cat="documents"] { --accent: #b45309; }
[data-cat="media"] { --accent: #9333ea; }
[data-cat="charts"] { --accent: #0f766e; }
[data-cat="math"] { --accent: #4338ca; }
[data-cat="crypto"] { --accent: #334155; }
[data-cat="apps"] { --accent: #0b5cad; }
/* dark variants: ≥ 4.5:1 as text on every dark surface and with the dark on-accent text */
[data-cat="everyday"] { --accent-dk: #7aa7ff; }
[data-cat="money"] { --accent-dk: #3fd69f; }
[data-cat="home-travel"] { --accent-dk: #fb9a5b; }
[data-cat="internet"] { --accent-dk: #b9a3ff; }
[data-cat="high-value"] { --accent-dk: #ff8f8f; }
[data-cat="developer"] { --accent-dk: #4fd3ec; }
[data-cat="web3"] { --accent-dk: #a98bff; }
[data-cat="infrastructure"] { --accent-dk: #56bdf5; }
[data-cat="security"] { --accent-dk: #ff8aa0; }
[data-cat="devcloud"] { --accent-dk: #4ade9b; }
[data-cat="ai-infra"] { --accent-dk: #ee8cfb; }
[data-cat="public-data"] { --accent-dk: #f6bd3f; }
[data-cat="explorer"] { --accent-dk: #7aa7ff; }
[data-cat="fun"] { --accent-dk: #f985c0; }
[data-cat="calculators"] { --accent-dk: #9ed94a; }
[data-cat="documents"] { --accent-dk: #fbb25f; }
[data-cat="media"] { --accent-dk: #cf9bff; }
[data-cat="charts"] { --accent-dk: #3fd8c4; }
[data-cat="math"] { --accent-dk: #a3adff; }
[data-cat="crypto"] { --accent-dk: #b3c0d3; }
[data-cat="apps"] { --accent-dk: #6ab4ff; }
:root[data-theme="dark"]:not(.uwapp-html), :root[data-theme="dark"]:not(.uwapp-html) [data-cat] { --accent: var(--accent-dk); }
:root[data-theme="dark"][data-app]:not(.uwapp-html), :root[data-theme="dark"]:not(.uwapp-html) [data-app], :root.uwapp-html[data-theme="dark"] .uwapp-bar { --accent: color-mix(in srgb, var(--app-accent, #0b5cad) 50%, #fff); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"], .uwapp-html), :root:not([data-theme="light"], .uwapp-html) [data-cat] { --accent: var(--accent-dk); }
  :root:not([data-theme="light"], .uwapp-html)[data-app], :root:not([data-theme="light"], .uwapp-html) [data-app], :root.uwapp-html:not([data-theme="light"]) .uwapp-bar { --accent: color-mix(in srgb, var(--app-accent, #0b5cad) 50%, #fff); }
}

/* script-specific system font fallbacks (no web fonts are downloaded) */
:lang(ja) body { font-family: system-ui, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Yu Gothic", Meiryo, "Noto Sans JP", "Noto Sans CJK JP", sans-serif; }
:lang(zh) body { font-family: system-ui, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", "Noto Sans CJK SC", sans-serif; }
:lang(ko) body { font-family: system-ui, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", "Noto Sans CJK KR", sans-serif; }
:lang(hi) body { font-family: system-ui, "Nirmala UI", "Kohinoor Devanagari", "Noto Sans Devanagari", sans-serif; }
:lang(ar) body { font-family: system-ui, "Segoe UI", "Geeza Pro", "Noto Naskh Arabic", "Noto Sans Arabic", sans-serif; }
:lang(ar) h1, :lang(ar) h2, :lang(ar) h3 { letter-spacing: 0; }

/* ================================================================== header */
.site-header { position: sticky; top: 0; z-index: 30; background: var(--surface); border-bottom: 1px solid var(--line); }
.site-header > .wrap.header-inner { max-width: 1440px; }
.header-inner { display: flex; align-items: center; gap: 10px 18px; min-height: 64px; flex-wrap: wrap; padding-block: 8px; }
/* Brand block (top left on every site): the brand logo → main site, then the current site */
.brand-block { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 0 1 auto; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); flex: none; }
.brand svg { flex: none; border-radius: 10px; }
.brand-text { display: inline-flex; flex-direction: column; gap: 3px; min-width: 0; line-height: 1.1; }
.brand-word { font-size: 1.3rem; font-weight: 800; letter-spacing: -.025em; line-height: 1; }
.brand-word .bw-main { color: var(--ink); }
.brand-word .bw-tld { color: var(--brand-tld, #1652f0); }
.brand-word .bw-tld.bw-app { color: var(--brand-tld-app, #7c3aed); }
.brand:hover .bw-main { color: var(--brand-tld, #1652f0); }
.brand:hover:has(.bw-app) .bw-main { color: var(--brand-tld-app, #7c3aed); }
:root[data-theme="dark"] { --brand-tld: #7aa7ff; --brand-tld-app: #b9a3ff; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --brand-tld: #7aa7ff; --brand-tld-app: #b9a3ff; } }
/* width 0 + min-width 100%: the tagline never widens the brand; it wraps under the wordmark instead. */
.brand-tagline { width: 0; min-width: 100%; font-size: .7rem; font-weight: 500; color: var(--muted); letter-spacing: 0; line-height: 1.25; text-wrap: balance; overflow-wrap: anywhere; }
.brand-sep { color: var(--line-strong); font-size: 1.5rem; font-weight: 300; }
.site-name { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; font-weight: 600; min-width: 0; padding-block: 4px; }
.site-name svg { border-radius: 6px; flex: none; }
.site-name span { max-width: 18rem; line-height: 1.15; overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; }
.site-name:hover { color: var(--accent-text); }

.site-header nav { margin-inline-start: auto; }
.site-header nav ul { list-style: none; display: flex; gap: 2px; margin: 0; padding: 0; flex-wrap: wrap; }
.site-header nav li { margin: 0; }
.site-header nav a { display: inline-flex; align-items: center; min-height: 36px; padding: 6px 10px; border-radius: var(--r-sm); text-decoration: none; color: var(--ink-2); font-size: .95rem; font-weight: 500; white-space: nowrap; }
.site-header nav a:hover { color: var(--ink); background: var(--surface-2); }
.site-header nav a[data-nav="apps"] { font-weight: 700; color: var(--ink); }
.site-header nav a .nav-short { display: none; }
.header-tools { display: flex; align-items: center; gap: 8px; flex: none; }

/* theme switch: <details> disclosure with three links (no JS needed) */
.theme-switch { position: relative; }
.theme-switch > summary { list-style: none; display: inline-grid; place-items: center; width: 38px; height: 38px; border: 1px solid var(--line-strong); border-radius: var(--r-md); color: var(--ink-2); background: var(--surface); }
.theme-switch > summary::-webkit-details-marker { display: none; }
.theme-switch > summary:hover, .theme-switch[open] > summary { color: var(--ink); background: var(--surface-2); }
.theme-switch .theme-icon { display: none; }
.theme-switch[data-current="auto"] summary .theme-icon-auto, .theme-switch[data-current="light"] summary .theme-icon-light, .theme-switch[data-current="dark"] summary .theme-icon-dark { display: block; }
.theme-pop { position: absolute; inset-inline-end: 0; top: calc(100% + 8px); z-index: 40; min-width: 17rem; padding: 8px; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-3); }
.theme-pop-h { margin: 4px 10px 6px; font-size: var(--fs-xs); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.theme-pop ul { list-style: none; margin: 0; padding: 0; }
.theme-pop li { margin: 0; }
.theme-pop a { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 8px 10px; border-radius: var(--r-sm); color: var(--ink); text-decoration: none; font-weight: 500; }
.theme-pop a .theme-icon { display: block; flex: none; color: var(--muted); }
.theme-pop a:hover { background: var(--surface-2); }
.theme-pop a[aria-current="true"] { background: var(--accent-tint-2); font-weight: 700; }
.theme-pop a[aria-current="true"] .theme-icon { color: var(--accent-text); }
.theme-pop a[aria-current="true"]::after { content: "✓"; margin-inline-start: auto; color: var(--accent-text); font-weight: 800; }
.theme-hint { font-weight: 400; color: var(--muted); font-size: var(--fs-sm); }

/* language switcher */
.lang-switch { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
.lang-switch label { display: inline-flex; color: var(--muted); }
.lang-switch select { min-height: 38px; font-size: .9rem; padding: 6px 30px 6px 10px; border: 1px solid var(--control); border-radius: var(--r-md); background-color: var(--surface); max-width: 13rem; }
[dir=rtl] .lang-switch select { padding: 6px 10px 6px 30px; }
.lang-switch .lang-apply { min-height: 38px; font-size: .85rem; padding: 6px 12px; }
/* Language switcher with JS: picking with the mouse applies at once; keyboard users get the Apply button while the select
 * or the button has keyboard focus (3.2.2 On Input). Without JS the button is always visible. */
.lang-switch.js-lang .lang-apply { position: absolute; width: 1px; height: 1px; min-height: 0; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.lang-switch.js-lang select:focus-visible + .lang-apply, .lang-switch.js-lang .lang-apply:focus { position: static; width: auto; height: auto; min-height: 38px; padding: 6px 12px; margin: 0; overflow: visible; clip-path: none; }
/* Same state from the first paint when scripting is on (no header jump when the deferred platform.js adds .js-lang, CLS);
 * the button also shows as soon as another language is picked, in case the script has not run yet. */
@media (scripting: enabled) {
  .lang-switch .lang-apply { position: absolute; width: 1px; height: 1px; min-height: 0; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
  .lang-switch select:focus-visible + .lang-apply, .lang-switch .lang-apply:focus, .lang-switch:has(option:checked:not([selected])) .lang-apply { position: static; width: auto; height: auto; min-height: 38px; padding: 6px 12px; margin: 0; overflow: visible; clip-path: none; }
}
.lang-note { margin: 8px auto 0; color: var(--muted); }

/* header layout: one row ≥ 1180 px; below, the nav gets its own row under brand + tools */
@media (min-width: 1180px) {
  .header-inner { flex-wrap: nowrap; }
  .site-header nav ul { flex-wrap: nowrap; }
}
@media (min-width: 1180px) and (max-width: 1439px) {
  .site-header nav a .nav-long { display: none; }
  .site-header nav a .nav-short { display: inline; }
  .site-name span { max-width: 12rem; }
}
/* the account slot takes the room of the long "More tools on …" label */
@media (min-width: 1180px) {
  .header-inner:has(.account-signin, .account-menu) nav a .nav-long { display: none; }
  .header-inner:has(.account-signin, .account-menu) nav a .nav-short { display: inline; }
}
@media (max-width: 1179px) {
  .header-inner { row-gap: 0; padding-bottom: 0; }
  .header-tools { margin-inline-start: auto; }
  .site-header nav { order: 3; width: 100%; margin: 0; border-top: 1px solid var(--line); padding-block: 4px; }
  .site-header nav ul { margin-inline: -10px; }
}
@media (max-width: 640px) {
  .site-header { position: static; }
  .header-inner { min-height: 56px; gap: 8px 10px; }
  .brand-word { font-size: 1.14rem; }
  .brand svg { width: 32px; height: 32px; }
  .brand-tagline { font-size: .66rem; }
  .brand-block { flex-wrap: wrap; row-gap: 2px; }
  .site-name span { max-width: 14rem; }
  .lang-switch select { max-width: 8.5rem; }
  .site-header nav a { padding-inline: 8px; font-size: .92rem; }
}
@media (max-width: 640px) {
  .header-tools { position: relative; }
  .theme-switch { position: static; } /* the menu opens under the tools row, aligned to its end: never off-screen */
  .theme-switch > summary, .lang-switch select, .account-signin, .account-menu > summary { min-height: 36px; }
  .theme-switch > summary { width: 36px; height: 36px; }
}
@media (max-width: 440px) { .lang-switch label svg { display: none; } .lang-switch { gap: 0; } .header-tools { gap: 6px; } .lang-switch select { max-width: 7rem; } }
@media (max-width: 299px) { .brand-tagline { display: none; } }
/* Phones: one compact row (logo + theme/language) and one nav row, so the tool's form starts high (docs/PERFORMANCE.md).
 * On tool and category sites the site name repeats the page's H1/eyebrow, so it is left out there; the tagline too. */
@media (max-width: 640px) {
  .brand-tagline { display: none; }
  .site-header[data-site-kind="tool"] .brand-sep, .site-header[data-site-kind="tool"] .site-name,
  .site-header[data-site-kind="category"] .brand-sep, .site-header[data-site-kind="category"] .site-name { display: none; }
  .site-header nav a .nav-long { display: none; }
  .site-header nav a .nav-short { display: inline; }
  .header-inner { padding-block: 6px 0; min-height: 0; }
  .site-header nav { padding-block: 2px; }
  .site-header nav a { min-height: 34px; padding-block: 4px; }
}

/* ================================================================== footer */
.site-footer { margin-top: var(--sp-8); padding: var(--sp-6) 0 var(--sp-6); background: var(--surface); border-top: 1px solid var(--line); color: var(--muted); font-size: .92rem; }
.footer-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); gap: var(--sp-5) var(--sp-7); align-items: start; }
.footer-brand { display: block; max-width: 36rem; color: var(--ink-2); }
.footer-brand svg { vertical-align: middle; margin-inline-end: 4px; border-radius: 7px; }
.footer-brand strong { color: var(--ink); font-size: 1.02rem; }
.footer-brand p { margin: 10px 0 0; color: var(--muted); }
.footer-links { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 10.5rem), 1fr)); gap: 2px 18px; }
.footer-links li { margin: 0; }
.footer-links a { display: inline-block; padding-block: 5px; color: var(--ink-2); text-decoration: none; }
.footer-links a:hover { color: var(--accent-text); text-decoration: underline; }
@media (max-width: 760px) { .footer-grid { grid-template-columns: minmax(0, 1fr); } }
/* keep the end of the page (footer links) reachable above the floating feedback button */
body:has(.fb-fab) .site-footer { padding-bottom: 88px; }

/* ================================================================== hero bands */
.hero-brand, .tool-hero { background: linear-gradient(180deg, var(--accent-tint) 0%, color-mix(in srgb, var(--accent-tint) 35%, var(--canvas)) 60%, var(--canvas) 100%); }
.hero-brand { padding: clamp(28px, 5vw, 56px) 0 clamp(24px, 4vw, 40px); }
.hero-brand h1 { letter-spacing: -.028em; }
.hero-home h1 { font-size: var(--fs-display); max-width: 24ch; }
.hero-home .lede { font-size: clamp(1.05rem, 1rem + .3vw, 1.2rem); max-width: 40em; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--sp-6); align-items: center; }
.has-art > .hero-grid { grid-template-columns: minmax(0, 1.45fr) minmax(240px, .95fr); }
.hero-copy { min-width: 0; }
.art { display: block; }
.art img { display: block; width: 100%; height: auto; }
.hero-art img { border-radius: var(--r-xl); }
.art img { border-radius: var(--r-xl); }
/* the artwork has a pale background: dim it a little in the dark theme so it does not glare */
:root[data-theme="dark"]:not(.uwapp-html) .art img { filter: brightness(.82) saturate(.95); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]):not(.uwapp-html) .art img { filter: brightness(.82) saturate(.95); } }
@media (max-width: 760px) { .has-art > .hero-grid { grid-template-columns: minmax(0, 1fr); } .hero-art { display: none; } }
.eyebrow { display: inline-flex; align-items: center; gap: 6px; margin: 0 0 10px; font-size: var(--fs-xs); font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--accent-text); }
.eyebrow a { color: inherit; text-decoration: none; padding-block: 4px; }
.eyebrow a:hover { text-decoration: underline; }
.eyebrow::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent-solid); flex: none; }

/* search */
.tool-search { margin-top: var(--sp-5); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px 16px 16px; box-shadow: var(--shadow-2); max-width: 52rem; }
.tool-search label { display: block; font-weight: 600; margin-bottom: 8px; }
.tool-search .check-row input { min-height: 50px; font-size: 1.05rem; padding-inline: 14px; }
.tool-search .check-row button { min-height: 50px; padding-inline: 24px; }

/* ================================================================== home: tools teaser + intro */
.home-body { padding-top: var(--sp-6); }
.home-tools { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: var(--sp-5) var(--sp-7); align-items: center; padding: clamp(18px, 3vw, 32px); margin: 0 0 var(--sp-6); background: var(--surface); border: 1px solid var(--line); border-inline-start: 4px solid var(--accent-solid); border-radius: var(--r-xl); box-shadow: var(--shadow-1); }
.home-tools h2 { margin: 0 0 .5em; font-size: var(--fs-xl); }
.home-tools p { margin: 0 0 .8em; color: var(--ink-2); }
.home-tools-text p:last-child { margin-bottom: 0; }
.home-stats { list-style: none; margin: 0 0 var(--sp-4); padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(5.25rem, 1fr)); gap: 8px; }
.home-stats li { margin: 0; padding: 10px 12px; border-radius: var(--r-lg); background: var(--accent-tint); border: 1px solid var(--accent-line); display: grid; gap: 2px; }
.home-stats strong { font-size: var(--fs-xl); line-height: 1.1; color: var(--accent-text); font-variant-numeric: tabular-nums; }
.home-stats span { font-size: var(--fs-sm); color: var(--ink-2); overflow-wrap: anywhere; }
.home-tools .home-tools-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 0; }
.home-tools-actions .button-link { flex: 1 1 auto; justify-content: center; text-align: center; }
[dir="rtl"] .home-tools-actions [aria-hidden="true"] { display: inline-block; transform: scaleX(-1); }
.home-intro { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: var(--sp-5) var(--sp-7); padding: clamp(18px, 3vw, 32px); margin: 0 0 var(--sp-6); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--shadow-1); }
.home-intro.home-intro-single { grid-template-columns: minmax(0, 1fr); }
.home-intro h2 { margin: 0 0 .6em; font-size: var(--fs-xl); }
.home-intro p { margin: 0 0 .8em; color: var(--ink-2); }
.home-intro-text p:last-child, .home-start p:last-child { margin-bottom: 0; }
.home-start { padding-inline-start: var(--sp-6); border-inline-start: 1px solid var(--line); }
.home-start .start-posts { list-style: none; margin: 10px 0 14px; padding: 0; display: grid; gap: 8px; }
.home-start .start-posts li { margin: 0; }
.home-start .start-posts a { font-weight: 600; text-decoration: none; display: inline-block; padding-block: 2px; }
.home-start .start-posts a:hover { text-decoration: underline; }
.start-posts-h { font-size: var(--fs-md); margin: 0 0 4px; }
@media (max-width: 860px) {
  .home-tools, .home-intro { grid-template-columns: minmax(0, 1fr); }
  .home-start { padding-inline-start: 0; border-inline-start: 0; border-top: 1px solid var(--line); padding-top: var(--sp-5); }
}

/* ================================================================== tool directory (/tools) */
.crumbs ol { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-wrap: wrap; gap: 2px 0; font-size: var(--fs-sm); }
.crumbs li { margin: 0; color: var(--ink-2); }
.crumbs li + li::before { content: "/"; margin-inline: .5em; color: var(--muted); }
.crumbs a, .crumbs [aria-current] { display: inline-block; padding-block: 4px; }
.crumbs a { color: var(--accent-text); }
.hero-tools h1 { margin: 0 0 .3em; }
.hero-tools .lede { max-width: 46em; }
.search-status { margin: 10px 0 0; font-weight: 600; color: var(--ink-2); }
.search-reset { margin: 10px 0 0; }
.search-reset a { display: inline-block; padding-block: 4px; }
.tools-start { margin-top: var(--sp-5); }
.tools-start h2 { font-size: var(--fs-md); margin: 0 0 8px; }
.start-chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.start-chips li { margin: 0; }
.start-chips a { display: inline-block; padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink); text-decoration: none; font-weight: 600; font-size: var(--fs-sm); }
.start-chips a:hover { border-color: var(--accent-line); color: var(--accent-text); text-decoration: underline; }

/* ================================================================== categories & directory */
.cat-icon { display: block; }
.cat-badge { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; flex: none; color: var(--accent-text); background: var(--accent-tint-2); border: 1px solid var(--accent-line); }
.cat-head { display: flex; gap: 14px; align-items: flex-start; }
.cat-head > div { min-width: 0; }
.cat-head h1, .cat-head h2 { margin: 0; }
.cat-head p { margin: 4px 0 0; }
.hero-category .cat-badge { width: 56px; height: 56px; border-radius: 16px; }
.hero-category .cat-badge svg { width: 30px; height: 30px; }
.hero-category .cat-head p.muted { font-size: var(--fs-lg); color: var(--ink-2); }
.cat-link { font-weight: 600; color: var(--accent-text); padding-block: 4px; display: inline-block; }

.themes { margin-top: var(--sp-6); }
.themes > h2 { margin: 0 0 var(--sp-2); }
.group-h { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .09em; color: var(--muted); margin: var(--sp-5) 0 var(--sp-2); font-weight: 700; }
.theme-grid { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 236px), 1fr)); gap: 10px; }
.theme-grid > li { margin: 0; }
.theme a { display: grid; grid-template-columns: 44px minmax(0, 1fr); grid-template-rows: auto auto; column-gap: 12px; align-items: center; height: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); text-decoration: none; color: var(--ink); box-shadow: var(--shadow-1); transition: transform .14s var(--ease), border-color .14s var(--ease), box-shadow .14s var(--ease); }
.theme a:hover { transform: translateY(-1px); border-color: var(--accent-line); box-shadow: var(--shadow-2); color: var(--ink); }
.theme .cat-badge { grid-row: 1 / span 2; }
.theme strong { font-size: .96rem; line-height: 1.25; }
.small-themes .theme a { grid-template-rows: auto; }
.small-themes .theme .cat-badge { grid-row: auto; width: 36px; height: 36px; border-radius: 10px; }
.small-themes .theme a { grid-template-columns: 36px minmax(0, 1fr); padding: 10px 12px; }

.cat-nav ul { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: var(--sp-5) 0; }
.cat-nav li { margin: 0; }
.cat-nav a { display: inline-flex; align-items: center; gap: 7px; min-height: 34px; padding: 5px 12px; border: 1px solid var(--line); border-radius: var(--r-pill); background: var(--surface); color: var(--ink-2); text-decoration: none; font-size: .9rem; font-weight: 500; }
.cat-nav a::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent-solid); flex: none; }
.cat-nav a:hover { border-color: var(--accent-line); color: var(--ink); background: var(--accent-tint); }
.group { margin-top: var(--sp-7); }
.group-label { margin: 0 0 var(--sp-2); font-size: var(--fs-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.category { margin-top: var(--sp-6); }
.category .cat-head { margin-bottom: 14px; }
.cards { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 12px; }
.cards > li { margin: 0; }
.card { position: relative; display: flex; flex-direction: column; min-width: 0; padding: 16px 16px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); transition: transform .14s var(--ease), border-color .14s var(--ease), box-shadow .14s var(--ease); }
.card::before { content: ""; position: absolute; inset-inline: 16px; top: -1px; height: 3px; border-radius: 0 0 3px 3px; background: var(--accent-solid); opacity: .85; }
.card:hover { transform: translateY(-2px); border-color: var(--accent-line); box-shadow: var(--shadow-2); }
.card h2, .card h3 { margin: 2px 0 6px; font-size: 1.04rem; line-height: 1.3; letter-spacing: -.005em; }
.card h2 a, .card h3 a { color: var(--ink); text-decoration: none; }
.card h2 a::after, .card h3 a::after { content: ""; position: absolute; inset: 0; border-radius: inherit; } /* the whole card is the link target */
.card h2 a:hover, .card h3 a:hover { color: var(--accent-text); text-decoration: underline; }
.card:has(h2 a:focus-visible, h3 a:focus-visible) { outline: 3px solid var(--focus-color); outline-offset: 2px; }
.card h2 a:focus-visible, .card h3 a:focus-visible { outline: none; text-decoration: underline; }
.card p { margin: 0 0 6px; color: var(--ink-2); font-size: .94rem; }
.card .card-meta { margin-top: auto; padding-top: 6px; font-size: var(--fs-xs); color: var(--muted); letter-spacing: .01em; }
.card[hidden] { display: none; }
.wf-step { border-top: 1px solid var(--line); margin-top: var(--sp-5); padding-top: var(--sp-2); }

/* ================================================================== tool page */
.tool-hero { padding: clamp(14px, 2.2vw, 28px) 0 var(--sp-6); }
.tool-hero h1 { margin: 0 0 6px; }
.tool-hero .lede { margin-bottom: var(--sp-4); }
.tool-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 18px 22px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); padding: clamp(16px, 2.6vw, 28px); box-shadow: var(--shadow-2); }
/* short fields (numbers, selects, dates, single-line text) pair up on wide forms; everything else spans the full row */
.tool-form > :not(.field-number, .field-integer, .field-select, .field-date, .field-time, .field-datetime, .field-text, .field-url, .field-boolean) { grid-column: 1 / -1; }
.field { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; align-content: start; border: 0; padding: 0; margin: 0; min-width: 0; }
.field > label, .field > legend, .table-field > legend { font-weight: 600; color: var(--ink); padding: 0; }
.field input:not([type=checkbox], [type=radio], [type=file]), .field select, .field textarea { width: 100%; min-width: 0; }
.field .hint, .field label { overflow-wrap: anywhere; }
.field .hint { margin: 0; }
.with-unit { display: flex; align-items: center; gap: 8px; }
.with-unit input { flex: 1; min-width: 0; }
.unit { color: var(--muted); font-size: .9rem; white-space: nowrap; }
.req { color: var(--muted); font-weight: 400; font-size: .85rem; }
.checks { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.check, .bool { display: inline-flex; align-items: center; gap: 8px; font-weight: 400; min-height: 28px; }
.bool label { font-weight: 600; }
.field-boolean { align-self: center; }
.table-field { border: 1px solid var(--line); border-radius: var(--r-lg); padding: 12px 14px; background: var(--surface-2); }
.table-field > legend { padding-inline: 6px; }
.table-field .table-wrap { background: var(--surface); }
.input-table td, .input-table th { padding: 4px; border-bottom: 0; }
.input-table tbody tr:nth-child(even) { background: none; }
.input-table input, .input-table select { min-height: 38px; padding: 6px 8px; min-width: 76px; width: 100%; }
.input-table thead th { font-size: .82rem; background: none; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding-top: 4px; }
.actions button[type=submit] { min-width: 10rem; min-height: 48px; font-size: 1.05rem; }
.error-summary { border: 1.5px solid var(--danger); border-radius: var(--r-md); padding: 10px 16px; background: var(--danger-bg); }
.error-summary h2 { font-size: 1.05rem; margin: 4px 0; color: var(--danger); }
.error-summary a { color: var(--danger); font-weight: 600; }
.examples { margin: 14px 0 0; color: var(--ink-2); }
.examples a { padding-block: 4px; }
.tool-more { margin: 4px 0 0; }
.tool-more a { display: inline-block; padding-block: 4px; }
/* "More options": optional fields of long forms, collapsed by default (no JS), right before the submit button */
.more-options { grid-column: 1 / -1; border-top: 1px solid var(--line); padding-top: 10px; }
.more-options > summary { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 4px 2px; cursor: pointer; font-weight: 700; color: var(--primary-text); list-style: none; }
.more-options > summary::-webkit-details-marker { display: none; }
.more-options > summary::before { content: ""; width: .55em; height: .55em; border: solid currentColor; border-width: 0 2px 2px 0; transform: rotate(-45deg); transition: transform .15s; flex: none; }
[dir=rtl] .more-options > summary::before { transform: rotate(135deg); }
.more-options[open] > summary::before { transform: rotate(45deg); }
.more-options > summary:hover { text-decoration: underline; }
.more-options > summary:focus-visible { outline: 3px solid var(--focus-color); outline-offset: 2px; border-radius: var(--r-sm); }
.more-options-body { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 18px 22px; padding-top: 12px; }
.more-options-body > :not(.field-number, .field-integer, .field-select, .field-date, .field-time, .field-datetime, .field-text, .field-url, .field-boolean) { grid-column: 1 / -1; }
@media (prefers-reduced-motion: reduce) { .more-options > summary::before { transition: none; } }
/* Phones: H1 + one-line tagline + the form's first fields and button in the first screen */
@media (max-width: 640px) {
  .tool-hero { padding-top: 12px; padding-bottom: var(--sp-5); }
  .tool-hero .eyebrow { margin-bottom: 4px; }
  .tool-hero h1 { font-size: clamp(1.45rem, 1.1rem + 2.2vw, 1.75rem); margin: 0 0 4px; }
  .tool-hero .lede { font-size: 1rem; line-height: 1.4; margin-bottom: 12px; }
  .tool-form { gap: 14px; padding: 14px; }
  .tool-form .hint { font-size: .84rem; line-height: 1.35; }
  .tool-form textarea { max-height: 11em; } /* tall rows=… boxes keep the button in view; the text scrolls inside */
  .actions button[type=submit] { min-height: 46px; }
}

.tool-info { grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: var(--sp-6) var(--sp-7); margin-top: var(--sp-6); }
.tool-how > h2:first-child { margin-top: 0; }
.tool-how { color: var(--ink-2); }
.tool-how li + li { margin-top: .45em; }
.tool-aside { display: grid; gap: var(--sp-4); align-content: start; }
.tool-aside > section { padding: 16px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.tool-aside > section > h2 { margin: 0 0 8px; font-size: var(--fs-lg); }
.tool-aside > section ul { margin: 0; padding-inline-start: 1.1em; }
.tool-aside > section li { color: var(--ink-2); }
.tool-aside > section li + li { margin-top: .5em; }
.tool-info:not(:has(.tool-aside > *)) { grid-template-columns: minmax(0, 1fr); }
.tool-info:not(:has(.tool-aside > *)) > .tool-how { max-width: calc(var(--measure) + 80px); }
.tool-info:not(:has(.tool-aside > *)) > .tool-aside { display: none; }
@media (max-width: 860px) { .tool-info { grid-template-columns: minmax(0, 1fr); } }

/* "For scripts and AI agents" + machine-readable result */
.machine { margin-top: var(--sp-5); padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface-2); }
.tool-aside > .machine { background: var(--surface-2); margin: 0; }
.machine h2 { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font-size: var(--fs-lg); }
.machine h2::before { content: "{ }"; display: inline-grid; place-items: center; min-width: 30px; height: 24px; padding: 0 5px; border-radius: var(--r-sm); background: var(--code-bg); color: var(--code-ink); font: 700 .72rem/1 var(--font-mono); }
.machine ul { margin: 0 0 8px; padding-inline-start: 1.1em; font-size: .92rem; }
.machine li + li { margin-top: .45em; }
.machine code { background: var(--surface); }
.machine details { margin-top: 8px; }
.machine summary { font-weight: 600; padding-block: 4px; }
.machine pre { margin: 8px 0 0; }

/* ================================================================== results */
.tool-result .result-head { padding-top: var(--sp-5); }
.result .verdict { padding: 16px 20px; border-radius: var(--r-lg); background: var(--accent-tint); border: 1px solid var(--accent-line); }
.result .verdict-text { font-size: clamp(1.05rem, 1rem + .35vw, 1.25rem); font-weight: 500; color: var(--ink); }
.block { margin: var(--sp-5) 0; min-width: 0; }
.block > h2 { font-size: var(--fs-xl); margin: 0 0 10px; }
.block > h3, .checklist h3 { font-size: var(--fs-lg); margin: 16px 0 6px; }
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); gap: 10px; margin: 0; }
.metric { border: 1px solid var(--line); border-radius: var(--r-lg); padding: 12px 14px; background: var(--surface); min-width: 0; }
.metric dt { font-size: var(--fs-sm); color: var(--muted); }
.metric dd { margin: 4px 0 0; font-size: 1.32rem; font-weight: 700; letter-spacing: -.01em; word-break: break-word; font-variant-numeric: tabular-nums; color: var(--ink); }
.metric.emphasis { border-color: var(--accent-line); background: var(--accent-tint); box-shadow: inset 0 0 0 1px var(--accent-line); }
.checklist ul { list-style: none; padding-inline-start: 0; }
.checklist li { padding: 6px 0; border-bottom: 1px solid var(--line); margin: 0; }
.due { font-size: .82rem; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 1px 6px; }
.bars .bar-cell { width: 45%; }
.bars svg { width: 100%; height: 14px; display: block; }
.bars rect.pos { fill: var(--accent-solid); }
.bars rect.neg { fill: var(--danger); }
.graph-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface-2); padding: .5rem; }
svg.graph { min-width: 100%; height: auto; font: 12px/1.2 var(--font-sans); }
.graph-node rect { fill: var(--surface); stroke: var(--accent-solid); stroke-width: 1.5; }
.graph-node text { fill: var(--ink); }
.graph-node .graph-kind { fill: var(--muted); font-size: 10px; }
.graph-edge { stroke: var(--control); stroke-width: 1.4; }
.graph-arrow { fill: var(--control); }
ol.timeline { list-style: none; padding: 0; margin: 0; border-inline-start: 3px solid var(--accent-line); }
ol.timeline li { position: relative; padding-block: .4rem .9rem; padding-inline-start: 1.25rem; display: grid; gap: .15rem; margin: 0; }
ol.timeline li::before { content: ""; position: absolute; inset-inline-start: -.6rem; top: .7rem; width: .85rem; height: .85rem; border-radius: 50%; background: var(--accent-solid); border: 2px solid var(--canvas); }
ol.timeline li.tl-good::before { background: var(--success); }
ol.timeline li.tl-warning::before { background: var(--warning); }
ol.timeline li.tl-bad::before { background: var(--danger); }
ol.timeline time { font-size: .8rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.image-block img { max-width: 100%; height: auto; border-radius: var(--r-lg); border: 1px solid var(--line); }
.artifact-block { margin: 1rem 0; }
.artifact-block .artifact-preview { display: block; max-width: 100%; height: auto; margin: 0 0 .7rem; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); }
.artifact-block audio.artifact-preview { width: 100%; border: 0; background: none; }
.artifact-block figcaption { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; overflow-wrap: anywhere; }
/* Tool charts are self-contained SVG images (also downloadable) with their own light background: in both themes they
   sit on a light "paper" so their internal colours keep their contrast. */
.svg-block { margin: 1rem 0; }
.svg-block svg { display: block; width: 100%; max-width: 100%; height: auto; border-radius: var(--r-md); }
.svg-block > svg { background: #fff; border: 1px solid var(--line); }
:root[data-theme="dark"] .svg-block > svg { filter: brightness(.9); } /* less glare; contrast inside the image is kept */
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .svg-block > svg { filter: brightness(.9); } }
.svg-block figcaption { margin-top: .5rem; }
.local-result { min-width: 0; }

/* ================================================================== tool guide (below "How it works") */
.tool-guide-wrap { margin-top: var(--sp-7); }
.wrap.narrow.tool-guide-wrap { max-width: var(--wrap); }
.tool-guide-wrap > * { max-width: calc(var(--measure) + 80px); }
.tool-guide { padding: clamp(20px, 3.5vw, 40px); margin-bottom: var(--sp-6); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); overflow-wrap: anywhere; }
.tool-result ~ .tool-guide, .wrap > .tool-guide { max-width: calc(var(--measure) + 80px); }
.tool-guide > h2 { margin-top: 0; font-size: var(--fs-2xl); }
.tool-guide .lede { font-size: var(--fs-lg); }
.guide-body { font-size: 1.03rem; line-height: 1.7; color: var(--ink-2); }
.guide-body h3 { margin: 2em 0 .55em; padding-top: 1.1em; border-top: 1px solid var(--line); font-size: var(--fs-xl); color: var(--ink); }
.guide-body h3:first-child { margin-top: .6em; padding-top: 0; border-top: 0; }
.guide-body h4 { margin: 1.5em 0 .35em; font-size: 1.04rem; color: var(--ink); }
.guide-body h4 + p { margin-top: 0; }
.guide-body strong { color: var(--ink); }
.guide-body li + li { margin-top: .4em; }
.guide-body table { font-size: .93rem; line-height: 1.5; }
.tool-guide .guide-updated { margin: 1.6em 0 0; }

/* ================================================================== prose pages: docs, blog, site & legal pages */
.prose { color: var(--ink-2); line-height: 1.7; }
.prose h1 { color: var(--ink); }
.prose h2, .prose h3 { color: var(--ink); }
.prose > .lede, .prose .lede { color: var(--ink-2); }
.prose li + li { margin-top: .4em; }
main > .wrap.narrow, .wrap.narrow.prose { padding-top: var(--sp-6); }
main > .wrap:first-child > h1:first-child { margin-top: var(--sp-6); }
.prose pre { line-height: 1.55; }

/* blog */
.blog > h1 { margin-bottom: .2em; }
.blog-card { display: grid; gap: var(--sp-4); padding: var(--sp-5) 0; border-bottom: 1px solid var(--line); }
.blog-card.has-cover { grid-template-columns: minmax(0, 220px) minmax(0, 1fr); align-items: start; }
.blog-card-cover img { border-radius: var(--r-lg); border: 1px solid var(--line); aspect-ratio: 16 / 9; object-fit: cover; }
.blog-card h2 { margin: 0 0 .3rem; font-size: var(--fs-xl); }
.blog-card h2 a { color: var(--ink); text-decoration: none; }
.blog-card h2 a:hover { color: var(--accent-text); text-decoration: underline; }
.blog-card p { margin: 0 0 .4rem; }
@media (max-width: 560px) { .blog-card.has-cover { grid-template-columns: minmax(0, 1fr); } }
/* Changelog (/changelog): one article per release */
.changelog .fb-callout-bottom { margin-top: var(--sp-5); }
.cl-feed { margin-top: 0; }
.cl-release { padding: var(--sp-5) 0; border-top: 1px solid var(--line); }
.cl-release > h2 { margin: 0 0 .2rem; font-size: var(--fs-xl); }
.cl-meta { margin: 0 0 var(--sp-3); }
.cl-body h3 { font-size: var(--fs-md); margin: var(--sp-4) 0 .3rem; }
.cl-body ul { margin: 0; }
.cl-body li { margin-bottom: .25rem; }
.cl-badge { display: inline-block; margin-inline-end: .3em; padding: 0 .5em; border-radius: var(--r-pill); background: var(--success-bg); border: 1px solid var(--success-line); color: var(--ink); font-size: var(--fs-xs); font-weight: 700; line-height: 1.6; white-space: nowrap; }
.blog-post h1 { margin-bottom: .3rem; font-size: var(--fs-3xl); }
.blog-cover { margin: var(--sp-4) 0 var(--sp-5); }
.blog-cover img, .blog-hero { width: 100%; height: auto; border-radius: var(--r-xl); border: 1px solid var(--line); }
.blog-content { font-size: 1.05rem; }
.blog-content h2 { margin-top: 2rem; }
.blog-content blockquote { border-inline-start-color: var(--accent-line); }
.blog-content img { border-radius: var(--r-lg); }
.blog-toc { padding: 14px 18px; border: 1px solid var(--line); border-radius: var(--r-lg); margin: 1rem 0 1.6rem; background: var(--surface); }
.blog-toc p { margin: 0 0 .3rem; color: var(--ink); }
.blog-toc ol { margin: 0; padding-inline-start: 1.25rem; }
.blog-cta { margin-top: 2rem; padding: 18px 20px; border-radius: var(--r-lg); }
.blog-cta .button-link { margin-top: 4px; }

/* site pages (about / contact / accessibility) + legal */
.site-page h2 { margin-top: 1.7em; }
.site-page ul { padding-inline-start: 1.3em; }
.page-art { margin: var(--sp-4) 0 var(--sp-5); }
.page-art img { border-radius: var(--r-xl); border: 1px solid var(--line); }
.legal { max-width: 46rem; }
.legal h2 { margin-top: 2rem; }
.legal-section h3 { font-size: 1.05rem; margin: 1.4rem 0 .4rem; }
.legal-address { font-style: normal; line-height: 1.6; padding: .8rem 1rem; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); margin: .5rem 0 1rem; }

/* credits */
.wrap.narrow:has(.credits-page) { max-width: 1160px; }
.credits-group { margin-top: 28px; }
.credits-table { font-size: .92rem; }
.credits-table th, .credits-table td { vertical-align: top; text-align: start; }
.credits-table tbody th { white-space: normal; min-width: 9rem; }

/* 404 */
.not-found { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--sp-6); align-items: center; padding-block: var(--sp-5); }
.not-found.has-art { grid-template-columns: minmax(0, 1.2fr) minmax(200px, 1fr); }
.wrap.narrow:has(.not-found.has-art) { max-width: 1000px; }
.not-found-code { margin: 0; font-size: clamp(3.5rem, 2rem + 6vw, 6rem); font-weight: 800; line-height: 1; letter-spacing: -.04em; color: var(--accent-text); opacity: .9; }
.not-found h1 { margin-top: .2em; }
.not-found-links { list-style: none; padding: 0; margin: var(--sp-4) 0 0; display: flex; flex-wrap: wrap; gap: 10px; }
.not-found-links li, .prose .not-found-links li + li { margin: 0; }
.not-found-art img { border-radius: var(--r-xl); }
@media (max-width: 640px) { .not-found.has-art { grid-template-columns: minmax(0, 1fr); } .not-found-art { max-width: 280px; } }

/* ================================================================== feedback */
.fb-fab { position: fixed; z-index: 40; inset-inline-end: max(16px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom)); display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px; border-radius: var(--r-pill); background: var(--primary); color: var(--on-accent); font-weight: 700; text-decoration: none; box-shadow: var(--shadow-3); border: 2px solid var(--surface); line-height: 1.1; }
.fb-fab:hover { color: var(--on-accent); text-decoration: underline; filter: brightness(1.06); }
.fb-fab:focus-visible { outline: 3px solid var(--focus-color); outline-offset: 3px; }
.fb-fab svg { flex: none; }
.fb-fab-sub { font-weight: 500; }
@media (max-width: 760px) { .fb-fab-sub { display: none; } }
@media (max-width: 600px) {
  .fb-fab { padding: 8px 14px; gap: 6px; font-size: .9rem; inset-inline-end: max(10px, env(safe-area-inset-right)); bottom: max(10px, env(safe-area-inset-bottom)); }
  .fb-fab svg { width: 18px; height: 18px; }
}
@media (max-width: 360px) {
  .fb-fab .fb-fab-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .fb-fab { padding: 10px; }
}
.feedback-page .fb-form { display: grid; gap: 20px; }
.fb-form input[type=email] { width: 100%; }
.fb-type-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 8px; }
.fb-radio { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 10px 14px; border: 1px solid var(--line-strong); border-radius: var(--r-md); cursor: pointer; font-weight: 500; background: var(--surface); }
.fb-radio:hover { border-color: var(--accent-line); }
.fb-radio:has(input:checked) { border-color: var(--accent-text); background: var(--accent-tint); box-shadow: inset 0 0 0 1px var(--accent-text); }
.fb-radio:has(input:focus-visible) { outline: 3px solid var(--focus-color); outline-offset: 2px; }
.fb-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 18px; }
.fb-privacy { padding: 12px 16px; border-radius: var(--r-md); background: var(--surface-2); color: var(--ink-2); }
.fb-privacy h2 { font-size: 1rem; margin: 2px 0 4px; }
.fb-hp { position: absolute !important; inset-inline-start: 0; top: auto; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.fb-count { margin: 4px 0 0; font-size: .85rem; color: var(--muted); }

/* feedback invitation on tool listings */
.fb-callout { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 18px; margin: var(--sp-6) 0; padding: 14px 18px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-1); }
.fb-callout-icon { flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--info-bg); color: var(--primary-text); border: 1px solid var(--info-line); }
.fb-callout-text { flex: 1 1 300px; min-width: 0; }
.fb-callout h2 { font-size: 1.06rem; margin: 0 0 2px; color: var(--ink); }
.fb-callout p { margin: 0; }
.fb-callout-text p { color: var(--ink-2); font-size: .95rem; overflow-wrap: anywhere; }
.fb-callout-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.fb-callout-btn { display: inline-flex; align-items: center; min-height: 40px; padding: 8px 18px; border-radius: var(--r-pill); background: var(--primary); color: var(--on-accent); font-weight: 700; text-decoration: none; border: 1.5px solid var(--primary); line-height: 1.2; }
.fb-callout-btn:hover { color: var(--on-accent); text-decoration: underline; filter: brightness(1.06); }
.fb-callout-btn:focus-visible { outline: 3px solid var(--focus-color); outline-offset: 3px; }
.fb-callout-btn-secondary { background: var(--surface); color: var(--primary-text); border-color: var(--info-line); }
.fb-callout-btn-secondary:hover { color: var(--primary-text); background: var(--info-bg); filter: none; }
.fb-callout-top { padding: 10px 14px; margin: var(--sp-5) 0; }
.fb-callout-top .fb-callout-icon { width: 36px; height: 36px; border-radius: 10px; }
.fb-callout-top h2 { font-size: 1rem; }
.fb-callout-top .fb-callout-text p { font-size: .9rem; }
.fb-callout-bottom { margin-top: var(--sp-7); padding: 22px 24px; background: var(--info-bg); border-color: var(--info-line); }
.fb-callout-bottom .fb-callout-icon { background: var(--surface); }
.fb-callout-bottom h2 { font-size: 1.25rem; }

/* ================================================================== ad slots (consent-gated; reserved space avoids layout shift) */
.uw-ad { position: relative; display: block; box-sizing: border-box; width: 100%; max-width: var(--wrap, 1160px); margin: 18px auto; padding-top: 18px; min-height: 120px; overflow: hidden; text-align: center; }
.uw-ad::before { content: attr(data-label); position: absolute; top: 0; left: 0; right: 0; font-size: .7rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); line-height: 18px; }
.uw-ad-after_tool, .uw-ad-after_result, .uw-ad-content_bottom { min-height: 120px; }
.uw-ad-content_mid { min-height: 280px; }
.uw-ad-sidebar { min-height: 270px; max-width: 336px; }
@media (max-width: 720px) { .uw-ad-content_mid, .uw-ad-sidebar { min-height: 120px; } .uw-ad-sidebar { max-width: none; } }
.uw-ad ins.adsbygoogle { display: block; width: 100%; }
.uw-ad.uw-ad-off { display: none; }
.uw-ad-placeholder, .uw-ad[data-preview] { display: flex; align-items: center; justify-content: center; border: 2px dashed var(--line-strong); border-radius: var(--r-md); background: repeating-linear-gradient(45deg, var(--surface-2), var(--surface-2) 10px, var(--surface-3) 10px, var(--surface-3) 20px); color: var(--muted); font-size: .85rem; }

/* ================================================================== consent bar (public/consent.js)
 * NON-BLOCKING (docs/CONSENT_CMP_SETUP.md): a compact bar fixed to the bottom; the page stays usable (no backdrop, nothing
 * inert, no scroll lock) and keeps free space at the bottom (body padding + scroll-padding = bar height, --uw-cb-h).
 * Wide screens: text left, the three choices right (≈ 1/5 of a 768 px tall screen). Phones: bottom sheet ≤ 30 % of the
 * viewport — the text scrolls inside the sheet while Accept/Reject stay visible. Accept and Reject look identical. */
.uw-cb { position: fixed; left: 0; right: 0; bottom: 0; z-index: 2147483000; display: flex; justify-content: center; padding: 0 12px 12px; pointer-events: none; }
.uw-cb-inner { pointer-events: auto; box-sizing: border-box; width: 100%; max-width: 1120px; max-height: 80vh; max-height: 80dvh; overflow-y: auto; overscroll-behavior: contain; background: var(--surface); color: var(--ink); border: 1px solid var(--line-strong); border-radius: var(--r-xl); box-shadow: var(--shadow-3); padding: 14px 18px; font-size: .92rem; line-height: 1.45; }
.uw-cb-title { font-size: 1.02rem; margin: 0 0 4px; color: var(--ink); }
.uw-cb-ptitle { font-size: 1rem; margin: 0 0 4px; color: var(--ink); }
.uw-cb-main { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 20px; align-items: center; }
.uw-cb-text, .uw-cb-more, .uw-cb-intro { margin: 0 0 6px; overflow-wrap: anywhere; color: var(--ink-2); }
.uw-cb-copy .uw-cb-more { margin: 0; }
.uw-cb-link { font-weight: 600; color: var(--primary-text); display: inline-block; padding-block: 2px; }
.uw-cb-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.uw-cb-main > .uw-cb-actions { flex-wrap: nowrap; }
.uw-cb-btn { flex: 1 1 auto; min-height: 44px; padding: 8px 16px; font: inherit; font-weight: 700; line-height: 1.2; border-radius: var(--r-md); border: 1.5px solid var(--primary); background: var(--primary); color: var(--on-accent); cursor: pointer; }
.uw-cb-main .uw-cb-btn { white-space: nowrap; }
.uw-cb-panel .uw-cb-btn { flex-basis: 10rem; }
.uw-cb-btn:hover { background: var(--primary-text); border-color: var(--primary-text); color: var(--on-accent); filter: brightness(.95); }
.uw-cb-btn-secondary { background: var(--surface); color: var(--primary-text); }
.uw-cb-btn-secondary:hover { background: var(--info-bg); color: var(--primary-text); filter: none; }
.uw-cb-btn:disabled { opacity: .6; cursor: progress; }
.uw-cb a:focus-visible, .uw-cb-btn:focus-visible, .uw-cb input:focus-visible, .uw-cb-title:focus-visible, .uw-cb-ptitle:focus-visible { outline: 3px solid var(--focus-color); outline-offset: 2px; }
.uw-cb-title:focus:not(:focus-visible), .uw-cb-ptitle:focus:not(:focus-visible) { outline: none; }
.uw-cb [hidden] { display: none !important; }
.uw-cb-row { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 10px; align-items: start; padding: 10px 0; border-bottom: 1px solid var(--line); }
.uw-cb-row input { width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--primary); }
.uw-cb-label { font-weight: 700; cursor: pointer; }
.uw-cb-badge { grid-column: 2; font-size: .78rem; font-weight: 700; color: var(--success); }
.uw-cb-desc { grid-column: 2; margin: 0; color: var(--muted); font-size: .88rem; }
.uw-cb-panel .uw-cb-actions { margin-top: 10px; }
html.uw-cb-open body { padding-bottom: var(--uw-cb-h, 0px); }
/* The floating feedback button would sit under the bar; moving it up would be a layout shift (CLS). It steps aside while
 * the bar is open — the footer's feedback link stays. */
html.uw-cb-open .fb-fab { display: none; }
@media (prefers-reduced-motion: no-preference) {
  .uw-cb-inner { animation: uw-cb-in .2s ease-out; }
  @keyframes uw-cb-in { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }
}
/* Medium widths: buttons under the text, in one row. */
@media (max-width: 1099px) {
  .uw-cb-main { grid-template-columns: minmax(0, 1fr); }
  .uw-cb-main > .uw-cb-actions { flex-wrap: wrap; }
}
/* Wide screens: a card in the bottom inline-end corner. Tool forms, their submit button and the page's main column start
 * at the inline-start side, so the card never covers the primary action. */
@media (min-width: 1100px) {
  .uw-cb { left: auto; right: 0; justify-content: flex-end; padding: 0 16px 16px; }
  [dir=rtl] .uw-cb { right: auto; left: 0; }
  .uw-cb-inner { width: 500px; max-width: calc(100vw - 32px); }
  .uw-cb-main { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .uw-cb-main > .uw-cb-actions { flex-wrap: wrap; }
  .uw-cb-main .uw-cb-btn { padding-inline: 12px; }
  html.uw-cb-open body { padding-bottom: 0; }
  html.uw-cb-open .site-footer { padding-bottom: calc(var(--uw-cb-h, 0px) + 16px); }
}
/* Phones: bottom sheet, at most 30 % of the viewport while only the bar is shown (the options panel, opened by the
 * visitor, may use more). Text scrolls inside; Accept + Reject side by side (equal size), Manage below. */
@media (max-width: 640px) {
  .uw-cb { padding: 0; }
  .uw-cb-inner { border-radius: var(--r-lg) var(--r-lg) 0 0; border-inline-width: 0; border-bottom-width: 0; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); font-size: .86rem; line-height: 1.38; max-height: 85vh; max-height: 85dvh; }
  .uw-cb-inner:has(> .uw-cb-main:not([hidden])) { max-height: 30vh; max-height: 30dvh; display: flex; flex-direction: column; overflow: hidden; }
  .uw-cb-title { font-size: .95rem; margin-bottom: 2px; flex: none; }
  .uw-cb-main { min-height: 0; flex: 1 1 auto; display: flex; flex-direction: column; gap: 6px; }
  .uw-cb-copy { min-height: 2.8em; flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; }
  .uw-cb-text { margin-bottom: 2px; }
  .uw-cb-main > .uw-cb-actions { flex: none; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
  .uw-cb-main .uw-cb-btn { white-space: normal; min-height: 40px; padding: 6px 8px; font-size: .86rem; }
  .uw-cb-main .uw-cb-btn-secondary { grid-column: 1 / -1; min-height: 32px; padding-block: 4px; border-color: transparent; text-decoration: underline; }
  .uw-cb-panel .uw-cb-btn { flex-basis: 100%; }
}

/* ================================================================== accessibility helpers (WCAG 2.2 AA)
 * Reflow (1.4.10) + text spacing (1.4.12): long words (German compounds, URLs, e-mail addresses, API paths) wrap instead
 * of widening the page at 320 CSS px. Tables keep their own min-content layout (they scroll inside .table-wrap). */
main :is(h1, h2, h3, h4, p, li, dd, dt, figcaption, legend, label, summary, a, code):not(table *, pre *), .site-footer :is(p, a) { overflow-wrap: anywhere; }
@media (max-width: 480px) { :is(h1, h2, h3) { hyphens: auto; } }
.grid-2 > *, .block, .machine, .tool-hero .wrap, .fb-callout-text, .card { min-width: 0; }
.grid-2 p, .grid-2 li, .block p, .block li, .machine li, .callout { overflow-wrap: anywhere; }
details, .machine, .tool-form, fieldset { min-width: 0; max-width: 100%; }
.tool-form textarea, .tool-form input, .tool-form select { max-width: 100%; }
/* Scrollable tables/charts are keyboard-focusable regions (2.1.1); show where focus is. */
.table-wrap[tabindex]:focus-visible, .graph-wrap[tabindex]:focus-visible, pre[tabindex]:focus-visible { outline: 3px solid var(--focus-color); outline-offset: 2px; }
/* Focus not obscured (2.4.11): keep focused fields clear of the fixed feedback button and the consent bar. */
html:has(.fb-fab) { scroll-padding-bottom: 88px; }
html.uw-cb-open { scroll-padding-bottom: calc(var(--uw-cb-h, 0px) + 16px); }
@media (max-width: 640px) { html { scroll-padding-top: 16px; } }
/* Target size (2.5.8): small inline-only links get a ≥ 24 px tall hit area without changing the line layout. */
.footer-links a, .eyebrow a, .examples a, .cat-link, .card-meta a, .themes > p > a, .app-showcase-more a, .blog > p.small > a { display: inline-block; padding-block: 4px; }
.themes > p { margin-top: var(--sp-4); }
@media (prefers-reduced-motion: reduce) { .theme a, .card { transition: none; transform: none !important; } }
@media (forced-colors: active) {
  .card::before, .eyebrow::before, .cat-nav a::before { forced-color-adjust: none; background: CanvasText; }
  .theme-pop a[aria-current="true"] { outline: 2px solid Highlight; }
}

/* ================================================================== print */
@media print {
  :root { color-scheme: light; --canvas: #fff; --surface: #fff; --surface-2: #f4f4f5; --line: #ccc; --ink: #000; --ink-2: #111; --muted: #333; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .site-header nav, .header-tools, .skip, .fb-fab, .fb-callout, .uw-ad, .uw-cb, .tool-form .actions, .check-another, .footer-links, .theme-switch, .hero-art, .tool-search { display: none !important; }
  .site-header, .site-footer { position: static; border: 0; background: none; }
  .hero-brand, .tool-hero { background: none; }
  .card, .theme a, .tool-guide, .tool-form, .metric, .machine, .home-intro, .tool-aside > section { box-shadow: none; break-inside: avoid; }
  pre { white-space: pre-wrap; max-height: none; background: #f4f4f5; color: #000; border-color: #ccc; }
  .table-wrap { overflow: visible; }
  .prose a[href^="http"]::after { content: " (" attr(href) ")"; font-size: .85em; color: #333; overflow-wrap: anywhere; }
  h1, h2, h3 { break-after: avoid; }
}
