/* On Thy Self — Design System
   Calming, clean, magical, spiritual, premium, minimal, gentle, grounded. */

:root {
  /* Brand colors */
  --color-baby-blue: #0082D9;
  --color-baby-blue-light: #E7F3FC;
  --color-baby-blue-soft: #CDE9F9;
  --color-baby-blue-dim: #4FA8E6;
  --color-accent: #87052F;
  --color-accent-soft: #F4E3E8;
  --color-accent-dim: #A83A5A;

  /* Neutrals */
  --color-white: #FFFFFF;
  --color-grey-50: #F7F8FA;
  --color-grey-100: #EEF1F4;
  --color-grey-200: #E2E6EA;
  --color-grey-400: #9AA4AE;
  --color-grey-600: #667079;
  --color-charcoal: #2B3238;
  --color-black: #14181B;

  /* Semantic */
  --bg-page: var(--color-white);
  --bg-elevated: var(--color-white);
  --bg-subtle: var(--color-grey-50);
  --text-primary: var(--color-charcoal);
  --text-secondary: var(--color-grey-600);
  --text-inverse: var(--color-white);
  --border-subtle: var(--color-grey-200);

  /* Typography */
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-display: Georgia, "Iowan Old Style", "Times New Roman", serif;

  /* Radius & shadow */
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-full: 999px;
  --shadow-soft: 0 6px 24px rgba(20, 24, 27, 0.06);
  --shadow-card: 0 10px 30px rgba(0, 130, 217, 0.08);

  /* Motion */
  --ease-gentle: cubic-bezier(0.22, 0.61, 0.36, 1);
  --dur-fast: 200ms;
  --dur-medium: 420ms;
  --dur-slow: 900ms;

  color-scheme: light;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  overflow-x: hidden; /* guards against any accidental horizontal overflow, which can otherwise make mobile browsers detach position:fixed elements like the bottom nav until the page is scrolled */
}

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg-page);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

#app {
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

img { max-width: 100%; display: block; }

a { color: inherit; }

button {
  font-family: inherit;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 400;
  margin: 0 0 8px;
  color: var(--text-primary);
  letter-spacing: 0.2px;
}

p { margin: 0 0 12px; color: var(--text-secondary); }

/* Layout */
.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  background: var(--bg-page);
  animation: fadeIn var(--dur-medium) var(--ease-gentle);
}

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

.container {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 24px 20px calc(96px + env(safe-area-inset-bottom));
  flex: 1;
}

@media (min-width: 900px) {
  .container { max-width: 640px; padding-top: 40px; }
}

.container--wide {
  max-width: 900px;
}

.top-spacer { height: env(safe-area-inset-top); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: var(--radius-full);
  padding: 16px 28px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform var(--dur-fast) var(--ease-gentle), box-shadow var(--dur-fast) var(--ease-gentle), background var(--dur-fast) var(--ease-gentle);
  min-height: 52px;
  width: 100%;
  text-align: center;
}
.btn:active { transform: scale(0.98); }

.btn-primary {
  background: var(--color-baby-blue);
  color: var(--text-inverse);
  box-shadow: var(--shadow-card);
}
.btn-primary:hover { background: #0072BE; }

.btn-accent {
  background: var(--color-accent);
  color: var(--text-inverse);
}
.btn-accent:hover { background: #720326; }

.btn-secondary {
  background: var(--bg-subtle);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
}

.btn-ghost {
  background: transparent;
  color: var(--color-baby-blue);
  width: auto;
  padding: 10px 6px;
  min-height: auto;
  font-weight: 500;
}

.btn-sm { padding: 10px 18px; min-height: 40px; font-size: 14px; width: auto; }
.btn-block-group { display: flex; flex-direction: column; gap: 12px; }

/* Cards */
.card {
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--border-subtle);
  padding: 20px;
}

.card--tinted {
  background: linear-gradient(180deg, var(--color-baby-blue-light) 0%, var(--color-white) 100%);
  border: none;
}

.card-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* Nav bar (bottom, mobile-first, persistent across primary app screens) */
.nav-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--border-subtle);
  box-shadow: 0 -6px 20px rgba(20, 24, 27, 0.05);
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 40;
}

.nav-bar-inner {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  display: flex;
  justify-content: space-around;
  align-items: stretch;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 10px 4px 8px;
  min-height: 52px;
  background: none;
  border: none;
  color: var(--color-grey-400);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  border-radius: var(--radius-md);
  transition: color var(--dur-fast) var(--ease-gentle);
}

.nav-item:focus-visible {
  outline: 2px solid var(--color-baby-blue);
  outline-offset: 2px;
}

.nav-item.active {
  color: var(--color-baby-blue);
  font-weight: 700;
}
.nav-item.active .nav-icon {
  background: var(--color-baby-blue-light);
  border-radius: var(--radius-full);
}
.nav-item .nav-icon {
  display: flex; align-items: center; justify-content: center;
  padding: 6px 16px;
  line-height: 1;
  font-size: 19px;
}

.nav-item.nav-item--central {
  color: var(--color-grey-600);
}
.nav-item--central .nav-icon-wrap {
  background: var(--color-accent);
  width: 50px; height: 50px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin-top: -22px;
  box-shadow: 0 8px 20px rgba(135,5,47,0.30);
  transition: box-shadow var(--dur-fast) var(--ease-gentle), transform var(--dur-fast) var(--ease-gentle);
}
.nav-item--central:focus-visible .nav-icon-wrap,
.nav-item--central:hover .nav-icon-wrap {
  box-shadow: 0 8px 24px rgba(135,5,47,0.42);
}
.nav-item--central .nav-icon {
  padding: 0;
  color: var(--color-white);
  font-size: 20px;
}
.nav-item--central.active { color: var(--color-accent); font-weight: 700; }
.nav-item--central.active .nav-icon { background: none; }
.nav-item--central span:last-child { color: inherit; }

/* Top bar */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 4px 10px;
}
.top-bar .back-btn {
  background: var(--bg-subtle);
  border: none;
  width: 40px; height: 40px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 18px;
}

/* Progress dots for check-in */
.progress-dots {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin: 4px 0 22px;
}
.progress-dots span {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--color-grey-200);
  transition: background var(--dur-fast) var(--ease-gentle), transform var(--dur-fast) var(--ease-gentle);
}
.progress-dots span.done { background: var(--color-baby-blue-dim); }
.progress-dots span.active { background: var(--color-baby-blue); transform: scale(1.3); }

/* Choice grid (emotions, body, support) */
.choice-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 8px 0 20px;
}
.choice-chip {
  background: var(--bg-subtle);
  border: 1.5px solid transparent;
  border-radius: var(--radius-md);
  padding: 16px 14px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  text-align: left;
  transition: all var(--dur-fast) var(--ease-gentle);
}
.choice-chip.selected {
  border-color: var(--color-baby-blue);
  background: var(--color-baby-blue-light);
  color: var(--color-baby-blue);
}
.choice-chip .chip-emoji { font-size: 20px; margin-right: 6px; }

/* Scale (mood / likert) */
.scale-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin: 12px 0 22px;
}
.scale-dot {
  flex: 1;
  min-width: 0; /* let flex items shrink below their content's intrinsic size so the row never overflows */
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1.5px solid var(--border-subtle);
  background: var(--bg-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-gentle);
}
.scale-dot.selected {
  background: var(--color-baby-blue);
  border-color: var(--color-baby-blue);
  color: var(--color-white);
  transform: scale(1.08);
}

/* Mood check-in icons: larger than the base 18px, but fluidly capped with
   clamp() so all 5 always fit within one screen width without horizontal
   scroll, on the smallest phone up through desktop. */
.scale-dot--mood {
  font-size: clamp(26px, 9vw, 40px);
  line-height: 1;
  padding: 4px;
  color: var(--color-grey-400);
}
.scale-dot--mood.selected {
  transform: scale(1.04);
}
.scale-labels {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: -14px;
  margin-bottom: 22px;
}

/* Section headers */
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 1.2px;
  font-size: 11px;
  font-weight: 700;
  color: var(--color-accent);
  margin-bottom: 8px;
}

.section-title {
  font-size: 20px;
  margin-bottom: 4px;
}

.section-sub {
  font-size: 15px;
  color: var(--text-secondary);
  margin-bottom: 18px;
}

/* Cheetah hero */
.hero-cheetah {
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: radial-gradient(120% 100% at 50% 0%, var(--color-baby-blue-soft) 0%, var(--color-baby-blue-light) 45%, var(--color-white) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 10px 6px;
  margin-bottom: 18px;
  position: relative;
}
.hero-cheetah img {
  width: 78%;
  max-width: 340px;
  animation: breathe 6s ease-in-out infinite;
  filter: drop-shadow(0 14px 22px rgba(20,24,27,0.12));
}
@keyframes breathe {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-4px) scale(1.012); }
}
.hero-cheetah .glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(60% 40% at 50% 20%, rgba(0,130,217,0.10), transparent 70%);
  pointer-events: none;
}

/* Video card */
.video-card {
  display: flex;
  gap: 14px;
  padding: 14px;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  text-align: left;
  width: 100%;
  margin-bottom: 12px;
  transition: box-shadow var(--dur-fast) var(--ease-gentle), transform var(--dur-fast) var(--ease-gentle);
}
.video-card:hover { box-shadow: var(--shadow-card); }
.video-card:active { transform: scale(0.99); }
.video-thumb {
  width: 92px; height: 92px;
  border-radius: var(--radius-sm);
  background: var(--color-baby-blue-light);
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  color: var(--color-baby-blue);
  overflow: hidden;
}
.video-thumb img { width: 100%; height: 100%; object-fit: cover; }
.video-meta { display: flex; flex-direction: column; justify-content: center; gap: 4px; min-width: 0; }
.video-meta h4 { margin: 0; font-size: 15px; font-family: var(--font-body); font-weight: 600; }
.video-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag-pill {
  background: var(--color-accent-soft);
  color: var(--color-accent);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: var(--radius-full);
}
.tag-pill--blue { background: var(--color-baby-blue-light); color: var(--color-baby-blue); }

/* Category grid on browse screen */
.category-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 24px;
}
.category-tile {
  border-radius: var(--radius-md);
  padding: 18px 14px;
  background: linear-gradient(160deg, var(--color-baby-blue-light), var(--color-white));
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  min-height: 88px;
  display: flex; flex-direction: column; justify-content: flex-end;
  font-weight: 600;
  font-size: 14px;
}
.category-tile .cat-icon { font-size: 22px; margin-bottom: 8px; }

/* Search input */
.search-input {
  width: 100%;
  padding: 14px 18px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
  background: var(--bg-subtle);
  font-size: 15px;
  margin-bottom: 18px;
}
.search-input:focus { outline: 2px solid var(--color-baby-blue-dim); }

/* Pill filters */
.filter-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 6px;
  margin-bottom: 18px;
  scrollbar-width: none;
}
.filter-row::-webkit-scrollbar { display: none; }
.filter-pill {
  flex-shrink: 0;
  padding: 9px 16px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
  background: var(--bg-subtle);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}
.filter-pill.selected {
  background: var(--color-baby-blue);
  border-color: var(--color-baby-blue);
  color: var(--color-white);
}

/* Video player */
.video-embed {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  background: var(--color-black);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 18px;
}
.video-embed iframe { width: 100%; height: 100%; border: 0; }

/* Stat tiles for journey */
.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 22px;
}
.stat-tile {
  background: var(--bg-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
}
.stat-tile .stat-value {
  font-family: var(--font-display);
  font-size: 26px;
  color: var(--color-baby-blue);
}
.stat-tile .stat-label {
  font-size: 12px;
  color: var(--text-secondary);
}

/* Achievement chip */
.achv-list { display: flex; flex-direction: column; gap: 10px; }
.achv-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}
.achv-item.locked { opacity: 0.45; }
.achv-icon {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--color-accent-soft);
  color: var(--color-accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}

/* Therapist card */
.therapist-card { display: flex; gap: 14px; margin-bottom: 14px; }
.therapist-photo {
  width: 64px; height: 64px; border-radius: 50%;
  background: var(--color-baby-blue-light);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; color: var(--color-baby-blue); flex-shrink: 0;
}

/* Plan card */
.plan-card {
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  margin-bottom: 12px;
  cursor: pointer;
  display: flex; justify-content: space-between; align-items: center;
}
.plan-card.selected { border-color: var(--color-baby-blue); background: var(--color-baby-blue-light); }
.plan-card .plan-name { font-weight: 600; }
.plan-card .plan-price { color: var(--color-baby-blue); font-weight: 700; }
.plan-badge {
  background: var(--color-accent);
  color: var(--color-white);
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  margin-left: 8px;
}

/* Settings list */
.settings-group { margin-bottom: 26px; }
.settings-group h3 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--text-secondary); margin-bottom: 10px; }
.settings-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 4px;
  border-bottom: 1px solid var(--border-subtle);
}
.settings-row:last-child { border-bottom: none; }

/* Toggle switch */
.toggle {
  width: 46px; height: 28px;
  border-radius: var(--radius-full);
  background: var(--color-grey-200);
  position: relative;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--dur-fast) var(--ease-gentle);
}
.toggle.on { background: var(--color-baby-blue); }
.toggle::after {
  content: "";
  position: absolute;
  top: 3px; left: 3px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--color-white);
  transition: transform var(--dur-fast) var(--ease-gentle);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle.on::after { transform: translateX(18px); }

/* Onboarding dots */
.onb-dots { display: flex; gap: 6px; justify-content: center; margin-top: 18px; }
.onb-dots span { width: 6px; height: 6px; border-radius: 50%; background: var(--color-grey-200); }
.onb-dots span.active { background: var(--color-baby-blue); width: 18px; border-radius: var(--radius-full); }

/* Splash */
.splash-screen {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, var(--color-baby-blue-light) 0%, var(--color-white) 60%);
  text-align: center;
  padding: 24px;
}
.splash-screen img { width: 60%; max-width: 280px; margin-bottom: 24px; animation: breathe 5s ease-in-out infinite; }
.splash-title { font-family: var(--font-display); font-size: 30px; margin-bottom: 6px; }
.splash-tagline { color: var(--color-accent); font-weight: 600; }

/* Empty states */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-secondary);
}
.empty-state .empty-icon { font-size: 34px; margin-bottom: 10px; }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* Utility */
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.text-center { text-align: center; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.italic-quote {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 17px;
  line-height: 1.6;
  color: var(--text-primary);
}
.divider { height: 1px; background: var(--border-subtle); margin: 20px 0; border: none; }
.badge-featured {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  color: var(--color-accent);
  background: var(--color-accent-soft);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  margin-bottom: 10px;
}
.link-inline { color: var(--color-baby-blue); text-decoration: underline; cursor: pointer; }
