/* Algorithm v2 — page styles. Load after v2-chrome.css (fonts, tokens, header, footer). */
:root {
    /* Legacy aliases: old token names still used in server-rendered and
       JS-generated markup (blog SSR, tool results). Map them to v2 values. */
    --text-main: var(--text);
    --text-secondary: var(--text-2);
    --text-muted: var(--text-2);
    --text-dim: var(--text-3);
    --primary-text: var(--accent);
    --success: var(--good);
    --warning: var(--warn);
    --danger: var(--bad);
    --fs-2xs: 0.75rem;
    --fs-xs: 0.8125rem;
    --fs-sm: 0.875rem;
    --fs-base: 1rem;
    --radius-sm: var(--r-xs);
    --radius: var(--r);
    --radius-lg: var(--r-lg);
    --font-body: var(--font);
    --font-heading: var(--font);
    --font-mono: var(--mono);
    --fs-xs-minus: 0.8125rem;
    --fs-lg: 1.125rem;
    --fs-xl: 1.375rem;
    --fs-2xl: 1.75rem;

    /* Surfaces and lines */
    --bg-dark: var(--bg);
    --bg-main: var(--bg);
    --bg-primary: var(--bg);
    --bg-surface: var(--bg-raised);
    --bg-card: var(--bg-raised);
    --bg-surface-2: var(--bg-overlay);
    --bg-elevated: var(--bg-overlay);
    --bg-panel: var(--bg-raised);
    --border: var(--line);
    --border-soft: var(--line);
    --border-strong: var(--line-strong);
    --glass-border: var(--line);
    --surface-1: rgba(var(--fg-rgb), 0.02);
    --surface-2: rgba(var(--fg-rgb), 0.04);
    --overlay-bg: rgba(0, 0, 0, 0.6);
    --shadow-card: 0 20px 50px -20px rgba(var(--shadow-rgb), calc(0.7 * var(--shadow-k)));

    /* Accent and status, with -rgb twins for rgba(var(--x-rgb), a) */
    --primary: var(--accent);
    --primary-rgb: var(--accent-rgb);
    --primary-hover: var(--accent-hover);
    --primary-bg: var(--accent-soft);
    --primary-border: rgba(var(--accent-rgb), 0.3);
    --primary-glow: var(--accent);
    --success-rgb: var(--good-rgb);
    --success-bg: rgba(var(--good-rgb), 0.1);
    --warning-rgb: var(--warn-rgb);
    --warning-bg: rgba(var(--warn-rgb), 0.1);
    --danger-rgb: var(--bad-rgb);
    --danger-bg: rgba(var(--bad-rgb), 0.1);
    --info-bg: rgba(var(--info-rgb), 0.1);
    /* Legacy "deep" primary button pair -> v2 primary (inverse button) */
    --primary-deep: var(--inverse);
    --primary-deep-hover: var(--inverse-hover);
    --primary-deep-text: var(--on-inverse);
    --primary-deep-text-hover: var(--on-inverse);
    --primary-deep-edge: transparent;
    --muted-rgb: var(--text-2-rgb);
    --text-dim-rgb: var(--text-3-rgb);
    /* Mock app windows on marketing pages */
    --panel: #0d0e11;
    --panel-top: #111216;
    --panel-rgb: 13, 14, 17;
    --panel-side: #0c0d10;
    --panel-card: #121317;
    --on-accent: #0b0c1a;
}
:root[data-theme="light"] {
    --panel: #fbfbfc;
    --panel-top: #f1f1f3;
    --panel-rgb: 251, 251, 252;
    --panel-side: #f1f1f3;
    --panel-card: #ffffff;
    --on-accent: #ffffff;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: 'ss01' on;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-xs); }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 36px; padding: 0 16px;
    border-radius: var(--r); border: 1px solid transparent;
    font-size: 14px; font-weight: 500; letter-spacing: -0.005em;
    cursor: pointer; white-space: nowrap;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    font-family: inherit; background: transparent; color: var(--text);
}
/* components.css (loaded earlier for toasts/modals) has a generic
   .btn:hover { color; border-color } that outranks a plain modifier class,
   so every modifier sets its own hover colour and border explicitly. */
.btn-primary, .btn-primary:hover { color: var(--on-inverse); border-color: transparent; }
.btn-primary { background: var(--inverse); }
.btn-primary:hover { background: var(--inverse-hover); }
.btn-ghost { background: transparent; border-color: var(--line-strong); color: var(--text); }
.btn-ghost:hover { background: var(--bg-hover); border-color: rgba(var(--fg-rgb), 0.2); color: var(--text); }
.btn-quiet { background: transparent; color: var(--text-2); padding: 0 12px; }
.btn-quiet:hover { color: var(--text); border-color: transparent; }
.btn-lg { height: 42px; padding: 0 20px; font-size: 15px; }

/* ---------- Hero ---------- */
.hero { padding: 96px 0 0; }
.hero h1 {
    margin: 0; max-width: 15ch;
    font-size: clamp(40px, 6.2vw, 72px); line-height: 1.0; font-weight: 560; letter-spacing: -0.042em;
}
.hero-sub { margin: 24px 0 0; max-width: 34em; font-size: 18px; line-height: 1.55; color: var(--text-2); letter-spacing: -0.005em; }
/* Split hero: headline left, lead + actions right, top edges aligned */
.hero-split { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: start; }
.hero-split h1 { max-width: none; font-size: clamp(38px, 4.7vw, 58px); line-height: 1.04; font-weight: 540; letter-spacing: -0.038em; }
.hero-split .hero-sub { margin: 0; padding-top: 6px; max-width: 30em; font-size: 20px; line-height: 1.5; color: var(--text-lead); letter-spacing: -0.012em; }
.hero-split .hero-actions { margin-top: 28px; }
.hero-split .hero-terms { margin-top: 22px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 32px; }
.hero-terms { display: flex; flex-wrap: wrap; gap: 6px 22px; margin: 28px 0 0; padding: 0; list-style: none; font-size: 13.5px; color: var(--text-3); }
.hero-terms li { display: inline-flex; align-items: center; gap: 8px; }
.hero-terms svg { width: 14px; height: 14px; color: var(--text-2); }

/* Product window */
.stage { position: relative; margin-top: 72px; }
.stage::after {
    content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 160px;
    background: linear-gradient(to bottom, rgba(var(--bg-rgb), 0), var(--bg) 92%);
    pointer-events: none;
}
.window {
    pointer-events: none; /* demo picture (role="img"): no hover or text selection */
    position: relative; overflow: hidden;
    border: 1px solid var(--line-strong); border-radius: var(--r-lg);
    background: var(--bg-raised);
    box-shadow: 0 0 0 1px rgba(var(--shadow-rgb), calc(0.6 * var(--shadow-k))), 0 40px 120px -20px rgba(var(--shadow-rgb), calc(0.8 * var(--shadow-k))), 0 -1px 0 rgba(var(--fg-rgb), 0.06) inset;
    display: grid; grid-template-columns: 208px 1fr 280px;
    min-height: 540px;
    font-size: 13px;
}
.win-side { border-right: 1px solid var(--line); padding: 14px 10px; background: var(--panel-side); }
.win-brand { display: flex; align-items: center; gap: 8px; padding: 2px 8px 14px; font-weight: 600; font-size: 13.5px; }
.win-group { font-size: 11.5px; color: var(--text-3); padding: 12px 8px 4px; }
.win-link { display: flex; align-items: center; gap: 9px; padding: 5px 8px; border-radius: var(--r-sm); color: var(--text-2); }
.win-link i { width: 6px; height: 6px; border-radius: 2px; background: var(--text-3); flex: none; opacity: 0.6; }
.win-link.is-active { background: var(--bg-hover); color: var(--text); }
.win-link.is-active i { background: var(--accent); opacity: 1; }

.win-main { min-width: 0; display: flex; flex-direction: column; }
.win-bar { display: flex; align-items: center; gap: 10px; height: 46px; padding: 0 16px; border-bottom: 1px solid var(--line); }
.win-crumb { color: var(--text-3); }
.win-crumb b { color: var(--text); font-weight: 500; }
.win-query { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; height: 28px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); color: var(--text-2); font-size: 12.5px; }
.win-query svg { width: 12px; height: 12px; }
.win-tabs { display: flex; gap: 2px; padding: 10px 16px 0; white-space: nowrap; overflow: hidden; }
.win-tab { padding: 5px 10px; border-radius: var(--r-sm); color: var(--text-3); font-size: 12.5px; }
.win-tab.is-active { background: var(--bg-hover); color: var(--text); }

.serp { width: 100%; border-collapse: collapse; margin-top: 8px; }
.serp th { text-align: left; font-weight: 400; color: var(--text-3); font-size: 11.5px; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.serp td { padding: 10px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
.serp th:first-child, .serp td:first-child { padding-left: 16px; width: 44px; }
.serp .pos { font-family: var(--mono); color: var(--text-3); font-size: 12px; }
.serp .page b { display: block; font-weight: 500; color: var(--text); max-width: 270px; overflow: hidden; text-overflow: ellipsis; }
.serp .page > span { display: block; font-family: var(--mono); font-size: 11.5px; color: var(--text-3); }
.serp .num { font-family: var(--mono); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.gain { display: inline-flex; align-items: center; gap: 8px; }
.gain-bar { width: 44px; height: 4px; border-radius: 2px; background: rgba(var(--fg-rgb), 0.08); overflow: hidden; }
.gain-bar i { display: block; height: 100%; background: var(--text-2); border-radius: 2px; }
.lvl { font-size: 12.5px; }
.lvl--good { color: var(--good); } .lvl--warn { color: var(--warn); } .lvl--bad { color: var(--bad); }
.engines { display: inline-flex; gap: 3px; }
.engines i { width: 8px; height: 8px; border-radius: 2px; background: rgba(var(--fg-rgb), 0.09); }
.engines i.on { background: var(--text-2); }
.serp tr.is-you td { background: var(--accent-soft); }
.serp tr.is-you .page b { color: var(--text-strong); }
.serp tr.is-you .gain-bar i { background: var(--accent); }
.serp tr.is-you .engines i.on { background: var(--accent); }
.serp .page .you-tag { display: inline-block; margin-left: 8px; padding: 0 6px; border-radius: var(--r-xs); background: var(--accent); color: var(--on-accent); font-family: var(--font); font-size: 11px; font-weight: 600; line-height: 17px; vertical-align: 1px; }

.win-aside { border-left: 1px solid var(--line); padding: 16px; display: flex; flex-direction: column; gap: 18px; background: var(--panel); }
.aside-head { font-size: 12px; color: var(--text-3); }
.score { display: flex; align-items: center; gap: 14px; }
.ring { width: 64px; height: 64px; flex: none; }
.score-num { font-family: var(--mono); font-size: 28px; line-height: 1; letter-spacing: -0.03em; }
.score-label { font-size: 12.5px; color: var(--text-3); margin-top: 4px; }
.split { display: flex; flex-direction: column; gap: 10px; }
.split-row { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; font-size: 12.5px; color: var(--text-2); }
.split-row .num { font-family: var(--mono); color: var(--text-3); font-size: 12px; }
.split-bar { grid-column: 1 / -1; height: 4px; border-radius: 2px; background: rgba(var(--fg-rgb), 0.07); overflow: hidden; }
.split-bar i { display: block; height: 100%; border-radius: 2px; }
.next { border: 1px solid var(--line); border-radius: var(--r); padding: 12px; font-size: 12.5px; color: var(--text-2); line-height: 1.5; }
.next b { display: block; color: var(--text); font-weight: 500; margin-bottom: 4px; }

/* ---------- Sections ---------- */
.section { padding: 128px 0; }
.section--tools { padding-top: 200px; }
.section + .section { border-top: 1px solid var(--line); }
/* Home: Why Algorithm and the quote read as one block — no dividers, tighter gap */
.section + .section--flush { border-top: 0; }
.section--quote { padding-top: 24px; }
.section--tools + .section--why { padding-top: 24px; }
.section-head { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: start; margin-bottom: 64px; }
.section-head h2 { margin: 0; font-size: clamp(30px, 3.6vw, 44px); line-height: 1.08; font-weight: 540; letter-spacing: -0.032em; max-width: 14ch; }
/* Variant: lead starts at the third column (matches 3-column grids below) */
.section-head--thirds { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.section-head--thirds { row-gap: 20px; }
.section-head--thirds h2, .section-head--thirds p { grid-column: 2; max-width: none; }
.section-head p { margin: 0; padding-top: 4px; font-size: 19px; line-height: 1.5; color: var(--text-lead); letter-spacing: -0.01em; max-width: 30em; }
.section-head p strong { color: var(--text); font-weight: 500; }

/* Flagship cards: a scroll-snap row (3 / 2 / 1.15 per view), arrows page it */
/* Flagship row bar: "[ Built in-house ]" lines up with the section lead (2nd half), arrows on the right */
.flag-bar { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: center; min-height: 40px; margin-bottom: 20px; }
.flag-tag { grid-column: 2; grid-row: 1; font-family: var(--mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-3); }
.flag-nav { grid-column: 2; grid-row: 1; justify-self: end; display: flex; gap: 8px; flex: none; }
.flag-nav.is-idle { visibility: hidden; }
.flag-nav-btn { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line-strong); background: none; color: var(--text-2); display: grid; place-items: center; cursor: pointer; transition: background 0.15s, color 0.15s, opacity 0.15s; }
.flag-nav-btn:hover:not(:disabled) { background: var(--bg-hover); color: var(--text); }
.flag-nav-btn:disabled { opacity: 0.35; cursor: default; }
.flag-nav-btn svg { width: 14px; height: 14px; }
.flag-nav-btn[data-dir="-1"] svg { transform: scaleX(-1); }
.flagships { display: grid; grid-auto-flow: column; grid-auto-columns: calc((100% - 32px) / 3); gap: 16px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior-x: contain; outline: none; }
.flagships::-webkit-scrollbar { display: none; }
.flag {
    position: relative; display: flex; flex-direction: column;
    border: 1px solid var(--line); border-radius: var(--r-xl);
    background: linear-gradient(180deg, var(--panel-top) 0%, var(--panel) 100%);
    overflow: hidden; scroll-snap-align: start;
    transition: border-color 0.2s;
}
.flag[hidden] { display: none; }
.flag:hover { border-color: var(--line-strong); }
.flag-art { position: relative; flex: 1; display: flex; flex-direction: column; padding: 32px 28px 0; }
.flag-foot { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; padding: 32px 28px 28px; }
.flag-kind { font-size: 14px; color: var(--text-3); }
.flag-title { font-size: 18px; font-weight: 500; letter-spacing: -0.012em; margin-top: 2px; line-height: 1.35; }
.flag-go { flex: none; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line-strong); display: grid; place-items: center; color: var(--text-2); transition: background 0.15s, color 0.15s; }
.flag-go svg { width: 14px; height: 14px; transform: rotate(-35deg); transition: transform 0.2s var(--ease, ease); }
.flag:hover .flag-go { background: var(--bg-hover); color: var(--text); }
.flag:hover .flag-go svg { transform: translate(1.5px, -1px) rotate(-35deg); }
.flag-link { position: absolute; inset: 0; z-index: 2; border-radius: inherit; }
.flag-link:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* Card art: a small report window drawn in HTML/SVG */
.fa { flex: none; height: 292px; display: flex; flex-direction: column; min-height: 0; overflow: hidden; border: 1px solid var(--line-strong); border-radius: var(--r-lg); background: var(--panel-card); padding: 14px 16px 16px; font-size: 12.5px; color: var(--text-2); box-shadow: 0 20px 40px rgba(var(--shadow-rgb), calc(0.4 * var(--shadow-k))); }
.fa-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid var(--line); font-family: var(--mono); font-size: 12px; color: var(--text-2); white-space: nowrap; }
.fa-head > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.fa-tag { flex: none; padding: 0 7px; line-height: 20px; border: 1px solid var(--line-strong); border-radius: var(--r-xs); font-family: var(--font); font-size: 11.5px; color: var(--text-2); }
.fa-big { flex: none; font-size: 20px; letter-spacing: -0.03em; color: var(--text); }
.fa > .fa-legend:last-child { margin-top: auto; padding-top: 12px; }
.fa-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; font-size: 11.5px; color: var(--text-3); }
.fa-legend i { display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; vertical-align: 0; }
.fa-chart { display: block; width: 100%; height: auto; overflow: visible; }
.fa-grid line { stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.fa-chart text { font-family: var(--mono); font-size: 9px; fill: var(--text-3); text-anchor: end; }
.fa-area { fill: rgba(var(--accent-rgb), 0.08); }
.fa-line { fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.fa-end { fill: var(--accent); stroke: var(--panel-card); stroke-width: 2; }
/* Topical Map */
.fa-map { display: block; width: 100%; height: 160px; }
.tm-ring { fill: rgba(var(--accent-rgb), 0.05); stroke: rgba(var(--accent-rgb), 0.45); stroke-width: 1; stroke-dasharray: 3 4; }
.tm-center { fill: none; stroke: var(--accent); stroke-width: 1.5; }
.tm-c { fill: var(--accent); opacity: 0.85; }
.tm-s { fill: var(--text-3); }
.tm-o { fill: none; stroke: var(--warn); stroke-width: 1.4; }
.lg-c { background: var(--accent); } .lg-s { background: var(--text-3); } .lg-o { border: 1.4px solid var(--warn); }
/* AI Visibility */
.ai-row { display: grid; grid-template-columns: 92px minmax(0, 1fr) 92px; align-items: center; gap: 12px; padding: 7px 0; }
.ai-row + .ai-row { border-top: 1px solid var(--line); }
.ai-name { color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ai-bar { height: 4px; border-radius: 2px; background: rgba(var(--fg-rgb), 0.07); overflow: hidden; }
.ai-bar i { display: block; height: 100%; border-radius: 2px; background: var(--text-3); }
.ai-row em { font-style: normal; font-size: 11.5px; color: var(--text-3); text-align: right; white-space: nowrap; }
.ai-row em.is-on { color: var(--good); }
.ai-row:has(em.is-on) .ai-bar i { background: var(--accent); }
/* Blog Audit */
.ba-cells { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 10px; }
.ba-cells > div { min-width: 0; padding-bottom: 12px; }
.ba-cells > div + div { padding-left: 12px; border-left: 1px solid var(--line); }
.ba-cells > div:not(:last-child) { padding-right: 12px; }
.ba-cells small { display: block; font-size: 11.5px; color: var(--text-3); white-space: nowrap; }
.ba-cells b { display: block; margin-top: 4px; font-family: var(--mono); font-size: 18px; font-weight: 400; letter-spacing: -0.03em; color: var(--text); }
.ba-cells b em { margin-left: 4px; font-style: normal; font-size: 11.5px; letter-spacing: 0; color: var(--text-3); }
.ba-track { display: block; height: 4px; margin-top: 10px; border-radius: 2px; background: rgba(var(--fg-rgb), 0.07); overflow: hidden; }
.ba-track i { display: block; height: 100%; border-radius: 2px; }
.ba-cells .is-good, .ba-row .is-good { background: var(--good); }
.ba-cells .is-warn, .ba-row .is-warn { background: var(--warn); }
.ba-cells .is-bad, .ba-row .is-bad { background: var(--bad); }
.ba-row { display: grid; grid-template-columns: 3px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); }
.ba-row i { height: 16px; border-radius: 2px; }
.ba-row span { color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ba-row b { font-family: var(--mono); font-weight: 400; color: var(--text-2); }
/* Commercial Audit */
.ca-mrow { display: grid; grid-template-columns: minmax(0, 1fr) auto 34px; align-items: center; gap: 12px; padding: 7px 0; border-top: 1px solid var(--line); }
.ca-mrow > span:first-child { color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ca-mrow.ca-mhead { padding-top: 0; border-top: 0; font-size: 11.5px; }
.ca-mrow.ca-mhead > span:first-child, .ca-mrow.ca-mhead b { color: var(--text-3); }
.ca-dots { display: flex; gap: 8px; }
.ca-dots i { width: 9px; height: 9px; border-radius: 50%; border: 1px solid var(--line-strong); }
.ca-dots i.on { background: var(--text-2); border-color: var(--text-2); }
.ca-dots em { width: 9px; font-style: normal; font-family: var(--mono); font-size: 10px; text-align: center; color: var(--text-3); }
.ca-mrow b { height: 22px; display: grid; place-items: center; border-radius: var(--r-xs); background: rgba(var(--accent-rgb), 0.08); font-weight: 500; color: var(--text-2); }
.ca-mrow.ca-mhead b { background: none; font-weight: 400; }
.ca-mrow b.is-ok { color: var(--good); } .ca-mrow b.is-miss { color: var(--bad); } .ca-mrow b.is-part { color: var(--warn); }
/* Rank Tracker: keyword rows with SERP features, no chart (SEO Audit has the chart) */
.rt-row { display: grid; grid-template-columns: minmax(0, 1fr) auto 26px 44px; align-items: center; gap: 10px; min-height: 33px; border-top: 1px solid var(--line); }
.rt-row > span:first-child { color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rt-row b { font-family: var(--mono); font-weight: 400; color: var(--text); text-align: right; }
.rt-row em { font-style: normal; font-family: var(--mono); font-size: 11.5px; text-align: right; color: var(--text-3); }
.rt-row em.is-up { color: var(--good); } .rt-row em.is-down { color: var(--bad); }
.rt-row.rt-h { min-height: 0; padding-bottom: 8px; border-top: 0; font-size: 11.5px; }
.rt-row.rt-h > span:first-child, .rt-row.rt-h b, .rt-row.rt-h em { color: var(--text-3); font-family: var(--font); font-size: 11.5px; }
.rt-row.rt-h > span:nth-child(2) { color: var(--text-3); }
.rt-f { display: flex; gap: 4px; justify-content: flex-end; }
.rt-f i { padding: 0 6px; line-height: 19px; border: 1px solid var(--line-strong); border-radius: var(--r-xs); font-style: normal; font-size: 11px; color: var(--text-3); white-space: nowrap; }
.rt-f i.is-cited { color: var(--good); border-color: rgba(var(--good-rgb), 0.35); }
.rt-note { margin-top: auto; padding-top: 10px; border-top: 1px solid var(--line); font-size: 11.5px; color: var(--text-3); }
@media (max-width: 560px) {
    /* Narrow card: keyword, one SERP badge and the position; five rows don't fit */
    .rt-row { grid-template-columns: minmax(0, 1fr) auto 24px; }
    .rt-row em, .rt-f i + i, .fa-rt .rt-row:nth-last-of-type(2) { display: none; }
}
/* SEO Audit */
.so-m { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 14px; }
.so-m > div + div { padding-left: 12px; border-left: 1px solid var(--line); }
.so-m small { display: block; font-size: 11.5px; color: var(--text-3); white-space: nowrap; }
.so-m b { display: block; margin-top: 4px; font-family: var(--mono); font-size: 18px; font-weight: 400; letter-spacing: -0.03em; color: var(--text); }
.so-x { display: flex; justify-content: space-between; margin-top: 6px; font-family: var(--mono); font-size: 10.5px; color: var(--text-3); }

/* Segmented filter (shared: home tools index, tools catalog, pricing) */
.seg { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: var(--r); }
.seg button { height: 28px; padding: 0 12px; border: 0; border-radius: var(--r-sm); background: none; color: var(--text-3); font-size: 13.5px; cursor: pointer; }
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--bg-hover); color: var(--text); }

/* Mono URL path (used on /tools/) */
.path { font-family: var(--mono); font-size: 12.5px; color: var(--text-3); }

/* Tool list under the flagship row: three columns, name / short description / price */
.tool-list { list-style: none; margin: 40px 0 0; padding: 8px 0 0; border-top: 1px dashed var(--line-strong); columns: 3; column-gap: 48px; }
.tool-list li { break-inside: avoid; }
.tool-list li[hidden] { display: none; }
.tool-list a { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; align-items: baseline; padding: 12px 0; border-bottom: 1px solid var(--line); color: var(--text-2); transition: color 0.15s; }
.tool-list a:hover .tl-name { color: var(--accent); }
.tl-main { min-width: 0; }
.tl-name { display: block; font-size: 15.5px; color: var(--text); transition: color 0.15s; }
.tl-desc { display: block; margin-top: 2px; font-size: 13.5px; color: var(--text-3); }
.tl-price { font-size: 13px; color: var(--text-3); white-space: nowrap; }
.tl-price.is-free { padding: 0 7px; line-height: 20px; border: 1px solid rgba(var(--accent-rgb), 0.4); border-radius: var(--r-xs); background: rgba(var(--accent-rgb), 0.08); color: var(--accent); }

/* How it runs */
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 32px; }
.step { position: relative; padding-top: 44px; display: flex; flex-direction: column; }
.step::before { content: ''; position: absolute; top: 12px; left: 28px; right: -32px; height: 1px; background: var(--line-strong); }
.step:last-child::before { right: 0; }
.step .dot { position: absolute; top: 0; left: 0; width: 24px; height: 24px; border-radius: 50%; background: var(--bg-overlay); display: grid; place-items: center; }
.step .dot::after { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--text-3); }
.step:first-child .dot { background: var(--accent-soft); }
.step:first-child .dot::after { background: var(--accent); }
.step h3 { margin: 0 0 8px; font-size: 17px; font-weight: 500; letter-spacing: -0.012em; }
.step p { margin: 0; color: var(--text-2); font-size: 15px; line-height: 1.6; }
.step code { display: block; margin-top: auto; padding-top: 18px; font-family: var(--mono); font-size: 12.5px; color: var(--text-3); }

/* Principles */
/* Why Algorithm: a grid of square cells with shared hairlines.
   Bracketed mono tag on top, title and dim text pinned to the bottom. */
.principles {
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
    border: 1px solid var(--line); border-radius: var(--r-xl); overflow: hidden;
}
.principle {
    display: grid; grid-row: span 2; grid-template-rows: subgrid; row-gap: 0;
    padding: 24px 28px 28px;
    box-shadow: 1px 0 0 var(--line), 0 1px 0 var(--line);
}
/* Subgrid keeps the titles of one row on one line, whatever the text length */
.principle-tag { padding-bottom: 96px; font-family: var(--mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-3); }
.principle h3 { margin: 0 0 8px; font-size: 17px; font-weight: 500; letter-spacing: -0.012em; }
.principle p { margin: 0; color: var(--text-3); font-size: 15px; line-height: 1.6; max-width: 34em; }

/* Home tool list head: "[ All tools ]" | filter | "N tools".
   Columns match the flagship row (3 cards, 16px gap), so the filter spans exactly the middle card. */
.seg-n { margin-left: 6px; font-family: var(--mono); font-size: 11.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.tl-head { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 16px; align-items: center; margin: 48px 0 0; padding-bottom: 16px; }
.tl-tag, .tl-count { font-family: var(--mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-3); white-space: nowrap; }
.tl-bar { display: contents; }
.tl-head .seg { grid-column: 2; display: flex; min-width: 0; }
.tl-head .seg button { flex: 1 1 auto; padding: 0 8px; white-space: nowrap; }
.tl-count { grid-column: 3; justify-self: end; }
.tl-head + .tool-list { margin-top: 0; }

/* Quote */
.quote { max-width: 760px; margin: 0; }
/* Home: quote lines up with the text of the middle Why Algorithm cell
   (same 3 columns with no gap; 28px cell padding + 1px grid border) */
.quote-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.quote-row .quote { grid-column: 2 / 3; padding: 0 29px; }
/* Hanging opening quote mark, so the letters line up with the text above */
.quote-row blockquote { text-indent: -0.375em; }
@media (max-width: 860px) { .quote-row { display: block; } .quote-row .quote { padding: 0; } }
.quote blockquote { margin: 0; font-size: 20px; line-height: 1.5; font-weight: 400; letter-spacing: -0.012em; color: var(--text); }
.quote figcaption { display: flex; align-items: center; gap: 16px; margin-top: 28px; font-size: 14px; }
.quote figcaption img, .avatar-fallback { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; flex: none; }
.avatar-fallback { display: grid; place-items: center; background: var(--bg-overlay); color: var(--text-2); font-weight: 500; font-size: 16px; }
.quote figcaption b { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.quote figcaption span { display: block; margin-top: 2px; color: var(--text-3); }
.quote-in { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: var(--r-xs); color: var(--text-3); transition: color 0.15s, background 0.15s; }
.quote-in:hover { color: var(--text); background: var(--bg-hover); }
.quote-in svg { width: 14px; height: 14px; }

/* Entrance: one orchestrated moment */
@media (prefers-reduced-motion: no-preference) {
    .hero h1, .hero-sub, .hero-actions, .hero-terms { animation: rise 0.7s var(--ease) both; }
    .hero-sub { animation-delay: 0.06s; }
    .hero-actions { animation-delay: 0.12s; }
    .hero-terms { animation-delay: 0.18s; }
    .window { animation: rise-window 1.1s var(--ease) 0.25s both; }
    @keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
    @keyframes rise-window { from { opacity: 0; transform: translateY(32px) scale(0.985); } to { opacity: 1; transform: none; } }
}

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
    .window { grid-template-columns: 180px 1fr; }
    .win-aside { display: none; }
    .flagships { grid-auto-columns: calc((100% - 16px) / 2); }
    .tool-list { columns: 2; }
    .tl-head { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .tl-count { display: none; }
    .steps { grid-template-columns: 1fr 1fr; gap: 48px 32px; }
    .step:nth-child(2)::before { right: 0; }
}
@media (max-width: 860px) {
    .hero { padding-top: 56px; }
    .hero-sub { font-size: 17px; }
    .hero-split { grid-template-columns: 1fr; gap: 20px; }
    .hero-split .hero-sub { font-size: 18px; padding-top: 0; }
    .section-head p { font-size: 17px; }
    .section-head { grid-template-columns: 1fr; gap: 16px; margin-bottom: 40px; }
    .section-head--thirds h2, .section-head--thirds p { grid-column: auto; }
    .section { padding: 88px 0; }
    .section--quote { padding-top: 16px; }
    .section--tools + .section--why { padding-top: 16px; }
    .section--tools { padding-top: 128px; }
    .principles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .flag-bar { grid-template-columns: 1fr; }
    .flag-tag, .flag-nav { grid-column: 1; }
    .tl-head { display: flex; flex-wrap: wrap; justify-content: space-between; row-gap: 8px; }
    .tl-count { display: inline; order: 1; }
    .tl-head::after { content: ""; order: 1; flex-basis: 100%; }
    .tl-head .seg { order: 2; }
    .principle-tag { padding-bottom: 72px; }
}
@media (max-width: 720px) {
    .window { grid-template-columns: 1fr; min-height: 0; }
    .win-side { display: none; }
    .win-query { display: none; }
    .win-crumb { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .serp .col-eeat, .serp .col-links { display: none; }
    .serp .page b { max-width: 150px; }
    .stage { margin-top: 48px; }
    .flagships { grid-auto-columns: 86%; gap: 12px; }
    .flag-art { padding: 24px 20px 0; }
    .flag-foot { padding: 16px 20px 22px; }
    .flag-nav { display: none; }
    .tool-list { columns: 1; margin-top: 32px; }
    .tl-head { margin-top: 40px; }
    .steps { grid-template-columns: 1fr; gap: 36px; }
    .step::before { display: none; }
    .principles { grid-template-columns: 1fr; }
    .principle { padding: 20px 20px 24px; }
    .principle-tag { padding-bottom: 40px; }
    .quote-row .quote { padding: 0 21px; }
}
@media (max-width: 480px) {
    .serp .col-ai { display: none; }
    .hero-actions .btn { flex: 1; }
}
@media (max-width: 600px) {
    .seg { display: flex; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; max-width: 100%; }
    .seg::-webkit-scrollbar { display: none; }
    .seg button { flex: none; }
}

/* ---------- Post rows: the blog list and the author page (.blog-grid / .blog-card).
   The server renders the same markup (server.js blogCardHtml). ---------- */
.blog-grid { margin-top: 32px; border-top: 1px solid var(--line); }
.blog-card { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 4px 48px; padding: 36px 0; border-bottom: 1px solid var(--line); }
.blog-card:has(.blog-card-cover) { grid-template-columns: 200px minmax(0, 1fr) 280px; }
.blog-card-cover-placeholder { display: none; }
.blog-card-cover { grid-column: 3; grid-row: 1 / span 3; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--r); border: 1px solid var(--line); }
.blog-card-body { display: contents; }
.blog-card .meta-row { grid-column: 1; grid-row: 1 / span 3; display: flex; flex-direction: column; gap: 4px; padding-top: 4px; font-size: 13.5px; color: var(--text-3); }
.blog-card .meta-row > span:first-child { color: var(--text-2); }
.blog-card .meta-row span[style*="opacity"] { display: none; }
.blog-card .meta-row .reading-time { font-family: var(--mono); font-size: 12px; }
.blog-card h2 { grid-column: 2; margin: 0; font-size: 24px; line-height: 1.25; font-weight: 500; letter-spacing: -0.022em; max-width: 30em; transition: color 0.15s; }
.blog-card p { grid-column: 2; margin: 8px 0 0; font-size: 16px; line-height: 1.6; color: var(--text-2); max-width: 40em; }
.blog-card .tags { grid-column: 2; display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.blog-card .tag { font-family: var(--mono); font-size: 12px; color: var(--text-3); }
.blog-card .tag + .tag::before { content: '/'; margin-right: 6px; color: var(--line-strong); }
.blog-card:hover h2 { color: var(--text-strong); }
.blog-card:hover p { color: var(--text-lead); }
.blog-empty { padding: 48px 0; color: var(--text-3); font-size: 15px; }
@media (max-width: 960px) {
    .blog-card, .blog-card:has(.blog-card-cover) { grid-template-columns: minmax(0, 1fr); gap: 0; }
    .blog-card .meta-row { grid-column: 1; grid-row: auto; flex-direction: row; flex-wrap: wrap; gap: 4px 14px; padding: 0 0 10px; }
    .blog-card h2, .blog-card p, .blog-card .tags { grid-column: 1; }
    .blog-card-cover { grid-column: 1; grid-row: auto; margin-bottom: 16px; }
}
@media (max-width: 860px) {
    .blog-card { padding: 28px 0; }
    .blog-card h2 { font-size: 21px; }
}
