/* =============================================================
   1. Tokens
   ============================================================= */
:root {
  --bg: #0a0d13;
  --bg-elevated: #12161f;
  --bg-elevated-2: #171c28;
  --border: #242b3a;
  --border-soft: #1a2029;
  --text: #e8ebf2;
  --text-dim: #9aa4b8;
  --text-faint: #626c82;
  --accent: #4f8cff;
  --accent-dim: #2a5cc9;
  --accent-soft: rgba(79, 140, 255, 0.12);
  --ok: #22c55e;
  --ok-soft: rgba(34, 197, 94, 0.14);
  --warn: #f59e0b;
  --warn-soft: rgba(245, 158, 11, 0.14);
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.14);
  --oos: #a855f7;
  --oos-soft: rgba(168, 85, 247, 0.14);
  --amazon: #ff9900;
  --sans: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --radius: 14px;
  --radius-sm: 8px;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --header-h: 64px;
}

/* =============================================================
   2. Reset & base
   ============================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; tab-size: 2; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}
img, svg, video { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
a { color: inherit; text-decoration: none; }
p { text-wrap: pretty; }
h1, h2, h3, h4 { text-wrap: balance; line-height: 1.15; letter-spacing: -0.01em; font-weight: 800; }
code { font-family: var(--mono); background: var(--bg-elevated-2); padding: .1em .4em; border-radius: 4px; font-size: 0.9em; }
::selection { background: var(--accent); color: #05070c; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.skip-link {
  position: fixed; top: -100px; left: 1rem;
  padding: .6rem 1rem; background: var(--accent); color: #05070c;
  z-index: 9999; border-radius: 8px; font-weight: 700;
  transition: top .2s var(--ease-out);
}
.skip-link:focus { top: 1rem; }

/* =============================================================
   3. Utilities
   ============================================================= */
.container { width: 100%; max-width: 1080px; margin-inline: auto; padding-inline: 1.25rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* =============================================================
   4. Header
   ============================================================= */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: rgba(10, 13, 19, 0.85);
  backdrop-filter: blur(10px) saturate(140%);
  -webkit-backdrop-filter: blur(10px) saturate(140%);
  border-bottom: 1px solid var(--border-soft);
}
@supports not (backdrop-filter: blur(1px)) { .site-header { background: var(--bg); } }
.header-row { display: flex; align-items: center; justify-content: space-between; height: var(--header-h); }
.brand { display: flex; align-items: center; gap: .5rem; font-weight: 800; font-size: 1.15rem; color: var(--text); }
.brand svg { color: var(--accent); }
.header-nav { display: none; gap: 1.75rem; font-weight: 600; font-size: 0.92rem; color: var(--text-dim); }
.header-nav a:hover { color: var(--text); }
@media (min-width: 720px) { .header-nav { display: flex; } }

/* =============================================================
   5. Hero + tool
   ============================================================= */
.hero { padding-block: 2.75rem 1.5rem; text-align: center; }
.eyebrow {
  display: inline-block; font-size: 0.8rem; font-weight: 700; letter-spacing: .04em;
  color: var(--accent); text-transform: uppercase; margin-bottom: .9rem;
}
.hero h1 {
  font-size: clamp(1.9rem, 4.4vw, 2.9rem);
  max-width: 20ch; margin-inline: auto;
}
.hero-sub {
  max-width: 62ch; margin: 1rem auto 0; color: var(--text-dim); font-size: 1.05rem;
}

.tool-card {
  margin: 2.25rem auto 0; max-width: 880px; text-align: left;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.5rem;
}
@media (min-width: 720px) { .tool-card { padding: 2rem; } }

.field-label { display: block; font-size: 0.85rem; font-weight: 700; color: var(--text-dim); margin-bottom: .5rem; }
.input-row { display: flex; flex-direction: column; gap: .6rem; }
@media (min-width: 640px) { .input-row { flex-direction: row; } }
#scanUrl {
  flex: 1; min-width: 0; background: var(--bg); border: 1px solid var(--border);
  color: var(--text); border-radius: var(--radius-sm); padding: .85rem 1rem;
  font-size: 1rem; font-family: var(--mono);
  transition: border-color .15s var(--ease-out);
}
#scanUrl:focus { border-color: var(--accent); }
#scanUrl::placeholder { color: var(--text-faint); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .85rem 1.4rem; border-radius: var(--radius-sm); font-weight: 700; font-size: 0.98rem;
  transition: transform .15s var(--ease-out), background .15s var(--ease-out), opacity .15s;
  white-space: nowrap;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--accent); color: #05070c; }
.btn-primary:hover { background: #6ba0ff; }
.btn-primary:disabled { opacity: .6; cursor: progress; }
.btn-secondary { background: var(--bg-elevated-2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--accent); }

.input-meta { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: .9rem; flex-wrap: wrap; }
.checkbox-inline { display: flex; align-items: center; gap: .45rem; font-size: 0.88rem; color: var(--text-dim); }
.checkbox-inline input { accent-color: var(--accent); width: 16px; height: 16px; }
.link-btn { color: var(--accent); font-weight: 600; font-size: 0.88rem; }
.link-btn:hover { text-decoration: underline; }

/* progress */
.tool-progress { margin-top: 1.5rem; }
.progress-track { height: 8px; border-radius: 99px; background: var(--bg-elevated-2); overflow: hidden; }
.progress-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--accent), #8ab4ff); transition: width .3s var(--ease-out); border-radius: 99px; }
.progress-label { margin-top: .6rem; font-size: 0.88rem; color: var(--text-dim); font-family: var(--mono); }

.tool-error { margin-top: 1.5rem; padding: 1rem 1.1rem; border-radius: var(--radius-sm); background: var(--danger-soft); border: 1px solid rgba(239,68,68,.35); display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.tool-error p { color: #ffb4b4; font-size: 0.92rem; }

/* results */
.tool-results { margin-top: 1.75rem; }
.health-row { display: grid; gap: 1.25rem; align-items: center; grid-template-columns: 1fr; margin-bottom: 1.25rem; }
@media (min-width: 720px) { .health-row { grid-template-columns: auto 1fr; } }

.health-score { display: flex; align-items: center; gap: 1rem; }
.health-ring { width: 84px; height: 84px; transform: rotate(-90deg); flex-shrink: 0; }
.health-ring-bg { fill: none; stroke: var(--bg-elevated-2); stroke-width: 10; }
.health-ring-fg { fill: none; stroke: var(--ok); stroke-width: 10; stroke-linecap: round; stroke-dasharray: 326.7; stroke-dashoffset: 326.7; transition: stroke-dashoffset .6s var(--ease-out), stroke .3s; }
.health-score-num { font-family: var(--mono); }
.health-score-num span { font-size: 1.9rem; font-weight: 800; }
.health-score-num small { font-size: 1.1rem; color: var(--text-dim); }
.health-score-num p { font-size: 0.78rem; color: var(--text-dim); margin-top: .1rem; font-family: var(--sans); }

.health-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: .6rem; }
@media (min-width: 540px) { .health-stats { grid-template-columns: repeat(5, 1fr); } }
.stat { background: var(--bg-elevated-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .6rem .5rem; text-align: center; }
.stat span { display: block; font-family: var(--mono); font-size: 1.25rem; font-weight: 700; }
.stat small { color: var(--text-dim); font-size: 0.72rem; text-transform: uppercase; letter-spacing: .03em; }
.stat-ok span { color: var(--ok); }
.stat-broken span { color: var(--danger); }
.stat-redirect span { color: var(--warn); }
.stat-oos span { color: var(--oos); }
.stat-amazon span { color: var(--amazon); }
.health-source { grid-column: 1 / -1; font-size: 0.78rem; color: var(--text-faint); }

.filters { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.filter-chip {
  padding: .4rem .8rem; border-radius: 99px; font-size: 0.82rem; font-weight: 600;
  background: var(--bg-elevated-2); border: 1px solid var(--border); color: var(--text-dim);
  transition: border-color .15s var(--ease-out), color .15s;
  display: inline-flex; align-items: center; gap: .4rem;
}
.filter-chip em { font-style: normal; font-family: var(--mono); opacity: .75; }
.filter-chip:hover { color: var(--text); }
.filter-chip.is-active { color: var(--text); border-color: var(--accent); background: var(--accent-soft); }
.filter-chip.filter-broken.is-active { border-color: var(--danger); background: var(--danger-soft); }
.filter-chip.filter-redirect.is-active { border-color: var(--warn); background: var(--warn-soft); }
.filter-chip.filter-oos.is-active { border-color: var(--oos); background: var(--oos-soft); }
.filter-chip.filter-amazon.is-active { border-color: var(--amazon); background: rgba(255,153,0,.12); }
.filter-chip.filter-ok.is-active { border-color: var(--ok); background: var(--ok-soft); }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.results-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; min-width: 640px; }
.results-table thead th {
  text-align: left; font-size: 0.72rem; text-transform: uppercase; letter-spacing: .04em;
  color: var(--text-faint); padding: .7rem .9rem; border-bottom: 1px solid var(--border);
  background: var(--bg-elevated-2); position: sticky; top: 0;
}
.results-table tbody td { padding: .65rem .9rem; border-bottom: 1px solid var(--border-soft); vertical-align: top; }
.results-table tbody tr:last-child td { border-bottom: none; }
.results-table tbody tr.is-hidden { display: none; }
.results-table .cell-page { max-width: 260px; }
.results-table .cell-page .page-title { font-weight: 600; display: block; }
.results-table .cell-page .page-url { color: var(--text-faint); font-size: 0.78rem; font-family: var(--mono); word-break: break-all; }
.results-table .cell-link { max-width: 300px; }
.results-table .cell-link a { font-family: var(--mono); font-size: 0.82rem; color: var(--accent); word-break: break-all; }
.results-table .cell-link a:hover { text-decoration: underline; }
.results-table .cell-code { font-family: var(--mono); color: var(--text-dim); white-space: nowrap; }
.results-table .cell-open a { color: var(--text-faint); }
.results-table .cell-open a:hover { color: var(--accent); }

.status-pill { display: inline-flex; align-items: center; gap: .4rem; font-size: 0.78rem; font-weight: 700; padding: .3rem .6rem; border-radius: 99px; white-space: nowrap; }
.status-pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.status-ok { color: var(--ok); background: var(--ok-soft); }
.status-broken { color: var(--danger); background: var(--danger-soft); }
.status-redirect { color: var(--warn); background: var(--warn-soft); }
.status-oos { color: var(--oos); background: var(--oos-soft); }
.status-unknown { color: var(--text-faint); background: var(--bg-elevated-2); }

.type-badge { font-size: 0.75rem; font-weight: 700; padding: .22rem .5rem; border-radius: 6px; white-space: nowrap; }
.type-amazon { color: var(--amazon); background: rgba(255,153,0,.12); }
.type-outbound { color: var(--text-dim); background: var(--bg-elevated-2); }

.results-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 1.25rem; }
.results-note { font-size: 0.85rem; color: var(--text-faint); }

.privacy-badge { margin-top: 1.5rem; font-size: 0.85rem; color: var(--text-dim); }
.limits-note { margin-top: .5rem; font-size: 0.8rem; color: var(--text-faint); }

/* =============================================================
   6. Ad slots
   ============================================================= */
.ad-slot {
  position: relative; display: flex; align-items: center; justify-content: center;
  min-height: 90px; border: 1px dashed var(--border); border-radius: var(--radius-sm);
  background: var(--bg-elevated); color: var(--text-faint);
  margin-block: 1.5rem; text-align: center; font-size: 0.85rem;
}
.ad-slot-label {
  position: absolute; top: .5rem; left: .7rem; font-size: 0.65rem; font-weight: 800;
  letter-spacing: .08em; color: var(--text-faint); text-transform: uppercase;
}
.ad-slot-leaderboard { min-height: 100px; }
.ad-slot-incontent { min-height: 120px; }

.corner-ad {
  position: fixed; right: 1rem; bottom: 1rem; z-index: 50;
  width: 220px; padding: .9rem 1rem 1rem; border-radius: var(--radius-sm);
  background: var(--bg-elevated); border: 1px solid var(--border);
  box-shadow: 0 10px 30px rgba(0,0,0,.4);
  animation: cornerIn .3s var(--ease-out);
}
@keyframes cornerIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.corner-ad p { font-size: 0.82rem; color: var(--text-faint); margin-top: .3rem; }
.corner-ad-close {
  position: absolute; top: .4rem; right: .5rem; width: 22px; height: 22px;
  border-radius: 50%; color: var(--text-dim); font-size: 1.1rem; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.corner-ad-close:hover { background: var(--bg-elevated-2); color: var(--text); }

.export-dialog {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg-elevated); color: var(--text);
  width: min(420px, 90vw); padding: 1.5rem; position: relative;
}
.export-dialog::backdrop { background: rgba(4,6,10,.7); backdrop-filter: blur(2px); }
.export-dialog-close {
  position: absolute; top: .7rem; right: .8rem; width: 28px; height: 28px; border-radius: 50%;
  color: var(--text-dim); font-size: 1.3rem; line-height: 1; display: flex; align-items: center; justify-content: center;
}
.export-dialog-close:hover { background: var(--bg-elevated-2); color: var(--text); }
.export-dialog-body { min-height: 140px; display: flex; align-items: center; justify-content: center; border: 1px dashed var(--border); border-radius: var(--radius-sm); margin-block: 1rem; color: var(--text-faint); }
.export-dialog-cta { width: 100%; }

/* =============================================================
   7. Content sections
   ============================================================= */
.section { padding-block: 3rem; }
.section-alt { background: var(--bg-elevated); border-top: 1px solid var(--border-soft); border-bottom: 1px solid var(--border-soft); }
.section h2 { font-size: clamp(1.5rem, 3vw, 2rem); text-align: center; margin-bottom: 2rem; }

.steps-grid { display: grid; gap: 1.25rem; grid-template-columns: 1fr; }
@media (min-width: 720px) { .steps-grid { grid-template-columns: repeat(3, 1fr); } }
.step-card { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; position: relative; }
.section-alt .step-card { background: var(--bg); }
.step-num {
  position: absolute; top: 1.1rem; right: 1.2rem; font-family: var(--mono); font-weight: 800;
  font-size: 1.6rem; color: var(--border); line-height: 1;
}
.step-card svg { color: var(--accent); margin-bottom: .9rem; width: 28px; height: 28px; }
.step-card h3 { font-size: 1.1rem; margin-bottom: .5rem; }
.step-card p { color: var(--text-dim); font-size: 0.92rem; }

.prose { max-width: 760px; }
.prose h2 { text-align: left; }
.prose p { color: var(--text-dim); margin-bottom: 1.1rem; }
.prose strong { color: var(--text); }

.usecases-grid { display: grid; gap: 1.1rem; grid-template-columns: 1fr; }
@media (min-width: 640px) { .usecases-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 960px) { .usecases-grid { grid-template-columns: repeat(3, 1fr); } }
.usecase-card { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.3rem; }
.usecase-card svg { color: var(--accent); width: 24px; height: 24px; margin-bottom: .8rem; }
.usecase-card h3 { font-size: 1.02rem; margin-bottom: .4rem; }
.usecase-card p { color: var(--text-dim); font-size: 0.88rem; }

.faq-list { display: flex; flex-direction: column; gap: .7rem; }
.faq-list details {
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 1rem 1.1rem;
}
.faq-list summary { font-weight: 700; cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.faq-list summary::-webkit-details-marker { display: none; }
.faq-list summary::after { content: "+"; font-size: 1.3rem; color: var(--accent); flex-shrink: 0; }
.faq-list details[open] summary::after { content: "–"; }
.faq-list p { margin-top: .7rem; color: var(--text-dim); font-size: 0.92rem; }

/* =============================================================
   8. Footer
   ============================================================= */
.site-footer { border-top: 1px solid var(--border-soft); padding-block: 1.75rem; }
.footer-row { display: flex; flex-direction: column; gap: .75rem; align-items: center; text-align: center; font-size: 0.85rem; color: var(--text-faint); }
@media (min-width: 640px) { .footer-row { flex-direction: row; justify-content: space-between; } }
.footer-row nav { display: flex; gap: 1.25rem; }
.footer-row nav a:hover { color: var(--text-dim); }

/* =============================================================
   9. Reduced motion — intrusive only
   ============================================================= */
@media (prefers-reduced-motion: reduce) {
  .corner-ad { animation: none; }
}

/* =============================================================
   10. Legal skeleton pages
   ============================================================= */
.legal-page { max-width: 720px; margin: 0 auto; padding: 3rem 1.25rem 4rem; }
.legal-page h1 { font-size: 1.8rem; margin-bottom: 1.25rem; }
.legal-page h2 { font-size: 1.15rem; margin: 1.75rem 0 .6rem; }
.legal-page p, .legal-page li { color: var(--text-dim); font-size: 0.95rem; margin-bottom: .8rem; }
.legal-page a { color: var(--accent); }
