/* tools.css: the free instant tools (/tools/, /tools/website-score/, /tools/tech-stack/).
   Loaded after styles.css and ui.css. The result is a record laid on the page like the other
   notices: empty, checking, result and error are states of the same card ([data-state]). */

.tool-hero { align-items: start; }
.tool-hero h1 { max-width: 13ch; }
.tool-hero .lede { margin-bottom: 1.75rem; }

/* ---------- The form ---------- */
.tool-form { display: flex; flex-wrap: wrap; gap: 0.5rem; max-width: 34rem; }
.tool-form label { flex-basis: 100%; font-size: 0.875rem; font-weight: 500; }
.tool-form .field { position: relative; flex: 1 1 14rem; min-width: 0; }
.tool-form .field span {
    position: absolute; left: 0.75rem; top: 50%; transform: translateY(-50%);
    font: 400 0.9375rem/1 var(--mono); color: var(--ink-2); pointer-events: none;
}
.tool-form input {
    width: 100%; font: 400 1.0625rem/1.25 var(--sans); color: var(--ink); background: var(--surface);
    border: 1px solid var(--ink-2); border-radius: 3px; padding: 0.8125rem 0.875rem 0.8125rem 5.25rem;
    transition: border-color 160ms var(--ease-out);
}
.tool-form input:hover { border-color: var(--ink); }
.tool-form input:focus-visible { outline: 2px solid var(--vermilion); outline-offset: 1px; border-color: var(--ink); }
.tool-form input[aria-invalid="true"] { border-color: var(--vermilion); }
.tool-form button { flex: 0 0 auto; border: 0; cursor: pointer; font: inherit; font-weight: 500; }
.tool-form button[aria-busy="true"] { cursor: progress; }
.tool-msg { margin: 0.625rem 0 0; font-size: 0.875rem; color: var(--vermilion-ink); max-width: 34rem; }
.tool-msg:empty { display: none; }
.tool-fine { margin: 0.875rem 0 0; font-size: 0.875rem; color: var(--ink-2); max-width: 40ch; }

/* ---------- The card and its states ---------- */
.tool-card { min-height: 22rem; }
.tool-card [data-show] { display: none; }
.tool-card[data-state="empty"] [data-show~="empty"],
.tool-card[data-state="loading"] [data-show~="loading"],
.tool-card[data-state="result"] [data-show~="result"],
.tool-card[data-state="error"] [data-show~="error"] { display: block; }
.tool-card .notice-head .mono { overflow-wrap: anywhere; }
.tool-card h2 { overflow-wrap: anywhere; }
.tool-card .muted { color: var(--ink-2); }
.tool-card .card-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.25rem; margin-top: 1.25rem; }
.tool-card .card-actions .btn { font-size: 0.9375rem; padding: 0.625rem 1rem; }
.tool-card button.link { background: none; border: 0; padding: 0; font: inherit; font-weight: 500; color: var(--ink); text-decoration: underline; text-underline-offset: 0.2em; cursor: pointer; }
.tool-card button.link:hover { text-decoration-color: var(--vermilion); }
.card-cap { margin-top: 1.25rem; padding-top: 0.875rem; border-top: 1px solid var(--rule); font-size: 0.8125rem; color: var(--ink-2); }
.card-cap p { margin: 0; }
.card-cap p + p { margin-top: 0.375rem; }

/* A new answer is set down like the first notice: lifted in, stamp pressed. */
.tool-card.is-new { animation: notice-in 700ms var(--ease-out) both; }
.tool-card.is-new .stamp { animation: stamp-in 500ms 350ms var(--ease-out) both; }
.stamp.plain { color: var(--ink-2); border-color: var(--ink-2); }

/* Checking: the steps of the check, ticked off as they pass. */
.steps { list-style: none; margin: 0.25rem 0 0; padding: 0; }
.steps li { display: grid; grid-template-columns: 1.25rem minmax(0, 1fr); gap: 0.5rem; padding: 0.5rem 0; border-bottom: 1px solid var(--rule); color: var(--ink-2); font-size: 0.9375rem; }
.steps li::before { content: ""; width: 0.5rem; height: 0.5rem; margin: 0.4375rem 0 0 0.25rem; border: 1.5px solid var(--rule); border-radius: 50%; }
.steps li[data-step="now"] { color: var(--ink); }
.steps li[data-step="now"]::before { border-color: var(--vermilion); background: var(--vermilion-wash); }
.steps li[data-step="done"] { color: var(--ink); }
.steps li[data-step="done"]::before {
    width: 0.3125rem; height: 0.625rem; margin: 0.25rem 0 0 0.375rem; border: solid var(--vermilion); border-width: 0 1.5px 1.5px 0;
    border-radius: 0; background: none; transform: rotate(45deg); animation: tick-in 260ms var(--ease-out) both;
}
.setting-line { height: 2px; margin-top: 1.25rem; background: linear-gradient(var(--vermilion), var(--vermilion)) 0 0 / 30% 100% no-repeat, var(--rule); animation: setting 1.4s var(--ease-out) infinite; }

/* Empty: what will land here, said plainly. */
.empty-note { margin: 0 0 1.25rem; color: var(--ink-2); max-width: 44ch; }

/* Error */
.tool-error strong { display: block; font: 600 1.25rem/1.3 var(--serif); margin-bottom: 0.375rem; }
.tool-error p { margin: 0; color: var(--ink-2); max-width: 46ch; }
.tool-error { padding-top: 1rem; border-top: 2px solid var(--vermilion); }

/* ---------- Website score: the number, and a printed 0-100 rule with a vermilion mark ---------- */
.score-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 0.625rem; margin: 0 0 1rem; }
.score-line strong { font: 600 clamp(3.25rem, 2.5rem + 3vw, 4.25rem)/0.9 var(--serif); letter-spacing: -0.03em; font-variant-numeric: lining-nums tabular-nums; }
.score-line span { font-size: 0.9375rem; color: var(--ink-2); }
.scale { position: relative; margin: 0.5rem 0 1.75rem; padding-bottom: 1.25rem; --at: 0; }
.scale-track { position: relative; height: 0.625rem; border-bottom: 1px solid var(--ink); }
.scale-track i { position: absolute; bottom: 0; width: 1px; height: 0.375rem; background: var(--ink-2); }
.scale-track i.major { height: 0.625rem; background: var(--ink); }
.scale-labels { position: absolute; left: 0; right: 0; bottom: 0; height: 1rem; font: 400 0.6875rem/1 var(--mono); color: var(--ink-2); }
.scale-labels span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.scale-labels span:first-child { transform: none; }
.scale-labels span:last-child { transform: translateX(-100%); }
.scale-mark {
    position: absolute; top: -0.5rem; left: calc(var(--at) * 1%); width: 3px; height: 1.125rem; margin-left: -1.5px;
    background: var(--vermilion); transform-origin: 50% 100%;
}
.scale-fill { position: absolute; left: 0; bottom: -1px; height: 3px; width: calc(var(--at) * 1%); background: var(--vermilion); transform-origin: 0 50%; }
.tool-card.is-new .scale-fill { animation: rule-draw 900ms 150ms var(--ease-out) both; }
.tool-card.is-new .scale-mark { animation: mark-in 900ms 150ms var(--ease-out) both; }
@keyframes mark-in { from { left: 0; } }
.bands { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; margin: 0 0 1.25rem; font-size: 0.8125rem; color: var(--ink-2); }
.bands b { font-weight: 500; color: var(--ink); }

.fix-head { font: 600 1.125rem/1.3 var(--serif); margin: 0 0 0.25rem; }
.fixes { list-style: none; counter-reset: fix; margin: 0; padding: 0; }
.fixes li { counter-increment: fix; display: grid; grid-template-columns: 1.75rem minmax(0, 1fr); gap: 0 0.5rem; padding: 0.875rem 0; border-bottom: 1px solid var(--rule); }
.fixes li::before { content: counter(fix); font: 600 1.125rem/1.35 var(--serif); color: var(--vermilion-ink); }
.fixes li > * { grid-column: 2; }
.fixes h4 { font: 600 1rem/1.4 var(--sans); margin: 0; }
.fixes .how { margin: 0.25rem 0 0; font-size: 0.9375rem; text-wrap: pretty; }
.fixes .why { margin: 0.25rem 0 0; font-size: 0.875rem; color: var(--ink-2); text-wrap: pretty; }
.fixes .on { margin: 0.375rem 0 0; font: 400 0.75rem/1.3 var(--mono); color: var(--ink-2); }
.tool-card.is-new .fixes li { animation: notice-in 600ms var(--ease-out) both; animation-delay: calc(250ms + var(--i, 0) * 70ms); }
.none-left { margin: 0.5rem 0 0; color: var(--ink-2); }

/* ---------- Tech stack: grouped fields ---------- */
.stack-part + .stack-part { margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--rule); }
.stack-part h3 { font: 600 1.0625rem/1.3 var(--serif); margin: 0 0 0.75rem; }
.stack-part .fields dd small { display: block; margin-top: 0.125rem; font-size: 0.8125rem; color: var(--ink-2); text-wrap: pretty; }
.stack-part .fields dd.flag-off { color: var(--vermilion-ink); }
.stack-note { margin: 0; font-size: 0.875rem; color: var(--ink-2); }
.tool-card .page-title { margin: -0.75rem 0 1.25rem; font-size: 0.9375rem; color: var(--ink-2); overflow-wrap: anywhere; }

/* ---------- Below the card ---------- */
.tool-source { font-size: 0.9375rem; color: var(--ink-2); }
.tool-source p { margin: 0 0 0.75rem; max-width: 64ch; }

/* /tools/: the two tools, set as entries in a contents page. */
.tool-list { list-style: none; margin: 2rem 0 0; padding: 0; border-top: 2px solid var(--ink); }
.tool-list li { border-bottom: 1px solid var(--rule); }
.tool-list a { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.375rem 1.5rem; align-items: baseline; padding: 1.5rem 0; color: inherit; text-decoration: none; }
.tool-list h2 { font-size: clamp(1.5rem, 1.25rem + 1vw, 2rem); line-height: 1.15; grid-column: 1; }
.tool-list p { margin: 0; grid-column: 1; color: var(--ink-2); max-width: 56ch; }
.tool-list .go { grid-column: 2; grid-row: 1 / span 2; align-self: center; font: 500 0.8125rem/1 var(--mono); text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-2); transition: color 160ms var(--ease-out), transform 200ms var(--ease-out); }
.tool-list a:hover h2 { text-decoration: underline; text-decoration-color: var(--vermilion); text-underline-offset: 0.15em; text-decoration-thickness: 2px; }
.tool-list a:hover .go { color: var(--vermilion-ink); transform: translateX(3px); }

@media (max-width: 52rem) {
    .tool-card { min-height: 0; }
}
@media (max-width: 30rem) {
    .tool-form button { flex: 1 1 100%; }
    .tool-list a { grid-template-columns: minmax(0, 1fr); }
    .tool-list .go { grid-column: 1; grid-row: auto; margin-top: 0.5rem; }
}
@media (prefers-reduced-motion: reduce) {
    .tool-card.is-new, .tool-card.is-new .stamp, .tool-card.is-new .scale-fill, .tool-card.is-new .scale-mark,
    .tool-card.is-new .fixes li, .steps li[data-step="done"]::before { animation: none; }
    .setting-line { animation: none; background: var(--rule); }
    .tool-list .go, .tool-form input { transition: none; }
}
