/* Tools hub, tool pages, error-code pages and the site-wide search palette. Tokens come from style.css. */

.crumbs { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-family: var(--font-mono); font-size: 0.8rem; color: var(--text-faint); margin-bottom: 14px; }
.crumbs a { color: var(--text-dim); text-decoration: none; }
.crumbs a:hover { color: var(--accent); }

/* --- Hub ------------------------------------------------------------------ */
.tool-search { position: relative; max-width: 720px; margin: 0 0 22px; }
.tool-search-input { height: 52px; padding: 0 52px 0 18px; font-size: 1.02rem; background: var(--surface); border: 1px solid var(--border-strong); color: var(--text); border-radius: var(--radius-lg); }
.tool-search-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); background: var(--surface); color: var(--text); }
.tool-search-input::placeholder { color: var(--text-faint); }
.tool-search-kbd { position: absolute; right: 14px; top: 14px; }
.tool-search-status { min-height: 1.3em; margin: 8px 2px 0; font-size: 0.85rem; color: var(--text-faint); }
kbd { font-family: var(--font-mono); font-size: 0.75rem; padding: 2px 7px; border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 5px; background: var(--surface-2); color: var(--text-dim); }

.tool-cats { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 34px; }
.tool-cats-foot { margin-top: 34px; }
.tool-cat { display: inline-flex; align-items: center; gap: 8px; padding: 7px 13px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text-dim); text-decoration: none; font-size: 0.9rem; transition: border-color 0.15s var(--ease), color 0.15s var(--ease); }
.tool-cat:hover { border-color: var(--accent-line); color: var(--text); }
.tool-cat-n { font-family: var(--font-mono); font-size: 0.75rem; color: var(--accent); }

.tool-group { margin-bottom: 40px; }
.tool-group[hidden] { display: none; }
.tool-group-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 16px; margin-bottom: 14px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.tool-group-title { font-family: var(--font-display); font-size: 1.35rem; font-weight: 700; margin: 0; }
.tool-group-title a { color: var(--text); text-decoration: none; }
.tool-group-title a:hover { color: var(--accent); }
.tool-group-blurb { margin: 0; color: var(--text-faint); font-size: 0.92rem; }

.tool-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.tool-card[hidden] { display: none; }
.tool-card-link { display: flex; flex-direction: column; gap: 6px; height: 100%; padding: 14px 15px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); text-decoration: none; transition: border-color 0.15s var(--ease), transform 0.15s var(--ease), background 0.15s var(--ease); }
.tool-card-link:hover, .tool-card-link:focus-visible { border-color: var(--accent-line); background: var(--surface-2); transform: translateY(-1px); }
.tool-card-title { color: var(--text); font-weight: 650; font-size: 0.98rem; }
.tool-card-sum { color: var(--text-dim); font-size: 0.86rem; line-height: 1.45; flex: 1; }
.tool-card-slug { align-self: flex-start; font-size: 0.72rem; color: var(--text-faint); background: none; padding: 0; }
.tool-none { padding: 26px; border: 1px dashed var(--border-strong); border-radius: var(--radius-lg); color: var(--text-dim); text-align: center; }

.tool-how { margin-top: 48px; padding-top: 28px; border-top: 1px solid var(--border); max-width: 860px; }
.tool-how-title, .tool-h { font-family: var(--font-display); font-size: 1.3rem; font-weight: 700; margin: 0 0 14px; }
.tool-h3 { font-size: 1rem; font-weight: 650; margin: 0 0 8px; color: var(--text-dim); }

/* --- Tool page ------------------------------------------------------------ */
.tool-bench { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 991px) { .tool-bench { grid-template-columns: minmax(0, 1fr); } }
.tool-field { margin-bottom: 16px; }
.tool-field .form-label { display: flex; align-items: baseline; gap: 8px; font-weight: 600; }
.tool-req { font-family: var(--font-mono); font-size: 0.68rem; font-weight: 400; color: var(--accent); text-transform: uppercase; letter-spacing: 0.06em; }
.tool-text { resize: vertical; min-height: 84px; max-height: 60vh; line-height: 1.5; tab-size: 2; }
.tool-field.has-error .form-control, .tool-field.has-error .form-select { border-color: var(--err); box-shadow: 0 0 0 3px var(--del-dim); }
.tool-field-error { margin-top: 6px; color: var(--err); font-size: 0.88rem; }
.tool-actions { align-items: center; flex-wrap: wrap; }
.tool-reset { color: var(--text-faint); text-decoration: none; }
.tool-reset:hover { color: var(--text); }
.tool-shortcut { margin-left: auto; color: var(--text-faint); font-size: 0.78rem; }
@media (max-width: 575px) { .tool-shortcut { display: none; } }

.tool-out { position: relative; }
@media (min-width: 992px) { .tool-out { position: sticky; top: calc(var(--nav-h) + 16px); } }
.tool-out-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 14px; }
.tool-state { margin: 0; font-family: var(--font-mono); font-size: 0.8rem; color: var(--text-faint); }
.tool-state.is-ok { color: var(--ok); }
.tool-state.is-err { color: var(--err); }
.tool-progress { height: 3px; margin: 10px 0 0; background: var(--surface-3); border-radius: 3px; overflow: hidden; }
.tool-progress span { display: block; height: 100%; width: 35%; background: var(--accent); border-radius: 3px; animation: tool-slide 1s var(--ease) infinite; }
@keyframes tool-slide { from { transform: translateX(-110%); } to { transform: translateX(320%); } }
@media (prefers-reduced-motion: reduce) { .tool-progress span { animation: none; width: 100%; opacity: 0.6; } }

.tool-error { margin-top: 14px; padding: 14px 16px; border: 1px solid var(--err); border-left-width: 4px; border-radius: var(--radius); background: var(--del-dim); }
.tool-error-title { margin: 0 0 6px; font-weight: 650; color: var(--text); }
.tool-error-fix { margin: 0 0 6px; color: var(--text-dim); }
.tool-error ul { margin: 6px 0; padding-left: 20px; color: var(--text-dim); }
.tool-error-meta { margin: 8px 0 0; font-family: var(--font-mono); font-size: 0.76rem; color: var(--text-faint); }
.tool-error-meta a { color: var(--text-dim); }

.tool-preview { margin-top: 14px; padding: 18px; display: flex; justify-content: center; border: 1px solid var(--border); border-radius: var(--radius); background-color: #fff; background-image: linear-gradient(45deg, #eee 25%, transparent 25%, transparent 75%, #eee 75%), linear-gradient(45deg, #eee 25%, transparent 25%, transparent 75%, #eee 75%); background-size: 16px 16px; background-position: 0 0, 8px 8px; }
.tool-preview img { max-width: 100%; max-height: 420px; height: auto; }
.tool-facts { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 0; }
.tool-facts div { padding: 6px 11px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.tool-facts dt { font-family: var(--font-mono); font-size: 0.68rem; font-weight: 400; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-faint); }
.tool-facts dd { margin: 0; font-family: var(--font-mono); font-size: 0.88rem; color: var(--text); word-break: break-word; }
.tool-result-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; }
.tool-views { display: inline-flex; margin-right: auto; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.tool-view { padding: 5px 12px; border: 0; background: transparent; color: var(--text-faint); font-size: 0.82rem; }
.tool-view[aria-pressed="true"] { background: var(--surface-3); color: var(--text); }
.tool-output { margin: 8px 0 0; padding: 14px; max-height: 460px; overflow: auto; background: var(--code-bg); border: 1px solid var(--border); border-radius: var(--radius); font-family: var(--font-mono); font-size: 0.84rem; line-height: 1.55; color: var(--text); white-space: pre-wrap; word-break: break-word; }
.tool-privacy { margin: 14px 0 0; }

.tool-section { margin-top: 44px; max-width: 980px; }
.tool-table { --bs-table-bg: transparent; --bs-table-color: var(--text-dim); --bs-table-border-color: var(--border); font-size: 0.92rem; }
.tool-table th { color: var(--text); font-weight: 600; }
.tool-table thead th { font-family: var(--font-mono); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-faint); }
.tool-table tr.is-current > * { background: var(--accent-dim); }
.tool-example-block { margin-bottom: 18px; }
.tool-example-pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
@media (max-width: 767px) { .tool-example-pair { grid-template-columns: minmax(0, 1fr); } }
.tool-example-label { font-family: var(--font-mono); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-faint); margin-bottom: 6px; }
.tool-faq dt { font-weight: 650; color: var(--text); margin-top: 14px; }
.tool-faq dd { margin: 4px 0 0; color: var(--text-dim); max-width: var(--measure); }

.err-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 991px) { .err-layout { grid-template-columns: minmax(0, 1fr); } }

/* --- File tools: drop zone, progress panel, result files (static/js/jobs.js) --- */
.tool-chip { margin-left: 6px; vertical-align: 2px; font-size: 0.62rem; padding: 0.05rem 0.4rem; text-transform: uppercase; }
.tool-error-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

.dropzone { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 124px; padding: 20px 16px; text-align: center; border: 1.5px dashed var(--border-strong); border-radius: var(--radius-lg); background: var(--surface-2); color: var(--text-dim); cursor: pointer; transition: border-color 0.15s var(--ease), background 0.15s var(--ease); }
.dropzone:hover, .dropzone.is-over { border-color: var(--accent); background: var(--accent-dim); }
.dropzone:focus-visible { outline: 2px solid var(--accent-hi); outline-offset: 3px; border-color: var(--accent); }
.dropzone.has-files { min-height: 76px; padding: 14px 16px; }
.dropzone input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.dropzone-title { margin: 0; color: var(--text); font-weight: 600; }
.dropzone-title u { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
.dropzone-hint { margin: 0; font-size: 0.82rem; color: var(--text-faint); }
.tool-field.has-error .dropzone { border-color: var(--err); background: var(--del-dim); }
.dropzone-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; }
.dropzone-list[hidden] { display: none; }
.dropzone-file { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto auto; align-items: center; gap: 10px; padding: 6px 8px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.dropzone-thumb { width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; overflow: hidden; border-radius: 4px; background: var(--surface-3); }
.dropzone-thumb img { width: 100%; height: 100%; object-fit: cover; }
.dropzone-thumb .jb-icon { width: 40px; height: 40px; font-size: 0.6rem; border: 0; border-radius: 0; }
.dropzone-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); font-size: 0.9rem; }
.dropzone-size { font-family: var(--font-mono); font-size: 0.76rem; color: var(--text-faint); white-space: nowrap; }
.dropzone-remove { font-size: 0.76rem; padding: 2px 8px; }
.dropzone-sample { padding: 0; margin-top: 8px; font-size: 0.88rem; color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.dropzone-sample:hover, .dropzone-sample:focus-visible { color: var(--accent-hi); }

.jb-progress { margin-top: 14px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.jb-progress[hidden] { display: none; }
.jb-steps { list-style: none; display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 0 0 12px; padding: 0; font-family: var(--font-mono); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; }
.jb-steps li { display: inline-flex; align-items: center; gap: 6px; color: var(--text-faint); }
.jb-steps li::before { content: ''; width: 7px; height: 7px; border-radius: 50%; border: 1px solid var(--border-strong); }
.jb-steps li.is-done { color: var(--text-dim); }
.jb-steps li.is-done::before { background: var(--ok); border-color: var(--ok); }
.jb-steps li.is-now { color: var(--accent); font-weight: 700; }
.jb-steps li.is-now::before { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
.jb-bar { height: 8px; border-radius: 8px; background: var(--surface-3); overflow: hidden; }
.jb-bar span { display: block; height: 100%; width: 0; border-radius: 8px; background: var(--accent); transition: width 0.25s linear; }
.jb-bar.is-unknown span { width: 30%; animation: tool-slide 1.2s var(--ease) infinite; transition: none; }
.jb-progress.is-over .jb-bar span { background: var(--ok); }
.jb-progress.is-stalled .jb-bar.is-unknown span { animation-duration: 3s; background: var(--text-faint); }
@media (prefers-reduced-motion: reduce) { .jb-bar.is-unknown span { animation: none; width: 100%; opacity: 0.45; } .jb-bar span { transition: none; } }
.jb-message { margin: 10px 0 0; color: var(--text); font-size: 0.95rem; overflow-wrap: anywhere; }
.jb-progress.is-stalled .jb-message { color: var(--warn); }
.jb-meta { margin: 2px 0 0; min-height: 1.3em; font-family: var(--font-mono); font-size: 0.76rem; color: var(--text-faint); }
.jb-rows { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; }
.jb-rows:empty { display: none; }
.jb-rows li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; align-items: baseline; font-size: 0.82rem; color: var(--text-dim); }
.jb-row-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jb-row-amount { font-family: var(--font-mono); font-size: 0.74rem; color: var(--text-faint); }
.jb-rows li.is-done .jb-row-amount { color: var(--ok); }
.jb-row-bar { grid-column: 1 / -1; height: 3px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.jb-row-bar span { display: block; height: 100%; width: 0; background: var(--accent); }
.jb-rows li.is-done .jb-row-bar span { background: var(--ok); }
.jb-cancel { margin-top: 12px; }

.jb-files { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 10px; }
.jb-files:empty { display: none; }
.jb-file { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 12px; align-items: center; padding: 10px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); }
.jb-file-view { display: flex; align-items: center; justify-content: center; width: 96px; height: 96px; overflow: hidden; border-radius: var(--radius); background: var(--surface-3); }
.jb-file-view.is-image { background-color: #fff; background-image: linear-gradient(45deg, #ddd 25%, transparent 25%, transparent 75%, #ddd 75%), linear-gradient(45deg, #ddd 25%, transparent 25%, transparent 75%, #ddd 75%); background-size: 12px 12px; background-position: 0 0, 6px 6px; }
.jb-file-view img { max-width: 100%; max-height: 100%; object-fit: contain; }
.jb-file-view.is-video, .jb-file-view.is-audio { grid-column: 1 / -1; width: 100%; height: auto; background: var(--code-bg); }
.jb-file-view video { width: 100%; max-height: 360px; }
.jb-file-view audio { width: 100%; margin: 10px; }
.jb-file-view.is-video + .jb-file-body, .jb-file-view.is-audio + .jb-file-body { grid-column: 1 / -1; }
.jb-icon { display: flex; align-items: center; justify-content: center; width: 54px; height: 66px; border: 1px solid var(--border-strong); border-radius: 4px 12px 4px 4px; background: var(--surface-2); font-family: var(--font-mono); font-size: 0.7rem; font-weight: 700; text-transform: uppercase; color: var(--accent); }
.jb-file-body { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.jb-file-name { color: var(--text); font-weight: 650; overflow-wrap: anywhere; }
.jb-file-meta { font-family: var(--font-mono); font-size: 0.76rem; color: var(--text-faint); overflow-wrap: anywhere; }
.jb-file-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.jb-file.is-large { grid-template-columns: minmax(0, 1fr); }
.jb-file.is-large .jb-file-view { width: 100%; height: auto; min-height: 96px; }
.jb-file.is-large .jb-file-view.is-image img { max-height: 70vh; }
.jb-file.is-large .jb-file-view:not(.is-image):not(.is-video):not(.is-audio) { padding: 18px; }
@media (max-width: 420px) { .jb-file { grid-template-columns: 64px minmax(0, 1fr); } .jb-file-view { width: 64px; height: 64px; } .dropzone-file { grid-template-columns: 40px minmax(0, 1fr) auto; } .dropzone-size { display: none; } }
.jb-share { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin: 14px 0 0; font-size: 0.9rem; color: var(--text-dim); }
.jb-share[hidden] { display: none; }
.jb-share a { color: var(--accent); }
.jb-expiry { font-family: var(--font-mono); font-size: 0.78rem; color: var(--text-faint); }
