/* ─────────────────────────────────────────────────
   Variables  — Claude Code warm beige, blue accent
───────────────────────────────────────────────── */
:root {
  --bg:            #FAF9F5;
  --surface:       #FFFFFF;
  --surface-raised:#F5F4EF;
  --border:        #E0DBCE;
  --border-subtle: #EBE8E0;
  --text:          #1C1917;
  --text-dim:      #44403C;
  --muted:         #78716C;
  --accent:        #2563EB;
  --accent-light:  #EFF6FF;
  --accent-strong: #1D4ED8;

  --good:          #15803D;
  --good-bg:       #F0FDF4;
  --good-border:   #86EFAC;

  --warn:          #A16207;
  --warn-bg:       #FEFCE8;
  --warn-border:   #FDE047;

  --bad:           #B91C1C;
  --bad-bg:        #FEF2F2;
  --bad-border:    #FECACA;

  --shadow-sm: 0 1px 2px rgba(28,25,23,.06);
  --shadow:    0 1px 4px rgba(28,25,23,.07), 0 8px 28px rgba(28,25,23,.06);
  --shadow-lg: 0 4px 8px rgba(28,25,23,.08), 0 16px 40px rgba(37,99,235,.1);
  --r:    16px;
  --r-sm:  10px;
}

/* ─────────────────────────────────────────────────
   Keyframes
───────────────────────────────────────────────── */
@keyframes slideUp {
  from { opacity: 0; transform: translateY(22px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes shimmer {
  from { background-position: 200% center; }
  to   { background-position: -200% center; }
}

@keyframes pulseGlow {
  0%   { box-shadow: 0 2px 12px rgba(37,99,235,.35), 0 0 0 0   rgba(37,99,235,.3); }
  60%  { box-shadow: 0 2px 12px rgba(37,99,235,.35), 0 0 0 9px rgba(37,99,235,.0); }
  100% { box-shadow: 0 2px 12px rgba(37,99,235,.35), 0 0 0 0   rgba(37,99,235,.0); }
}

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

@keyframes dotPop {
  0%   { transform: scale(0); opacity: 0; }
  60%  { transform: scale(1.35); }
  100% { transform: scale(1);  opacity: 1; }
}

@keyframes blobDrift1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%       { transform: translate(3%, 5%) scale(1.06); }
  66%       { transform: translate(-2%, 2%) scale(0.97); }
}

@keyframes blobDrift2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  40%       { transform: translate(-4%, -3%) scale(1.08); }
  70%       { transform: translate(2%, -2%) scale(0.95); }
}

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

body {
  font-family: "Inter", system-ui, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
  overflow-x: hidden;
}

/* Animated background blobs */
body::before {
  content: "";
  position: fixed;
  width: 700px; height: 700px;
  left: -12%; top: -18%;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(37,99,235,.07) 0%, transparent 68%);
  pointer-events: none;
  z-index: -1;
  animation: blobDrift1 20s ease-in-out infinite;
}

body::after {
  content: "";
  position: fixed;
  width: 580px; height: 580px;
  right: -8%; bottom: -14%;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(37,99,235,.055) 0%, transparent 68%);
  pointer-events: none;
  z-index: -1;
  animation: blobDrift2 26s ease-in-out infinite;
}

/* ─────────────────────────────────────────────────
   Page shell
───────────────────────────────────────────────── */
.page {
  width: min(1100px, 100% - 3rem);
  margin-inline: auto;
  padding-block: 2rem 6rem;
}

/* ─────────────────────────────────────────────────
   Top bar
───────────────────────────────────────────────── */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 3rem;
}

.brand    { animation: slideUp .5s cubic-bezier(.22,1,.36,1) .00s both; }
.nav-link { animation: slideUp .5s cubic-bezier(.22,1,.36,1) .08s both; }

.brand {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--accent);
  text-decoration: none;
  letter-spacing: -0.03em;
  transition: opacity .15s;
}
.brand:hover { opacity: .8; }

.nav-link {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  transition: color .15s;
}
.nav-link:hover { color: var(--text); }

/* ─────────────────────────────────────────────────
   Hero
───────────────────────────────────────────────── */
.hero { max-width: 100%; margin-bottom: 2.25rem; }

.hero h1 {
  font-size: clamp(2rem, 4.5vw, 3.5rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.1;
  margin-bottom: 1.4rem;
  white-space: nowrap;

  /* shimmer */
  background: linear-gradient(
    90deg,
    var(--text) 0%,
    var(--text) 30%,
    #2563eb 50%,
    var(--text) 70%,
    var(--text) 100%
  );
  background-size: 250% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;

  animation:
    slideUp .55s cubic-bezier(.22,1,.36,1) .16s both,
    shimmer 6s linear 1.4s infinite;
}

.features {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.features li {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  font-size: 1rem;
  color: var(--muted);
  line-height: 1.6;
}

.features li:nth-child(1) { animation: slideUp .55s cubic-bezier(.22,1,.36,1) .28s both; }
.features li:nth-child(2) { animation: slideUp .55s cubic-bezier(.22,1,.36,1) .36s both; }
.features li:nth-child(3) { animation: slideUp .55s cubic-bezier(.22,1,.36,1) .44s both; }

.features li::before {
  content: "";
  width: 6px; height: 6px; min-width: 6px;
  border-radius: 50%;
  background: var(--accent);
  margin-top: 0.57em;
  transition: transform .2s;
}
.features li:hover::before { transform: scale(1.5); }

/* ─────────────────────────────────────────────────
   Cards  (base)
───────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 1.5rem 1.625rem;
  box-shadow: var(--shadow);
  transition: transform .22s cubic-bezier(.22,1,.36,1), box-shadow .22s;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.card-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--muted);
  margin-bottom: 1rem;
}
.card-label svg { flex-shrink: 0; }

/* ─────────────────────────────────────────────────
   Input card
───────────────────────────────────────────────── */
.input-card-label { margin-bottom: 0.75rem; }

.input-card {
  margin-bottom: 1.375rem;
  animation: slideUp .55s cubic-bezier(.22,1,.36,1) .52s both;
  transition: transform .22s cubic-bezier(.22,1,.36,1), box-shadow .22s, border-color .2s;
}

.input-card:focus-within {
  border-color: rgba(37,99,235,.35);
  box-shadow: var(--shadow), 0 0 0 3px rgba(37,99,235,.08);
  transform: translateY(-1px);
}

.input-card textarea {
  display: block;
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  padding: 1rem 1.1rem;
  font: inherit;
  font-size: 1rem;
  color: var(--text);
  background: var(--surface-raised);
  resize: vertical;
  min-height: 96px;
  transition: border-color .15s, background .15s;
  line-height: 1.6;
}

.input-card textarea::placeholder { color: #A8A29E; }

.input-card textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
}

.input-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.625rem;
  margin-top: 1rem;
}

/* ─────────────────────────────────────────────────
   Submit button
───────────────────────────────────────────────── */
#submit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  width: 100%;
  background: linear-gradient(135deg, #3B82F6, #2563EB);
  color: #fff;
  border: none;
  border-radius: var(--r-sm);
  padding: 0.8rem 1.3rem;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.01em;
  transition: background .15s, transform .15s;
  animation: pulseGlow 2.8s ease-out 1.5s infinite;
}

#submit:hover:not(:disabled) {
  background: linear-gradient(135deg, #2563EB, #1D4ED8);
  transform: translateY(-1px);
  animation: none;
  box-shadow: 0 4px 16px rgba(37,99,235,.4);
}

#submit:active:not(:disabled) { transform: translateY(0); }

#submit:disabled {
  opacity: .65;
  cursor: wait;
  animation: none;
}

/* spinner toggle */
.btn-icon-spin  { display: none; animation: spin .7s linear infinite; }
.btn-icon-search { display: block; }

#submit:disabled .btn-icon-spin   { display: block; }
#submit:disabled .btn-icon-search { display: none; }

.status-text { font-size: 0.875rem; color: var(--muted); }

/* ─────────────────────────────────────────────────
   Results
───────────────────────────────────────────────── */
#results { display: flex; flex-direction: column; gap: 1rem; }

/* stagger continues the top-to-bottom page sequence after input card */
#results.show .results-grid > *:nth-child(1) { animation: slideUp .55s cubic-bezier(.22,1,.36,1) .62s both; }
#results.show .results-grid > *:nth-child(2) { animation: slideUp .55s cubic-bezier(.22,1,.36,1) .68s both; }
#results.show .results-grid > *:nth-child(3) { animation: slideUp .55s cubic-bezier(.22,1,.36,1) .74s both; }
#results.show .results-grid > *:nth-child(4) { animation: slideUp .55s cubic-bezier(.22,1,.36,1) .80s both; }
#results.show .results-grid > *:nth-child(5) { animation: slideUp .55s cubic-bezier(.22,1,.36,1) .86s both; }
#results.show .results-grid > *:nth-child(6) { animation: slideUp .55s cubic-bezier(.22,1,.36,1) .92s both; }

/* ─────────────────────────────────────────────────
   Results three-card grid
───────────────────────────────────────────────── */
.results-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.results-grid > * {
  min-height: 160px;
}

/* ─────────────────────────────────────────────────
   Card header row (label + inline button)
───────────────────────────────────────────────── */
.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.875rem;
}
.card-head .card-label { margin-bottom: 0; }

/* small inline download pill */
.btn-dl {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.22rem 0.65rem;
  border-radius: 7px;
  background: var(--accent-light);
  color: var(--accent);
  border: 1px solid #BFDBFE;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: 0.01em;
  transition: background .15s, border-color .15s;
}
.btn-dl:hover { background: #DBEAFE; border-color: #93C5FD; }
.btn-dl[aria-disabled="true"] { opacity: 0.35; pointer-events: none; }

/* ─────────────────────────────────────────────────
   Download card (PDF)
───────────────────────────────────────────────── */
.dl-card {
  display: flex;
  flex-direction: column;
}

.dl-card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.btn-dl-large {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 1rem;
  background: var(--accent-light);
  color: var(--accent);
  border: 1.5px dashed #BFDBFE;
  border-radius: var(--r-sm);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  transition: background .15s, border-color .15s, color .15s;
}

.btn-dl-large:hover { background: #DBEAFE; border-color: var(--accent); }
.btn-dl-large[aria-disabled="true"] { opacity: 0.35; pointer-events: none; }

.dl-caption {
  font-size: 0.74rem;
  color: #A8A29E;
  text-align: center;
  line-height: 1.55;
}

.stats-card { padding: 1.375rem 1.5rem; }

.stats-list { display: flex; flex-direction: column; }

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border-subtle);
}
.stat-row:last-child  { border-bottom: none; padding-bottom: 0; }
.stat-row:first-child { padding-top: 0; }

.stat-label { font-size: 0.82rem; color: var(--muted); font-weight: 500; }

.stat-value {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
  text-align: right;
  max-width: 60%;
  word-break: break-all;
}

.audio-card { padding: 1.5rem 1.625rem; }

.audio-empty {
  display: block;
  color: #A8A29E;
  font-size: 0.8rem;
  padding: 0.25rem 0 0.5rem;
  font-style: italic;
}
.audio-empty[hidden] { display: none; }

#audio-player {
  display: block;
  width: 100%;
  border-radius: 8px;
  accent-color: var(--accent);
}

/* ─────────────────────────────────────────────────
   Content card
───────────────────────────────────────────────── */
.content-card { padding: 1.5rem 1.625rem; }

.content-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.btn-ghost {
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 500;
  border-radius: 7px;
  padding: 0.25rem 0.7rem;
  cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
}
.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
}

.content-pre {
  background: var(--surface-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-sm);
  padding: 1.1rem 1.2rem;
  font-family: "SF Mono", "Fira Code", "Cascadia Code", monospace;
  font-size: 0.815rem;
  line-height: 1.8;
  color: var(--text-dim);
  overflow: auto;
  max-height: 320px;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ─────────────────────────────────────────────────
   Metric cards (.mc)
───────────────────────────────────────────────── */
.mc {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding-top: 1.35rem;
}

/* Coloured accent stripe at top */
.mc::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--border);
  border-radius: var(--r) var(--r) 0 0;
  transition: background .3s;
}
.mc[data-active="good"]::before { background: var(--good-border); }
.mc[data-active="warn"]::before { background: var(--warn-border); }
.mc[data-active="bad"]::before  { background: var(--bad-border);  }

/* Status dot */
.mc-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--border);
  transition: background .3s;
  margin-bottom: 0.5rem;
}
.mc[data-active="good"] .mc-dot { background: var(--good); animation: dotPop .35s ease both; }
.mc[data-active="warn"] .mc-dot { background: var(--warn); animation: dotPop .35s ease both; }
.mc[data-active="bad"]  .mc-dot { background: var(--bad);  animation: dotPop .35s ease both; }

/* Card label */
.mc-name {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--muted);
  margin-bottom: 0.6rem;
}

/* Bottom info area */
.mc-info { display: flex; flex-direction: column; gap: 0.2rem; }

/* Value (e.g. "Low", "Subjective", "None detected") */
.mc-value {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
  transition: color .3s;
}
.mc[data-active="good"] .mc-value { color: var(--good); }
.mc[data-active="warn"] .mc-value { color: var(--warn); }
.mc[data-active="bad"]  .mc-value { color: var(--bad);  }

/* Reason / tooltip */
.mc-tooltip {
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.5;
}

/* ─────────────────────────────────────────────────
   Docs page
───────────────────────────────────────────────── */
.docs-hero { max-width: 600px; margin-bottom: 2rem; }

.docs-hero h1 {
  font-size: clamp(1.6rem, 4vw, 2.1rem);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.2;
  margin-bottom: 0.6rem;
}

.docs-hero p { font-size: 0.95rem; color: var(--muted); line-height: 1.65; }

.eyebrow {
  font-size: 0.7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.09em;
  color: var(--accent); margin-bottom: 0.6rem;
}

.card h2 { font-size: 0.9rem; font-weight: 700; color: var(--text); margin-bottom: 0.8rem; }

.docs-list { list-style: none; display: flex; flex-direction: column; gap: 0.55rem; }

.docs-list li {
  font-size: 0.9rem; color: var(--muted);
  padding-left: 1.1rem; position: relative;
}
.docs-list li::before { content: "–"; position: absolute; left: 0; color: var(--accent); }

/* ─────────────────────────────────────────────────
   Responsive
───────────────────────────────────────────────── */
@media (max-width: 600px) {
  .results-grid { grid-template-columns: 1fr; }
  .hero h1 { white-space: normal; }
}

@media (max-width: 580px) {
  .page { width: calc(100% - 2rem); padding-block: 1.5rem 4rem; }
  .hero h1 { font-size: clamp(2rem, 8vw, 2.6rem); }
  .topbar { padding-bottom: 2.25rem; }
}
