/* ─────────────────────────────────────────────────────────────────────────────
   Tool page v3 — PILOT (config/tool-page-v3.php, owner approved 2026-11-23).
   Loaded ONLY on the pilot slugs, after tool-page.css. Every rule is scoped to
   a v3-only hook (.tp-head, .tool-strip--v3, .tp-v3, .tp-col, .tp-toc), so it
   cannot reach a non-pilot page even if it were loaded there.

   The !important flags override per-widget heading styles that are written
   with high specificity across ~900 widget files; the point of this layer is
   that no widget file has to change.
   ───────────────────────────────────────────────────────────────────────────── */

/* ── Title block ───────────────────────────────────────────────────────────── */
.tp-head {
    background: linear-gradient(180deg, #F4F0E8 0%, var(--bg, #f7f6f3) 100%);
    padding: 22px 0 16px;
}
.tp-kicker {
    display: inline-flex; align-items: center; gap: 8px;
    font: 600 12px/1 var(--font-mono, monospace); letter-spacing: .08em; text-transform: uppercase;
    color: var(--c); text-decoration: none;
}
.tp-kicker::before { content: ""; width: 10px; height: 10px; border-radius: 3px; background: var(--c); }
.tp-kicker:hover { text-decoration: underline; }
.tp-h1 {
    font-family: var(--rt-font-serif, var(--font-serif, Georgia, serif)); font-weight: 700;
    font-size: clamp(28px, 3.4vw, 42px); line-height: 1.1; letter-spacing: -.015em;
    color: #1a1814; margin: 8px 0 6px; max-width: 26ch; text-wrap: balance;
}
.tp-dek { font-size: 18px; line-height: 1.45; color: #3d3a35; max-width: 70ch; margin: 0 0 12px; }
.tp-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; font-size: 14px; color: #5f5b54; }
.tp-meta a { color: #1a1814; font-weight: 600; text-decoration: none; border-bottom: 1px solid #d8d4cc; }
.tp-meta a:hover { border-bottom-color: currentColor; }
.tp-meta .tp-check, .tp-meta .tp-date { display: inline-flex; align-items: center; gap: 5px; }
.tp-meta .tp-check::before {
    content: ""; width: 16px; height: 16px; border-radius: 50%; flex: none;
    background: #E7F5EC url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4.5 8.2l2.2 2.2 4.8-4.8' fill='none' stroke='%23177a3c' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/16px no-repeat;
}
.tp-tags { display: inline-flex; flex-wrap: wrap; gap: 6px; margin-left: auto; }
.tp-tags .ts-tag { font-size: 10.5px; }
.tp-lang:empty { display: none; }
.tp-lang { margin-top: 10px; }
.tp-lang .rt-lang-toggle { display: inline-flex; }

/* ── Sticky strip: the name is a label now, shown once the title scrolls away ─ */
@media (min-width: 768px) {
    .tool-strip--v3 .ts-name, .tool-strip--v3 .ts-icon { opacity: 0; transition: opacity .2s; }
    .tp-scrolled .tool-strip--v3 .ts-name, .tp-scrolled .tool-strip--v3 .ts-icon { opacity: 1; }
}

/* ── Sticky strip: the language toggle, shown once the title scrolls away ──── */
/* display: contents keeps the pills a direct flex item of the strip, so the
   phone rule in tool-page.css (pills pinned sticky at the right edge) still
   applies. visibility (inherited) removes them from view AND from the tab order
   while the title block, which carries its own copy, is on screen. */
.tool-strip--v3 .ts-lang { display: contents; visibility: hidden; }
.tool-strip--v3 .ts-lang .rt-lang-toggle { opacity: 0; transition: opacity .2s; }
.tp-scrolled .tool-strip--v3 .ts-lang { visibility: visible; }
.tp-scrolled .tool-strip--v3 .ts-lang .rt-lang-toggle { opacity: 1; }

/* ── Body: reading column + sidebar that runs the full height ──────────────── */
.tp-v3 .main-body { padding-top: 14px; }
@media (min-width: 1024px) {
    /* The sidebar column used to end ~700px down a ~6,000px page because the
       grid aligned it to its content. Stretched, it can carry the sticky list. */
    .tp-v3 .main-grid > .tool-sidebar { align-self: stretch; }
    .tp-v3 .sticky-sb { position: static; }
}

/* Reading order below the tool, without touching any widget file:
   how-to → article → facts → FAQ → Method & sources → related tools → guides.
   Sections the widget emits stay in DOM order (order 0); the template's own
   blocks and the widget's related-tools section are moved after the FAQ. */
.tp-col { display: flex; flex-direction: column; }
.tp-col > * { min-width: 0; }
.tp-col > .tool-freshness { order: 1; }
.tp-col > #method-sources { order: 1; }
.tp-col > #related-tools { order: 2; }
.tp-col > #embed-this-tool { order: 2; }
.tp-col > #related-guides { order: 3; }

.tp-col > .tool-section { margin-top: 44px; }
.tp-col .tool-section > h2,
.tp-col .tool-section h2.section-heading:not(.te-title) {
    font-family: var(--rt-font-serif, var(--font-serif, Georgia, serif)) !important;
    font-weight: 700 !important; font-size: clamp(23px, 2.6vw, 29px) !important;
    line-height: 1.2 !important; letter-spacing: -.01em !important; text-transform: none !important;
    color: #1a1814 !important; position: relative;
    border-left: 0 !important; padding: 16px 0 0 !important; margin: 0 0 14px !important;
}
.tp-col .tool-section > h2::before,
.tp-col .tool-section h2.section-heading:not(.te-title)::before {
    content: ""; position: absolute; left: 0; top: 0; width: 44px; height: 3px; border-radius: 2px;
    background: var(--c, var(--accent, #e8622a));
}
/* Prose sections read at article width and size; grids (facts, related tools)
   keep the full column. */
.tp-col > #how-to-use, .tp-col > #about, .tp-col > #faq,
.tp-col > #method-sources, .tp-col > .tool-freshness { max-width: 720px; }
.tp-col > #how-to-use p, .tp-col > #how-to-use li,
.tp-col > #about p, .tp-col > #about li,
.tp-col > #faq p, .tp-col > #method-sources p, .tp-col > #method-sources li {
    font-size: 17px; line-height: 1.72; color: #2b2823;
}
/* An odd number of fact cards: the last spans the row instead of leaving a hole. */
.tp-col .fact-cards-grid > .fact-card:last-child:nth-child(odd) { grid-column: 1 / -1; }

/* Method & sources reads as a section of the article, not a boxed appendix. */
.tp-col > #method-sources { background: transparent; border: 0; box-shadow: none; padding: 0; }
.tp-col > #method-sources .te-head { background: none; border: 0; padding: 0; margin: 0 0 14px; }
.tp-col > #method-sources .te-title {
    font-family: var(--rt-font-serif, var(--font-serif, Georgia, serif)) !important; font-weight: 700 !important;
    font-size: clamp(23px, 2.6vw, 29px) !important; line-height: 1.2 !important; letter-spacing: -.01em !important;
    text-transform: none !important; color: #1a1814 !important; position: relative; padding: 16px 0 0 !important; border: 0 !important;
}
.tp-col > #method-sources .te-title::before {
    content: ""; position: absolute; left: 0; top: 0; width: 44px; height: 3px; border-radius: 2px;
    background: var(--c, var(--accent, #e8622a));
}
.tp-col > #method-sources .te-group { padding-left: 0; padding-right: 0; }
.tp-col > #method-sources .te-group h3 { font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: #5f5b54; }

/* ── On this page ──────────────────────────────────────────────────────────── */
.tp-toc { position: sticky; top: calc(var(--nav-h, 60px) + 44px + 20px); margin-top: 28px; padding: 4px 0 0 18px; border-left: 2px solid #ebe7df; }
.tp-toc[hidden] { display: none; }
.tp-toc-h { font: 600 11px/1 var(--font-mono, monospace); letter-spacing: .1em; text-transform: uppercase; color: #5f5b54; margin: 0 0 10px; }
.tp-toc ol { list-style: none; margin: 0; padding: 0; }
.tp-toc a { display: block; padding: 6px 0; font-size: 14px; line-height: 1.35; color: #3d3a35; text-decoration: none; }
.tp-toc a:hover, .tp-toc a:focus-visible { color: #1a1814; text-decoration: underline; }

/* ── Phone ─────────────────────────────────────────────────────────────────── */
@media (max-width: 767px) {
    .tp-head { padding: 18px 0 14px; }
    .tp-kicker { font-size: 11px; }
    .tp-dek { font-size: 17px; }
    .tp-meta { font-size: 13px; gap: 4px 12px; }
    .tp-tags { display: none; }
    .tp-lang { margin-top: 8px; }
    .tp-col > #how-to-use p, .tp-col > #how-to-use li,
    .tp-col > #about p, .tp-col > #about li,
    .tp-col > #faq p, .tp-col > #method-sources p, .tp-col > #method-sources li { font-size: 16px; }
}
