/* ============================================================
   Never Behind — Shared Styles
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,500&family=Instrument+Sans:wght@400;500;600&family=Geist:wght@400;500;600&display=swap');

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

:root {
  --bg: #EDE6DC;
  --surface: #FDFAF7;
  --surface2: #F0E8DC;
  --surface3: #DDD3C4;
  --border: #DDD3C4;
  --border2: #C4B49A;
  --accent: #C07840;
  --accent-dim: #A06030;
  --accent-text: #925B30;
  --accent-bg: rgba(192,120,64,0.08);
  --text: #1E1510;
  --muted: #695B49;
  --muted2: #756351;
  --danger: #C05040;
  --danger-bg: rgba(192,80,64,0.1);
  --success: #5A7A5E;
  --success-bg: rgba(90,122,94,0.12);
  /* "info" is this app's gentle-warning tone — used for deload/ramp-back
     states specifically. Deliberately a slate-periwinkle, not amber/red:
     scaling back after a layoff isn't a failure, so it can't share a hue
     with anything that reads as an alarm. See DESIGN.md. */
  --info: #5A60AB;
  --info-bg: rgba(90,96,171,0.12);
  --font-d: 'Fraunces', Georgia, serif;
  --font-b: 'Instrument Sans', system-ui, sans-serif;
  --font-m: 'Geist', system-ui, sans-serif;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --radius-pill: 999px;
  --nav-h: 52px;
}

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-b);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Typography ── */
.font-display { font-family: var(--font-d); }
h1,h2,h3 { font-family: var(--font-d); font-weight: 500; letter-spacing: -0.2px; }

/* ── Layout ── */
.container {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ── Nav ── */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--nav-h);
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 50;
}
.nav-brand {
  font-family: var(--font-d);
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -0.2px;
  color: var(--accent-text);
}
.nav-brand span { color: var(--muted); font-weight: 400; }

/* ── Cards ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.card-sm { padding: 14px 16px; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: var(--radius-pill);
  border: none;
  font-family: var(--font-b);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: opacity 0.12s, transform 0.1s;
  text-transform: uppercase;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.4; cursor: default; transform: none; }
.btn-primary { background: var(--accent); color: var(--text); width: 100%; }
.btn-primary:hover:not(:disabled) { opacity: 0.9; }
.btn-ghost { background: var(--surface2); color: var(--muted); border: 1px solid var(--border); }
.btn-ghost:hover:not(:disabled) { border-color: var(--border2); color: var(--text); }
.btn-danger { background: var(--danger-bg); color: var(--danger); border: 1px solid var(--danger); }
.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-full { width: 100%; }

/* ── Form elements ── */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-family: var(--font-b);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}
.form-input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  color: var(--text);
  font-size: 15px;
  font-family: var(--font-b);
  outline: none;
  transition: border-color 0.12s;
}
.form-input:focus { border-color: var(--accent); }
.form-input::placeholder { color: var(--muted2); }
.form-error {
  font-size: 13px;
  color: var(--danger);
  margin-top: 6px;
  display: none;
}
.form-error.visible { display: block; }

/* ── Avatar ── */
.avatar {
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-b);
  font-weight: 600;
  flex-shrink: 0;
}
.avatar-sm { width: 32px; height: 32px; font-size: 13px; }
.avatar-md { width: 44px; height: 44px; font-size: 17px; }
.avatar-lg { width: 64px; height: 64px; font-size: 24px; }

/* ── Badges ── */
.badge {
  display: inline-block;
  font-family: var(--font-b);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  border-radius: 4px;
  padding: 2px 7px;
}
.badge-accent { background: var(--accent); color: var(--text); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-success { background: var(--success-bg); color: var(--success); }

/* ── Bottom nav ── */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  z-index: 50;
}
.bottom-nav-inner {
  display: flex;
  max-width: 680px;
  margin: 0 auto;
}
.bnav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 10px;
  background: transparent;
  border: none;
  color: var(--muted);
  font-family: var(--font-b);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.12s;
}
.bnav-btn svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.bnav-btn.active { color: var(--accent-text); }

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 72px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  padding: 10px 18px;
  font-size: 14px;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 200;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.success { border-color: var(--success); color: var(--success); }
.toast.error { border-color: var(--danger); color: var(--danger); }

/* ── Modal ── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  padding: 28px;
  max-width: 400px;
  width: 100%;
}
.modal-box h2 { font-size: 26px; margin-bottom: 10px; }
.modal-box p { color: var(--muted); font-size: 14px; line-height: 1.6; margin-bottom: 20px; }
.modal-actions { display: flex; gap: 10px; }
.modal-actions .btn { flex: 1; }

/* ── Spinner ── */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }

/* ── Utility ── */
.text-muted { color: var(--muted); }
.text-accent { color: var(--accent-text); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-center { text-align: center; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.w-full { width: 100%; }
