/* ── Design tokens ────────────────────────────────────────────────── */
:root {
  --bg:           #0C1016;
  --surface:      #161D29;
  --raised:       #1B2433;
  --hairline:     #232E41;
  --text:         #F2F5FA;
  --muted:        #818EA3;
  --accent:       #FF8A3D;
  --accent-soft:  #FFB35C;
  --green:        #3FD9A0;
  --track:        #283449;
  --on-accent:    #2A1405;
  --coach-grad-a: #2A1C12;
  --coach-grad-b: #181E2C;
}

/* ── Reset ────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }

/* ── Layout ───────────────────────────────────────────────────────── */
.wrap {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ── Nav ──────────────────────────────────────────────────────────── */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(12, 16, 22, 0.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--hairline);
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 58px;
}
.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 16px;
  color: var(--text);
}
.nav-icon {
  width: 30px;
  height: 30px;
  border-radius: 7px;
}
.nav-actions { display: flex; align-items: center; gap: 10px; }

/* ── Buttons ──────────────────────────────────────────────────────── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
  font-size: 16px;
  padding: 14px 24px;
  border-radius: 14px;
  text-decoration: none;
  transition: transform 0.15s ease, filter 0.15s ease;
}
.btn-primary:hover { transform: translateY(-1px); filter: brightness(1.07); }
.btn-primary:active { transform: scale(0.98); }

.btn-ghost {
  background: var(--surface);
  color: var(--muted);
  border: 1px solid var(--hairline);
  border-radius: 10px;
  padding: 7px 14px;
  font-size: 14px;
  font-weight: 500;
  transition: color 0.15s, border-color 0.15s;
}
.btn-ghost:hover { color: var(--text); border-color: var(--muted); }

/* ── Hero ─────────────────────────────────────────────────────────── */
.hero {
  padding: 80px 0 64px;
  background:
    radial-gradient(120% 70% at 50% 0%, rgba(255, 138, 61, 0.13), transparent 65%);
  overflow: hidden;
}
.hero-inner {
  display: grid;
  grid-template-columns: 1fr;
  gap: 48px;
  align-items: center;
}
@media (min-width: 640px) {
  .hero-inner { grid-template-columns: 1fr 1fr; }
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-soft);
  margin-bottom: 20px;
}
.eyebrow-dot {
  width: 6px;
  height: 6px;
  background: var(--green);
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}

.hero-headline {
  font-size: clamp(36px, 7vw, 54px);
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.06;
  margin-bottom: 20px;
}
.hero-sub {
  font-size: clamp(16px, 3vw, 19px);
  color: var(--muted);
  max-width: 32ch;
  margin-bottom: 34px;
  line-height: 1.6;
}
.hero-ctas { margin-bottom: 12px; }
.hero-note { font-size: 13px; color: var(--muted); margin-top: 10px; }

/* ── Hero visual (mock app card) ─────────────────────────────────── */
.hero-visual {
  display: flex;
  justify-content: center;
}
.hero-ring-card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 22px;
  padding: 22px 20px 18px;
  width: 100%;
  max-width: 280px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.5);
}
.hrc-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 2px;
}
.hrc-routine {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 14px;
  color: var(--text);
}
.hrc-ring-wrap {
  position: relative;
  width: 90px;
  height: 90px;
  margin: 0 auto 14px;
}
.hrc-ring { width: 100%; height: 100%; }
.hrc-track {
  fill: none;
  stroke: var(--track);
  stroke-width: 8;
}
.hrc-fill {
  fill: none;
  stroke: var(--green);
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.6s ease;
}
.hrc-count {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 800;
  gap: 1px;
}
.hrc-done { color: var(--green); }
.hrc-sep  { color: var(--muted); font-size: 14px; }
.hrc-total { color: var(--muted); }

.hrc-habits { display: flex; flex-direction: column; gap: 7px; margin-bottom: 14px; }
.hrc-habit {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  color: var(--muted);
}
.hrc-habit.done { color: var(--text); }
.hrc-check {
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--hairline);
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
}
.done-check { background: var(--green); border-color: var(--green); color: #06281C; font-weight: 900; }
.done-title { text-decoration: line-through; color: var(--muted); }

.hrc-streak {
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-soft);
  background: linear-gradient(135deg, var(--coach-grad-a), var(--coach-grad-b));
  border: 1px solid #3A2A1A;
  border-radius: 10px;
  padding: 8px 12px;
}

/* ── Section common ───────────────────────────────────────────────── */
.section-header { text-align: center; margin-bottom: 36px; }
.section-title {
  font-size: clamp(22px, 4vw, 30px);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}
.section-sub { color: var(--muted); font-size: 15px; max-width: 42ch; margin: 0 auto; }

/* ── Features ─────────────────────────────────────────────────────── */
.features-section { padding: 72px 0; }
.features-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr;
}
@media (min-width: 520px) { .features-grid { grid-template-columns: 1fr 1fr; } }

.feat-card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 18px;
  padding: 24px 22px;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.feat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(0,0,0,0.3);
}
.feat-emoji { font-size: 28px; display: block; margin-bottom: 12px; }
.feat-title { font-size: 16px; font-weight: 700; margin-bottom: 7px; }
.feat-body  { font-size: 14px; color: var(--muted); line-height: 1.6; }

/* ── Routines section ─────────────────────────────────────────────── */
.routines-section { padding: 0 0 80px; }
.routines-scroll {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 36px;
}

.routine-card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 16px;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: border-color 0.15s, background 0.15s;
}
.routine-card:hover { border-color: var(--accent); background: var(--raised); }
.rc-emoji { font-size: 28px; flex-shrink: 0; }
.rc-body { flex: 1; min-width: 0; }
.rc-name { font-size: 15px; font-weight: 700; margin-bottom: 2px; }
.rc-tagline { font-size: 13px; color: var(--muted); }
.rc-count { font-size: 11px; color: var(--accent-soft); margin-top: 4px; font-weight: 600; }
.rc-arrow { font-size: 20px; color: var(--muted); flex-shrink: 0; }

/* ── Dashboard section ────────────────────────────────────────────── */
.dashboard-section {
  padding: 72px 0 80px;
  background:
    radial-gradient(80% 40% at 50% 0%, rgba(255,138,61,0.06), transparent 70%);
  border-top: 1px solid var(--hairline);
}
.dash-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}
.dash-sync { font-size: 12px; color: var(--muted); }

/* ── Dashboard cards ──────────────────────────────────────────────── */
.dash-card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 20px;
  padding: 22px 20px;
  margin-bottom: 14px;
}

/* Today card */
.today-card { }
.today-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.today-eyebrow {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}
.today-routine {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.01em;
  margin-bottom: 6px;
}
.today-coach { font-size: 13px; }

.today-ring-wrap {
  position: relative;
  width: 72px;
  height: 72px;
  flex-shrink: 0;
}
.today-ring { width: 100%; height: 100%; }
.tr-track {
  fill: none;
  stroke: var(--track);
  stroke-width: 7;
}
.tr-fill {
  fill: none;
  stroke: var(--green);
  stroke-width: 7;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.6s ease;
}
.today-ring-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

/* Habits list */
.habits-list { display: flex; flex-direction: column; gap: 8px; }
.habit-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--raised);
  border-radius: 11px;
  border: 1px solid var(--hairline);
  font-size: 14px;
}
.habit-row.habit-done { opacity: 0.65; }
.habit-check {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 900;
}
.hc-done  { background: var(--green); color: #06281C; }
.hc-empty { border: 1.5px solid var(--hairline); }
.habit-title { flex: 1; }
.habit-done .habit-title { text-decoration: line-through; color: var(--muted); }

.no-habits {
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  padding: 28px 0;
  line-height: 1.6;
}

/* Stats row */
.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 16px;
  padding: 18px 14px;
  text-align: center;
}
.stat-value {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--accent-soft);
  line-height: 1;
  margin-bottom: 5px;
}
.stat-label { font-size: 11px; color: var(--muted); font-weight: 500; }
.flame-card .stat-value { color: var(--accent); }

/* Goal card */
.goal-card { }
.goal-eyebrow {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}
.goal-name { font-size: 17px; font-weight: 700; margin-bottom: 4px; }
.goal-meta { font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.goal-bar-bg {
  height: 6px;
  background: var(--track);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 6px;
}
.goal-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-soft));
  border-radius: 3px;
  transition: width 0.5s ease;
  width: 0%;
}
.goal-pct { font-size: 12px; color: var(--accent-soft); font-weight: 600; }

/* Calendar card */
.calendar-card { }
.cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.cal-month-label { font-size: 15px; font-weight: 700; }
.cal-nav-btn {
  background: var(--raised);
  border: 1px solid var(--hairline);
  border-radius: 8px;
  color: var(--text);
  width: 30px;
  height: 30px;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.cal-nav-btn:hover { background: var(--hairline); }
.cal-nav-btn:disabled { opacity: 0.3; cursor: default; }

.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 8px;
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.cal-cell {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  border-radius: 8px;
  color: var(--muted);
}
.cal-empty { }
.cal-done {
  background: rgba(63, 217, 160, 0.18);
  color: var(--green);
  font-weight: 700;
}
.cal-today {
  border: 1.5px solid var(--accent);
  color: var(--accent-soft);
  font-weight: 700;
}
.cal-today.cal-done { border-color: var(--green); }
.cal-future { opacity: 0.3; }

.cal-total {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--hairline);
}

/* ── Sign-in prompt ───────────────────────────────────────────────── */
.signin-section {
  padding: 72px 0 80px;
  border-top: 1px solid var(--hairline);
}
.signin-card {
  max-width: 420px;
  margin: 0 auto;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 22px;
  padding: 40px 32px;
}
.signin-icon { font-size: 40px; margin-bottom: 16px; display: block; }
.signin-title { font-size: 20px; font-weight: 800; margin-bottom: 10px; }
.signin-body { font-size: 14px; color: var(--muted); line-height: 1.65; margin-bottom: 28px; }
.signin-note { font-size: 12px; color: var(--muted); margin-top: 16px; }

/* ── Footer ───────────────────────────────────────────────────────── */
.footer {
  border-top: 1px solid var(--hairline);
  padding: 32px 0 52px;
}
.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
}
.footer-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 14px;
  color: var(--muted);
}
.footer-icon { width: 22px; height: 22px; border-radius: 5px; opacity: 0.7; }
.footer-links {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  justify-content: center;
}
.footer-links a { color: var(--accent-soft); font-size: 14px; }
.footer-links a:hover { text-decoration: underline; }
.footer-copy { font-size: 12px; color: var(--muted); }

/* ── Article (privacy / support) ─────────────────────────────────── */
.article { padding: 64px 0 72px; }
.article .back { color: var(--accent-soft); text-decoration: none; font-size: 14px; font-weight: 600; }
.article h1 { font-size: clamp(28px, 6vw, 38px); margin: 22px 0 6px; text-align: left; }
.article .updated { color: var(--muted); font-size: 14px; margin-bottom: 32px; }
.article h2 { font-size: 19px; font-weight: 700; margin: 30px 0 10px; }
.article p, .article li { color: #C7D0DE; font-size: 15px; margin-bottom: 12px; }
.article ul { padding-left: 22px; }
.article strong { color: var(--text); }
.article a { color: var(--accent-soft); }

/* ── CloudKit sign-in button overrides ───────────────────────────── */
#ck-sign-in-btn apple-sign-in-button,
#ck-sign-in-btn-2 apple-sign-in-button {
  --apple-sign-in-button-width: 200px;
  --apple-sign-in-button-height: 44px;
  --apple-sign-in-button-border-radius: 12px;
}
