/* ─────────────────────────────────────────────────────────────────
   FATHR — STYLES
   Brand-locked. Do not modify without approval.
   ───────────────────────────────────────────────────────────────── */

:root {
  /* Colours (LOCKED) */
  --ink: #111110;
  --carbon: #1a1a18;
  --graphite: #3a3a38;
  --golden: #F5C842;
  --gold-dim: #C9A22E;
  --bone: #f0ede8;
  --muted: #888884;

  /* Spacing (8px grid) */
  --xs: 4px;
  --sm: 8px;
  --md: 16px;
  --lg: 24px;
  --xl: 32px;
  --2xl: 48px;
  --3xl: 64px;

  /* Radii */
  --r-sm: 4px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-xl: 20px;
  --r-full: 9999px;

  /* Type */
  --display: 'Archivo Black', 'Arial Black', system-ui, sans-serif;
  --body: 'DM Sans', system-ui, -apple-system, sans-serif;

  /* App */
  --max-w: 480px;       /* Phone-first; constrains on tablet/desktop */
  --tab-h: 72px;        /* Bottom nav height */
  --safe-bottom: env(safe-area-inset-bottom, 0);
}

/* ─── Reset ─────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-tap-highlight-color: transparent; }

body {
  font-family: var(--body);
  background: var(--ink);
  color: var(--bone);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overscroll-behavior-y: none;
}

button { font-family: inherit; cursor: pointer; }
button:focus-visible, [role="button"]:focus-visible {
  outline: 2px solid var(--golden);
  outline-offset: 2px;
}

img { display: block; max-width: 100%; }
a { color: var(--golden); text-decoration: none; }

/* ─── App shell ─────────────────────────────────────────────────── */

#app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  max-width: var(--max-w);
  margin: 0 auto;
  background: var(--ink);
  position: relative;
}

@media (min-width: 480px) {
  body { background: #0a0a09; }   /* Slightly darker frame off-canvas */
  #app {
    box-shadow: 0 0 80px rgba(0,0,0,0.5);
    min-height: 100dvh;
  }
}

.app-main {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: calc(var(--tab-h) + var(--safe-bottom));
  -webkit-overflow-scrolling: touch;
}

.app-main.no-tabs { padding-bottom: var(--safe-bottom); }

/* ─── Logo ─────────────────────────────────────────────────────── */

.logo {
  font-family: var(--display);
  letter-spacing: -1.2px;
  display: inline-flex;
  align-items: baseline;
  user-select: none;
}
.logo .f { color: var(--golden); }
.logo .athr { color: var(--bone); }

/* ─── Typography ───────────────────────────────────────────────── */

.display-xl { font-family: var(--display); font-size: 40px; line-height: 1.1; letter-spacing: -1px; color: var(--bone); }
.display-lg { font-family: var(--display); font-size: 28px; line-height: 1.15; letter-spacing: -0.5px; color: var(--bone); }
.display-md { font-family: var(--display); font-size: 22px; line-height: 1.2; letter-spacing: -0.3px; color: var(--bone); }
.display-sm { font-family: var(--display); font-size: 18px; line-height: 1.25; color: var(--bone); }

.label {
  font-family: var(--body);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--bone);
}
.label.gold { color: var(--golden); }

.body-lg { font-size: 17px; line-height: 1.65; }
.body { font-size: 15px; line-height: 1.65; }
.body-sm { font-size: 13px; line-height: 1.55; }
.caption { font-size: 12px; line-height: 1.4; color: var(--muted); }

p { margin: 0 0 var(--md); }
p:last-child { margin-bottom: 0; }
p.placeholder { color: var(--muted); font-style: italic; }

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

.header {
  padding: env(safe-area-inset-top, 0) var(--md) 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 56px;
  flex-shrink: 0;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: var(--md) 0;
}

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

.btn {
  font-family: var(--body);
  font-weight: 700;
  font-size: 15px;
  border: 0;
  padding: 14px 22px;
  border-radius: var(--r-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sm);
  min-height: 48px;
  transition: transform 0.12s ease, opacity 0.12s ease;
  text-align: center;
}
.btn:active { transform: scale(0.97); opacity: 0.92; }

.btn-primary { background: var(--golden); color: var(--ink); }
.btn-primary:hover { background: #FFD355; }

.btn-secondary {
  background: var(--carbon);
  color: var(--golden);
  border: 1px solid var(--golden);
}
.btn-secondary:hover { background: #21211f; }

.btn-ghost { background: transparent; color: var(--bone); }
.btn-ghost:hover { background: rgba(255,255,255,0.04); }

.btn-full { width: 100%; }

.btn-icon {
  background: var(--carbon);
  border: 1px solid var(--graphite);
  width: 36px; height: 36px;
  border-radius: var(--r-md);
  padding: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--bone);
  flex-shrink: 0;
}
.btn-icon:disabled { opacity: 0.4; }

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

.card {
  background: var(--carbon);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: var(--r-lg);
  padding: var(--md);
  margin-bottom: var(--sm);
  text-align: left;
  display: block;
  width: 100%;
  color: inherit;
}

button.card { cursor: pointer; }
button.card:active { opacity: 0.92; transform: scale(0.99); }

.card-eyebrow {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--golden);
  margin-bottom: var(--sm);
  display: block;
}
.card-title {
  font-family: var(--display);
  font-size: 16px;
  line-height: 1.3;
  color: var(--bone);
  margin-bottom: 4px;
}
.card-body {
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--bone);
  margin-bottom: 0;
}
.card.locked .card-eyebrow { color: var(--gold-dim); }
.card.locked .card-title { color: var(--bone); }
.card.locked { position: relative; }
.card .lock {
  position: absolute;
  top: var(--md);
  right: var(--md);
  width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
  color: var(--gold-dim);
}

/* ─── Sections ─────────────────────────────────────────────────── */

.section {
  padding: 0 var(--md);
  margin-bottom: var(--xl);
}
.section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--muted);
  display: block;
  margin: 0 var(--md) var(--md);
}

/* ─── Tabs (bottom nav) ────────────────────────────────────────── */

.tabs {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--tab-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: rgba(26,26,24,0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid rgba(255,255,255,0.06);
  display: flex;
  z-index: 50;
  max-width: var(--max-w);
  margin: 0 auto;
}

.tab {
  flex: 1;
  background: none;
  border: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  padding: var(--sm) 0;
  font-family: inherit;
}
.tab .tab-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.tab.active .tab-icon { background: var(--golden); color: var(--ink); }
.tab.active { color: var(--golden); }

/* ─── Hero (current week) ──────────────────────────────────────── */

.week-hero {
  margin: var(--md);
  background: var(--carbon);
  border-radius: var(--r-xl);
  padding: var(--lg);
  border: 1px solid rgba(255,255,255,0.06);
  display: flex;
  gap: var(--md);
}
.week-hero-text { flex: 1; }
.week-hero-emoji { font-size: 44px; line-height: 1; flex-shrink: 0; text-align: center; }
.week-hero .size-label {
  font-size: 11px;
  color: var(--muted);
  margin-top: var(--sm);
  text-align: center;
}
.week-hero .size-value {
  font-size: 12px;
  color: var(--golden);
  font-weight: 700;
  text-align: center;
}

.trimester-bar {
  display: flex;
  gap: 4px;
  padding: 0 var(--md);
  margin-bottom: var(--md);
}
.trimester-bar > div {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: var(--graphite);
}
.trimester-bar .past { background: var(--gold-dim); }
.trimester-bar .current { background: var(--golden); }

/* ─── Expandable sections (week content) ───────────────────────── */

.section-card {
  background: var(--carbon);
  border-radius: var(--r-lg);
  border: 1px solid rgba(255,255,255,0.06);
  margin-bottom: var(--sm);
  overflow: hidden;
}
.section-card.open { border-color: var(--graphite); }
.section-card.open.paid { border-color: rgba(245,200,66,0.4); }

.section-header {
  width: 100%;
  background: none;
  border: 0;
  padding: var(--md);
  display: flex;
  align-items: center;
  gap: var(--md);
  text-align: left;
  font-family: inherit;
  color: inherit;
}

.section-tag {
  display: inline-block;
  background: var(--graphite);
  color: var(--bone);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--r-sm);
  letter-spacing: 0.8px;
  margin-bottom: 6px;
}
.section-tag.action { background: var(--golden); color: var(--ink); }
.section-tag.premium { background: rgba(245,200,66,0.15); color: var(--gold-dim); }

.section-name { font-size: 14.5px; font-weight: 600; color: var(--bone); line-height: 1.3; }
.section-chevron { color: var(--muted); flex-shrink: 0; transition: transform 0.2s; }
.section-card.open .section-chevron { transform: rotate(180deg); }

.section-body {
  padding: 0 var(--md) var(--md);
  font-size: 14px;
  line-height: 1.7;
  color: var(--bone);
  white-space: pre-wrap;
}

/* ─── Phase tabs ───────────────────────────────────────────────── */

.phase-tabs {
  display: flex;
  gap: 6px;
  padding: 0 var(--md) var(--md);
}
.phase-tab {
  flex: 1;
  padding: 10px 4px;
  border-radius: var(--r-full);
  border: 0;
  background: var(--carbon);
  color: var(--bone);
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-family: inherit;
}
.phase-tab.active { background: var(--golden); color: var(--ink); }
.phase-tab:disabled, .phase-tab.locked { color: var(--muted); }

/* ─── Week grid (journey) ──────────────────────────────────────── */

.week-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
  padding: 0 var(--md);
  margin-bottom: var(--lg);
}

.week-cell {
  aspect-ratio: 1;
  border-radius: var(--r-md);
  border: 0;
  background: #1E1E1C;
  color: var(--bone);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
}
.week-cell.current {
  background: var(--golden);
  color: var(--ink);
  font-weight: 800;
  box-shadow: 0 0 0 2px var(--golden), 0 0 0 4px var(--ink);
}
.week-cell.viewed { background: var(--graphite); color: var(--bone); }
.week-cell.milestone {
  position: relative;
  border: 1px solid var(--gold-dim);
}
.week-cell.milestone .milestone-dot {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--golden);
}
.week-cell.current.milestone {
  border-color: var(--ink);
}

/* ─── Milestones strip (Journey screen) ────────────────────────── */

.milestones-strip {
  display: flex;
  gap: var(--sm);
  overflow-x: auto;
  padding-bottom: var(--sm);
  margin: 0 calc(-1 * var(--md));
  padding-left: var(--md);
  padding-right: var(--md);
  scrollbar-width: none;
}
.milestones-strip::-webkit-scrollbar { display: none; }

.milestone-pill {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  background: var(--carbon);
  border: 1px solid var(--graphite);
  border-radius: var(--r-md);
  padding: 8px 12px;
  font-family: inherit;
  cursor: pointer;
  min-width: 86px;
  transition: border-color 0.15s, background 0.15s;
}
.milestone-pill:hover { border-color: var(--gold-dim); }
.milestone-pill.past {
  border-color: var(--gold-dim);
  background: rgba(245,200,66,0.06);
}
.milestone-pill .milestone-week {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--golden);
}
.milestone-pill .milestone-label {
  font-size: 12px;
  color: var(--bone);
  font-weight: 500;
}

/* ─── Trimester divider ────────────────────────────────────────── */

.trimester-row {
  display: flex;
  align-items: center;
  gap: var(--sm);
  padding: 0 var(--md);
  margin-bottom: var(--sm);
  margin-top: var(--lg);
}
.trimester-row .label { color: var(--muted); flex-shrink: 0; }
.trimester-row .line { flex: 1; height: 1px; background: var(--graphite); }
.trimester-row .range { color: var(--muted); font-size: 11px; flex-shrink: 0; }

/* ─── Onboarding ──────────────────────────────────────────────── */

.onboarding {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: var(--lg) var(--md) var(--md);
}
.onboarding-body { flex: 1; padding: var(--xl) 0; }
.onboarding h1 { margin: 0 0 var(--md); }
.onboarding p { color: var(--bone); }

input[type="date"] {
  font-family: inherit;
  font-size: 17px;
  background: var(--carbon);
  color: var(--bone);
  border: 1px solid var(--graphite);
  border-radius: var(--r-md);
  padding: 14px var(--md);
  width: 100%;
  margin-top: var(--md);
  color-scheme: dark;
}
input[type="date"]:focus { outline: 2px solid var(--golden); outline-offset: 2px; border-color: var(--golden); }

/* ─── Modal / paywall ─────────────────────────────────────────── */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fade-in 0.2s ease;
}

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes slide-up { from { transform: translateY(40px); } to { transform: translateY(0); } }

.modal {
  width: 100%;
  max-width: var(--max-w);
  background: var(--carbon);
  border-top: 2px solid var(--golden);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  padding: var(--lg) var(--md) calc(var(--lg) + var(--safe-bottom));
  animation: slide-up 0.25s ease;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-close {
  background: var(--graphite);
  border: 0;
  border-radius: var(--r-full);
  width: 36px; height: 36px;
  color: var(--bone);
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  top: var(--md);
  right: var(--md);
  z-index: 1;
}

.benefit-list { list-style: none; padding: 0; margin: var(--lg) 0; }
.benefit-list li {
  display: flex;
  align-items: flex-start;
  gap: var(--md);
  margin-bottom: var(--md);
  font-size: 14px;
}
.benefit-list .check {
  width: 20px; height: 20px;
  border-radius: 10px;
  background: var(--golden);
  color: var(--ink);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}

.plan {
  background: var(--ink);
  border: 1px solid var(--graphite);
  border-radius: var(--r-lg);
  padding: var(--md);
  margin-bottom: var(--sm);
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  position: relative;
}
.plan.selected { border-color: var(--golden); border-width: 2px; padding: calc(var(--md) - 1px); }
.plan-info { flex: 1; }
.plan-name { font-family: var(--display); font-size: 17px; color: var(--bone); }
.plan-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.plan-price { font-family: var(--display); font-size: 22px; color: var(--golden); }
.plan-tag {
  position: absolute;
  top: -10px;
  left: var(--md);
  background: var(--golden);
  color: var(--ink);
  font-size: 9px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--r-sm);
  letter-spacing: 0.8px;
}

/* ─── Misc helpers ─────────────────────────────────────────────── */

.locked-hint {
  display: flex;
  align-items: center;
  gap: var(--sm);
  background: rgba(245,200,66,0.07);
  border: 1px solid rgba(245,200,66,0.2);
  border-radius: var(--r-md);
  padding: 10px var(--md);
  margin: 0 var(--md) var(--md);
  font-size: 13px;
  color: var(--muted);
}
.locked-hint svg { color: var(--golden); flex-shrink: 0; }

.empty {
  text-align: center;
  padding: var(--3xl) var(--md);
  color: var(--muted);
}

.back-bar {
  display: flex;
  align-items: center;
  gap: var(--md);
  padding: var(--md);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.back-bar .title { font-weight: 700; flex: 1; color: var(--bone); }

.community-locked {
  position: relative;
  margin: 0 var(--md) var(--lg);
}
.community-locked .blurred { filter: blur(3px); pointer-events: none; }
.community-locked .overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(17,17,16,0.85);
  border-radius: var(--r-lg);
  padding: var(--md);
  text-align: center;
}

/* Article body */
.article {
  padding: var(--md) var(--md) var(--xl);
}
.article p { font-size: 15px; line-height: 1.75; color: var(--bone); white-space: pre-wrap; }

.prose-p {
  font-size: 15.5px;
  line-height: 1.75;
  color: var(--bone);
  margin: 0 0 var(--md);
}
.prose-h2 {
  font-family: var(--display);
  font-size: 19px;
  line-height: 1.3;
  color: var(--bone);
  margin: var(--xl) 0 var(--md);
}
.prose-h3 {
  font-family: var(--body);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--golden);
  margin: var(--lg) 0 var(--sm);
}
.prose-ul {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--md);
}
.prose-ul li {
  position: relative;
  padding-left: var(--lg);
  font-size: 15px;
  line-height: 1.7;
  color: var(--bone);
  margin-bottom: var(--sm);
}
.prose-ul li::before {
  content: '—';
  position: absolute;
  left: 0;
  color: var(--golden);
  font-weight: 700;
}

/* Profile */
.profile-card {
  margin: 0 var(--md) var(--md);
  background: var(--carbon);
  border-radius: var(--r-xl);
  padding: var(--lg);
  border: 1px solid rgba(255,255,255,0.06);
}
.progress-bar {
  height: 6px;
  background: var(--graphite);
  border-radius: 3px;
  overflow: hidden;
  margin: var(--sm) 0;
}
.progress-bar > div { height: 100%; background: var(--golden); transition: width 0.4s; }

/* Footer */
.app-footer {
  padding: var(--xl) var(--md);
  text-align: center;
  font-size: 11px;
  color: var(--muted);
}
