/* SEO Analysis — public tool. Theme follows html[data-theme] like the rest of
   davefrassoni.com. */

:root {
  --ink: #15191e;
  --muted: #5b6470;
  --paper: #f3f4f1;
  --panel: #ffffff;
  --panel-2: #f7f8f6;
  --line: rgba(20, 24, 30, 0.12);
  --accent: #0f766e;
  --accent-ink: #ffffff;
  --accent-soft: #d8efec;
  --pass: #15803d;
  --pass-soft: #dcf3e3;
  --warn: #b45309;
  --warn-soft: #fdf0d9;
  --fail: #c2410c;
  --fail-soft: #fde4d8;
  --info: #475569;
  --info-soft: #e7ebf0;
  --content: 1080px;
  --gutter: clamp(1rem, 4vw, 2.5rem);
  --radius: 14px;
}

html[data-theme="dark"] {
  --ink: #eceff3;
  --muted: #9aa4b0;
  --paper: #0d1114;
  --panel: #151a1f;
  --panel-2: #1b2127;
  --line: rgba(255, 255, 255, 0.11);
  --accent: #2dd4bf;
  --accent-ink: #062320;
  --accent-soft: #123532;
  --pass: #4ade80;
  --pass-soft: #12301d;
  --warn: #fbbf24;
  --warn-soft: #36290d;
  --fail: #fb923c;
  --fail-soft: #3a1d10;
  --info: #a5b4c6;
  --info-soft: #222a33;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: "Manrope", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); }
h1, h2, h3 { line-height: 1.15; letter-spacing: -0.02em; margin: 0; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.wrap {
  width: min(100%, calc(var(--content) + var(--gutter) * 2));
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* ---- chrome ------------------------------------------------------------ */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--ink);
  font-weight: 800;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 9px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 0.8rem;
}

.theme-toggle {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  border-radius: 999px;
  width: 2.3rem;
  height: 2.3rem;
  cursor: pointer;
}

.footer {
  margin: 3rem 0 2rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.85rem;
}

.eyebrow {
  margin: 0 0 0.4rem;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hint { color: var(--muted); font-size: 0.88rem; margin: 0.5rem 0 0; }
.notice { padding: 0.8rem 1rem; border-radius: 10px; background: var(--warn-soft); color: var(--warn); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 2.9rem;
  padding: 0 1.3rem;
  border-radius: 10px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink); }

/* ---- start form -------------------------------------------------------- */

.hero { padding: clamp(2rem, 6vw, 4rem) 0 1rem; }
.hero h1 { font-size: clamp(2rem, 5vw, 3.2rem); font-weight: 800; }
.lead { max-width: 44rem; color: var(--muted); font-size: 1.08rem; margin: 0.9rem 0 1.6rem; }

.audit-form {
  padding: 1.2rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.url-row { display: flex; gap: 0.6rem; flex-wrap: wrap; }

.url-row input {
  flex: 1 1 18rem;
  min-width: 0;
  min-height: 2.9rem;
  padding: 0 0.9rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-2);
  color: var(--ink);
  font: inherit;
}

.url-row input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.captcha-row { margin-top: 1rem; }
.captcha-row .g-recaptcha { max-width: 100%; overflow: hidden; }
.form-error { margin: 0.8rem 0 0; color: var(--fail); font-weight: 600; }

.batch-preview {
  list-style: none;
  padding: 0;
  margin: 1.6rem 0 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 0.8rem;
}

.batch-chip {
  display: grid;
  gap: 0.15rem;
  padding: 0.9rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  border-top: 4px solid var(--accent);
  background: var(--panel);
}

.batch-chip strong { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.batch-chip span { font-weight: 800; }
.batch-chip small { color: var(--muted); }
.batch-critical { border-top-color: var(--fail); }
.batch-high { border-top-color: var(--warn); }
.batch-medium { border-top-color: var(--accent); }
.batch-ai { border-top-color: #7c3aed; }

/* ---- progress ---------------------------------------------------------- */

.panel {
  margin-top: 2rem;
  padding: clamp(1.1rem, 3vw, 1.8rem);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.target-url { font-size: 1.15rem; overflow-wrap: anywhere; }

.progress {
  height: 0.55rem;
  margin: 1.1rem 0;
  border-radius: 999px;
  background: var(--panel-2);
  overflow: hidden;
}

.progress-bar { height: 100%; width: 0; background: var(--accent); transition: width 0.4s ease; }

.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }

.step {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0.9rem;
  border-radius: 10px;
  background: var(--panel-2);
}

.step-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 50%;
  background: var(--info-soft);
  color: var(--info);
  font-size: 0.85rem;
  font-weight: 800;
}

.step.done .step-icon { background: var(--pass-soft); color: var(--pass); }
.step.running .step-icon { background: var(--accent-soft); color: var(--accent); animation: pulse 1.2s ease-in-out infinite; }
.step.skipped { opacity: 0.55; }
.step small { display: block; color: var(--muted); }

@keyframes pulse { 50% { transform: scale(0.85); } }

.failed h2 { color: var(--fail); margin-bottom: 0.5rem; }

/* ---- report: insights -------------------------------------------------- */

.insights {
  margin-top: 2rem;
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 1rem;
}

.card {
  grid-column: span 12;
  padding: clamp(1rem, 2.5vw, 1.5rem);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  min-width: 0;
}

.card h3 { font-size: 1rem; margin-bottom: 0.8rem; }
.card-half { grid-column: span 6; }

.overview { display: flex; flex-wrap: wrap; align-items: center; gap: 1.5rem; }

.score-ring {
  --value: 0;
  --tone: var(--accent);
  flex: none;
  display: grid;
  place-items: center;
  width: 8.5rem;
  height: 8.5rem;
  border-radius: 50%;
  background: conic-gradient(var(--tone) calc(var(--value) * 1%), var(--panel-2) 0);
}

.score-ring > div {
  display: grid;
  place-items: center;
  width: 6.8rem;
  height: 6.8rem;
  border-radius: 50%;
  background: var(--panel);
  text-align: center;
  line-height: 1.05;
}

.score-ring b { font-size: 2.2rem; }
.score-ring span { color: var(--muted); font-size: 0.8rem; font-weight: 700; }

.overview-copy { flex: 1 1 18rem; min-width: 0; }
.overview-copy h2 { font-size: clamp(1.3rem, 3vw, 1.7rem); margin-bottom: 0.4rem; }
.overview-copy .target { color: var(--muted); overflow-wrap: anywhere; margin: 0 0 0.8rem; }

.counts { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.count {
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
}

.tone-pass { background: var(--pass-soft); color: var(--pass); }
.tone-warn { background: var(--warn-soft); color: var(--warn); }
.tone-fail { background: var(--fail-soft); color: var(--fail); }
.tone-info, .tone-error { background: var(--info-soft); color: var(--info); }

.ai-card { border-color: color-mix(in srgb, #7c3aed 35%, var(--line)); }
.ai-tag { display: inline-block; margin-left: 0.4rem; padding: 0.05rem 0.45rem; border-radius: 6px; background: #7c3aed; color: #fff; font-size: 0.7rem; vertical-align: middle; }
.ai-summary { margin: 0 0 0.8rem; font-size: 1.02rem; }
.meta-line { display: flex; flex-wrap: wrap; gap: 0.4rem 1.2rem; color: var(--muted); font-size: 0.9rem; }
.meta-line b { color: var(--ink); }

.issue-list, .action-list, .plain-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 0.55rem; }

.issue {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.2rem 0.7rem;
  align-items: start;
}

.issue a { color: var(--ink); font-weight: 700; text-decoration: none; }
.issue a:hover { text-decoration: underline; }
.issue p { grid-column: 2; margin: 0; color: var(--muted); font-size: 0.9rem; }

.badge {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.action { display: flex; gap: 0.7rem; align-items: baseline; }
.action-n { flex: none; display: grid; place-items: center; width: 1.6rem; height: 1.6rem; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 800; font-size: 0.8rem; }
.action small { display: block; color: var(--muted); }

.serp {
  padding: 1rem;
  border-radius: 10px;
  background: var(--panel-2);
  font-family: Arial, Helvetica, sans-serif;
  overflow-wrap: anywhere;
}

.serp-url { color: var(--muted); font-size: 0.8rem; }
.serp-title { color: #1a0dab; font-size: 1.15rem; margin: 0.15rem 0; }
html[data-theme="dark"] .serp-title { color: #8ab4f8; }
.serp-desc { color: var(--muted); font-size: 0.88rem; }

.batch-bars { display: grid; gap: 0.7rem; }
.batch-bar { display: grid; grid-template-columns: minmax(8rem, 12rem) 1fr auto; gap: 0.7rem; align-items: center; font-size: 0.9rem; }
.batch-bar .track { height: 0.5rem; border-radius: 999px; background: var(--panel-2); overflow: hidden; }
.batch-bar .fill { height: 100%; background: var(--accent); }
.strengths { display: flex; flex-wrap: wrap; gap: 0.4rem; }

/* ---- report: batches --------------------------------------------------- */

.batch { margin-top: 2.2rem; }

.batch-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.9rem;
  padding-bottom: 0.7rem;
  border-bottom: 2px solid var(--line);
}

.batch-head h2 { font-size: 1.35rem; }
.batch-head p { margin: 0.2rem 0 0; color: var(--muted); }
.batch-score { font-weight: 800; font-size: 1.1rem; }

.results { display: grid; gap: 0.55rem; }

.result {
  border: 1px solid var(--line);
  border-left: 4px solid var(--info);
  border-radius: 10px;
  background: var(--panel);
  scroll-margin-top: 1rem;
}

.result.s-pass { border-left-color: var(--pass); }
.result.s-warn { border-left-color: var(--warn); }
.result.s-fail { border-left-color: var(--fail); }

.result summary {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.2rem 0.8rem;
  align-items: center;
  padding: 0.8rem 1rem;
  cursor: pointer;
  list-style: none;
}

.result summary::-webkit-details-marker { display: none; }
.result summary .name { font-weight: 700; }
.result summary .impact { color: var(--muted); font-size: 0.78rem; white-space: nowrap; }
.result summary .line { grid-column: 2 / 4; color: var(--muted); font-size: 0.92rem; }
.result[open] summary { border-bottom: 1px solid var(--line); }

.result-body { padding: 0.8rem 1rem 1rem; display: grid; gap: 0.6rem; font-size: 0.93rem; }
.result-body p { margin: 0; }
.result-body .fix { padding: 0.6rem 0.8rem; border-radius: 8px; background: var(--accent-soft); }
.result-body ul { margin: 0; padding-left: 1.1rem; color: var(--muted); overflow-wrap: anywhere; }
.result-body code { font-size: 0.85em; }

.report-actions { display: flex; flex-wrap: wrap; gap: 0.7rem; margin-top: 2rem; }

/* ---- nav, history, AI prompt ------------------------------------------- */

.topnav { display: flex; align-items: center; gap: 0.9rem; }
.nav-link { color: var(--ink); font-weight: 700; text-decoration: none; }
.nav-link:hover { color: var(--accent); }

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.8rem;
  margin-bottom: 1rem;
}

.section-head > div { flex: 1 1 18rem; min-width: 0; }
.section-head h2 { font-size: 1.3rem; }
.history { scroll-margin-top: 1rem; }
.history-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }

.history-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.9rem;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-2);
  color: var(--ink);
  text-decoration: none;
}

.history-row:hover { border-color: var(--accent); }

.history-score {
  --tone: var(--info);
  display: grid;
  place-items: center;
  width: 3.1rem;
  height: 3.1rem;
  border-radius: 50%;
  border: 3px solid var(--tone);
  font-size: 0.7rem;
  font-weight: 800;
  line-height: 1;
  color: var(--muted);
}

.history-score b { color: var(--ink); font-size: 1rem; }
.history-score.is-muted { font-size: 1rem; }
.history-main { display: grid; min-width: 0; }
.history-url { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-meta { color: var(--muted); font-size: 0.85rem; }
.history-open { color: var(--accent); font-weight: 700; font-size: 0.9rem; white-space: nowrap; }

.prompt-text {
  width: 100%;
  max-width: 100%;
  min-height: 16rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-2);
  color: var(--ink);
  font: 0.85rem/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  resize: vertical;
}

@media (max-width: 760px) {
  .card-half { grid-column: span 12; }
  .batch-bar { grid-template-columns: 1fr auto; }
  .batch-bar .track { grid-column: 1 / 3; grid-row: 2; }
  .result summary { grid-template-columns: auto 1fr; }
  .result summary .impact { grid-column: 2; }
  .result summary .line { grid-column: 1 / 3; }
  .history-row { grid-template-columns: auto 1fr; }
  .history-open { display: none; }
}
