:root {
  --bg: #0b0f17;
  --surface: #121826;
  --surface-2: #1a2235;
  --border: #2a3550;
  --text: #e8edf7;
  --muted: #8b98b8;
  --accent: #5b8def;
  --accent-2: #7c5cff;
  --success: #3ecf8e;
  --warning: #f5a623;
  --danger: #ff6b6b;
  --radius: 14px;
  --font: "Inter", system-ui, sans-serif;
  --mono: "JetBrains Mono", monospace;
}

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

body {
  font-family: var(--font);
  background: radial-gradient(ellipse at top, #151d30 0%, var(--bg) 55%);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

.app {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.header__brand { display: flex; gap: 1rem; align-items: center; }

.logo {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 1.4rem;
}

.header h1 { font-size: 1.6rem; font-weight: 700; }
.header p { color: var(--muted); font-size: 0.9rem; margin-top: 0.15rem; }
.header__meta { color: var(--muted); font-size: 0.8rem; align-self: center; }

.upload-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
}

.upload-card h2 { margin-bottom: 0.5rem; }
.upload-card > p { color: var(--muted); margin-bottom: 1.5rem; font-size: 0.92rem; }

.file-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 2.5rem 1rem;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  margin-bottom: 1.25rem;
}

.file-drop:hover, .file-drop.dragover {
  border-color: var(--accent);
  background: rgba(91, 141, 239, 0.06);
}

.file-drop__icon { font-size: 2rem; }
.file-drop__text { color: var(--muted); font-size: 0.92rem; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.form-row label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.form-row input, .form-row select {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  color: var(--text);
  font-family: var(--font);
  font-size: 0.95rem;
}

.btn {
  border: none;
  border-radius: 10px;
  padding: 0.75rem 1.5rem;
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
}

.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn:not(:disabled):active { transform: scale(0.98); }

.btn--primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  width: 100%;
}

.btn--secondary {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
}

.recorder {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.recorder__status { color: var(--danger); font-size: 0.85rem; font-family: var(--mono); }

.loading {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--muted);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 1rem;
}

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

.dashboard { animation: fadeIn 0.4s ease; }

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

.hero-scores {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.hero-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
}

.hero-card--health { border-top: 3px solid var(--success); }
.hero-card--comm { border-top: 3px solid var(--accent); }
.hero-card--risk { border-top: 3px solid var(--warning); }

.hero-card__label {
  display: block;
  font-size: 0.82rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.5rem;
}

.hero-card__value {
  font-size: 2.8rem;
  font-weight: 700;
  font-family: var(--mono);
}

.hero-card__value--text { font-size: 1.6rem; }

.modules { display: flex; flex-direction: column; gap: 1.25rem; }

.module {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}

.module h3 {
  font-size: 1rem;
  margin-bottom: 1rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.score-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.75rem;
}

.score-item {
  background: var(--surface-2);
  border-radius: 10px;
  padding: 1rem;
  text-align: center;
}

.score-item__label {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.score-item__value {
  font-size: 1.6rem;
  font-weight: 700;
  font-family: var(--mono);
}

.score-item__sub {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 0.25rem;
}

.score-item__bar {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin-top: 0.5rem;
  overflow: hidden;
}

.score-item__bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.6s ease;
}

.feature-table {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.5rem;
}

.feature-row {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  background: var(--surface-2);
  border-radius: 8px;
  font-size: 0.85rem;
}

.feature-row span:first-child { color: var(--muted); }
.feature-row span:last-child { font-family: var(--mono); font-weight: 500; }

.transcript {
  background: var(--surface-2);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--text);
  min-height: 3rem;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 0.75rem;
  font-size: 0.82rem;
  color: var(--muted);
  font-family: var(--mono);
}

#new-analysis-btn { margin-top: 1.5rem; }

.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--danger);
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: 10px;
  font-size: 0.9rem;
  z-index: 100;
  max-width: 90vw;
}

.toast.success { background: var(--success); color: #0b0f17; }
.toast a { color: #fff; text-decoration: underline; font-weight: 600; }

.recorder__hint { color: var(--muted); font-size: 0.8rem; margin-top: 0.5rem; }

.risk-low { color: var(--success); }
.risk-medium { color: var(--warning); }
.risk-high, .risk-critical { color: var(--danger); }

@media (max-width: 700px) {
  .hero-scores { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
}

/* ------------------------------------------------------------------ */
/* Site chrome: header, nav, footer                                    */
/* ------------------------------------------------------------------ */
.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--accent);
  color: #fff;
  padding: 0.5rem 1rem;
  border-radius: 0 0 8px 0;
  z-index: 200;
}
.skip-link:focus { left: 0; }

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: 1100px;
  margin: 0 auto;
  padding: 1rem 1.25rem;
  flex-wrap: wrap;
}
.site-header__brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--text);
}
.site-header__name { font-weight: 700; font-size: 1.15rem; }
.logo--sm { width: 34px; height: 34px; font-size: 1rem; border-radius: 9px; }
.logo-img { display: block; border-radius: 10px; }
.logo-img--sm { border-radius: 8px; }

.site-nav { display: flex; gap: 1.25rem; flex-wrap: wrap; }
.site-nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  padding: 0.3rem 0;
  border-bottom: 2px solid transparent;
}
.site-nav a:hover { color: var(--text); }
.site-nav a[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); }

.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 3rem;
  padding: 2rem 1.25rem 1rem;
}
.site-footer__inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}
.site-footer__brand { display: flex; gap: 0.75rem; align-items: center; }
.site-footer__brand p { color: var(--muted); font-size: 0.85rem; }
.site-footer__links { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; }
.site-footer__links a { color: var(--muted); text-decoration: none; font-size: 0.9rem; }
.site-footer__links a:hover { color: var(--text); }
.site-footer__copy {
  max-width: 1100px;
  margin: 1.5rem auto 0;
  color: var(--muted);
  font-size: 0.8rem;
  text-align: center;
}

/* ------------------------------------------------------------------ */
/* Home hero + content sections                                        */
/* ------------------------------------------------------------------ */
.hero { text-align: center; padding: 1rem 0 2rem; }
.hero h1 { font-size: 2rem; line-height: 1.2; margin-bottom: 0.75rem; }
.hero__lead {
  color: var(--muted);
  max-width: 720px;
  margin: 0 auto;
  font-size: 1.02rem;
  line-height: 1.6;
}
.hero__lead strong { color: var(--text); }

.content-section {
  margin-top: 3rem;
  border-top: 1px solid var(--border);
  padding-top: 2rem;
}
.content-section h2 { font-size: 1.4rem; margin: 1.5rem 0 0.75rem; }
.content-section p { color: var(--muted); max-width: 780px; line-height: 1.7; }
.content-section a { color: var(--accent); }

.feature-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin: 1.25rem 0 2rem;
}
.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}
.feature-card h3 { font-size: 1.05rem; margin-bottom: 0.4rem; }
.feature-card p { font-size: 0.9rem; }

details {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  margin-bottom: 0.6rem;
}
details summary { cursor: pointer; font-weight: 600; }
details p { margin-top: 0.5rem; }

/* ------------------------------------------------------------------ */
/* Blog + article + legal pages                                        */
/* ------------------------------------------------------------------ */
.page { max-width: 820px; margin: 0 auto; padding: 1.5rem 1.25rem 2rem; }
.page--center { text-align: center; }
.page__header { margin-bottom: 1.5rem; }
.page__header h1 { font-size: 2rem; line-height: 1.2; margin-bottom: 0.5rem; }
.page__header p { color: var(--muted); }
.page__meta { font-size: 0.85rem; color: var(--muted); font-family: var(--mono); }

.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}
.post-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.2s, transform 0.1s;
}
.post-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.post-card h2 { font-size: 1.1rem; margin-bottom: 0.5rem; }
.post-card p { color: var(--muted); font-size: 0.9rem; margin-bottom: 0.75rem; }
.post-card__meta { color: var(--muted); font-size: 0.78rem; font-family: var(--mono); }

.breadcrumb { font-size: 0.85rem; color: var(--muted); margin-bottom: 1rem; }
.breadcrumb a { color: var(--accent); text-decoration: none; }
.breadcrumb span { margin: 0 0.35rem; }

.article-body { color: var(--text); line-height: 1.75; }
.article-body h2 { font-size: 1.35rem; margin: 1.75rem 0 0.6rem; }
.article-body h3 { font-size: 1.1rem; margin: 1.25rem 0 0.4rem; }
.article-body p, .article-body li { color: #c7d0e4; }
.article-body ul, .article-body ol { margin: 0.5rem 0 1rem 1.4rem; }
.article-body li { margin-bottom: 0.35rem; }
.article-body a { color: var(--accent); }
.article-body blockquote {
  border-left: 3px solid var(--accent);
  padding: 0.5rem 1rem;
  margin: 1rem 0;
  color: var(--muted);
  background: var(--surface);
  border-radius: 0 8px 8px 0;
}
.article-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.9rem;
}
.article-body th, .article-body td {
  border: 1px solid var(--border);
  padding: 0.5rem 0.75rem;
  text-align: left;
}
.article-body th { background: var(--surface-2); }

.cta-box {
  margin-top: 2.5rem;
  background: linear-gradient(135deg, rgba(91,141,239,0.12), rgba(124,92,255,0.12));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  text-align: center;
}
.cta-box h2 { font-size: 1.3rem; margin-bottom: 0.4rem; }
.cta-box p { color: var(--muted); margin-bottom: 1rem; }
.cta-box .btn { display: inline-block; text-decoration: none; width: auto; }

@media (max-width: 700px) {
  .hero h1 { font-size: 1.6rem; }
  .site-footer__inner { flex-direction: column; }
}
