/* ═══════════════════════════════════════════════════════
   Native DNA Scanner — Stylesheet
   Morgan Heights Studio
   ═══════════════════════════════════════════════════════ */

:root {
  --bg:             #06090d;
  --surface:        #0d1117;
  --surface-raised: #151b24;
  --border:         #1c2533;
  --border-hover:   #2a3a52;
  --text:           #b8c4d4;
  --text-muted:     #5a6a7e;
  --heading:        #e2e8f0;
  --accent:         #38bdf8;
  --accent-dim:     rgba(56,189,248,0.10);
  --green:          #22c55e;
  --green-bg:       rgba(34,197,94,0.08);
  --green-border:   rgba(34,197,94,0.25);
  --amber:          #fbbf24;
  --amber-bg:       rgba(251,191,36,0.08);
  --red:            #f87171;
  --red-bg:         rgba(248,113,113,0.06);
  --mono:           'SFMono-Regular', 'Cascadia Code', 'Consolas', monospace;
  --sans:           -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --radius:         6px;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.shell {
  max-width: 900px;
  margin: 0 auto;
  padding: 1.5rem;
}

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

.site-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 0 1.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-glyph {
  font-size: 1.75rem;
  line-height: 1;
  filter: hue-rotate(160deg) brightness(1.5);
}

.logo-title {
  font-family: var(--mono);
  font-size: 1rem;
  font-weight: 600;
  color: var(--heading);
}

.logo-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ── Cards ───────────────────────────────────────────── */

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

.card h2 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--heading);
  margin-bottom: 0.5rem;
}

.card h3 {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--heading);
  margin-bottom: 0.35rem;
  margin-top: 1rem;
}

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

code {
  font-family: var(--mono);
  font-size: 0.85em;
  color: var(--accent);
}

/* ── Upload ──────────────────────────────────────────── */

.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 3rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  margin: 1rem 0;
  position: relative;
}

.drop-zone:hover,
.drop-zone.dragover {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.drop-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.drop-icon { font-size: 2.5rem; margin-bottom: 0.5rem; }
.drop-text { font-size: 1rem; color: var(--heading); font-weight: 500; }
.drop-sub  { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.25rem; }

/* ── Buttons ─────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1.25rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-primary {
  background: var(--accent);
  color: #000;
  border-color: var(--accent);
}
.btn-primary:hover { filter: brightness(1.1); }

.btn-secondary {
  background: var(--surface-raised);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover { border-color: var(--border-hover); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border);
}
.btn-ghost:hover { color: var(--heading); border-color: var(--border-hover); }

.btn-large {
  padding: 0.75rem 2rem;
  font-size: 1rem;
  margin-top: 1rem;
}

/* ── Alert ───────────────────────────────────────────── */

.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
  font-size: 0.85rem;
}

.alert-error {
  background: var(--red-bg);
  border: 1px solid rgba(248,113,113,0.2);
  color: var(--red);
}

/* ── Panel chips ─────────────────────────────────────── */

.panel-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.75rem 0;
}

.panel-chip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.75rem;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.8rem;
}

.panel-name { color: var(--heading); font-weight: 500; }
.panel-meta { color: var(--text-muted); font-size: 0.7rem; }

.ref-upload-form {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1rem;
}

.ref-upload-form input[type="file"] {
  font-family: var(--sans);
  font-size: 0.8rem;
  color: var(--text);
}

/* ── Calculator selector ─────────────────────────────── */

.calc-selector {
  margin: 1rem 0;
  padding: 1rem;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.check-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0;
  font-size: 0.85rem;
  color: var(--heading);
  cursor: pointer;
}

.check-item input[type="checkbox"] {
  accent-color: var(--accent);
}

/* ── Results ─────────────────────────────────────────── */

.results-header {
  margin-bottom: 1.5rem;
}

.results-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--heading);
}

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

/* ── Stats ────────────────────────────────────────────── */

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

@media (max-width: 600px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }

.stat-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1rem;
  text-align: center;
}

.stat-box.accent {
  border-color: var(--green-border);
}

.stat-val {
  font-family: var(--mono);
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--heading);
  line-height: 1;
}

.stat-box.accent .stat-val { color: var(--green); }

.stat-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}

/* ── Category bars ───────────────────────────────────── */

.cat-grid {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.cat-item {
  display: grid;
  grid-template-columns: 200px 1fr auto;
  gap: 0.75rem;
  align-items: center;
  font-size: 0.85rem;
}

@media (max-width: 600px) {
  .cat-item { grid-template-columns: 1fr; }
}

.cat-bar-label { color: var(--text); }

.cat-bar-track {
  height: 8px;
  background: var(--surface-raised);
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.cat-bar-fill {
  height: 100%;
  background: var(--green);
  border-radius: 4px;
  transition: width 0.5s ease;
}

.cat-bar-val {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ── Hits ─────────────────────────────────────────────── */

.hits-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.hit-row {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-left: 3px solid var(--green);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
}

.hit-row.moderate { border-left-color: var(--accent); }
.hit-row.mtdna    { border-left-color: var(--amber); }
.hit-row.ychr     { border-left-color: #a78bfa; }

.hit-main {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.hit-rsid {
  font-family: var(--mono) !important;
  font-weight: 600;
  color: var(--heading) !important;
}

.hit-badge {
  font-size: 0.6rem;
  font-family: var(--mono);
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 3px;
  letter-spacing: 0.03em;
}

.hit-badge.homo {
  background: var(--green-bg);
  color: var(--green);
  border: 1px solid var(--green-border);
}

.hit-badge.het {
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid rgba(56,189,248,0.25);
}

.hit-chr {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-left: auto;
}

.hit-desc {
  font-size: 0.8rem;
  color: var(--text);
  margin-bottom: 0.35rem;
}

.hit-data {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.75rem;
  font-family: var(--mono);
  color: var(--text-muted);
}

.hit-data strong {
  color: var(--heading);
  font-weight: 500;
}

/* ── Chromosome chart ────────────────────────────────── */

.chr-chart { margin-top: 0.75rem; }

.chr-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.chr-label {
  width: 3rem;
  text-align: right;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.chr-bar-track {
  flex: 1;
  height: 16px;
  background: var(--surface-raised);
  border-radius: 3px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.chr-bar-fill {
  height: 100%;
  background: var(--green);
  border-radius: 3px;
  transition: width 0.5s ease;
}

.chr-count {
  width: 1.5rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--heading);
  text-align: center;
}

/* ── Data table ──────────────────────────────────────── */

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  margin-top: 0.5rem;
}

.data-table th {
  text-align: left;
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-muted);
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 0.4rem 0.75rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.data-table tr:hover td {
  background: var(--surface-raised);
}

/* ── Admixture ───────────────────────────────────────── */

.admix-card {
  border-color: var(--border-hover);
}

.admix-bars {
  margin: 1rem 0;
}

.admix-row {
  display: grid;
  grid-template-columns: 180px 1fr 60px;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 0.4rem;
  font-size: 0.85rem;
}

@media (max-width: 500px) {
  .admix-row { grid-template-columns: 120px 1fr 50px; }
}

.admix-pop {
  color: var(--text);
  font-size: 0.8rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admix-bar-track {
  height: 20px;
  background: var(--surface-raised);
  border-radius: 3px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.admix-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.6s ease;
  min-width: 2px;
}

.admix-pct {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--heading);
  text-align: right;
  font-weight: 500;
}

.admix-details {
  margin-top: 1rem;
}

.admix-details summary {
  font-size: 0.8rem;
  color: var(--accent);
  cursor: pointer;
  padding: 0.5rem 0;
}

/* ── Callout ─────────────────────────────────────────── */

.callout-card {
  border-left: 3px solid var(--accent);
}

.callout-card p {
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
  max-width: 72ch;
}
.callout-card p:last-child { margin-bottom: 0; }

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

.site-foot {
  margin-top: 3rem;
  padding: 1.5rem 0;
  border-top: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  text-align: center;
}
