/* Algorithm v2 — tool page template (hero, composer, options, run bar,
   sample report, "what it checks", "what we don't do").
   Load after v2.css. Generic class names are scoped to their block so they
   never reach JS-rendered results (#resultsSection). */
.tool-hero { padding: 72px 0 0; }
.crumbs { display: flex; gap: 8px; margin-bottom: 28px; font-size: 13.5px; color: var(--text-3); }
.crumbs a:hover { color: var(--text); }
.crumbs span[aria-current] { color: var(--text-2); }
.tool-hero h1 { margin: 0; }

/* Composer: the form */

/* Options (collapsibles) */
.options { margin-top: 12px; border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.option + .option { border-top: 1px solid var(--line); }

/* Run bar */
.run-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px 24px; margin-top: 20px; }
.run-bar .switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; font-size: 14px; color: var(--text-2); }
.run-bar .switch small { color: var(--text-3); font-size: 13px; }
.run-right { display: flex; align-items: center; gap: 14px; }
.run-bar .kbd { font-size: 13px; color: var(--text-3); }
.run-bar .kbd kbd { font-family: var(--mono); font-size: 11.5px; padding: 1px 5px; border: 1px solid var(--line-strong); border-radius: var(--r-xs); color: var(--text-2); }
#runBtn { min-width: 180px; }
#runBtn:disabled { opacity: 0.5; cursor: progress; }

/* Loading */
#loading { padding: 64px 0; text-align: center; color: var(--text-2); font-size: 14px; }
.spinner { width: 22px; height: 22px; margin: 0 auto 14px; border-radius: 50%; border: 2px solid var(--line-strong); border-top-color: var(--accent); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* What it checks */
.checks-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 48px; }
#featureCards .check h3, .checks-grid .check h3 { display: flex; align-items: center; gap: 12px; margin: 0 0 10px; font-size: 17px; font-weight: 500; letter-spacing: -0.012em; }
#featureCards .check h3 svg, .checks-grid .check h3 svg { width: 18px; height: 18px; flex: none; }
#featureCards .check p, .checks-grid .check p { margin: 0; color: var(--text-2); font-size: 15.5px; line-height: 1.65; }

/* Sample report */
.report { border: 1px solid var(--line-strong); border-radius: var(--r-lg); background: var(--bg-raised); overflow: hidden; box-shadow: 0 40px 120px -20px rgba(var(--shadow-rgb), calc(0.8 * var(--shadow-k))); }
.report-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 46px; padding: 0 16px; border-bottom: 1px solid var(--line); font-size: 13px; color: var(--text-3); }
.report-bar b { color: var(--text); font-weight: 500; }
.report-tags { display: flex; gap: 8px; }
.report-tags span { padding: 2px 8px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); color: var(--text-2); font-size: 12.5px; }
.report .scores { display: grid; grid-template-columns: repeat(4, 1fr); }
.report .score-tile { padding: 22px 20px; }
.report .score-tile + .score-tile { border-left: 1px solid var(--line); }
.report .score-tile .label { font-size: 13px; color: var(--text-3); }
.report .score-tile .value { margin-top: 10px; font-family: var(--mono); font-size: 34px; line-height: 1; letter-spacing: -0.04em; }
.report .score-tile .verdict { margin-top: 8px; font-size: 13.5px; }
.report .score-tile .track { margin-top: 14px; height: 4px; border-radius: 2px; background: rgba(var(--fg-rgb), 0.07); overflow: hidden; }
.report .score-tile .track i { display: block; height: 100%; border-radius: 2px; }
.report-tabs { display: flex; gap: 2px; padding: 10px 16px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); overflow: hidden; white-space: nowrap; }
.report-tabs span { padding: 5px 10px; border-radius: var(--r-sm); font-size: 13px; color: var(--text-3); }
.report-tabs span.is-active { background: var(--bg-hover); color: var(--text); }
.report-body { display: grid; grid-template-columns: 1fr 1fr; }
.report-col { padding: 20px; }
.report-col + .report-col { border-left: 1px solid var(--line); }
.report-col h4 { margin: 0 0 14px; font-size: 13.5px; font-weight: 500; color: var(--text); display: flex; justify-content: space-between; }
.report-col h4 span { font-weight: 400; color: var(--good); }
.report .vrow { display: grid; grid-template-columns: 90px 1fr 70px; gap: 12px; align-items: center; padding: 6px 0; font-size: 13px; color: var(--text-2); }
.report .vrow .bar { height: 6px; border-radius: 3px; background: rgba(var(--fg-rgb), 0.06); overflow: hidden; }
.report .vrow .bar i { display: block; height: 100%; border-radius: 3px; background: var(--text-3); }
.report .vrow .n { font-family: var(--mono); font-size: 12px; text-align: right; color: var(--text-3); }
.report .rec { display: grid; grid-template-columns: 8px 1fr; gap: 12px; padding: 8px 0; font-size: 13.5px; color: var(--text-2); line-height: 1.5; }
.report .rec i { width: 6px; height: 6px; margin-top: 7px; border-radius: 50%; }
.report-wrap { position: relative; }
.report-wrap::after { content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 120px; background: linear-gradient(to bottom, rgba(var(--bg-rgb), 0), var(--bg) 92%); pointer-events: none; }

/* What we don't do */
.dont { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--line); }
.dont > div { padding: 28px 32px 32px 0; border-bottom: 1px solid var(--line); }
.dont > div:nth-child(even) { padding-left: 32px; padding-right: 0; border-left: 1px solid var(--line); }
.dont h3 { margin: 0 0 8px; font-size: 17px; font-weight: 500; letter-spacing: -0.012em; }
.dont p { margin: 0; color: var(--text-2); font-size: 15.5px; line-height: 1.65; max-width: 32em; }

@media (prefers-reduced-motion: no-preference) {
    .tool-hero h1, .tool-hero .hero-sub { animation: rise 0.7s var(--ease) both; }
    .tool-hero .hero-sub { animation-delay: 0.06s; }
}
@media (max-width: 960px) {
    .checks-grid { grid-template-columns: 1fr; gap: 32px; }
    .report .scores { grid-template-columns: 1fr 1fr; }
    .report .score-tile:nth-child(3) { border-left: 0; }
    .report .score-tile:nth-child(n+3) { border-top: 1px solid var(--line); }
    .report-body { grid-template-columns: 1fr; }
    .report-col + .report-col { border-left: 0; border-top: 1px solid var(--line); }
}
@media (max-width: 860px) {
    .tool-hero { padding-top: 40px; }
}
@media (max-width: 600px) {
    .run-bar { flex-direction: column-reverse; align-items: stretch; }
    .run-right { flex-direction: column; align-items: stretch; }
    .run-bar .kbd { display: none; }
    #runBtn { width: 100%; }
    .dont { grid-template-columns: 1fr; }
    .dont > div, .dont > div:nth-child(even) { padding: 24px 0; border-left: 0; }
    .report-tags { display: none; }
    .report .vrow { grid-template-columns: 70px 1fr 60px; }
}

/* Checks split by vertical hairlines that run down to the section's bottom
   line: each column starts with a line, text 24px in. The section loses its
   bottom padding, the columns carry it instead. */
.section:has(> .checks-grid--lines), .section:has(> .wrap > .checks-grid--lines) { padding-bottom: 0; }
.checks-grid--lines { gap: 0; }
.checks-grid--lines .check { padding: 0 24px 128px; border-left: 1px solid var(--line); }

/* Section head on the column line of .checks-grid--lines: h2 at column 2,
   lead paragraph at column 3, both 24px in from the column line. */
.section-head--c2 { grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 0; }
.section-head--c2 h2 { grid-column: 2; padding-left: 24px; }
.section-head--c2 p { grid-column: 3; padding-left: 24px; }
@media (max-width: 960px) {
    .checks-grid--lines { gap: 32px; }
    .checks-grid--lines .check { padding: 0 0 0 20px; }
    .checks-grid--lines .check:last-child { padding-bottom: 0; }
    .section:has(> .checks-grid--lines), .section:has(> .wrap > .checks-grid--lines) { padding-bottom: 88px; }
    .section-head--c2 { grid-template-columns: 1fr; gap: 16px; }
    .section-head--c2 h2, .section-head--c2 p { grid-column: auto; padding-left: 0; }
}

/* Demo screenshot (PNG) inside the landing template, until the page gets an
   HTML-drawn report: one hairline frame, bottom fade from .report-wrap. */

/* Phones: a short screenshot would be mostly covered by the 120px fade */
@media (max-width: 560px) { .report-wrap::after { height: 56px; } }
/* Demo as the last landing block: the fade already reads as space, so the
   section doesn't need its full bottom padding before the footer */
.section:last-child:has(> .report-wrap), .section:last-child:has(> .wrap > .report-wrap) { padding-bottom: 48px; }
/* Last landing block → footer (2026-11-05; trial since then: no closing line).
   The last block has no bottom hairline: the Dont rows' last line and the
   cards' closing line are gone, and the cards' column lines end 32px under the
   text, like the Dont divider. From where the lines end to the footer line is
   the section padding, as from a section's top line to its h2: 128 (88 at
   ≤860). The footer's margin (`.app-container + .site-footer`, v2-legacy.css:
   96 / 64) covers most of it; the last block adds 32 / 24 (0 on phones, where
   the Dont rows carry their own 24px).
   - "What we don't do" closes the landing on every tool page. Not :last-child:
     the hidden results container often comes after it in <main>.
   - Lined feature cards as the last block (Notes, Rank Tracker, Prompt
     Builder, Schema Generator) take a margin, and <main> becomes a BFC so it
     doesn't collapse into the footer's (a hidden section in app mode has none).
   Spacing is scoped to .app-container, where that footer margin exists. */
@media (min-width: 601px) {
    .dont > div:nth-child(odd):nth-last-child(-n+2),
    .dont > div:nth-child(odd):nth-last-child(-n+2) + div,
    .dont > div:nth-child(even):nth-last-child(2) { border-bottom: 0; }
}
@media (max-width: 600px) { .dont > div:last-child { border-bottom: 0; } }
.app-container .section:has(> .dont), .app-container .section:has(> .wrap > .dont) { padding-bottom: 32px; }
.app-container .section:last-child:has(> .checks-grid--lines), .app-container .section:last-child:has(> .wrap > .checks-grid--lines) { margin-bottom: 32px; }
.app-container main:has(.section:last-child > .checks-grid--lines, .section:last-child > .wrap > .checks-grid--lines) { display: flow-root; }
@media (min-width: 961px) {
    .app-container .section:last-child:has(> .checks-grid--lines) .checks-grid--lines .check,
    .app-container .section:last-child:has(> .wrap > .checks-grid--lines) .checks-grid--lines .check { padding-bottom: 32px; }
}
@media (max-width: 960px) {
    .app-container .section:last-child:has(> .checks-grid--lines), .app-container .section:last-child:has(> .wrap > .checks-grid--lines) { padding-bottom: 0; }
}
@media (max-width: 860px) {
    .app-container .section:has(> .dont), .app-container .section:has(> .wrap > .dont) { padding-bottom: 24px; }
    .app-container .section:last-child:has(> .checks-grid--lines), .app-container .section:last-child:has(> .wrap > .checks-grid--lines) { margin-bottom: 24px; }
}
@media (max-width: 600px) {
    .app-container .section:has(> .dont), .app-container .section:has(> .wrap > .dont) { padding-bottom: 0; }
}

/* ── One gap above the landing (2026-10-21) ──
   While the landing sections are on screen, the block right above the first
   one (form card, history list or links row) ends with exactly 16px; the
   section's own padding (128px, 88px on phones) makes the rest: 144 / 104px
   to its heading on every tool page. Once results show, the landing is hidden
   (inline display:none) and these rules switch off, so the form → results
   spacing is untouched. */
.app-container main > .tform:has(~ section.section:not([style*="none"])) { margin-bottom: 16px; }
.hero-section--form:has(~ section.section:not([style*="none"])) { margin-bottom: 0; padding-bottom: 0; }
.hero-section--form:has(~ section.section:not([style*="none"])) > :is(.tform, .tform-history) { margin-bottom: 16px; }
