/* audit.css — Battle Card Audit page
   Theme: dark terminal aesthetic — phosphor green on near-black
   Font: Space Grotesk (headings) + Space Mono (scores, labels)
*/

/* ── Reset & base ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0b0f0c;
  --bg-surface: #111714;
  --bg-card: #151c17;
  --border: #1f2d22;
  --border-light: #2a3d2e;
  --green: #22c55e;
  --green-dim: #16a34a;
  --green-glow: rgba(34,197,94,0.12);
  --amber: #f59e0b;
  --red: #ef4444;
  --text: #d1fae5;
  --text-dim: #6b7280;
  --text-muted: #374151;
  --font-head: 'Space Grotesk', sans-serif;
  --font-mono: 'Space Mono', monospace;
  --radius: 8px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
}

.audit-body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-head);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── Header ──────────────────────────────────────────────────────────── */
.audit-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 100;
}

.audit-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.logo-dot {
  width: 8px;
  height: 8px;
  background: var(--green);
  border-radius: 50%;
  display: inline-block;
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(0.85); }
}

.audit-nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.audit-nav a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.875rem;
  transition: color 0.2s;
}

.audit-nav a:hover { color: var(--text); }

.audit-nav-cta {
  background: var(--green);
  color: #0b0f0c !important;
  padding: 0.4rem 1rem;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.8rem;
  transition: background 0.2s !important;
}

.audit-nav-cta:hover { background: #16a34a !important; }

/* ── Landing hero ─────────────────────────────────────────────────────── */
.audit-main {
  max-width: 900px;
  margin: 0 auto;
  padding: 4rem 1.5rem 2rem;
}

.audit-hero {
  text-align: center;
  margin-bottom: 3rem;
}

.audit-hero-label {
  display: inline-block;
  background: var(--green-glow);
  border: 1px solid var(--green-dim);
  color: var(--green);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.3rem 0.8rem;
  border-radius: 100px;
  margin-bottom: 1.25rem;
}

.audit-hero-title {
  font-size: clamp(2.2rem, 6vw, 3.5rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 1rem;
}

.audit-hero-accent {
  color: var(--green);
}

.audit-hero-sub {
  font-size: 1.05rem;
  color: var(--text-dim);
  max-width: 560px;
  margin: 0 auto 1.5rem;
  line-height: 1.6;
}

.audit-rubric-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}

.rubric-pill {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--green);
  border: 1px solid var(--border-light);
  padding: 0.25rem 0.65rem;
  border-radius: 100px;
  background: var(--bg-surface);
}

/* ── Form card ────────────────────────────────────────────────────────── */
.audit-form-section {
  margin-bottom: 4rem;
}

.audit-form-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

.audit-input-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  width: fit-content;
}

.audit-tab {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-family: var(--font-head);
  font-size: 0.85rem;
  padding: 0.45rem 1rem;
  cursor: pointer;
  transition: all 0.15s;
}

.audit-tab--active {
  background: var(--green);
  color: #0b0f0c;
  font-weight: 600;
}

.audit-tab:hover:not(.audit-tab--active) {
  color: var(--text);
}

.audit-textarea {
  width: 100%;
  min-height: 260px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.6;
  padding: 1rem;
  resize: vertical;
  transition: border-color 0.2s;
}

.audit-textarea:focus {
  outline: none;
  border-color: var(--green-dim);
}

.audit-textarea::placeholder { color: var(--text-muted); }

/* File drop zone */
.audit-file-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: 2px dashed var(--border-light);
  border-radius: var(--radius);
  padding: 3rem 1rem;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  min-height: 200px;
}

.audit-file-drop:hover,
.audit-file-drop.drag-over {
  border-color: var(--green-dim);
  background: var(--green-glow);
}

.audit-file-drop.has-file {
  border-color: var(--green);
  border-style: solid;
}

.file-drop-icon { font-size: 2.5rem; }
.file-drop-text { font-weight: 600; font-size: 0.95rem; }
.file-drop-hint { font-size: 0.8rem; color: var(--text-dim); }
.file-drop-selected { font-size: 0.8rem; color: var(--green); font-family: var(--font-mono); margin-top: 0.25rem; }

/* Form actions */
.audit-form-actions {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.audit-submit-btn {
  background: var(--green);
  color: #0b0f0c;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font-head);
  font-size: 0.95rem;
  font-weight: 700;
  padding: 0.75rem 1.75rem;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.audit-submit-btn:hover:not(:disabled) {
  background: #16a34a;
  transform: translateY(-1px);
}

.audit-submit-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.audit-form-hint {
  font-size: 0.8rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

.audit-error {
  color: var(--red);
  font-size: 0.85rem;
  margin-top: 0.75rem;
  font-family: var(--font-mono);
}

/* Spinner dots */
.submit-spinner {
  display: inline-flex;
  gap: 3px;
  align-items: center;
}

.spinner-dot {
  width: 5px;
  height: 5px;
  background: #0b0f0c;
  border-radius: 50%;
  animation: bounce-dot 1s ease-in-out infinite;
}

.spinner-dot:nth-child(2) { animation-delay: 0.2s; }
.spinner-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce-dot {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.8; }
  40% { transform: translateY(-4px); opacity: 1; }
}

/* ── Polling overlay ──────────────────────────────────────────────────── */
.audit-polling-overlay {
  display: flex;
  justify-content: center;
  margin: 2rem 0;
}

.audit-polling-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 3rem 2rem;
  max-width: 480px;
  width: 100%;
  text-align: center;
}

.audit-polling-score-ring {
  width: 80px;
  height: 80px;
  border: 3px solid var(--border-light);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.polling-ring-label {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  color: var(--text-dim);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

@keyframes spin { to { transform: rotate(360deg); } }

.audit-polling-title {
  font-size: 1.4rem;
  margin-bottom: 0.6rem;
}

.audit-polling-sub {
  font-size: 0.875rem;
  color: var(--text-dim);
  margin-bottom: 2rem;
  line-height: 1.5;
}

.audit-polling-steps {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  text-align: left;
}

.polling-step {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  transition: color 0.3s;
}

.polling-step.step-active {
  color: var(--green);
}

.step-dot {
  width: 7px;
  height: 7px;
  border: 1.5px solid currentColor;
  border-radius: 50%;
  flex-shrink: 0;
  transition: background 0.3s;
}

.polling-step.step-active .step-dot {
  background: var(--green);
}

/* ── SEO block ────────────────────────────────────────────────────────── */
.audit-seo-block {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2.5rem;
  margin-top: 2rem;
}

.audit-seo-block h2 {
  font-size: 1.4rem;
  margin-bottom: 1.5rem;
  color: var(--text);
}

.audit-seo-cols {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.audit-seo-col h3 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--green);
  margin-bottom: 0.5rem;
}

.audit-seo-col p {
  font-size: 0.85rem;
  color: var(--text-dim);
  line-height: 1.6;
}

.audit-seo-links p {
  font-size: 0.85rem;
  color: var(--text-dim);
  line-height: 1.6;
  margin-bottom: 0.5rem;
}

.audit-seo-links a {
  color: var(--green);
  text-decoration: none;
}

.audit-seo-links a:hover { text-decoration: underline; }

/* ── Result page ─────────────────────────────────────────────────────── */
.audit-result-main {
  max-width: 960px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
}

/* Score ring header */
.result-score-header {
  display: flex;
  align-items: center;
  gap: 2.5rem;
  margin-bottom: 2.5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.result-score-ring {
  flex-shrink: 0;
  position: relative;
  width: 120px;
  height: 120px;
}

.score-ring-svg {
  width: 120px;
  height: 120px;
  transform: rotate(-90deg);
}

.score-ring-bg {
  fill: none;
  stroke: var(--border-light);
  stroke-width: 8;
}

.score-ring-fill {
  fill: none;
  stroke: var(--green);
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset 1.5s cubic-bezier(0.2,0.8,0.2,1);
}

.score-ring-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

.score-ring-number {
  font-family: var(--font-mono);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}

.score-ring-sub {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-dim);
}

.result-title {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
}

.result-subtitle {
  font-size: 0.9rem;
  color: var(--text-dim);
  margin-bottom: 1rem;
}

.result-share-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.result-share-btn {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
  background: var(--bg-surface);
  color: var(--text-dim);
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
}

.result-share-btn:hover {
  border-color: var(--green-dim);
  color: var(--text);
}

.result-share-tw {
  border-color: #1d9bf0;
  color: #1d9bf0;
}

.result-share-tw:hover {
  background: rgba(29,155,240,0.1);
  color: #1d9bf0 !important;
}

/* Result grid */
.result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

@media (max-width: 700px) {
  .result-grid { grid-template-columns: 1fr; }
}

.result-section-title {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 1rem;
}

/* Sub-scores */
.result-subscores, .result-top-fixes {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.5rem;
}

.subscore-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 0.25rem;
}

.subscore-label {
  font-size: 0.82rem;
  font-weight: 500;
}

.subscore-bar-wrap {
  width: 80px;
  height: 5px;
  background: var(--border);
  border-radius: 100px;
  overflow: hidden;
}

.subscore-bar {
  height: 100%;
  background: var(--green);
  border-radius: 100px;
  transition: width 1s cubic-bezier(0.2,0.8,0.2,1);
}

.subscore-num {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  min-width: 36px;
  text-align: right;
}

.score-good { color: var(--green); }
.score-mid  { color: var(--amber); }
.score-low  { color: var(--red); }

.subscore-verdict {
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-bottom: 0.75rem;
  line-height: 1.4;
  padding-left: 0;
  grid-column: 1 / -1;
}

/* Gated rows */
.subscore-row--gated .subscore-label { color: var(--text-muted); }
.subscore-bar-wrap--gated { background: var(--border); opacity: 0.4; }
.subscore-bar-placeholder { height: 100%; background: var(--border-light); width: 40%; }
.subscore-num--gated { color: var(--text-muted); }

/* Email gate CTA */
.subscore-gate-cta {
  margin-top: 1.25rem;
  padding: 1.25rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  text-align: center;
}

.subscore-gate-cta p {
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
  color: var(--text);
}

.email-gate-form {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

.email-gate-input {
  flex: 1;
  min-width: 180px;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-head);
  font-size: 0.85rem;
  padding: 0.5rem 0.75rem;
}

.email-gate-input:focus {
  outline: none;
  border-color: var(--green-dim);
}

.email-gate-btn {
  background: var(--green);
  color: #0b0f0c;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font-head);
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.5rem 1rem;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s;
}

.email-gate-btn:hover:not(:disabled) { background: #16a34a; }
.email-gate-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.email-gate-fine {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

/* Top fixes */
.top-fixes-gated {
  text-align: center;
  padding: 1rem 0;
}

.top-fixes-gated-icon { font-size: 2rem; margin-bottom: 0.75rem; }
.top-fixes-gated h3 { font-size: 1rem; margin-bottom: 0.5rem; }
.top-fixes-gated p { font-size: 0.82rem; color: var(--text-dim); margin-bottom: 1rem; line-height: 1.5; }

.top-fix-item {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  margin-bottom: 0.9rem;
}

.top-fix-num {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  background: var(--green-glow);
  border: 1px solid var(--green-dim);
  color: var(--green);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
}

.top-fix-text {
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text);
}

/* Annotations */
.annotation-item {
  border-left: 2px solid var(--border-light);
  padding: 0.75rem 0.75rem 0.75rem 1rem;
  margin-bottom: 0.75rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--bg-surface);
}

.annotation-item--high { border-left-color: var(--red); }
.annotation-item--medium { border-left-color: var(--amber); }
.annotation-item--low { border-left-color: var(--green-dim); }

.annotation-severity {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.25rem;
}

.annotation-item--high .annotation-severity { color: var(--red); }
.annotation-item--medium .annotation-severity { color: var(--amber); }
.annotation-item--low .annotation-severity { color: var(--green); }

.annotation-text {
  font-size: 0.8rem;
  font-style: italic;
  color: var(--text-dim);
  margin-bottom: 0.35rem;
  font-family: var(--font-mono);
  word-break: break-word;
}

.annotation-issue {
  font-size: 0.82rem;
  color: var(--text);
  line-height: 1.4;
}

/* ── CTA bar ──────────────────────────────────────────────────────────── */
.result-cta-bar {
  background: linear-gradient(135deg, var(--bg-card) 0%, rgba(34,197,94,0.06) 100%);
  border: 1px solid var(--green-dim);
  border-radius: 12px;
  padding: 2rem;
}

.result-cta-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.result-cta-text h3 {
  font-size: 1.1rem;
  margin-bottom: 0.35rem;
}

.result-cta-text p {
  font-size: 0.85rem;
  color: var(--text-dim);
}

.result-cta-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.result-cta-btn-primary {
  background: var(--green);
  color: #0b0f0c;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius);
  font-weight: 700;
  font-size: 0.88rem;
  text-decoration: none;
  transition: background 0.2s, transform 0.1s;
  white-space: nowrap;
}

.result-cta-btn-primary:hover {
  background: #16a34a;
  transform: translateY(-1px);
}

.result-cta-btn-secondary {
  border: 1px solid var(--border-light);
  color: var(--text-dim);
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius);
  font-size: 0.88rem;
  text-decoration: none;
  transition: all 0.2s;
  white-space: nowrap;
}

.result-cta-btn-secondary:hover {
  border-color: var(--text-dim);
  color: var(--text);
}

/* ── Not found ────────────────────────────────────────────────────────── */
.audit-not-found {
  text-align: center;
  padding: 6rem 1rem;
}

.audit-not-found h1 { font-size: 2rem; margin-bottom: 0.75rem; }
.audit-not-found p { color: var(--text-dim); margin-bottom: 2rem; }

/* ── Footer ──────────────────────────────────────────────────────────── */
.audit-footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 2rem;
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.audit-footer a {
  color: var(--text-dim);
  text-decoration: none;
}

.audit-footer a:hover { color: var(--text); }

/* ── Responsive ──────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .audit-header { padding: 0.75rem 1rem; }
  .audit-nav { gap: 0.75rem; }
  .audit-nav a:not(.audit-nav-cta) { display: none; }
  .result-score-header { flex-direction: column; gap: 1rem; text-align: center; }
  .result-share-row { justify-content: center; }
  .result-cta-content { flex-direction: column; }
  .result-cta-actions { width: 100%; }
  .result-cta-btn-primary, .result-cta-btn-secondary { width: 100%; text-align: center; }
  .audit-form-actions { flex-direction: column; align-items: flex-start; }
}
