/* ==========================================================================
   AEO Baseline Audit — design system
   Cinematic dark UI: near-black ground, charcoal cards, hairline borders,
   one accent, and semantic pass/warn/fail colours.
   ========================================================================== */

:root {
  /* Ground */
  --bg:            #060607;
  --bg-elevated:   #0d0e10;
  --surface:       #121316;
  --surface-2:     #17181c;
  --surface-hover: #1c1e22;

  /* Lines */
  --line:          #232529;
  --line-strong:   #303339;

  /* Text */
  --text:          #f4f5f7;
  --text-muted:    #a4a8b0;
  --text-dim:      #6f747d;

  /* Accent */
  --accent:        #6d7cff;
  --accent-soft:   rgba(109, 124, 255, 0.14);
  --accent-line:   rgba(109, 124, 255, 0.42);

  /* Semantics */
  --pass:          #3ddc84;
  --pass-soft:     rgba(61, 220, 132, 0.12);
  --warn:          #ffb020;
  --warn-soft:     rgba(255, 176, 32, 0.12);
  --fail:          #ff5d5d;
  --fail-soft:     rgba(255, 93, 93, 0.12);
  --skip:          #7a808a;
  --skip-soft:     rgba(122, 128, 138, 0.12);

  /* Shape */
  --r-sm: 8px;
  --r:    14px;
  --r-lg: 20px;
  --r-xl: 28px;

  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 12px 36px rgba(0,0,0,.36);

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
          "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --maxw: 1080px;
  --ease: cubic-bezier(.22, .61, .36, 1);
}

/* --- Reset ---------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.2; letter-spacing: -0.02em; }
p { margin: 0; }
img, svg { max-width: 100%; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Visible focus for keyboard users everywhere. */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: 12px; top: -60px;
  background: var(--surface); color: var(--text);
  padding: 10px 16px; border-radius: var(--r-sm);
  border: 1px solid var(--line-strong); z-index: 100;
  transition: top .18s var(--ease);
}
.skip-link:focus { top: 12px; }

/* --- Layout --------------------------------------------------------------- */

.shell { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }
.stack > * + * { margin-top: 16px; }

/* Ambient glow behind the hero; purely decorative. */
.aurora {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(760px 380px at 50% -8%, rgba(109,124,255,.16), transparent 70%),
    radial-gradient(560px 320px at 88% 8%, rgba(61,220,132,.07), transparent 70%);
}
.shell, .site-header, .site-footer { position: relative; z-index: 1; }

/* --- Header / footer ------------------------------------------------------ */

.site-header {
  border-bottom: 1px solid var(--line);
  background: rgba(6,6,7,.72);
  backdrop-filter: blur(12px);
  position: sticky; top: 0; z-index: 20;
}
.site-header__inner {
  max-width: var(--maxw); margin: 0 auto; padding: 14px 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand__mark {
  width: 26px; height: 26px; border-radius: 7px;
  background: linear-gradient(135deg, var(--accent), #3ddc84);
  display: grid; place-items: center;
  font-size: 13px; font-weight: 700; color: #08090b;
}
.brand__text { font-size: 15px; letter-spacing: -0.01em; }

.site-footer {
  border-top: 1px solid var(--line);
  margin-top: 72px; padding: 28px 0 48px;
  color: var(--text-dim); font-size: 13px;
}
.site-footer p + p { margin-top: 8px; }

/* --- Hero / form ---------------------------------------------------------- */

.hero { padding: 92px 0 64px; text-align: center; }

.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 14px; border-radius: 999px;
  border: 1px solid var(--accent-line); background: var(--accent-soft);
  color: #c3cbff; font-size: 12.5px; font-weight: 500;
  letter-spacing: .04em; text-transform: uppercase;
}

.hero h1 {
  margin-top: 24px;
  font-size: clamp(2.1rem, 5.4vw, 3.6rem);
  letter-spacing: -0.035em;
}
.hero__sub {
  margin: 18px auto 0; max-width: 620px;
  color: var(--text-muted); font-size: clamp(1rem, 2vw, 1.14rem);
}

.audit-form { margin: 40px auto 0; max-width: 620px; text-align: left; }

.field-label {
  display: block; margin-bottom: 8px;
  font-size: 13px; font-weight: 500; color: var(--text-muted);
}

.input-row { display: flex; gap: 10px; }

.input {
  flex: 1 1 auto; min-width: 0;
  padding: 15px 17px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--line-strong); border-radius: var(--r);
  font-family: var(--font); font-size: 15px;
  transition: border-color .16s var(--ease), background .16s var(--ease);
}
.input::placeholder { color: var(--text-dim); }
.input:hover { border-color: #3a3e46; }
.input:focus { outline: none; border-color: var(--accent); background: var(--surface-2); }
.input[aria-invalid="true"] { border-color: var(--fail); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 15px 24px; border-radius: var(--r);
  border: 1px solid transparent;
  font-family: var(--font); font-size: 15px; font-weight: 600;
  cursor: pointer; white-space: nowrap;
  transition: transform .12s var(--ease), background .16s var(--ease), border-color .16s var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }

.btn--primary { background: var(--text); color: #08090b; }
.btn--primary:hover:not(:disabled) { background: #fff; }

.btn--ghost {
  background: var(--surface); color: var(--text);
  border-color: var(--line-strong);
}
.btn--ghost:hover:not(:disabled) { background: var(--surface-hover); border-color: #3d424b; }

.btn--accent { background: var(--accent); color: #fff; }
.btn--accent:hover:not(:disabled) { background: #7d8bff; }

.field-hint { margin-top: 10px; color: var(--text-dim); font-size: 13px; }

.form-error {
  margin-top: 14px; padding: 12px 15px;
  background: var(--fail-soft); border: 1px solid rgba(255,93,93,.3);
  border-radius: var(--r-sm); color: #ffc9c9; font-size: 14px;
}
.form-error[hidden] { display: none; }

/* --- Trust strip ---------------------------------------------------------- */

.trust {
  margin-top: 56px; display: flex; flex-wrap: wrap;
  justify-content: center; gap: 10px 28px;
  color: var(--text-dim); font-size: 13px;
}
.trust span { display: inline-flex; align-items: center; gap: 7px; }
.dot { width: 5px; height: 5px; border-radius: 50%; background: var(--pass); }

/* --- Progress overlay ------------------------------------------------------ */

.overlay {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(4,4,5,.9); backdrop-filter: blur(14px);
  display: grid; place-items: center; padding: 24px;
  overflow-y: auto;
}
.overlay[hidden] { display: none; }

.progress-card {
  width: 100%; max-width: 520px;
  background: var(--bg-elevated);
  border: 1px solid var(--line); border-radius: var(--r-xl);
  box-shadow: var(--shadow); padding: 36px 32px;
}

.progress-card h2 { font-size: 1.5rem; }
.progress-card__sub { margin-top: 10px; color: var(--text-muted); font-size: 14.5px; }

.progress-meter { margin-top: 28px; }
.progress-meter__head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 10px;
}
.progress-meter__stage { font-size: 14px; color: var(--text-muted); }
.progress-meter__pct {
  font-size: 22px; font-weight: 700;
  font-variant-numeric: tabular-nums; letter-spacing: -0.02em;
}
.progress-track {
  height: 7px; border-radius: 999px;
  background: var(--surface-2); overflow: hidden;
}
.progress-fill {
  height: 100%; width: 0%; border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), #3ddc84);
  transition: width .55s var(--ease);
}

.stages { margin-top: 26px; list-style: none; padding: 0; display: grid; gap: 3px; }
.stage {
  display: flex; align-items: center; gap: 11px;
  padding: 7px 8px; border-radius: var(--r-sm);
  font-size: 14px; color: var(--text-dim);
  transition: color .22s var(--ease), background .22s var(--ease);
}
.stage__icon {
  flex: none; width: 19px; height: 19px; border-radius: 50%;
  border: 1.5px solid var(--line-strong);
  display: grid; place-items: center;
  font-size: 11px; line-height: 1;
  transition: all .22s var(--ease);
}
.stage.is-active { color: var(--text); background: rgba(109,124,255,.08); }
.stage.is-active .stage__icon { border-color: var(--accent); color: var(--accent); }
.stage.is-done { color: var(--text-muted); }
.stage.is-done .stage__icon {
  border-color: var(--pass); background: var(--pass); color: #06210f; font-weight: 700;
}

.progress-note { margin-top: 24px; color: var(--text-dim); font-size: 12.5px; text-align: center; }

/* A spinner is motion with meaning; respect reduced-motion. */
.spinner {
  width: 11px; height: 11px; border-radius: 50%;
  border: 1.5px solid var(--accent); border-top-color: transparent;
  animation: spin .75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

/* --- Report --------------------------------------------------------------- */

.report { padding: 48px 0 0; }

.report-head { display: grid; gap: 14px; }
.report-head__meta {
  display: flex; flex-wrap: wrap; gap: 8px 18px;
  color: var(--text-dim); font-size: 13px;
}
.report-head__url {
  font-family: var(--mono); font-size: 13px; color: var(--text-muted);
  word-break: break-all;
}

.section { margin-top: 56px; }
.section__head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.section__num {
  font-family: var(--mono); font-size: 12px; color: var(--text-dim);
  letter-spacing: .1em;
}
.section__title { font-size: 1.3rem; }
.section__note { color: var(--text-dim); font-size: 13px; }

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 26px;
}

/* Score hero */
.score-hero {
  display: grid; grid-template-columns: auto 1fr; gap: 34px; align-items: center;
}
.gauge { position: relative; width: 168px; height: 168px; flex: none; }
.gauge svg { transform: rotate(-90deg); display: block; }
.gauge__track { stroke: var(--surface-2); }
.gauge__value { stroke-linecap: round; transition: stroke-dashoffset 1s var(--ease); }
.gauge__label {
  position: absolute; inset: 0; display: grid; place-content: center; text-align: center;
}
.gauge__pct {
  font-size: 2.7rem; font-weight: 700; letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums; line-height: 1;
}
.gauge__cap { margin-top: 5px; font-size: 11.5px; color: var(--text-dim); letter-spacing: .1em; text-transform: uppercase; }

.score-hero__body h2 { font-size: clamp(1.3rem, 3vw, 1.75rem); }
.score-hero__body p { margin-top: 10px; color: var(--text-muted); }

.pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 4px 11px; border-radius: 999px;
  font-size: 12px; font-weight: 600; letter-spacing: .01em;
}
.pill--pass { background: var(--pass-soft); color: var(--pass); }
.pill--warning { background: var(--warn-soft); color: var(--warn); }
.pill--fail { background: var(--fail-soft); color: var(--fail); }
.pill--skipped { background: var(--skip-soft); color: var(--skip); }
.pill--muted { background: var(--surface-2); color: var(--text-muted); }

.notice {
  display: flex; gap: 12px; padding: 15px 18px;
  border-radius: var(--r); font-size: 14px; line-height: 1.55;
}
.notice--warning { background: var(--warn-soft); border: 1px solid rgba(255,176,32,.28); color: #ffdfa6; }
.notice--fail { background: var(--fail-soft); border: 1px solid rgba(255,93,93,.28); color: #ffc9c9; }
.notice--info { background: var(--surface-2); border: 1px solid var(--line); color: var(--text-muted); }

/* Context chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 6px 13px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line);
  font-size: 13px; color: var(--text-muted);
}
.chip strong { color: var(--text); font-weight: 600; }

/* LLM cards */
.llm-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }

.llm-card { text-align: left; width: 100%; font-family: var(--font); }
.llm-card__top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.llm-card__name { font-size: 15px; font-weight: 600; }
.llm-card__score {
  font-size: 1.9rem; font-weight: 700; letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums; margin-top: 12px;
}
.llm-card__score span { font-size: 1rem; color: var(--text-dim); font-weight: 500; }
.llm-card__bar { margin-top: 14px; height: 5px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.llm-card__bar i { display: block; height: 100%; border-radius: 999px; background: var(--accent); }
.llm-card__model { margin-top: 12px; font-family: var(--mono); font-size: 11.5px; color: var(--text-dim); }

/* Questions */
.q-list { list-style: none; margin: 18px 0 0; padding: 0; display: grid; gap: 8px; }
.q-item {
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--r); padding: 15px 17px;
}
.q-item__head { display: flex; gap: 14px; align-items: flex-start; justify-content: space-between; }
.q-item__text { font-size: 14.5px; line-height: 1.5; }
.q-item__idx { font-family: var(--mono); font-size: 12px; color: var(--text-dim); flex: none; }
.q-item__meta { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.q-item__providers { display: flex; gap: 6px; flex-wrap: wrap; }
.q-tag {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 6px;
  font-size: 11.5px; font-weight: 500;
  background: var(--surface); border: 1px solid var(--line);
  color: var(--text-dim);
}
.q-tag.is-hit { background: var(--pass-soft); border-color: rgba(61,220,132,.3); color: var(--pass); }
.q-tag.is-fail { background: var(--fail-soft); border-color: rgba(255,93,93,.28); color: var(--fail); }
.q-item__competitors { margin-top: 9px; font-size: 12.5px; color: var(--text-dim); }

/* Ranking table */
.rank-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.rank-table th {
  text-align: left; padding: 10px 12px;
  font-size: 11.5px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-dim); border-bottom: 1px solid var(--line);
}
.rank-table td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.rank-table tr:last-child td { border-bottom: 0; }
.rank-table tr.is-target td { background: var(--accent-soft); }
.rank-table tr.is-target td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.rank-table__num { font-family: var(--mono); color: var(--text-dim); width: 52px; }
.rank-table__name { font-weight: 500; }
.rank-table__sov { width: 190px; }
.sov-bar { height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; margin-top: 6px; }
.sov-bar i { display: block; height: 100%; border-radius: 999px; background: var(--text-dim); }
.is-target .sov-bar i { background: var(--accent); }
.num { font-variant-numeric: tabular-nums; }

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* Authority section cards */
.authority-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }

.auth-card { text-align: left; width: 100%; font-family: var(--font); cursor: pointer; }
.auth-card__label { font-size: 14px; font-weight: 600; }
.auth-card__score {
  margin-top: 10px; font-size: 2.2rem; font-weight: 700;
  letter-spacing: -0.03em; font-variant-numeric: tabular-nums; line-height: 1;
}
.auth-card__sub { margin-top: 7px; font-size: 12.5px; color: var(--text-dim); }
.auth-card__bar { margin-top: 14px; height: 5px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.auth-card__bar i { display: block; height: 100%; border-radius: 999px; }

/* Check cards */
.checks { display: grid; gap: 8px; margin-top: 16px; }

.check {
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--r); overflow: hidden;
}
.check__btn {
  width: 100%; display: flex; align-items: center; gap: 13px;
  padding: 15px 17px; background: none; border: 0; cursor: pointer;
  color: var(--text); font-family: var(--font); font-size: 14.5px; text-align: left;
}
.check__btn:hover { background: var(--surface-hover); }
.check__icon {
  flex: none; width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center; font-size: 12px; font-weight: 700;
}
.check__icon--pass { background: var(--pass-soft); color: var(--pass); }
.check__icon--warning { background: var(--warn-soft); color: var(--warn); }
.check__icon--fail { background: var(--fail-soft); color: var(--fail); }
.check__icon--skipped { background: var(--skip-soft); color: var(--skip); }
.check__title { flex: 1 1 auto; font-weight: 500; }
.check__value { color: var(--text-dim); font-size: 13px; text-align: right; }
.check__chev { flex: none; color: var(--text-dim); transition: transform .2s var(--ease); }
.check__btn[aria-expanded="true"] .check__chev { transform: rotate(180deg); }

.check__body { padding: 0 17px 18px 52px; display: grid; gap: 16px; }
.check__body[hidden] { display: none; }
.check__block h4 {
  font-size: 11.5px; letter-spacing: .09em; text-transform: uppercase;
  color: var(--text-dim); font-weight: 500; margin-bottom: 5px;
}
.check__block p { font-size: 14px; color: var(--text-muted); line-height: 1.6; white-space: pre-line; }
.check__resources { display: flex; flex-wrap: wrap; gap: 8px; }
.check__resources a {
  padding: 6px 12px; border-radius: var(--r-sm);
  background: var(--surface); border: 1px solid var(--line);
  font-size: 13px; color: var(--text-muted);
}
.check__resources a:hover { border-color: var(--accent-line); color: var(--text); text-decoration: none; }

.evidence {
  font-family: var(--mono); font-size: 12px; color: var(--text-dim);
  background: var(--bg-elevated); border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: 12px 14px;
  max-height: 220px; overflow: auto; white-space: pre-wrap; word-break: break-word;
}

/* CTA */
.cta {
  margin-top: 64px; padding: 40px 32px; text-align: center;
  background: linear-gradient(180deg, var(--surface), var(--bg-elevated));
  border: 1px solid var(--line); border-radius: var(--r-xl);
}
.cta h2 { font-size: clamp(1.35rem, 3vw, 1.8rem); }
.cta p { margin-top: 10px; color: var(--text-muted); }
.cta__actions { margin-top: 24px; display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }

/* History */
.history { display: grid; gap: 8px; }
.history__row {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 13px 16px; background: var(--surface-2);
  border: 1px solid var(--line); border-radius: var(--r); font-size: 14px;
}
.history__row.is-current { border-color: var(--accent-line); }

/* Error / state screens */
.state {
  max-width: 520px; margin: 92px auto; text-align: center;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-xl); padding: 44px 34px;
}
.state__icon {
  width: 52px; height: 52px; margin: 0 auto 20px; border-radius: 50%;
  display: grid; place-items: center; font-size: 24px;
}
.state h1 { font-size: 1.45rem; }
.state p { margin-top: 12px; color: var(--text-muted); font-size: 14.5px; }
.state__actions { margin-top: 26px; display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* Attribution */
.attribution {
  margin-top: 40px; padding: 18px 20px;
  background: var(--bg-elevated); border: 1px solid var(--line);
  border-radius: var(--r); font-size: 12.5px; color: var(--text-dim); line-height: 1.6;
}
.attribution strong { color: var(--text-muted); font-weight: 600; }

/* --- Responsive ------------------------------------------------------------ */

@media (max-width: 760px) {
  .hero { padding: 60px 0 44px; }
  .input-row { flex-direction: column; }
  .btn { width: 100%; }

  .score-hero { grid-template-columns: 1fr; gap: 24px; text-align: center; justify-items: center; }

  .progress-card { padding: 28px 22px; }

  .card { padding: 20px; }

  .check__body { padding-left: 17px; }

  /* Question tables become cards rather than scrolling sideways. */
  .q-item__head { flex-direction: column; gap: 8px; }
  .check__btn { flex-wrap: wrap; }
  .check__value { width: 100%; text-align: left; padding-left: 35px; }

  .rank-table__sov { width: 120px; }
  .rank-table th:nth-child(3), .rank-table td:nth-child(3) { display: none; }
}

@media (max-width: 420px) {
  .gauge { width: 140px; height: 140px; }
  .gauge__pct { font-size: 2.2rem; }
}

@media print {
  .aurora, .site-header, .cta__actions { display: none; }
  body { background: #fff; color: #000; }
  .card, .check { border-color: #ddd; background: #fff; }
}
