/* AI-assisted (Claude Code, claude.ai) — https://claude.ai */
/* ─────────────────────────────────────────────────────────────
   nocapchicken — app.css
   Palette: near-black text, off-white bg, grade accents
───────────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  color-scheme: light;
  --bg:          #f8f7f4;
  --surface:     #ffffff;
  --border:      #e5e2db;
  --text:        #1a1916;
  --text-muted:  #595550;
  --accent:      #1a1916;
  --star:        #c27803;

  --grade-a:         #16a34a;
  --grade-a-bg:      #f0fdf4;
  --grade-flagged:   #dc2626;
  --grade-flagged-bg:#fef2f2;

  --radius-sm:   6px;
  --radius-md:   12px;
  --radius-lg:   20px;

  --shadow-sm:   0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.05);
  --shadow-md:   0 4px 16px rgba(0,0,0,.08), 0 2px 6px rgba(0,0,0,.05);
  --shadow-lg:   0 12px 40px rgba(0,0,0,.10), 0 4px 12px rgba(0,0,0,.06);

  --font:        system-ui, -apple-system, BlinkMacSystemFont, sans-serif;

  --btn-bg:      #1a1916;
  --btn-text:    #ffffff;
  --focus-ring:  rgba(26, 25, 22, 0.35);

  --text-secondary: #3d3b36;
  --accent-soft:    #edece8;
}

html { font-size: 16px; -webkit-font-smoothing: antialiased; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

a { color: inherit; }
a:hover { text-decoration: underline; }

/* ── Layout ──────────────────────────────────────────────── */

.container {
  width: 100%;
  max-width: 780px;
  margin: 0 auto;
  padding: 0 24px;
}

.main { flex: 1; padding-bottom: 80px; }

/* ── Header ──────────────────────────────────────────────── */

.site-header {
  border-bottom: 1px solid var(--border);
  padding: 20px 0;
  background: var(--surface);
}

.site-header .container {
  display: flex;
  align-items: center;
  gap: 20px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.logo-icon { width: 32px; height: 32px; max-width: 32px; max-height: 32px; object-fit: contain; flex-shrink: 0; }

.logo-cap { color: #9a3412; }

.logo-text {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.tagline {
  font-size: 13px;
  color: var(--text-muted);
  border-left: 1px solid var(--border);
  padding-left: 20px;
}

.btn-theme {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  transition: color .15s, background-color .15s;
  margin-left: auto;
  flex-shrink: 0;
}

.btn-theme:hover { color: var(--text); background: var(--border); }

/* Show moon in light mode (click → go dark), sun in dark mode (click → go light) */
.btn-theme .icon-sun  { display: none; }
.btn-theme .icon-moon { display: block; }

html[data-theme="dark"] .btn-theme .icon-sun  { display: block; }
html[data-theme="dark"] .btn-theme .icon-moon { display: none; }

/* ── Hero ────────────────────────────────────────────────── */

.hero {
  padding: 64px 0 40px;
  text-align: center;
}

.hero-stars { color: var(--star); }

.hero-title {
  font-size: clamp(36px, 6vw, 56px);
  font-weight: 700;
  letter-spacing: -1.5px;
  line-height: 1.1;
  margin-bottom: 20px;
}

.hero-sub {
  font-size: 17px;
  color: var(--text-muted);
  max-width: 520px;
  margin: 0 auto;
  line-height: 1.6;
}

/* ── Search form ─────────────────────────────────────────── */

.search-section {
  margin-bottom: 48px;
}

.search-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-md);
}

.search-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.field-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 2;
  min-width: 180px;
}

label {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
}

input[type="text"] {
  width: 100%;
  padding: 12px 14px;
  font-family: var(--font);
  font-size: 15px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color .15s;
}

input[type="text"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

input[type="text"]::placeholder { color: var(--text-muted); opacity: .6; }

.btn-search {
  padding: 12px 28px;
  background: var(--btn-bg);
  color: var(--btn-text);
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
  transition: opacity .15s, transform .1s;
  height: 46px;
  align-self: flex-end;
  position: relative;
}

.btn-search:hover { opacity: .85; }
.btn-search:active { transform: scale(.98); }

.btn-search.loading .btn-text { opacity: 0; }
.btn-search.loading .btn-spinner { display: block; }

.examples-row {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 8px; margin-top: 14px;
}
.examples-label {
  font-size: 13px; color: var(--text-muted); font-weight: 500;
}
.example-chip {
  background: none; border: 1px solid var(--border);
  border-radius: 20px; padding: 5px 13px;
  font-size: 13px; color: var(--text-secondary);
  cursor: pointer; transition: background .15s, border-color .15s, color .15s;
  white-space: nowrap;
}
.example-chip:hover {
  background: var(--accent-soft); border-color: var(--accent);
  color: var(--accent);
}

.btn-spinner {
  display: none;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  position: absolute;
  inset: 0;
  margin: auto;
}

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

/* ── Skeleton loading ────────────────────────────────────── */

@keyframes shimmer {
  0%   { background-position: -600px 0; }
  100% { background-position:  600px 0; }
}

.skeleton-bone {
  background: linear-gradient(90deg, var(--border) 25%, #ebe8e1 50%, var(--border) 75%);
  background-size: 600px 100%;
  animation: shimmer 1.5s infinite linear;
  border-radius: var(--radius-sm);
}

.skeleton-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.skeleton-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 28px 32px;
  border-bottom: 1px solid var(--border);
}

.skeleton-banner-left  { display: flex; align-items: center; gap: 20px; }
.skeleton-banner-lines { display: flex; flex-direction: column; gap: 8px; }

.skeleton-circle { width: 72px; height: 72px; border-radius: 50%; flex-shrink: 0; }

.skeleton-line           { height: 14px; }
.skeleton-line--name     { width: 180px; }
.skeleton-line--loc      { width: 110px; height: 12px; }
.skeleton-line--conf     { width: 64px;  height: 28px; }
.skeleton-line--plabel   { width: 36px;  height: 12px; }
.skeleton-line--pvalue   { width: 80px;  height: 22px; }
.skeleton-line--pcount   { width: 100px; height: 10px; }
.skeleton-line--feature  { width: 120px; flex-shrink: 0; }
.skeleton-line--impact   { width: 40px;  flex-shrink: 0; }
.skeleton-line--title    { width: 220px; height: 12px; }

.skeleton-platforms {
  display: flex;
  border-bottom: 1px solid var(--border);
}

.skeleton-platform-block {
  flex: 1;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-right: 1px solid var(--border);
}
.skeleton-platform-block:last-child { border-right: none; }

.skeleton-shap {
  padding: 28px 32px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.skeleton-shap-row { display: flex; align-items: center; gap: 12px; }

.skeleton-bar-bg { flex: 1; height: 8px; border-radius: 99px; }

/* ── Data source badges ──────────────────────────────────── */

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-header .section-title { margin-bottom: 0; }

.data-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 99px;
  letter-spacing: 0.2px;
  flex-shrink: 0;
}

.data-badge--predicted { background: #dbeafe; color: #1e3a5f; }
.data-badge--real      { background: #d1fae5; color: #065f46; }
.data-badge--explained { background: #ede9fe; color: #3b0764; }

/* ── Result card ─────────────────────────────────────────── */

.result-section { margin-bottom: 64px; }

.result-error {
  background: var(--grade-flagged-bg);
  border: 1px solid #fca5a5;
  border-radius: var(--radius-md);
  padding: 16px 20px;
  color: var(--grade-flagged);
  font-size: 15px;
}

.result-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  animation: slideUp .3s ease;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Grade banner */

.grade-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 28px 32px;
  border-bottom: 1px solid var(--border);
}

.grade-left { display: flex; align-items: center; gap: 20px; }

.grade-pill-wrap { display: flex; flex-direction: column; align-items: center; gap: 4px; }

.grade-pill-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--text-muted);
}

.grade-pill {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: 700;
  flex-shrink: 0;
}

.grade-pill.grade-A       { background: var(--grade-a-bg);       color: var(--grade-a); }
.grade-pill.grade-Flagged { background: var(--grade-flagged-bg); color: var(--grade-flagged); }
.grade-pill.grade-unknown { background: #f3f4f6; color: #9ca3af; }

/* Actual grade pill: visually subordinate to predicted */
.grade-pill-wrap--actual .grade-pill {
  width: 52px;
  height: 52px;
  font-size: 22px;
}

.actual-score {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
}

.actual-date {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
}

.grade-meta { display: flex; flex-direction: column; gap: 4px; }

.grade-name {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.grade-location { font-size: 14px; color: var(--text-muted); }

.grade-confidence {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.confidence-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-muted);
}

.confidence-value {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

/* Divergence alert */

.divergence-alert {
  display: none;
}

.divergence-alert:not([hidden]) {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: #fff7ed;
  border-bottom: 1px solid #fed7aa;
  padding: 18px 32px;
  font-size: 14px;
  line-height: 1.5;
  color: #92400e;
}

.alert-icon { font-size: 20px; flex-shrink: 0; margin-top: 1px; }

/* Platform ratings */

.platforms-row {
  display: flex;
  align-items: stretch;
  gap: 0;
  border-bottom: 1px solid var(--border);
}

.platform-card {
  flex: 1;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-right: 1px solid var(--border);
}

.platform-card:last-child { border-right: none; }

.platform-logo {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
}

.google-logo { color: #4285f4; }

.platform-stars {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.star-glyph { color: var(--star); }

.platform-count { font-size: 12px; color: var(--text-muted); }

/* SHAP section */

.shap-section,
.reviews-section {
  padding: 28px 32px;
  border-bottom: 1px solid var(--border);
}

.reviews-section { border-bottom: none; }

.section-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.shap-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.shap-item {
  display: flex;
  align-items: center;
  gap: 12px;
}

.shap-feature {
  font-size: 14px;
  font-weight: 500;
  width: 200px;
  flex-shrink: 0;
  text-transform: capitalize;
}

.shap-bar-wrap {
  flex: 1;
  height: 8px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
}

.shap-bar {
  height: 100%;
  border-radius: 99px;
  transition: width .4s ease;
}

.shap-bar.positive { background: var(--grade-a); }
.shap-bar.negative { background: var(--grade-flagged); }

.shap-impact {
  font-size: 13px;
  font-weight: 600;
  width: 56px;
  text-align: right;
  flex-shrink: 0;
}

/* Reviews */

.reviews-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.review-item {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-muted);
  border-left: 3px solid var(--border);
}

/* Model details (collapsed) */

.model-details {
  border-top: 1px solid var(--border);
  padding: 0 32px;
}

.model-summary {
  padding: 16px 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  list-style: none;
}

.model-summary::-webkit-details-marker { display: none; }

.model-summary::before {
  content: '▸ ';
  font-size: 11px;
}

details[open] > .model-summary::before {
  content: '▾ ';
}

.model-details-body {
  padding-bottom: 20px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-muted);
}

.model-details-body p { margin-bottom: 12px; }

.trace-timing { font-family: monospace; font-size: 12px; margin-top: 8px; margin-bottom: 0; }

.trace-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 20px 0 8px;
}

.trace-label:first-child { margin-top: 0; }

.trace-console {
  background: var(--bg-secondary, rgba(0,0,0,0.03));
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px 16px 8px;
}

[data-theme="dark"] .trace-console {
  background: rgba(255,255,255,0.04);
}

.trace-input {
  width: 90px;
  font-family: monospace;
  font-size: 13px;
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text);
  text-align: right;
}

.trace-run-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.trace-run-btn {
  font-size: 12px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.trace-run-btn:hover {
  background: var(--accent, #2563eb);
  color: #fff;
  border-color: transparent;
}

.trace-run-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.trace-run-output {
  font-family: monospace;
  font-size: 12px;
  color: var(--text-muted);
}

.model-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 12px;
  font-size: 13px;
}

.model-table th {
  text-align: left;
  font-weight: 600;
  padding: 6px 12px 6px 0;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
}

.model-table td {
  padding: 6px 12px 6px 0;
  border-bottom: 1px solid var(--border);
}

.model-table-active td {
  color: var(--text);
  font-weight: 500;
}

/* ── How it works ────────────────────────────────────────── */

.how-section { padding: 16px 0 0; }

.how-section .section-title {
  text-align: center;
  margin-bottom: 32px;
}

.steps-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.step {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
}

.step-num {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 1px;
  margin-bottom: 12px;
}

.step h4 {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 8px;
}

.step p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ── Footer ──────────────────────────────────────────────── */

.site-footer {
  border-top: 1px solid var(--border);
  padding: 24px 0;
  background: var(--surface);
}

.site-footer .container {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.site-footer p {
  font-size: 12px;
  color: var(--text-muted);
}

/* ── Dark mode (opt-in via toggle) ───────────────────────── */

html[data-theme="dark"] {
  color-scheme: dark;
  --bg:         #1c1c1e;
  --surface:    #2c2c2e;
  --border:     #3a3a3c;
  --text:       #f2f2f7;
  --text-muted: #aeaeb2;
  --accent:     #f2f2f7;
  --star:       #ffd60a;

  --grade-a:         #30d158;
  --grade-a-bg:      #0d2318;
  --grade-flagged:   #ff453a;
  --grade-flagged-bg:#2d0d0d;

  --btn-bg:       #636366;
  --focus-ring:   rgba(242, 242, 247, 0.35);

  --text-secondary: #c7c7cc;
  --accent-soft:    #3a3a3c;
}

html[data-theme="dark"] .data-badge--predicted { background: #1c2d4a; color: #90c4f9; }
html[data-theme="dark"] .data-badge--real      { background: #0d2318; color: #30d158; }
html[data-theme="dark"] .data-badge--explained { background: #2d1a4a; color: #bf5af2; }

html[data-theme="dark"] .divergence-alert {
  background: #2d1a00;
  border-bottom-color: #6b3d00;
  color: #ffd60a;
}

html[data-theme="dark"] .result-error { border-color: #7a2020; }

html[data-theme="dark"] .review-item { background: var(--bg); }

html[data-theme="dark"] .skeleton-bone {
  background: linear-gradient(90deg, #3a3a3c 25%, #48484a 50%, #3a3a3c 75%);
  background-size: 600px 100%;
  animation: shimmer 1.5s infinite linear;
}

/* ── Accessibility ───────────────────────────────────────── */

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

/* ── Responsive ──────────────────────────────────────────── */

@media (max-width: 600px) {
  .hero { padding: 40px 0 28px; }
  .hero-title { font-size: 36px; letter-spacing: -1px; }

  .search-row { flex-direction: column; }
  .field-wrap { min-width: 100%; }
  .btn-search { width: 100%; justify-content: center; }

  .grade-banner { flex-direction: column; align-items: flex-start; gap: 16px; }
  .grade-confidence { align-items: flex-start; }

  .platforms-row { flex-direction: column; }
  .platform-card { border-right: none; border-bottom: 1px solid var(--border); }

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

  .shap-section, .reviews-section, .grade-banner, .divergence-alert { padding: 20px 20px; }
}
