/* Tool pages, "the firm" direction (DESIGN.md, color.firm). Loads after /home.css and reads its tokens and shell classes
   (top bar, type, buttons, bands, footer). Inputs sit on paper; the answer is evidence, so it sits on ink.
   Class names and ids used by /tools/js/airflow-schedule.mjs (run-utc, run-row--immediate, the element ids) are kept. */

/* ---------- Page head ---------- */
.t-head { padding-top: 48px; padding-bottom: 40px; }
.t-crumb { display: inline-block; font-size: 14px; margin-bottom: 24px; }
.t-h1 { max-width: 18em; }
.t-head .f-lead { margin-bottom: 0; max-width: 36em; }
section.t-tool { padding-top: 0; padding-bottom: 96px; }

/* ---------- Tool layout: inputs left on paper, answer right on ink ---------- */
.tool-layout { display: grid; grid-template-columns: minmax(280px, 4fr) minmax(0, 8fr); gap: 64px; align-items: start; padding-top: 40px; border-top: 1px solid var(--bg); }
.tool-form { display: grid; gap: 28px; }

.tool-field label { display: block; font-size: 14px; color: var(--text-dim); margin-bottom: 8px; }
.tool-field input, .tool-field select {
    width: 100%;
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--bg);
    border-radius: 0;
    padding: 8px 0 12px;
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.5;
    color: var(--bg);
    color-scheme: light;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}
.tool-field select {
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    padding-right: 28px;
    /* A chevron drawn from two gradients, so it reads the ink token instead of a colour baked into an image. */
    background-image: linear-gradient(45deg, transparent 50%, var(--bg) 50%), linear-gradient(135deg, var(--bg) 50%, transparent 50%);
    background-position: calc(100% - 10px) 50%, calc(100% - 4px) 50%;
    background-size: 6px 6px;
    background-repeat: no-repeat;
}
.tool-field select option { background: var(--gold-light); color: var(--bg); }
.tool-field input:hover, .tool-field select:hover { border-bottom-color: var(--teal-deep); }
/* The 2px outline from home.css stays; the underline turns teal as well. */
body.firm .tool-field input:focus-visible, body.firm .tool-field select:focus-visible { border-bottom-color: var(--teal-deep); box-shadow: 0 1px 0 0 var(--teal-deep); }

/* The cron expression is the input the visitor came to type: one step larger. */
.tool-field--primary input { font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }

.tool-hint { margin-top: 8px; font-size: 14px; line-height: 1.5; color: var(--text-dim); }
.tool-presets { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.tool-preset {
    padding: 8px 12px;
    border: 1px solid var(--text-dim);
    border-radius: 0;
    background: transparent;
    color: var(--bg);
    font-family: var(--font-body);
    font-size: 14px;
    line-height: 1.5;
    font-variant-numeric: tabular-nums;
    cursor: pointer;
    transition: border-color 0.3s ease, color 0.3s ease;
}
.tool-preset:hover { border-color: var(--teal-deep); color: var(--teal-deep); }
.tool-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }

/* Errors are text with a rule on the left, never a coloured box. */
.tool-error { margin-top: 12px; padding-left: 12px; border-left: 2px solid var(--teal-deep); font-size: 14px; line-height: 1.5; color: var(--bg); }
.tool-error:empty { display: none; }

.tool-more { border-top: 1px solid var(--text-muted); padding-top: 20px; }
.tool-more summary { font-size: 14px; font-weight: 600; color: var(--teal-deep); cursor: pointer; }
.tool-more summary:hover { color: var(--bg); }
.tool-more[open] summary { margin-bottom: 24px; }
.tool-more .tool-form { gap: 24px; }

/* ---------- The answer, on ink ---------- */
.tool-results[hidden] { display: none; }
/* The ink surface, its text colour and its focus ring come from .f-ink; .f-onink gives the links their colour. */
.tool-results { min-width: 0; padding: 40px; transition: opacity 0.3s ease; }
/* An input error keeps the last good answer on screen, visibly stale. */
.tool-layout:has(.tool-error:not(:empty)) .tool-results { opacity: 0.4; }

.tool-results__head { display: flex; justify-content: space-between; gap: 16px; font-size: 14px; color: var(--text-muted); padding-bottom: 16px; border-bottom: 1px solid var(--border-hover); }
.tool-resolved { font-size: 14px; line-height: 1.5; color: var(--text-muted); margin: 20px 0 12px; }
/* The bold element: the answer as one sentence. */
.tool-answer { font-size: 24px; font-weight: 600; line-height: 1.3; letter-spacing: -0.02em; color: var(--gold-light); max-width: 32em; text-wrap: pretty; }

.tool-warnings { list-style: none; margin-top: 28px; display: grid; gap: 12px; }
.tool-warnings:empty { display: none; }
.tool-warnings li { border-left: 2px solid var(--gold); padding: 4px 0 4px 16px; font-size: 14px; line-height: 1.5; color: var(--text-muted); max-width: 75ch; }

.tool-runs { width: 100%; border-collapse: collapse; margin-top: 40px; font-size: 14px; }
.tool-runs caption { text-align: left; font-size: 14px; color: var(--text-muted); padding-bottom: 12px; }
.tool-runs th { font-size: 14px; font-weight: 600; text-align: left; color: var(--text); border-bottom: 1px solid var(--border-hover); padding: 12px 0; white-space: nowrap; }
.tool-runs thead, .tool-runs tbody { display: block; }
.tool-runs tr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 24px; }
.tool-runs tbody tr { padding: 16px 0; border-bottom: 1px solid var(--border-hover); }
.tool-runs tbody tr:last-child { border-bottom: 0; }
.tool-runs td { padding: 0; line-height: 1.5; color: var(--text-muted); }
/* The sentence sits on its own line under the three times it explains. */
.tool-runs td:last-child { grid-column: 1 / -1; margin-top: 12px; max-width: 75ch; }
.tool-runs th:last-child { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.tool-runs time { display: block; font-size: 16px; color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tool-runs .run-utc { display: block; font-size: 14px; color: var(--text-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.run-row--immediate td:first-child::before { content: 'Due when unpaused'; display: block; font-size: 14px; font-weight: 600; color: var(--teal); margin-bottom: 4px; }

.tool-actions { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px 16px; margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--border-hover); }
body.firm .tool-copy { background: none; border: 0; padding: 0; font-family: var(--font-body); font-size: 16px; line-height: 1.5; cursor: pointer; }
.tool-copy-status { font-size: 14px; color: var(--text-muted); }
.tool-tested { margin-top: 12px; font-size: 14px; color: var(--text-muted); }

/* ---------- Iceberg Inspector: files in, the table on ink ---------- */
/* The place files are dropped: a ruled box on paper, square, no fill until something is dragged over it. */
.tool-drop { border: 1px solid var(--bg); padding: 24px; transition: background-color 0.3s ease, border-color 0.3s ease; }
.tool-drop.is-over { background: var(--gold); border-color: var(--teal-deep); }
.tool-drop__say { font-size: 18px; font-weight: 600; line-height: 1.4; }
.tool-drop .tool-hint { margin-top: 16px; }
/* The native file inputs stay in the page for the buttons to open, out of sight and out of the tab order. */
.tool-file { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); opacity: 0; }
.tool-loaded { font-size: 14px; line-height: 1.5; color: var(--text-dim); margin-bottom: 8px; }
.tool-loaded:empty { display: none; }
.tool-what { border-top: 1px solid var(--text-muted); }
.tool-what div { padding: 16px 0; border-bottom: 1px solid var(--text-muted); }
.tool-what div:last-child { border-bottom: 0; padding-bottom: 0; }
.tool-what dt { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.tool-what dd { font-size: 14px; line-height: 1.5; color: var(--text-dim); }

/* One part of the answer: a heading, then its evidence. */
/* The base stylesheet pads every section element; the full padding is restated so it does not leak in. */
section.ice-part { margin-top: 40px; padding: 24px 0 0; border-top: 1px solid var(--border-hover); }
.ice-part[hidden] { display: none; }
.ice-h { font-size: 18px; font-weight: 600; line-height: 1.4; color: var(--text); margin-bottom: 16px; }

/* Health checks: text with a rule on the left. The cream rule marks the ones that need attention; no colour codes. */
.ice-checks { list-style: none; display: grid; gap: 20px; }
.ice-check { padding-left: 16px; border-left: 2px solid var(--border-hover); max-width: 75ch; }
.ice-check--attention { border-left-color: var(--gold); }
.ice-check__level { display: block; font-size: 14px; line-height: 1.5; color: var(--text-muted); }
.ice-check--attention .ice-check__level { color: var(--gold-light); font-weight: 600; }
.ice-check__title { display: block; font-size: 16px; font-weight: 600; line-height: 1.5; color: var(--text); }
.ice-check__detail, .ice-check__threshold { font-size: 14px; line-height: 1.5; color: var(--text-muted); margin-top: 4px; }

/* Figures of the current snapshot. */
.ice-facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px; }
.ice-facts:empty { display: none; }
.ice-facts div { display: flex; flex-direction: column-reverse; justify-content: flex-end; }
.ice-facts dt { font-size: 14px; line-height: 1.4; color: var(--text-muted); }
.ice-facts dd { font-size: 24px; font-weight: 600; line-height: 1.2; letter-spacing: -0.02em; color: var(--gold-light); margin-bottom: 4px; font-variant-numeric: tabular-nums; white-space: nowrap; }

.ice-table { width: 100%; border-collapse: collapse; font-size: 14px; line-height: 1.5; }
.ice-facts + .ice-table { margin-top: 28px; }
.ice-table[hidden] { display: none; }
.ice-table caption { text-align: left; color: var(--text-muted); padding-bottom: 8px; }
.ice-table th { font-weight: 600; text-align: left; color: var(--text); border-bottom: 1px solid var(--border-hover); padding: 12px 24px 12px 0; white-space: nowrap; }
.ice-table td { padding: 12px 24px 12px 0; vertical-align: top; color: var(--text-muted); border-bottom: 1px solid var(--border-hover); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.ice-table th:last-child, .ice-table td:last-child { padding-right: 0; }
.ice-table tbody tr:last-child td { border-bottom: 0; }
.ice-table td:first-child { color: var(--text); }
.ice-table .ice-id { display: block; color: var(--text-muted); white-space: nowrap; }
.ice-table .ice-ref { display: block; color: var(--teal); }
.ice-part > .tool-copy { margin-top: 16px; color: var(--teal); }

.ice-list { list-style: none; display: grid; gap: 8px; font-size: 14px; line-height: 1.5; color: var(--text-muted); max-width: 75ch; }
.ice-list:empty { display: none; }
.ice-table + .ice-list { margin-top: 20px; }
.ice-list b { font-weight: 600; color: var(--text); }

/* ---------- Below the tool ---------- */
.t-prose code { font-family: inherit; font-weight: 600; color: var(--teal-deep); }

/* FAQ: bare h3 and p, so the visible text stays comparable to the JSON-LD (a test reads them). */
.t-faq { border-top: 1px solid var(--bg); }
.t-faq h3 { font-size: 18px; font-weight: 600; line-height: 1.4; letter-spacing: -0.01em; padding-top: 24px; margin-bottom: 8px; max-width: 36em; }
.t-faq p { color: var(--text-dim); max-width: 40em; padding-bottom: 24px; border-bottom: 1px solid var(--text-muted); }
.t-faq p:last-child { border-bottom: 0; padding-bottom: 0; }

/* Closing band on ink. */
.t-close { display: grid; grid-template-columns: minmax(0, 8fr) minmax(0, 4fr); gap: 64px; align-items: end; }
.t-close .f-sub { max-width: 36em; }
.t-close__go { text-align: right; }

/* ---------- Tablet and phone ---------- */
/* Below 1240 the answer column is too narrow for three time columns side by side, so the inputs stack above it. */
@media (max-width: 1240px) {
    .tool-layout { grid-template-columns: 1fr; gap: 40px; }
    .tool-layout > .tool-form { max-width: 560px; }
}

@media (max-width: 960px) {
    .t-head { padding-top: 40px; padding-bottom: 32px; }
    section.t-tool { padding-bottom: 64px; }
    .tool-layout { padding-top: 32px; }
    .t-close { grid-template-columns: 1fr; gap: 32px; }
    .t-close__go { text-align: left; }
}

@media (max-width: 768px) {
    /* The run table becomes a list of labelled rows. */
    .tool-runs thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
    .tool-runs, .tool-runs caption, .tool-runs tbody tr, .tool-runs td { display: block; }
    .tool-runs tbody tr { padding: 20px 0; }
    .tool-runs td { padding: 8px 0; }
    .tool-runs td:last-child { margin-top: 8px; }
    .tool-runs td::before { content: attr(data-label); display: block; font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
    .run-row--immediate td:first-child::before { content: 'Starts (due when unpaused)'; color: var(--teal); }
    .tool-runs time, .tool-runs .run-utc { white-space: normal; }
    .tool-answer { font-size: 18px; line-height: 1.4; }
    /* Tables in the inspector become labelled rows as well. */
    .ice-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
    .ice-table, .ice-table caption, .ice-table tbody, .ice-table tr, .ice-table td { display: block; }
    .ice-table tbody tr { padding: 12px 0; border-bottom: 1px solid var(--border-hover); }
    .ice-table tbody tr:last-child { border-bottom: 0; }
    .ice-table td { padding: 4px 0; border-bottom: 0; }
    .ice-table td::before { content: attr(data-label); display: block; font-size: 14px; color: var(--text-muted); }
    .ice-table td:not(:first-child) { color: var(--text); }
}

@media (max-width: 560px) {
    .tool-results { padding: 24px; margin: 0 -24px; }
    .tool-results__head { flex-direction: column; gap: 0; }
    .tool-pair { grid-template-columns: 1fr; }
    .t-close__go .f-btn { width: 100%; text-align: center; }
    .ice-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* home.css already stops every transition under body.firm; stated here as well so this file stands alone. */
@media (prefers-reduced-motion: reduce) {
    .tool-field input, .tool-field select, .tool-preset, .tool-results, .tool-drop { transition: none; }
}
