/* ─── Reset & base ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  line-height: 1.5;
}
img { display: block; max-width: 100%; }
button { font-family: inherit; cursor: pointer; }
a { color: var(--scan); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ─── Design tokens ─────────────────────────────────────────────────── */
:root {
  /* Base */
  --bg:           #111214;
  --surface:      #202225;
  --surface-alt:  #17181b;
  --border:       #3a3d41;
  --text:         #f3f4f6;
  --text-muted:   #8b949e;

  /* Brand */
  --primary:      #f38020;
  --primary-text: #111111;

  /* Scan accent */
  --scan:         #38bdf8;
  --scan-dim:     rgba(56, 189, 248, 0.12);
  --scan-border:  rgba(56, 189, 248, 0.35);

  /* Status */
  --pass:         #35c46a;
  --pass-bg:      rgba(53, 196, 106, 0.12);
  --pass-border:  rgba(53, 196, 106, 0.45);
  --fail:         #ff5c5c;
  --fail-bg:      rgba(255, 92, 92, 0.12);
  --fail-border:  rgba(255, 92, 92, 0.45);
  --warn:         #f59e0b;
  --warn-bg:      rgba(245, 158, 11, 0.12);
  --warn-border:  rgba(245, 158, 11, 0.45);
  --info:         #38bdf8;
  --info-bg:      rgba(56, 189, 248, 0.10);
  --info-border:  rgba(56, 189, 248, 0.35);
  --high:         #f97316;
  --high-bg:      rgba(249, 115, 22, 0.12);
  --high-border:  rgba(249, 115, 22, 0.45);
  --critical:     #ef4444;
  --critical-bg:  rgba(239, 68, 68, 0.12);
  --critical-border: rgba(239, 68, 68, 0.45);

  /* Typography */
  --font-sans:  "IBM Plex Sans", "Segoe UI", sans-serif;
  --font-mono:  "IBM Plex Mono", "Fira Code", "Courier New", monospace;

  /* Spacing */
  --space-1:  4px;
  --space-2:  8px;
  --space-3:  12px;
  --space-4:  16px;
  --space-5:  20px;
  --space-6:  24px;
  --space-8:  32px;

  /* Radius */
  --radius-sm:   6px;
  --radius-md:   10px;
  --radius-lg:   14px;
  --radius-full: 999px;

  --container: 820px;
}

/* ─── Layout ────────────────────────────────────────────────────────── */
.container {
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--space-6);
}

.page { display: flex; flex-direction: column; min-height: 100dvh; }
.main { flex: 1; padding-block: var(--space-8) 60px; }

/* ─── Header ────────────────────────────────────────────────────────── */
.site-header {
  background: var(--surface-alt);
  border-bottom: 1px solid var(--border);
  padding-block: 14px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.site-header__brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: 700;
  font-size: 15px;
}
.site-header__badge {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* ─── Hero ──────────────────────────────────────────────────────────── */
.hero { text-align: center; margin-bottom: var(--space-8); padding-top: var(--space-8); }
.hero__title {
  font-size: 28px;
  font-weight: 900;
  line-height: 1.2;
  margin-bottom: var(--space-3);
}
.hero__subtitle { color: var(--text-muted); font-size: 14px; }

/* ─── URL bar ───────────────────────────────────────────────────────── */
.url-form { margin-bottom: var(--space-8); }

.url-bar {
  display: flex;
  align-items: center;
  background: var(--surface-alt);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0 0 0 14px;
  height: 56px;
  gap: 10px;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}
.url-bar:focus-within {
  border-color: var(--scan-border);
  box-shadow: 0 0 0 3px var(--scan-dim);
}
.url-bar--scanning {
  border-color: var(--scan-border);
  box-shadow: 0 0 0 3px var(--scan-dim);
  animation: scan-pulse 1.4s ease-in-out infinite;
}
.url-bar__icon { color: var(--text-muted); flex-shrink: 0; }
.url-bar__input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-family: var(--font-mono);
  font-size: 15px;
  color: var(--text);
  caret-color: var(--scan);
  min-width: 0;
}
.url-bar__input::placeholder { color: var(--text-muted); }

.url-bar__btn {
  height: 100%;
  padding: 0 20px;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  background: var(--primary);
  color: var(--primary-text);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: none;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
  animation: btn-shimmer 4.6s ease-in-out infinite, btn-lift 4.6s ease-in-out infinite;
}
.url-bar__btn:hover { filter: brightness(1.08); }
.url-bar__btn:disabled { opacity: 0.7; cursor: not-allowed; animation: none; }
.url-bar__btn-spinner { animation: spin 0.8s linear infinite; }

.url-form__error {
  margin-top: var(--space-2);
  font-size: 13px;
  color: var(--fail);
  min-height: 18px;
}

/* ─── Loading ───────────────────────────────────────────────────────── */
.loading {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  margin-bottom: var(--space-6);
}
.loading__steps { display: flex; flex-direction: column; gap: 10px; }
.loading__step {
  font-size: 14px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  transition: color 200ms ease;
}
.loading__step--done { color: var(--pass); }
.loading__step--done .loading__dot::before { content: "✅"; }
.loading__dot { font-family: var(--font-mono); width: 20px; }

/* ─── Error card ────────────────────────────────────────────────────── */
.error-card {
  background: var(--surface);
  border: 1px solid var(--fail-border);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  text-align: center;
  margin-bottom: var(--space-6);
}
.error-card__icon { font-size: 32px; margin-bottom: var(--space-4); }
.error-card__message { font-size: 15px; color: var(--text-muted); margin-bottom: var(--space-6); }

/* ─── Buttons ───────────────────────────────────────────────────────── */
.btn-secondary {
  background: transparent;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  padding: 8px 20px;
  font-size: 13px;
  font-weight: 600;
  transition: border-color 140ms, background 140ms;
}
.btn-secondary:hover { border-color: var(--scan-border); background: var(--scan-dim); }

/* ─── Results sections ──────────────────────────────────────────────── */
#results { display: flex; flex-direction: column; gap: var(--space-6); }

/* ─── Verdict hero ──────────────────────────────────────────────────── */
.verdict-hero {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
}
.verdict-hero--pass { border-color: var(--pass-border); }
.verdict-hero--fail-high { border-color: var(--high-border); }
.verdict-hero--fail-low { border-color: var(--warn-border); }
.verdict-hero--warn { border-color: var(--warn-border); }

.verdict-pass {
  display: flex;
  align-items: center;
  gap: var(--space-5);
}
.verdict-pass__img {
  width: 72px; height: 72px;
  border-radius: var(--radius-md);
  background: repeating-conic-gradient(#333 0% 25%, #222 0% 50%) 0 0 / 8px 8px;
  object-fit: contain;
  padding: 6px;
  flex-shrink: 0;
}
.verdict-pass__info { flex: 1; }
.verdict-pass__url { font-family: var(--font-mono); font-size: 13px; color: var(--text-muted); }
.verdict-pass__domain { font-size: 18px; font-weight: 700; margin-bottom: var(--space-2); }
.verdict-pass__stamp { font-size: 20px; font-weight: 900; color: var(--pass); }

/* Conflict layout */
.favicon-conflict {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: stretch;
  gap: var(--space-4);
  align-items: center;
  margin-bottom: var(--space-5);
}
.favicon-conflict__arrow {
  color: var(--high);
  font-size: 20px;
  font-weight: 900;
  animation: arrow-pulse 1.2s ease infinite;
}

.favicon-card {
  background: var(--surface-alt);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  text-align: center;
  align-self: stretch;
}
.favicon-card--fail { border-color: var(--fail-border); }
.favicon-card--active { border-color: var(--high-border); background: var(--high-bg); }

.favicon-card__label {
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: var(--space-3);
}
.favicon-card--fail .favicon-card__label { color: var(--fail); }
.favicon-card--active .favicon-card__label { color: var(--high); }

.favicon-card__img {
  width: 64px; height: 64px;
  border-radius: var(--radius-sm);
  background: repeating-conic-gradient(#333 0% 25%, #222 0% 50%) 0 0 / 8px 8px;
  object-fit: contain;
  padding: 4px;
  margin-inline: auto;
  border: 1px solid var(--border);
}
.favicon-card__url {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  margin-top: var(--space-2);
  word-break: break-all;
}
.favicon-card__dims {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  margin-top: var(--space-1);
}
.favicon-card__dims--fail { color: var(--fail); }
.favicon-card__dims--pass { color: var(--pass); }
.favicon-card__badge {
  display: inline-block;
  margin-top: var(--space-2);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: var(--warn-bg);
  color: var(--warn);
  border: 1px solid var(--warn-border);
}

.verdict-score {
  font-family: var(--font-mono);
  font-size: 32px;
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 1;
  animation: score-pop 400ms cubic-bezier(0.2, 0.9, 0.2, 1) forwards;
}
.verdict-score--pass { color: var(--pass); }
.verdict-score--fail { color: var(--fail); }
.verdict-score--warn { color: var(--warn); }

/* ─── SERP preview ──────────────────────────────────────────────────── */
.serp-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
}
.section-label {
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: var(--space-4);
}
.serp-mockup {
  background: #fff;
  border-radius: var(--radius-md);
  padding: 14px 16px;
  color: #202124;
}
.serp-mockup__domain-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.serp-mockup__favicon {
  width: 18px; height: 18px;
  border-radius: 2px;
  object-fit: contain;
}
.serp-mockup__domain { font-size: 13px; color: #202124; }
.serp-mockup__title { font-size: 18px; color: #1a0dab; font-weight: 400; margin-bottom: 2px; }
.serp-mockup__url { font-size: 13px; color: #006621; margin-bottom: 4px; }
.serp-mockup__desc { font-size: 13px; color: #4d5156; line-height: 1.4; }
.serp-warning {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  margin-top: var(--space-4);
  font-size: 13px;
  color: var(--warn);
  padding: var(--space-3) var(--space-4);
  background: var(--warn-bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--warn-border);
}

/* ─── Checks list ───────────────────────────────────────────────────── */
.checks-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.checks-card__header {
  background: var(--surface-alt);
  padding: 10px var(--space-4);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.check-row {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: var(--space-3);
  padding: 12px var(--space-4);
  border-top: 1px solid var(--border);
  cursor: pointer;
  opacity: 0;
  animation: check-slide-in 280ms ease forwards;
}
.check-row:hover { background: rgba(255,255,255,0.025); }
.check-row__icon {
  width: 22px; height: 22px;
  border-radius: var(--radius-full);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
  flex-shrink: 0;
}
.check-row__icon--pass     { background: var(--pass-bg); color: var(--pass); }
.check-row__icon--fail     { background: var(--fail-bg); color: var(--fail); }
.check-row__icon--warn     { background: var(--warn-bg); color: var(--warn); }
.check-row__icon--info     { background: var(--info-bg); color: var(--info); }
.check-row__icon--high     { background: var(--high-bg); color: var(--high); }
.check-row__icon--critical { background: var(--critical-bg); color: var(--critical); }

.check-row__label { font-size: 14px; font-weight: 500; color: var(--text); }
.check-row__meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  text-align: right;
  white-space: nowrap;
}
.check-row__detail {
  grid-column: 2 / -1;
  font-size: 13px;
  color: var(--text-muted);
  padding-top: var(--space-2);
  line-height: 1.5;
  display: none;
}
.check-row--expanded .check-row__detail { display: block; }

/* ─── Issue cards ───────────────────────────────────────────────────── */
.issues-section { display: flex; flex-direction: column; gap: var(--space-3); }
.issue-card {
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  border-left-width: 3px;
  background: var(--surface);
  padding: 14px var(--space-4);
}
.issue-card--high     { border-left-color: var(--high); }
.issue-card--critical { border-left-color: var(--critical); }
.issue-card--medium, .issue-card--warn { border-left-color: var(--warn); }
.issue-card--low, .issue-card--info    { border-left-color: var(--info); }

.issue-card__severity {
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: var(--space-1);
}
.issue-card--high .issue-card__severity     { color: var(--high); }
.issue-card--critical .issue-card__severity { color: var(--critical); }
.issue-card--medium .issue-card__severity,
.issue-card--warn .issue-card__severity     { color: var(--warn); }
.issue-card--low .issue-card__severity,
.issue-card--info .issue-card__severity     { color: var(--info); }

.issue-card__check-id {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: var(--space-3);
}
.issue-card__body { font-size: 14px; color: var(--text-muted); line-height: 1.6; }
.issue-card__steps { margin-top: var(--space-3); display: flex; flex-direction: column; gap: 6px; }
.issue-card__step {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 13px;
  color: var(--text);
  min-height: 44px;
  align-items: center;
}
.issue-card__step-num {
  width: 20px; height: 20px;
  border-radius: var(--radius-full);
  background: rgba(243, 128, 32, 0.18);
  border: 1px solid rgba(243, 128, 32, 0.5);
  color: #fef3c7;
  font-size: 11px;
  font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

/* ─── Format coverage grid ──────────────────────────────────────────── */
.format-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.format-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.format-card--pass { border-color: var(--pass-border); }
.format-card--fail { border-color: rgba(255,92,92,0.2); }

.format-card__label {
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}
.format-card__status { font-size: 18px; }
.format-card__detail {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}
.format-card__dim-fail { color: var(--fail); }

/* ─── Animations ────────────────────────────────────────────────────── */
@keyframes scan-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(56,189,248,0.12); }
  50%       { box-shadow: 0 0 0 6px rgba(56,189,248,0.04); }
}
@keyframes check-slide-in {
  from { opacity: 0; transform: translateX(-8px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes score-pop {
  0%   { transform: scale(0.7); opacity: 0; }
  60%  { transform: scale(1.08); }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes arrow-pulse {
  0%, 100% { opacity: 0.5; }
  50%       { opacity: 1; }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
@keyframes btn-shimmer {
  0%, 60%, 100% { background: var(--primary); }
  80%           { background: #f5921e; }
}
@keyframes btn-lift {
  0%, 60%, 100% { transform: translateY(0); }
  80%           { transform: translateY(-1px); }
}

/* ─── Staggered check row delays ────────────────────────────────────── */
.check-row:nth-child(1)  { animation-delay: 0ms; }
.check-row:nth-child(2)  { animation-delay: 40ms; }
.check-row:nth-child(3)  { animation-delay: 80ms; }
.check-row:nth-child(4)  { animation-delay: 120ms; }
.check-row:nth-child(5)  { animation-delay: 160ms; }
.check-row:nth-child(6)  { animation-delay: 200ms; }
.check-row:nth-child(7)  { animation-delay: 240ms; }
.check-row:nth-child(8)  { animation-delay: 280ms; }
.check-row:nth-child(9)  { animation-delay: 320ms; }
.check-row:nth-child(10) { animation-delay: 360ms; }

/* ─── Reduced motion ────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

.url-form__mobile-btn { display: none; }

/* ─── Mobile (≤640px) ───────────────────────────────────────────────── */
@media (max-width: 640px) {
  .container { padding-inline: var(--space-4); }
  .hero__title { font-size: 22px; }

  .url-bar {
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    border-bottom: none;
    height: 52px;
  }
  .url-bar__btn {
    display: none; /* moved below */
  }
  .url-form::after { display: none; }

  /* Mobile SCAN button — injected by app.js as .url-form__mobile-btn */
  .url-form__mobile-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    height: 52px;
    background: var(--primary);
    color: var(--primary-text);
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    border: none;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    cursor: pointer;
  }
  .url-bar { border-radius: var(--radius-md) var(--radius-md) 0 0; }

  .favicon-conflict { grid-template-columns: 1fr; }
  .favicon-conflict__arrow { text-align: center; transform: rotate(90deg); }

  .format-grid { grid-template-columns: 1fr 1fr; }

  .check-row { grid-template-columns: 28px 1fr; }
  .check-row__meta { display: none; }

  .verdict-pass { flex-direction: column; text-align: center; }
}
