/* ==========================================================================
   Base — reset, typography, layout primitives, shared components
   ========================================================================== */

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

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--athera-off-white);
  color: var(--athera-charcoal);
  font-family: var(--athera-sans);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4 { margin: 0; font-weight: 300; }
p { margin: 0; }
a { color: var(--athera-blue-deep); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; }
ul { margin: 0; padding: 0; list-style: none; }

:focus-visible {
  outline: 2px solid var(--athera-blue-deep);
  outline-offset: 2px;
}

/* ---- Type scale ---------------------------------------------------------- */

.display-xl { font-family: var(--athera-display); font-size: clamp(56px, 8vw, 104px); font-weight: 300; line-height: 0.98; letter-spacing: -0.02em; }
.display-lg { font-family: var(--athera-display); font-size: clamp(40px, 6vw, 68px); font-weight: 300; line-height: 1.0; letter-spacing: -0.015em; }
.display-md { font-family: var(--athera-display); font-size: clamp(28px, 4vw, 44px); font-weight: 400; line-height: 1.12; letter-spacing: -0.01em; }
.display-sm { font-family: var(--athera-display); font-size: clamp(21px, 3vw, 30px); font-weight: 400; line-height: 1.2; }

.body-lg { font-size: 18px; font-weight: 300; line-height: 1.7; color: var(--athera-charcoal-light); }
.body { font-size: 15px; font-weight: 400; line-height: 1.65; color: var(--athera-charcoal); }
.body-sm { font-size: 13px; font-weight: 400; line-height: 1.55; color: var(--athera-grey); }

.label {
  font-size: 10px; font-weight: 500; letter-spacing: 0.2em;
  text-transform: uppercase; color: var(--athera-grey);
}
.label-blue { color: var(--athera-blue-deep); }

.mono { font-family: var(--athera-mono); font-weight: 400; }

.blue-rule { width: 48px; height: 1px; background: var(--athera-blue); border: 0; margin: 0; }

/* The A! is always brand blue, wherever "A!thera" appears in running copy. */
.brand-a { color: var(--athera-blue); }

.measure { max-width: 60ch; }
.muted { color: var(--athera-grey); }

/* ---- Layout primitives --------------------------------------------------- */

.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 48px;
}
.page-wide { max-width: 1320px; }

.section { padding: var(--sp-7) 0; }
.stack-1 > * + * { margin-top: var(--sp-1); }
.stack-2 > * + * { margin-top: var(--sp-2); }
.stack-3 > * + * { margin-top: var(--sp-3); }
.stack-4 > * + * { margin-top: var(--sp-4); }
.stack-5 > * + * { margin-top: var(--sp-5); }

.section-head { margin-bottom: var(--sp-4); }
.section-head .label { display: block; margin-bottom: var(--sp-2); }
.section-head .blue-rule { margin-top: var(--sp-3); }

/* ---- Buttons ------------------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 13px 26px;
  font-family: var(--athera-sans);
  font-size: 12px; font-weight: 500;
  letter-spacing: 0.06em; text-transform: uppercase;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
  text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--athera-blue); color: var(--athera-navy); }
.btn-primary:hover { background: var(--athera-blue-deep); color: #fff; }
.btn-secondary { background: transparent; color: var(--athera-charcoal); border-color: var(--athera-line); }
.btn-secondary:hover { background: var(--athera-white); border-color: var(--athera-grey-light); }
.btn-ghost { background: transparent; color: var(--athera-grey); border-color: transparent; padding-left: 0; padding-right: 0; }
.btn-ghost:hover { color: var(--athera-charcoal); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-arrow::after { content: "\2192"; font-size: 14px; }

.btn-row { display: flex; gap: var(--sp-2); align-items: center; flex-wrap: wrap; }

/* ---- Cards --------------------------------------------------------------- */

.card {
  background: var(--athera-white);
  border: 1px solid var(--athera-line);
  border-radius: var(--radius);
  padding: var(--sp-4);
}
.card-flush { padding: 0; overflow: hidden; }
.card-dark {
  background: var(--athera-navy);
  color: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--athera-line-dark);
  border-radius: var(--radius);
  padding: var(--sp-4);
}

/* ---- Stat blocks --------------------------------------------------------- */

.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1px;
  background: var(--athera-line);
  border: 1px solid var(--athera-line);
  border-radius: var(--radius);
  overflow: hidden;
}
.stat {
  background: var(--athera-white);
  padding: var(--sp-3) var(--sp-3);
}
.stat-value {
  font-family: var(--athera-mono);
  font-size: 30px; font-weight: 400; line-height: 1;
  color: var(--athera-charcoal);
  letter-spacing: -0.01em;
}
.stat-label {
  display: block; margin-top: 10px;
  font-size: 10px; font-weight: 500; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--athera-grey);
  line-height: 1.4;
}

/* ---- Tables -------------------------------------------------------------- */

.table { width: 100%; border-collapse: collapse; font-family: var(--athera-sans); font-size: 13px; }
.table th {
  padding: 12px 16px; text-align: left;
  font-size: 10px; font-weight: 500; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--athera-grey-light);
  border-bottom: 1px solid var(--athera-line);
}
.table td {
  padding: 13px 16px; color: var(--athera-charcoal);
  border-bottom: 1px solid var(--athera-line-light);
  vertical-align: middle;
}
.table tr:last-child td { border-bottom: none; }
.table .num { font-family: var(--athera-mono); }

/* ---- Callout ------------------------------------------------------------- */

.callout {
  border: 1px solid var(--athera-line);
  border-left: 2px solid var(--athera-blue);
  background: var(--athera-white);
  border-radius: var(--radius);
  padding: var(--sp-3);
}
.callout .label { display: block; margin-bottom: var(--sp-1); }

/* ---- Pills / badges ------------------------------------------------------ */

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 100px;
  font-size: 10px; font-weight: 500; letter-spacing: 0.1em;
  text-transform: uppercase;
  border: 1px solid var(--athera-line);
  color: var(--athera-grey);
}
.pill-dot::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; display: inline-block;
}

/* Risk-level tones (indicators only) */
.tone-high { color: var(--risk-high); border-color: var(--risk-high-line); background: var(--risk-high-bg); }
.tone-medium { color: var(--risk-medium); border-color: var(--risk-medium-line); background: var(--risk-medium-bg); }
.tone-low { color: var(--risk-low); border-color: var(--risk-low-line); background: var(--risk-low-bg); }

/* ---- Inline completeness bar --------------------------------------------- */

.bar {
  position: relative; width: 100px; height: 4px;
  background: var(--athera-line); border-radius: 2px; overflow: hidden;
  display: inline-block; vertical-align: middle;
}
.bar > span { position: absolute; left: 0; top: 0; bottom: 0; background: var(--athera-steel); border-radius: 2px; }
.bar.warn > span { background: var(--athera-amber); }

/* ---- State blocks (loading / empty / error) ------------------------------ */

.state {
  padding: var(--sp-7) var(--sp-4);
  text-align: center;
  color: var(--athera-grey);
}
.state .display-sm { color: var(--athera-charcoal); margin-bottom: var(--sp-2); }
.state .btn-row { justify-content: center; margin-top: var(--sp-4); }
.state-error { border-left: 2px solid var(--risk-high); text-align: left; }

.spinner {
  width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid var(--athera-line);
  border-top-color: var(--athera-blue);
  animation: spin 0.7s linear infinite;
  margin: 0 auto var(--sp-3);
}
@keyframes spin { to { transform: rotate(360deg); } }

.skeleton {
  background: linear-gradient(90deg, var(--athera-surface) 25%, var(--athera-mist) 37%, var(--athera-surface) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

/* ---- Toast --------------------------------------------------------------- */

#toast-host {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  z-index: 1000; display: flex; flex-direction: column; gap: 8px; align-items: center;
}
.toast {
  background: var(--athera-navy); color: #fff;
  padding: 12px 20px; border-radius: var(--radius); font-size: 13px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.18);
  animation: toast-in 0.25s ease;
  max-width: 420px;
}
.toast.toast-error { border-left: 2px solid var(--risk-high); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ---- View transition ----------------------------------------------------- */

.view-enter { animation: fade-in 0.3s ease; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* ---- Utilities ----------------------------------------------------------- */
.hidden { display: none !important; }
.flex { display: flex; }
.between { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-2); }
.gap-1 { gap: var(--sp-1); } .gap-2 { gap: var(--sp-2); } .gap-3 { gap: var(--sp-3); }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
