/* Facon Blog Engine — design tokens, then layout, then components. */

:root {
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Consolas, monospace;

  /* Warm paper, ink text, one deep teal accent and an amber spark for moments of delight. */
  --bg: #f6f3ee;
  --surface: #fffdf9;
  --surface-2: #f2eee7;
  --sunken: #ebe5dc;
  --text: #1c1a17;
  --text-2: #4d4740;
  --muted: #6b645a; /* 4.5:1 or better on every light surface (WCAG AA) */
  --line: #e7e0d5;
  --line-strong: #d8cfc2;

  --accent: #0f6b5c;
  --accent-hover: #0b5749;
  --accent-soft: #e2efe9;
  --accent-ink: #ffffff;
  --spark: #d9822b;
  --spark-soft: #fbeedd;
  --glow-a: rgba(15, 107, 92, .10);
  --glow-b: rgba(217, 130, 43, .08);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);

  --ok: #11734f;
  --ok-soft: #e4f3ec;
  --warn: #9a5b00;
  --warn-soft: #fbf0dc;
  --bad: #b42335;
  --bad-soft: #fbe7ea;
  --info: #2b5bb8;
  --info-soft: #e7eefb;

  --g-question: #3d63c9;
  --g-preposition: #148a77;
  --g-comparison: #c46a12;
  --g-alphabetical: #7a54c7;
  --g-related: #7c7f85;

  --r-sm: 6px;
  --r: 10px;
  --r-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(20, 20, 18, .05);
  --shadow: 0 1px 2px rgba(20, 20, 18, .04), 0 4px 16px rgba(20, 20, 18, .06);
  --shadow-lg: 0 12px 40px rgba(20, 20, 18, .18);
  --sidebar: 248px;
  color-scheme: light;
}

/* theme.js resolves Light / Dark / System into data-theme before first paint. */
:root[data-theme="dark"] {
    --bg: #12110f;
    --surface: #1a1916;
    --surface-2: #211f1b;
    --sunken: #161512;
    --text: #efeae2;
    --text-2: #bcb5aa;
    --muted: #8d867b;
    --line: #2d2a25;
    --line-strong: #3a3631;
    --accent: #45b89c;
    --accent-hover: #62cab0;
    --accent-soft: #15302a;
    --accent-ink: #0d1412;
    --spark: #f0a24d;
    --spark-soft: #2f2416;
    --glow-a: rgba(69, 184, 156, .10);
    --glow-b: rgba(240, 162, 77, .06);
    --ok: #4cc38a; --ok-soft: #13291f;
    --warn: #e0a53b; --warn-soft: #2d2412;
    --bad: #f0707f; --bad-soft: #321a1e;
    --info: #7da2f0; --info-soft: #18233a;
    --g-question: #7d9cf0; --g-preposition: #3fc2ac; --g-comparison: #e8984a;
    --g-alphabetical: #ae8ef0; --g-related: #8a8c88;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, .5);
    color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--font);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
.link { color: var(--accent); }
.link:hover { text-decoration: underline; text-underline-offset: 2px; }
svg.icon { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none;
  stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.num, td.num { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ------------------------------------------------------------------ shell */

.app { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 4px;
  padding: 16px 12px; border-right: 1px solid var(--line); background: var(--surface);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; font-weight: 650;
  letter-spacing: -.01em; }
.brand-mark {
  width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center;
  background: var(--text); color: var(--surface); font-weight: 700; font-size: 14px;
}
.brand small { display: block; font-weight: 450; color: var(--muted); font-size: 11.5px; }
.nav-label { padding: 14px 10px 6px; font-size: 11px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: .06em; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--r-sm);
  color: var(--text-2); font-weight: 500;
}
/* A sidebar entry that opens a dialog is a button: it must look exactly like the links. */
button.nav-item { width: 100%; background: none; border: 0; font: inherit; text-align: left; cursor: pointer; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--surface-2); color: var(--text); font-weight: 600; }
.nav-item .count { margin-left: auto; color: var(--muted); font-size: 12px; font-weight: 500; }
.nav-site { min-width: 0; }
.nav-site span.name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); flex: none; }
.status-dot.ready { background: var(--ok); }
.status-dot.analyzing { background: var(--info); animation: pulse 1.4s ease-in-out infinite; }
.status-dot.error { background: var(--bad); }
.sidebar-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); }
.mobile-bar { display: none; }
.main { min-width: 0; }

.page { padding: 28px 40px 96px; max-width: 1280px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px;
  flex-wrap: wrap; margin-bottom: 24px; }
.crumbs { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px;
  margin-bottom: 6px; }
.crumbs a:hover { color: var(--text); }
h1 { font-size: 24px; line-height: 1.25; letter-spacing: -.02em; font-weight: 650; margin: 0; }
h2 { font-size: 15px; font-weight: 600; letter-spacing: -.005em; margin: 0; }
.sub { color: var(--muted); margin: 4px 0 0; }
.meta-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; color: var(--muted);
  font-size: 13px; margin-top: 6px; }
.meta-row .sep { width: 3px; height: 3px; border-radius: 50%; background: var(--line-strong); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ------------------------------------------------------------- primitives */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 34px; padding: 0 14px; border-radius: var(--r-sm);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text);
  font: 500 13.5px/1 var(--font); cursor: pointer; white-space: nowrap;
  box-shadow: var(--shadow-sm); transition: background .12s, border-color .12s, color .12s;
}
.btn:focus-visible, .input:focus-visible, .chip:focus-visible, .tab:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-2); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn .spin { width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 50%; animation: spin .7s linear infinite; }

.input, select.input, textarea.input {
  width: 100%; height: 36px; padding: 0 11px; border-radius: var(--r-sm);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text);
  font: 14px var(--font); transition: border-color .12s, box-shadow .12s;
}
textarea.input { height: auto; min-height: 84px; padding: 9px 11px; line-height: 1.5; resize: vertical; }
textarea.input.code { font: 12.5px/1.6 var(--mono); min-height: 460px; }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field label { display: block; font-size: 13px; font-weight: 550; margin-bottom: 6px; }
.field .opt { color: var(--muted); font-weight: 400; }
.field .help { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.field .help b { color: var(--text-2); font-weight: 550; }
.field .counter { float: right; font-weight: 450; color: var(--muted); font-size: 12px; }
.field .counter.over { color: var(--warn); }
.form-grid { display: grid; gap: 16px; grid-template-columns: 1fr 1fr; }
.form-grid .full { grid-column: 1 / -1; }
.search { position: relative; }
.search .icon { position: absolute; left: 10px; top: 10px; color: var(--muted); }
.search .input { padding-left: 32px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm); }
.card-pad { padding: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 20px; border-bottom: 1px solid var(--line); }

.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px;
  border-radius: 999px; font-size: 12px; font-weight: 550; white-space: nowrap;
  background: var(--surface-2); color: var(--text-2);
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .9; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.busy { background: var(--info-soft); color: var(--info); }
.pill.busy::before { animation: pulse 1.4s ease-in-out infinite; }
.pill.plain::before { display: none; }

.notice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px;
  border-radius: var(--r); font-size: 13.5px; border: 1px solid; }
.notice .icon { margin-top: 2px; }
.page > .notice { margin-bottom: 16px; }
.notice.warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 25%, transparent); color: var(--warn); }
.notice.bad { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 25%, transparent); color: var(--bad); }
.notice.info { background: var(--info-soft); border-color: color-mix(in srgb, var(--info) 25%, transparent); color: var(--info); }
.notice strong { font-weight: 600; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px;
  overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 12px; border: 0; background: none;
  color: var(--muted); font: 500 13.5px var(--font); cursor: pointer; white-space: nowrap;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--text); font-weight: 600; }
.tab .count { font-size: 11.5px; color: var(--muted); background: var(--surface-2);
  padding: 1px 6px; border-radius: 999px; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 11px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--surface);
  color: var(--text-2); font: 500 13px var(--font); cursor: pointer;
}
.chip:hover { border-color: var(--line-strong); color: var(--text); }
.chip.active { background: var(--text); border-color: var(--text); color: var(--surface); }
.chip .count { font-size: 11.5px; opacity: .65; font-variant-numeric: tabular-nums; }
.gdot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.gdot.question { background: var(--g-question); }
.gdot.preposition { background: var(--g-preposition); }
.gdot.comparison { background: var(--g-comparison); }
.gdot.alphabetical { background: var(--g-alphabetical); }
.gdot.related { background: var(--g-related); }

.segmented { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 8px; }
.segmented button { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px;
  border: 0; border-radius: 6px; background: none; color: var(--muted); font: 500 12.5px var(--font); cursor: pointer; }
.segmented button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

.check { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; margin: 0; }
.toggle-row { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2);
  cursor: pointer; user-select: none; }

/* -------------------------------------------------------------- KPI strip */

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 24px; }
.kpi { padding: 16px 20px; border-left: 1px solid var(--line); }
.kpi:first-child { border-left: 0; }
.kpi .label { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.kpi .value { font-size: 26px; font-weight: 650; letter-spacing: -.02em; margin-top: 2px;
  font-variant-numeric: tabular-nums; }
.kpi .value small { font-size: 13px; font-weight: 500; color: var(--muted); letter-spacing: 0; margin-left: 4px; }

/* ------------------------------------------------------------- site cards */

.site-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); }
.site-card { display: flex; flex-direction: column; transition: border-color .15s, box-shadow .15s; }
.site-card:hover { border-color: var(--line-strong); box-shadow: var(--shadow); }
.site-card .top { display: flex; gap: 12px; align-items: flex-start; padding: 18px 18px 14px; }
.platform {
  width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; flex: none;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--text-2);
  font-weight: 700; font-size: 13px;
}
.site-card .title { font-weight: 600; font-size: 15px; letter-spacing: -.01em; }
.site-card .url { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; max-width: 220px; }
.site-card .pill { margin-left: auto; }
.site-card .stats { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line); }
.site-card .stat { padding: 12px 18px; border-left: 1px solid var(--line); }
.site-card .stat:first-child { border-left: 0; }
.site-card .stat b { display: block; font-size: 17px; font-weight: 650; font-variant-numeric: tabular-nums; }
.site-card .stat span { font-size: 12px; color: var(--muted); }
.site-card .detail { padding: 10px 18px 0; font-size: 12.5px; color: var(--muted); min-height: 30px; }
.site-card .detail.bad { color: var(--bad); }
.site-card .foot { display: flex; gap: 8px; padding: 12px 18px 16px; }
.site-card .foot .btn.primary { flex: 1; }

.autopilot { margin: 0 18px; padding: 12px 0 4px; border-bottom: 1px solid var(--line); display: grid; gap: 4px; }
.ap-head { display: flex; align-items: center; gap: 8px; }
.ap-title { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 13.5px; margin-right: auto; }
.autopilot.is-on .ap-title { color: var(--accent); }
.ap-line { font-size: 12.5px; color: var(--text-2); }
.ap-line.muted, .ap-line .muted { color: var(--muted); }
.switch { position: relative; width: 38px; height: 22px; border-radius: 999px; border: 0; padding: 0; flex: none;
  background: var(--line-strong); cursor: pointer; transition: background .15s; }
.switch .knob { position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; box-shadow: var(--shadow-sm); transition: transform .15s; }
.switch.on { background: var(--accent); }
.switch.on .knob { transform: translateX(16px); }
.switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ap-schedule { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: end; }
.ap-every { padding-bottom: 9px; color: var(--muted); font-weight: 500; }
.ap-preview { margin: 0; padding: 10px 12px; border-radius: var(--r); background: var(--accent-soft); color: var(--accent);
  font-weight: 550; font-size: 13.5px; }
.ap-steps { margin: 0; padding-left: 20px; display: grid; gap: 8px; font-size: 13.5px; color: var(--text-2); }
.modal-foot .spacer { flex: 1; }
.ap-tag { margin-left: 8px; height: 18px; font-size: 11px; vertical-align: 1px; }
.featured { margin: 0 0 24px; }
.featured img { display: block; width: 100%; aspect-ratio: 1600 / 928; object-fit: cover; border-radius: var(--r); background: var(--sunken); } /* the store's featured format */
/* Editor: one photo per heading */
.heading-images { display: grid; gap: 10px; margin-top: 8px; }
.hi-item { border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); overflow: hidden; }
.hi-row { display: flex; gap: 14px; padding: 10px; align-items: center; }
.hi-thumb { flex: none; width: 120px; height: 72px; border-radius: var(--r-sm); background: var(--sunken);
  display: grid; place-items: center; overflow: hidden; }
.hi-thumb img { width: 100%; height: 100%; object-fit: cover; }
.hi-thumb.wide { width: 160px; height: 93px; }
.hi-body { min-width: 0; flex: 1; display: grid; gap: 2px; }
.hi-heading { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hi-actions { display: flex; gap: 6px; margin-top: 4px; flex-wrap: wrap; }
.hi-picker { border-top: 1px solid var(--line); padding: 10px; display: grid; gap: 10px; background: var(--surface-2); }
.hi-search { display: flex; gap: 8px; flex-wrap: wrap; }
.hi-search .input { flex: 1 1 220px; min-width: 0; }
.hi-group { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.hi-grid { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); max-height: 320px; overflow-y: auto; }
.hi-tile { position: relative; padding: 0; border: 2px solid transparent; border-radius: var(--r-sm); overflow: hidden;
  background: var(--sunken); cursor: pointer; aspect-ratio: 4 / 3; }
.hi-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hi-tile:hover, .hi-tile:focus-visible { border-color: var(--accent); }
.hi-badges { position: absolute; left: 4px; bottom: 4px; display: flex; gap: 4px; flex-wrap: wrap; }
.badge { font-size: 10.5px; font-weight: 600; padding: 2px 6px; border-radius: 4px; background: rgba(0, 0, 0, .65); color: #fff; }
.badge.warn { background: rgba(160, 90, 0, .9); }
@media (max-width: 560px) { .hi-thumb, .hi-thumb.wide { width: 84px; height: 56px; } }
.article .section-photo { margin: 6px 0 18px; }
.article .section-photo img { display: block; width: 100%; max-height: 460px; object-fit: cover; border-radius: var(--r); background: var(--sunken); }
.article .section-photo figcaption { margin-top: 6px; font-size: 12px; color: var(--muted); }
.featured figcaption { margin-top: 6px; font-size: 12px; color: var(--muted); }
.featured { position: relative; }
.featured .featured-change { position: absolute; top: 12px; right: 12px; box-shadow: var(--shadow, 0 2px 8px rgb(0 0 0 / .25)); }
.featured figcaption a { color: inherit; text-decoration: underline; }.empty-state { text-align: center; padding: 64px 24px; }
.empty-state .art { width: 48px; height: 48px; margin: 0 auto 14px; border-radius: 12px; display: grid;
  place-items: center; background: var(--surface-2); border: 1px solid var(--line); color: var(--text-2); }
.empty-state h2 { font-size: 16px; }
.empty-state p { color: var(--muted); max-width: 380px; margin: 6px auto 18px; }

/* -------------------------------------------------------------- topic table */

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .left, .toolbar .right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.toolbar .search { width: 260px; }

.table-wrap { overflow-x: auto; overflow-y: hidden; } /* rows rising in must not flash a scrollbar */
table.data { width: 100%; border-collapse: separate; border-spacing: 0; }
table.data th {
  position: sticky; top: 0; z-index: 1; background: var(--surface-2);
  text-align: left; font-size: 12px; font-weight: 550; color: var(--muted);
  padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.data th:first-child { border-top-left-radius: var(--r-lg); }
table.data th:last-child { border-top-right-radius: var(--r-lg); }
table.data td { padding: 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr { transition: background .1s; }
table.data tbody tr:hover { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
table.data tbody tr.selected { background: var(--accent-soft); }
table.data tbody tr.flash { background: var(--accent-soft); }
.col-check { width: 44px; }
.col-num { text-align: right; width: 80px; }
.col-rel { width: 120px; }
.col-status { width: 150px; }
.col-act { width: 120px; text-align: right; }
.topic-title { font-weight: 600; color: var(--text); letter-spacing: -.005em; }
.topic-kw { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.expander { display: inline-flex; align-items: center; gap: 4px; margin-top: 8px; padding: 0;
  border: 0; background: none; color: var(--text-2); font: 500 12.5px var(--font); cursor: pointer; }
.expander:hover { color: var(--accent); }
.expander .icon { width: 14px; height: 14px; transition: transform .15s; }
.expander[aria-expanded="true"] .icon { transform: rotate(90deg); }
.topic-more { margin-top: 10px; padding: 12px 14px; border-radius: var(--r); background: var(--surface-2);
  display: grid; gap: 12px; }
.topic-more h3 { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted);
  font-weight: 600; margin: 0 0 6px; }
.kw-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.kw-tag { font-size: 12.5px; padding: 3px 8px; border-radius: 6px; background: var(--surface);
  border: 1px solid var(--line); color: var(--text-2); }
.kw-tag.main { border-color: var(--accent); color: var(--accent); font-weight: 550; }
.link-list { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; }
.link-list a { display: inline-flex; gap: 5px; align-items: center; color: var(--text-2); }
.link-list a:hover { color: var(--accent); }
.link-list .kind { color: var(--muted); text-transform: capitalize; }
.row-note { margin-top: 8px; font-size: 12.5px; }
.row-note.bad { color: var(--bad); }
.row-note.warn { color: var(--warn); }
.group-cell { display: inline-flex; align-items: center; gap: 7px; color: var(--text-2); font-size: 13px; }
.meter { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-2); }
.meter .track { width: 54px; height: 5px; border-radius: 3px; background: var(--sunken); overflow: hidden; }
.meter .fill { display: block; height: 100%; border-radius: 3px; background: var(--accent); }
.w0{width:0}.w10{width:10%}.w20{width:20%}.w30{width:30%}.w40{width:40%}.w50{width:50%}
.w60{width:60%}.w70{width:70%}.w80{width:80%}.w90{width:90%}.w100{width:100%}
.table-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 12px 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }

.bulkbar {
  position: fixed; left: calc(var(--sidebar) + 50%); bottom: 24px; transform: translate(-50%, 16px);
  display: flex; align-items: center; gap: 14px; padding: 8px 8px 8px 16px; border-radius: 12px;
  background: var(--text); color: var(--surface); box-shadow: var(--shadow-lg);
  opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s; z-index: 20;
}
.bulkbar.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.bulkbar .btn.ghost { color: color-mix(in srgb, var(--surface) 75%, transparent); }
.bulkbar .btn.ghost:hover:not(:disabled) { background-color: color-mix(in srgb, var(--surface) 12%, transparent); color: var(--surface); }
.bulkbar .btn.primary { box-shadow: none; }

/* ------------------------------------------------------------------- wheel */

.wheel-card { padding: 16px 20px 20px; }
.wheel-legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12.5px; color: var(--text-2); }
.wheel-legend span { display: inline-flex; align-items: center; gap: 6px; }
.wheel-wrap { overflow: auto; display: flex; margin-top: 12px; }
.wheel-wrap > svg { margin-inline: auto; flex: none; } /* auto margins collapse on overflow, so every side scrolls into reach */
.wheel text { font: 11.5px var(--font); fill: var(--text-2); cursor: pointer; }
.wheel text:hover { fill: var(--text); font-weight: 600; }
.wheel .spoke { stroke-width: 1; opacity: .35; }
.wheel .ring { fill: none; stroke: var(--line); }
.wheel .hub { fill: var(--surface-2); stroke: var(--line-strong); }
.wheel .hub-label { font: 600 14px var(--font); fill: var(--text); cursor: default; }
.wheel .hub-sub { font: 12px var(--font); fill: var(--muted); cursor: default; }
.wheel .question { stroke: var(--g-question); fill: var(--g-question); }
.wheel .preposition { stroke: var(--g-preposition); fill: var(--g-preposition); }
.wheel .comparison { stroke: var(--g-comparison); fill: var(--g-comparison); }
.wheel .alphabetical { stroke: var(--g-alphabetical); fill: var(--g-alphabetical); }
.wheel .related { stroke: var(--g-related); fill: var(--g-related); }

/* ------------------------------------------- AnswerThePublic keywords view */

.section-switch { display: inline-flex; gap: 2px; padding: 3px; margin-bottom: 18px; border-radius: 10px;
  background: var(--surface-2); border: 1px solid var(--line); }
.section-switch a { padding: 7px 14px; border-radius: 7px; font-weight: 550; font-size: 13.5px; color: var(--muted); }
.section-switch a:hover { color: var(--text); }
.section-switch a.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.atp-summary { margin: 0 0 14px; font-size: 13px; }

/* Keywords Data view: a list in the same style as Blog topics. */
.kw-note { display: inline-block; margin-left: 8px; vertical-align: 1px; font-size: 11px; font-weight: 500;
  padding: 1px 6px; border-radius: 4px; background: var(--sunken); color: var(--muted); white-space: nowrap; }
table.data tr.muted .topic-title { color: var(--muted); }
/* Blogs list: per-row Publish / Remove. */
.col-time { width: 110px; }
.col-acts { width: 1%; white-space: nowrap; text-align: right; }
.row-actions { display: inline-flex; align-items: center; gap: 6px; justify-content: flex-end; }
.btn.icon-only { width: 28px; padding: 0; }
.btn.icon-only .icon { width: 15px; height: 15px; }
@media (max-width: 860px) {
  .col-acts { white-space: normal; }
  .row-actions { flex-wrap: wrap; }
}
.col-rank { width: 52px; }
.best-intro { margin: 0 0 14px; font-size: 13.5px; max-width: 760px; }
.hf-looks { margin: 12px 0; padding-left: 18px; font-size: 13.5px; display: grid; gap: 4px; }
.celeb-person { font-weight: 650; font-size: 15px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.celeb-person + .topic-kw { margin: 2px 0 6px; }
.celeb-person .badge.ok { background: var(--ok-soft, rgba(46, 160, 110, .15)); color: var(--ok); font-size: 11px; }
.topic-more .facts { margin: 0; font-size: 13px; line-height: 1.55; white-space: pre-line; max-width: 760px; }
.more-research { margin-top: 18px; font-size: 13px; }
.rank { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  background: var(--surface-2); color: var(--muted); font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.rank.top { background: var(--accent-soft); color: var(--accent); }
#best-view .topic-title { font-size: 15px; }
#data-view tr.list-divider td { padding: 10px 14px; background: var(--surface-2); color: var(--muted);
  font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
#data-view tr.list-divider:hover { background: transparent; }
#data-view th.hide-sm:nth-child(2) { width: 130px; }
.show-sm, .show-sm-inline { display: none; }
.kw-status-sm { margin-top: 6px; }
.rank-sm { color: var(--accent); }
@media (max-width: 860px) {
  .show-sm { display: block; }
  .show-sm-inline { display: inline; }
  #data-view .col-act { width: 84px; }
}

.atp-wheel .branch { stroke-width: 2; opacity: .55; }
.atp-wheel .twig { fill: none; stroke-width: 1; opacity: .22; }
.atp-wheel .branch.question, .atp-wheel .twig.question { stroke: var(--g-question); }
.atp-wheel .branch.preposition, .atp-wheel .twig.preposition { stroke: var(--g-preposition); }
.atp-wheel .branch.comparison, .atp-wheel .twig.comparison { stroke: var(--g-comparison); }
.atp-wheel .branch.alphabetical, .atp-wheel .twig.alphabetical { stroke: var(--g-alphabetical); }
.atp-wheel .branch.related, .atp-wheel .twig.related { stroke: var(--g-related); }
.atp-wheel .branch-pill { stroke: none; }
.atp-wheel .branch-pill.question { fill: var(--g-question); }
.atp-wheel .branch-pill.preposition { fill: var(--g-preposition); }
.atp-wheel .branch-pill.comparison { fill: var(--g-comparison); }
.atp-wheel .branch-pill.alphabetical { fill: var(--g-alphabetical); }
.atp-wheel .branch-pill.related { fill: var(--g-related); }
.atp-wheel .branch-label { font: 700 11px var(--font); fill: #fff; letter-spacing: .06em; cursor: default; }
:root[data-theme="dark"] .atp-wheel .branch-label { fill: #12110f; }
.atp-wheel text.faded, .atp-wheel circle.faded { opacity: .4; }

/* -------------------------------------------------------------- blog page */

.blog-layout { display: grid; gap: 24px; grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
/* A column never grows past its track for one long word (a slug, a URL, a pasted meta). */
.blog-layout > * { min-width: 0; }
.serp, .checklist .detail { overflow-wrap: anywhere; }
.side-stack { display: grid; gap: 16px; position: sticky; top: 24px; }
.paper { padding: 48px 56px; }
.paper .kicker { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--accent); }
.paper .article-title { font-size: 32px; line-height: 1.2; letter-spacing: -.025em; margin: 10px 0 0; }
.article { font-size: 16px; line-height: 1.75; color: var(--text-2); margin-top: 24px; max-width: 70ch; overflow-x: auto; }
.article > p:first-child { font-size: 17.5px; color: var(--text); }
.article h2 { font-size: 21px; line-height: 1.3; letter-spacing: -.015em; color: var(--text); margin: 36px 0 10px; }
.article h3 { font-size: 17px; color: var(--text); margin: 24px 0 6px; }
.article a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px;
  text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.article ul, .article ol { padding-left: 22px; }
.article li + li { margin-top: 4px; }
.article table { width: 100%; border-collapse: collapse; margin: 18px 0; font-size: 14.5px; }
.article th, .article td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; }
.article th { background: var(--surface-2); color: var(--text); }
.article blockquote { margin: 18px 0; padding: 4px 16px; border-left: 3px solid var(--accent); color: var(--text); }

.serp { padding: 16px 18px; }
.serp .site { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--text-2); }
.serp .favicon { width: 26px; height: 26px; border-radius: 50%; background: var(--surface-2);
  border: 1px solid var(--line); display: grid; place-items: center; font-size: 11px; font-weight: 700; }
.serp .site small { display: block; color: var(--muted); }
.serp .stitle { font-size: 18px; line-height: 1.3; color: #1a0dab; margin: 8px 0 4px; }
.serp .sdesc { font-size: 13.5px; color: var(--text-2); line-height: 1.5; }
:root[data-theme="dark"] .serp .stitle { color: #99c3ff; }

.score { display: flex; align-items: center; gap: 14px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.ring { --p: 0; width: 56px; height: 56px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: conic-gradient(var(--ring-color, var(--accent)) calc(var(--p) * 1%), var(--sunken) 0); }
.ring span { width: 44px; height: 44px; border-radius: 50%; background: var(--surface); display: grid;
  place-items: center; font-weight: 650; font-variant-numeric: tabular-nums; }
.checklist { list-style: none; margin: 0; padding: 6px 0; }
.checklist li { display: grid; grid-template-columns: 20px 1fr; gap: 10px; padding: 9px 20px; }
.checklist .mark { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; margin-top: 1px; }
.checklist .mark .icon { width: 12px; height: 12px; stroke-width: 2.5; }
.checklist .pass .mark { background: var(--ok-soft); color: var(--ok); }
.checklist .fail .mark { background: var(--warn-soft); color: var(--warn); }
.checklist .name { font-weight: 550; font-size: 13.5px; }
.checklist .detail { font-size: 12.5px; color: var(--muted); }

.editor { display: grid; gap: 18px; padding: 20px; margin-bottom: 24px; }

/* ------------------------------------------------------------------ dialog */

dialog.modal {
  width: min(640px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--line);
  border-radius: var(--r-lg); background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg);
}
dialog.modal::backdrop { background: rgba(15, 15, 14, .45); backdrop-filter: blur(2px); }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
  padding: 20px 24px 0; }
.modal-head p { color: var(--muted); margin: 4px 0 0; font-size: 13.5px; }
.modal-body { padding: 20px 24px; display: grid; gap: 18px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 24px;
  border-top: 1px solid var(--line); background: var(--surface-2);
  border-radius: 0 0 var(--r-lg) var(--r-lg); }
.platform-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.platform-pick label {
  display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: var(--r);
  border: 1px solid var(--line-strong); cursor: pointer; font-weight: 550;
}
.platform-pick label small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }
.platform-pick input { position: absolute; opacity: 0; }
.platform-pick input:checked + label { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.platform-pick input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ------------------------------------------------------------------- login */

.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(380px, 100%); padding: 32px; }
.login-card .brand { padding: 0 0 24px; }
.login-card h1 { font-size: 20px; }
.login-card form { display: grid; gap: 16px; margin-top: 20px; }
.login-card .btn { height: 38px; }

/* ------------------------------------------------------------------- toast */

#toast {
  position: fixed; right: 24px; bottom: 24px; z-index: 50; max-width: min(420px, calc(100vw - 48px));
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r);
  background: var(--text); color: var(--surface); box-shadow: var(--shadow-lg); font-size: 13.5px;
  opacity: 0; transform: translateY(8px); pointer-events: none; transition: opacity .18s, transform .18s;
}
#toast.show { opacity: 1; transform: none; }
#toast.bad { background: var(--bad); color: #fff; }
:root[data-theme="dark"] #toast.bad { color: #12110f; }

.skeleton { border-radius: 6px; background: linear-gradient(90deg, var(--surface-2), var(--sunken), var(--surface-2));
  background-size: 200% 100%; animation: shimmer 1.2s ease-in-out infinite; height: 14px; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: .35; } }
@keyframes shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* -------------------------------------------------------------- responsive */

@media (max-width: 1100px) {
  .blog-layout { grid-template-columns: minmax(0, 1fr); }
  .side-stack { position: static; }
  .paper { padding: 32px 28px; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 280px; z-index: 40; transform: translateX(-100%);
    transition: transform .2s; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .mobile-bar { display: flex; align-items: center; gap: 10px; padding: 10px 16px; position: sticky; top: 0;
    z-index: 30; background: var(--surface); border-bottom: 1px solid var(--line); }
  .page { padding: 20px 16px 96px; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .kpi:nth-child(3) { border-left: 0; }
  .kpi:nth-child(n+3) { border-top: 1px solid var(--line); }
  .toolbar .search { width: 100%; }
  .toolbar .left, .toolbar .right { width: 100%; }
  .hide-sm { display: none; }
  .form-grid, .platform-pick { grid-template-columns: 1fr; }
  .bulkbar { left: 50%; }
  table.data td, table.data th { padding: 10px; }
  .paper .article-title { font-size: 26px; }
}

/* ======================================================= experience layer */
/* Warmth, depth and motion on top of the components above. Everything that moves is
   switched off by prefers-reduced-motion (rule near the keyframes). */

/* Ambient glow on its own composited layer: painted once, never repainted on scroll.
   (background-attachment: fixed, a full-screen SVG noise filter and backdrop blur all
   forced a full-page repaint on every scroll frame.) */
body { background: var(--bg); }
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(900px 520px at 85% -10%, var(--glow-a), transparent 60%),
    radial-gradient(700px 480px at -10% 110%, var(--glow-b), transparent 60%);
  transform: translateZ(0); will-change: transform;
}
.app, .login { position: relative; z-index: 1; }
.sidebar { background: var(--surface); }
.mobile-bar { background: var(--surface); }

h1 { font-family: var(--display); font-weight: 600; font-size: 30px; letter-spacing: -.015em;
  font-variation-settings: "opsz" 72, "SOFT" 50; }
.paper .article-title, .empty-state h2, .hero h1 { font-family: var(--display); }
.brand-mark { background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 55%, var(--spark)));
  color: #fff; box-shadow: 0 4px 12px -4px var(--accent); }

/* Page changes: the browser crossfades old and new page (cross-document view transition),
   while the sidebar is matched by name so it stays perfectly still. */
@view-transition { navigation: auto; }
.sidebar { view-transition-name: sidebar; }
.mobile-bar { view-transition-name: mobile-bar; }
html:not(.theme-vt)::view-transition-group(sidebar),
html:not(.theme-vt)::view-transition-group(mobile-bar) { animation: none; }
html:not(.theme-vt)::view-transition-old(sidebar),
html:not(.theme-vt)::view-transition-old(mobile-bar) { animation: none; opacity: 0; }
html:not(.theme-vt)::view-transition-new(sidebar),
html:not(.theme-vt)::view-transition-new(mobile-bar) { animation: none; }
html:not(.theme-vt)::view-transition-old(root) { animation: vt-out .18s ease both; }
html:not(.theme-vt)::view-transition-new(root) { animation: vt-in .26s var(--ease-out) both; }
@keyframes vt-out { to { opacity: 0; } }
@keyframes vt-in { from { opacity: 0; transform: translateY(6px); } }

/* Reserve the sidebar column before JavaScript builds the sidebar, so content never jumps. */
.app::before { content: ""; grid-row: 1; grid-column: 1; position: sticky; top: 0; height: 100vh;
  background: var(--surface); border-right: 1px solid var(--line); }
.app > .sidebar { grid-row: 1; grid-column: 1; }
.app > .main { grid-row: 1; grid-column: 2; }
/* Hold space for what arrives with the data, so the page does not jump when it lands.
   The title block gets a fixed basis: buttons wrap the same way for "Loading…" and a long name. */
.page-head > div:first-child { flex: 1 1 520px; min-width: 0; }
.page-head > .actions { flex: 0 1 auto; }
.meta-row:empty { min-height: 22px; }
.hero .story { min-height: 3em; }
.hero > div:first-child { flex: 1 1 520px; min-width: 0; }
.hero .eyebrow { min-height: 19px; }
/* Pages whose body is built from data stay invisible (but laid out) until the first render,
   then appear in one piece instead of growing section by section. */
.pending { visibility: hidden; animation: unhide 0s 4s forwards; } /* safety net if a script fails */
@keyframes unhide { to { visibility: visible; } }
@media (prefers-reduced-motion: reduce) { .pending { animation: unhide 0s 4s forwards !important; } } /* not motion: keep it */
.arrived { animation: fade .25s ease both; }
.card.kpis:empty { min-height: 93px; }
.tabs:empty { min-height: 38px; }
.chips:empty { min-height: 30px; }
@media (max-width: 860px) {
  .app::before { display: none; }
  .app > .main { grid-column: 1; }
  /* Same idea for the phone top bar. */
  .main::before { content: ""; display: block; height: 53px; border-bottom: 1px solid var(--line);
    background: var(--surface); }
  .main:has(> .mobile-bar)::before { display: none; }
}
.reveal-in { animation: rise .6s var(--ease-out) backwards; animation-delay: calc(var(--i, 0) * 60ms); }

/* Buttons: colour fades on hover (background-color, which animates; a gradient swap would
   snap), a 1px lift, a press-in on click. Disabled buttons and touch screens get no hover. */
.btn { transition: background-color .16s ease, border-color .16s ease, color .16s ease,
  box-shadow .2s ease, transform .16s var(--ease-out); }
.btn.primary { background-color: var(--accent);
  background-image: linear-gradient(180deg, rgba(255, 255, 255, .14), rgba(255, 255, 255, 0));
  box-shadow: 0 1px 0 rgba(255, 255, 255, .22) inset, 0 6px 16px -8px var(--accent); }
@media (hover: hover) {
  .btn:hover:not(:disabled) { background-color: var(--surface-2); border-color: color-mix(in srgb, var(--line-strong) 70%, var(--text)); }
  .btn.primary:hover:not(:disabled) { background-color: var(--accent-hover); border-color: var(--accent-hover);
    transform: translateY(-1px); box-shadow: 0 1px 0 rgba(255, 255, 255, .22) inset, 0 10px 20px -10px var(--accent); }
  .btn.ghost:hover:not(:disabled) { background-color: var(--surface-2); border-color: transparent; color: var(--text); }
  .btn.danger:hover:not(:disabled) { color: var(--bad); border-color: var(--bad); background-color: var(--bad-soft); }
}
.btn:active:not(:disabled) { transform: translateY(0) scale(.97); transition-duration: .06s; }
.btn:disabled { box-shadow: none; }
.switch .knob { transition: transform .35s var(--ease-spring); }
.card { transition: border-color .2s, box-shadow .25s, transform .25s var(--ease-out); }
.site-card:hover, .kpi-card:hover, .draft-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
#toast.show { animation: toast-in .45s var(--ease-spring) both; }

/* ------------------------------------------------------------------- hero */

.hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap;
  margin-bottom: 28px; }
.hero .eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600;
  color: var(--accent); letter-spacing: .02em; }
.hero .eyebrow .pulse-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent);
  animation: beacon 2.4s ease-in-out infinite; }
.hero h1 { font-size: clamp(30px, 3.4vw, 42px); line-height: 1.1; margin: 8px 0 8px; }
.hero h1 .wave { display: inline-block; transform-origin: 70% 70%; animation: wave 2.2s ease-in-out 1s 2; }
.hero .story { max-width: 620px; color: var(--text-2); font-size: 15px; margin: 0; }
.hero .story b { color: var(--text); font-weight: 600; }
.hero .story .hl { color: var(--accent); font-weight: 600; }
.kbd { display: inline-flex; align-items: center; gap: 2px; padding: 1px 6px; border-radius: 5px;
  border: 1px solid var(--line-strong); background: var(--surface); font: 600 11px var(--font); color: var(--muted);
  box-shadow: 0 1px 0 var(--line-strong); }

/* --------------------------------------------------------------- KPI cards */

.kpi-row { display: grid; gap: 14px; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 28px; }
.kpi-card { padding: 16px 18px; display: grid; gap: 10px; }
.kpi-card .top { display: flex; align-items: center; justify-content: space-between; }
.kpi-card .label { font-size: 12.5px; color: var(--muted); font-weight: 550; }
.kpi-card .chip { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); }
.kpi-card.spark .chip { background: var(--spark-soft); color: var(--spark); }
.kpi-card .value { font-family: var(--display); font-size: 34px; font-weight: 600; line-height: 1;
  letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi-card .hint { font-size: 12px; color: var(--muted); }

.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 8px 0 14px; }
.section-title h2 { font-family: var(--display); font-size: 20px; font-weight: 600; }
.section-title .sub { margin: 0; font-size: 13px; }
.mt-section { margin-top: 36px; }

/* -------------------------------------------------------------- site cards */

.site-card { position: relative; overflow: hidden; }
.site-card .top > div { min-width: 0; flex: 1; }
.site-card .url { max-width: none; }
.site-card .pill { flex: none; }
.site-card::before { /* the site's own colour, derived from its name */
  content: ""; position: absolute; inset: 0 0 auto 0; height: 4px;
  background: linear-gradient(90deg, hsl(var(--hue, 160) 55% 45%), hsl(calc(var(--hue, 160) + 40) 70% 55%));
}
.site-card .platform { background: linear-gradient(135deg, hsl(var(--hue, 160) 55% 92%), hsl(calc(var(--hue, 160) + 40) 70% 88%));
  color: hsl(var(--hue, 160) 50% 28%); border: 0; font-family: var(--display); font-size: 16px; }
:root[data-theme="dark"] .site-card .platform {
  background: linear-gradient(135deg, hsl(var(--hue, 160) 35% 22%), hsl(calc(var(--hue, 160) + 40) 40% 18%));
  color: hsl(var(--hue, 160) 60% 75%);
}
.theme-switch { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; padding: 3px; margin-bottom: 8px;
  border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); }
.theme-switch button { display: inline-flex; align-items: center; justify-content: center; gap: 5px; height: 28px;
  border: 0; border-radius: 7px; background: none; color: var(--muted); font: 500 12px var(--font); cursor: pointer;
  transition: background .2s, color .2s; }
.theme-switch button:hover { color: var(--text); }
.theme-switch button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.theme-switch button .icon { width: 14px; height: 14px; }
.theme-switch.floating { position: fixed; top: 16px; right: 16px; z-index: 5; margin: 0; width: 230px;
  background: color-mix(in srgb, var(--surface-2) 85%, transparent); backdrop-filter: blur(10px); }
html.theme-switching, html.theme-switching *, html.theme-switching *::before, html.theme-switching *::after {
  transition: none !important; }
/* Theme switch: a plain crossfade (no slide), overriding the page-change animation. */
html.theme-vt::view-transition-old(*), html.theme-vt::view-transition-new(*) {
  animation-duration: .28s; animation-timing-function: ease; }
.site-card .progress { height: 3px; margin: 0 18px; border-radius: 2px; overflow: hidden; background: var(--sunken); }
.site-card .progress span { display: block; height: 100%; width: 40%; border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent); animation: sweep 1.4s ease-in-out infinite; }
.site-card .stat b { font-family: var(--display); font-size: 20px; }

/* ----------------------------------------------------------- recent drafts */

.drafts { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.draft-card { display: flex; flex-direction: column; overflow: hidden; }
.draft-card .thumb { aspect-ratio: 16 / 9; background: var(--sunken); overflow: hidden; position: relative; }
.draft-card .thumb img { width: 100%; height: 100%; object-fit: cover; display: block;
  transition: transform .6s var(--ease-out); }
.draft-card:hover .thumb img { transform: scale(1.04); }
.draft-card .thumb .placeholder { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted);
  background: linear-gradient(135deg, var(--surface-2), var(--sunken)); }
.draft-card .thumb .placeholder .icon { width: 28px; height: 28px; }
.draft-card .thumb .pill { position: absolute; top: 10px; left: 10px; backdrop-filter: blur(8px); }
.draft-card .body { padding: 12px 14px 14px; display: grid; gap: 4px; }
.draft-card .body .t { font-weight: 600; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden; }
.draft-card .body .m { font-size: 12px; color: var(--muted); }

/* --------------------------------------------------------- command palette */

dialog.palette { width: min(620px, calc(100vw - 32px)); margin-top: 12vh; padding: 0; border: 1px solid var(--line);
  border-radius: 16px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); overflow: hidden; }
dialog.palette[open] { animation: pop .28s var(--ease-spring) both; }
dialog.palette::backdrop { background: rgba(15, 14, 12, .4); backdrop-filter: blur(3px); }
.palette .search-row { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.palette .search-row .icon { width: 18px; height: 18px; color: var(--muted); }
.palette input { flex: 1; border: 0; outline: 0; background: none; color: var(--text); font: 16px var(--font); }
.palette ul { list-style: none; margin: 0; padding: 6px; max-height: 360px; overflow-y: auto; }
.palette .group { padding: 10px 10px 4px; font-size: 11px; font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; color: var(--muted); }
.palette .item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px; cursor: pointer; }
.palette .item .icon { color: var(--muted); }
.palette .item .hint { margin-left: auto; font-size: 12px; color: var(--muted); }
.palette .item.active { background: var(--accent-soft); color: var(--accent); }
.palette .item.active .icon { color: var(--accent); }
.palette .none { padding: 24px; text-align: center; color: var(--muted); }
.palette footer { display: flex; gap: 14px; padding: 9px 16px; border-top: 1px solid var(--line); font-size: 12px;
  color: var(--muted); background: var(--surface-2); }
.palette-trigger { display: flex; align-items: center; gap: 8px; width: 100%; margin: 4px 0 8px; padding: 8px 10px;
  border-radius: 9px; border: 1px solid var(--line); background: var(--surface-2); color: var(--muted);
  font: 13px var(--font); cursor: pointer; transition: border-color .15s; }
.palette-trigger:hover { border-color: var(--line-strong); color: var(--text-2); }
.palette-trigger .kbd { margin-left: auto; }

/* ------------------------------------------------------------- user chip */

.user-chip { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px; }
.user-chip .avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: none;
  font-weight: 700; font-size: 13px; color: #fff;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 40%, var(--spark))); }
.user-chip .who { min-width: 0; line-height: 1.25; }
.user-chip .who b { display: block; font-size: 13px; }
.user-chip .who span { display: block; font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip .btn { margin-left: auto; }

/* ------------------------------------------------------------ login page */

.login { grid-template-columns: minmax(0, 1.1fr) minmax(360px, .9fr); display: grid; place-items: stretch; padding: 0; }
.login-art { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end;
  padding: 48px; color: #f4efe6; background:
    radial-gradient(600px 400px at 20% 20%, rgba(240, 162, 77, .35), transparent 60%),
    radial-gradient(700px 500px at 90% 80%, rgba(69, 184, 156, .45), transparent 60%),
    #0f1a17; }
.login-art svg.orbit { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .9; }
.login-art .orbit text { font: 13px var(--font); fill: rgba(244, 239, 230, .75); }
.login-art .orbit .ring { fill: none; stroke: rgba(244, 239, 230, .12); }
.login-art .orbit .spin-slow { transform-origin: center; transform-box: view-box; animation: spin 140s linear infinite; }
.login-art .orbit .spin-rev { transform-origin: center; transform-box: view-box; animation: spin 200s linear infinite reverse; }
.login-art::after { content: ""; position: absolute; inset: auto 0 0 0; height: 58%; z-index: 1;
  background: linear-gradient(transparent, rgba(12, 22, 19, .94) 70%); }
.login-art blockquote, .login-art p { z-index: 2; }
.login-art blockquote { position: relative; margin: 0; max-width: 460px; font-family: var(--display);
  font-size: 30px; line-height: 1.2; font-weight: 500; }
.login-art p { position: relative; margin: 14px 0 0; color: rgba(244, 239, 230, .7); max-width: 420px; }
.login-side { display: grid; place-items: center; padding: 32px 24px; }
.login-card { box-shadow: var(--shadow); animation: rise .7s var(--ease-out) both; }
.login-card h1 { font-size: 28px; }

/* ------------------------------------------------------ keywords + blog */

/* The wheel grows only when its seed or group changes (class .grow), not on every poll
   or search keystroke. Fill mode "backwards" means it is fully visible without animation. */
.atp-wheel.grow .twig, .atp-wheel.grow .branch { stroke-dasharray: 900;
  animation: draw 1s var(--ease-out) backwards; animation-delay: var(--d, 0ms); }
.atp-wheel.grow text, .atp-wheel.grow circle:not(.hub) { animation: fade .5s ease backwards;
  animation-delay: calc(var(--d, 0ms) + 350ms); }
.atp-wheel .hub, .atp-wheel .hub-label, .atp-wheel .hub-sub { animation: none; }
.read-progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 60; transform-origin: 0 50%;
  transform: scaleX(var(--p, 0)); background: linear-gradient(90deg, var(--accent), var(--spark)); }
.featured img { animation: fade .8s ease both; }

@keyframes page-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes rise { from { opacity: 0; transform: translateY(12px) scale(.99); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } }
@keyframes draw { from { stroke-dashoffset: 900; } }
@keyframes sweep { from { transform: translateX(-100%); } to { transform: translateX(260%); } }
@keyframes beacon { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .45; transform: scale(.8); } }
@keyframes wave { 0%, 60%, 100% { transform: rotate(0); } 15%, 45% { transform: rotate(14deg); } 30% { transform: rotate(-8deg); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(14px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: translateY(-8px) scale(.97); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .atp-wheel .twig, .atp-wheel .branch { stroke-dashoffset: 0; }
  .atp-wheel text, .atp-wheel circle { opacity: 1; }
  .read-progress { display: none; }
}

@media (max-width: 1100px) {
  .kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .login { grid-template-columns: 1fr; }
  .login-art { min-height: 260px; padding: 28px; }
  .login-art blockquote { font-size: 22px; }
}
@media (max-width: 860px) {
  .hero h1 { font-size: 28px; }
  .kpi-card .value { font-size: 28px; }
  .kpi-row { gap: 10px; }
  .kpi-card { padding: 14px; }
  .section-title { flex-direction: column; align-items: flex-start; gap: 2px; }
  .theme-switch.floating { top: auto; bottom: 16px; right: 16px; }
}
