/* ============================================================================
 * ai-tools.css — shared layer for the apprun.icu AI tools (loaded after ds.css + tools.css)
 * ----------------------------------------------------------------------------
 * Page furniture that tools.css does not cover (breadcrumbs, prose, numbered
 * steps) plus a small vocabulary for tool workbenches: .ait-* classes.
 * Each tool adds its own specifics in /<slug>/app.css. Colours come from the
 * page's voxel material (--m, --m-soft, --m-ink, --on-m) and the semantic
 * tokens in ds.css; nothing here hard-codes a palette.
 * ==========================================================================*/

/* ---------- page furniture ------------------------------------------------ */
.crumbs ol { display: flex; flex-wrap: wrap; gap: 2px 8px; list-style: none; margin: 0 0 14px; padding: 0; font-size: 13px; font-weight: 700; color: var(--ink-3); }
.crumbs li + li::before { content: "/"; margin-right: 8px; color: var(--line-2); }
.crumbs a { color: var(--ink-2); text-decoration: underline; text-underline-offset: 2px; }
.crumbs a:hover { color: var(--ink); }

.prose p, .prose li { max-width: 78ch; font-size: 15.5px; color: var(--ink-2); }
.prose p { margin-bottom: 12px; }
.prose p:last-child { margin-bottom: 0; }
.prose h3 { font: 850 1.1rem/1.25 var(--display); font-stretch: 108%; margin: 22px 0 6px; }
.prose ul, .prose ol { margin: 0 0 14px 1.2em; }
.prose li { margin-bottom: 4px; }
.prose a, .qa a, .plain a { text-decoration: underline; text-underline-offset: 2px; }
.prose code, .qa code { font-size: 0.88em; background: var(--m-soft); color: var(--m-ink); padding: 1px 6px; font-weight: 700; }
.prose .tblwrap { margin: 8px 0 16px; max-width: 100%; }
.prose .tbl td { white-space: normal; vertical-align: top; }
.prose .callout { max-width: 78ch; margin: 14px 0; padding: 12px 14px; border: 2px solid var(--line-2); border-left: 6px solid var(--m); background: #fff; font-size: 15px; }
.prose .callout b { color: var(--ink); }

.steps { counter-reset: st; list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; max-width: 78ch; }
.steps li { counter-increment: st; position: relative; padding: 2px 0 2px 46px; font-size: 15.5px; color: var(--ink-2); }
.steps li::before { content: counter(st); position: absolute; left: 0; top: 0; width: 32px; height: 32px; display: grid; place-items: center; background: var(--m); color: var(--on-m); font: 850 0.95rem/1 var(--display); box-shadow: 3px 3px 0 var(--m-side); }
.steps li b { display: block; color: var(--ink); font-weight: 800; margin-bottom: 2px; }

.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px 26px; }
.guide-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }

/* ---------- workbench primitives ----------------------------------------- */
.ait { display: grid; gap: 18px; min-width: 0; }
.ait > * { min-width: 0; }
.ait-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.ait-grid.wide-left { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); }
.ait-grid.wide-right { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); }
@media (max-width: 900px) { .ait-grid, .ait-grid.wide-left, .ait-grid.wide-right { grid-template-columns: 1fr; } }
.ait .card + .card { margin-top: 0; }   /* tools.css stacks sibling cards with a top margin; in a grid they must align */
.ait > .card + .card, .ait-stack > .card + .card { margin-top: 18px; }

textarea.ait-ta { min-height: 220px; font: 500 13.5px/1.55 var(--code); font-stretch: 100%; tab-size: 2; white-space: pre-wrap; overflow-wrap: anywhere; }
textarea.ait-ta.tall { min-height: 340px; }
textarea.ait-ta.short { min-height: 120px; }
.ait-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin: 10px 0 0; }
.ait-bar .btn { margin: 0 4px 6px 0; }
.ait-bar .grow { flex: 1 1 auto; }
.ait-meta { font-size: 12.5px; color: var(--ink-3); margin-top: 6px; line-height: 1.5; }
.ait-meta b { color: var(--ink); font-weight: 800; }
.ait-status { min-height: 1.4em; font-size: 13.5px; font-weight: 700; color: var(--ink-2); }
.ait-status.bad { color: var(--bad); }
.ait-status.ok { color: var(--ok); }

.ait-drop { display: block; border: 3px dashed var(--line-2); background: #fff; padding: 26px 16px; text-align: center; cursor: pointer; font-weight: 700; color: var(--ink-2); transition: border-color 0.15s, background 0.15s; }
.ait-drop:hover, .ait-drop:focus-within, .ait-drop.is-over { border-color: var(--m); background: var(--m-soft); }
.ait-drop small { display: block; font-weight: 600; color: var(--ink-3); margin-top: 4px; }
.ait-drop input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

.ait-tag { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; font-size: 12px; font-weight: 800; line-height: 1.5; border: 2px solid var(--line-2); background: var(--page-2); color: var(--ink-2); white-space: nowrap; }
.ait-tag.ok { background: var(--ok-soft); border-color: #a8dcb8; color: #0f5a2c; }
.ait-tag.warn { background: var(--warn-soft); border-color: #f0cf8a; color: #5f3d00; }
.ait-tag.bad { background: var(--bad-soft); border-color: #f0a9a2; color: #7a1d17; }
.ait-tag.info { background: var(--info-soft); border-color: #b7cff5; color: #123f8c; }

.ait-meter { height: 10px; background: var(--page-2); border: 2px solid var(--line-2); overflow: hidden; }
.ait-meter > i { display: block; height: 100%; background: var(--m); }

mark.ait-hl, .ait-hl { background: color-mix(in srgb, var(--sand) 55%, #fff); color: var(--ink); padding: 0 2px; }
.ait-ins { background: var(--ok-soft); color: #0f5a2c; text-decoration: none; }
.ait-del { background: var(--bad-soft); color: #7a1d17; text-decoration: line-through; }

pre.ait-out { font: 500 12.5px/1.6 var(--code); font-stretch: 100%; background: #fff; border: 2px solid var(--line-2); padding: 12px 14px; max-height: 420px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; }

.ait-tabs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 12px; }
.ait-tabs button { font: 800 0.85rem/1 var(--font-ui); padding: 9px 14px; border: 2px solid var(--line-2); background: #fff; color: var(--ink-2); cursor: pointer; }
.ait-tabs button[aria-selected="true"] { background: var(--m); border-color: var(--m-side); color: var(--on-m); box-shadow: 0 3px 0 var(--m-side); }
.ait-panel[hidden] { display: none; }

.ait-empty { padding: 26px 16px; text-align: center; color: var(--ink-3); border: 2px dashed var(--line-2); background: #fff; font-size: 14.5px; }
.ait-note { font-size: 13px; color: var(--ink-3); max-width: 78ch; }
.ait-warn { padding: 10px 12px; border: 2px solid #f0cf8a; background: var(--warn-soft); color: #5f3d00; font-size: 14px; }
.ait-sample { font: 700 0.85rem/1 var(--font-ui); background: none; border: 0; padding: 0; color: var(--m-ink); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }

.ait-kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; font-size: 14px; }
.ait-kv dt { font-weight: 800; color: var(--ink); }
.ait-kv dd { margin: 0; color: var(--ink-2); overflow-wrap: anywhere; }

/* stat strips: tools.css fills the grid gaps with a line colour, which shows as a solid block when the last row is short */
#tool .stats { background: transparent; border: 0; gap: 10px; overflow: visible; }
#tool .stat { border: 2px solid var(--line-2); border-radius: var(--r-md); }

/* hub page */
.hub-group + .hub-group { margin-top: 34px; }
.hub-group > h3 { font: 850 1.15rem/1.2 var(--display); font-stretch: 112%; margin-bottom: 4px; }
.hub-group > p { color: var(--ink-3); font-size: 14.5px; max-width: 70ch; margin-bottom: 14px; }
.hub-pairs { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.hub-pair { border: 2px solid var(--ink); background: #fff; padding: 14px 16px 12px; box-shadow: 4px 4px 0 var(--m); }
.hub-pair > a.tool { display: block; font: 850 1.08rem/1.2 var(--display); font-stretch: 112%; color: var(--ink); text-decoration: none; }
.hub-pair > a.tool:hover { text-decoration: underline; text-underline-offset: 3px; }
.hub-pair p { font-size: 14px; margin: 6px 0 8px; }
.hub-pair ul { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.hub-pair li { padding: 6px 0 0; font-size: 13.5px; }
.hub-pair li a { text-decoration: underline; text-underline-offset: 2px; }

@media print {
  .ait-bar, .ait-tabs, .ait-drop { display: none !important; }
}
