/*
  Token system
  Color:  --dusk (#1B2436 deep indigo night), --dawn (#F1EDE4 warm parchment),
          --ember (#E3922B amber/fire — the pillar of fire by night),
          --cloud (#8FA3B0 dusty blue-grey — the pillar of cloud by day),
          --moss (#5C7A5C quiet success green), --clay (#B4553F warning/removed)
  Type:   Display = Fraunces (warm, slightly irregular serif — scripture-adjacent
          without being literal), Body/UI = Work Sans (plain, legible, humble)
  Layout: single mobile-first column; a literal three-stop path is the
          signature element because the journey genuinely IS a sequence.
*/

:root {
  --dusk: #1B2436;
  --dusk-2: #26314A;
  --dawn: #F1EDE4;
  --ember: #E3922B;
  --cloud: #8FA3B0;
  --moss: #5C7A5C;
  --clay: #B4553F;
  --ink: #232323;
  --paper: #FFFFFF;
  --line: #E4DFD3;

  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Work Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--dawn);
  color: var(--ink);
  font-family: var(--font-body);
  max-width: 560px;
  margin-inline: auto;
  min-height: 100vh;
}

/* ---------- Top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  background: var(--dusk);
  color: var(--dawn);
}
.wordmark {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.25rem;
  letter-spacing: 0.01em;
}
.brand { display: flex; align-items: center; gap: 0.55rem; }
.brand-logo {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 0 1px rgba(241, 237, 228, 0.25);
}
.icon-btn {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 999px;
  border: none;
  background: var(--ember);
  color: var(--dusk);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}
.icon-btn:focus-visible { outline: 3px solid var(--cloud); outline-offset: 2px; }

/* ---------- Journey path (signature element) ---------- */
.journey-path {
  background: var(--dusk-2);
  padding: 1.5rem 1.25rem 1.75rem;
}
.path {
  list-style: none;
  display: flex;
  margin: 0;
  padding: 0;
  position: relative;
}
.path::before {
  content: '';
  position: absolute;
  top: 0.9rem;
  left: 1.9rem;
  right: 1.9rem;
  height: 2px;
  background: rgba(241, 237, 228, 0.2);
}
.path-stop {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  position: relative;
}
.path-dot {
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: var(--dusk);
  border: 2px solid var(--cloud);
  color: var(--cloud);
  font-family: var(--font-display);
  font-size: 0.85rem;
  z-index: 1;
}
.path-stop.active .path-dot {
  background: var(--ember);
  border-color: var(--ember);
  color: var(--dusk);
}
.path-label {
  font-size: 0.72rem;
  color: rgba(241, 237, 228, 0.75);
  text-align: center;
  max-width: 6.5rem;
}
.path-stop.active .path-label { color: var(--dawn); font-weight: 600; }

/* ---------- Verse of the day ---------- */
.verse-card {
  margin: 1.25rem;
  padding: 1.5rem;
  background: var(--paper);
  border-left: 3px solid var(--ember);
  border-radius: 2px;
}
.verse-eyebrow {
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--cloud);
  margin: 0 0 0.6rem;
}
.verse-text {
  font-family: var(--font-display);
  font-size: 1.15rem;
  line-height: 1.5;
  margin: 0 0 0.6rem;
  color: var(--dusk);
}
.verse-ref {
  margin: 0;
  font-size: 0.85rem;
  color: var(--cloud);
}

/* ---------- Feed ---------- */
.feed { padding: 0 1.25rem 6rem; display: flex; flex-direction: column; gap: 0.9rem; }
.feed-loading, .feed-empty { color: var(--cloud); text-align: center; padding: 2rem 0; }

.post-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1.1rem;
}
.post-meta { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; }
.message-author-btn {
  margin-left: auto;
  border: none;
  background: none;
  color: var(--cloud);
  font-size: 1rem;
  cursor: pointer;
  line-height: 1;
}
.message-author-btn:hover { color: var(--ember); }
.follow-btn {
  border: 1px solid var(--line);
  background: var(--dawn);
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
  font-size: 0.72rem;
  cursor: pointer;
  color: var(--dusk-2);
}
.follow-btn.active { background: var(--dusk); color: var(--dawn); border-color: var(--dusk); }
.save-btn {
  border: none;
  background: none;
  font-size: 1rem;
  cursor: pointer;
  opacity: 0.5;
}
.save-btn.active { opacity: 1; }

.feed-toolbar { display: flex; gap: 0.5rem; padding: 0 1.25rem 0.75rem; }
.feed-toolbar-btn {
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 999px;
  padding: 0.35rem 0.85rem;
  font-size: 0.82rem;
  cursor: pointer;
  color: var(--dusk-2);
}
.feed-toolbar-btn.active { background: var(--dusk); color: var(--dawn); border-color: var(--dusk); }

.appeal-banner {
  margin: 0 1.25rem 1rem;
  padding: 0.7rem 0.9rem;
  background: #F2DAD5;
  color: var(--clay);
  border-radius: 6px;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

/* ---------- Messages / thread view ---------- */
.thread-messages {
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-height: 50vh;
}
.message-bubble {
  max-width: 78%;
  padding: 0.55rem 0.8rem;
  border-radius: 14px;
  font-size: 0.9rem;
  line-height: 1.4;
}
.message-bubble.theirs {
  align-self: flex-start;
  background: var(--paper);
  border: 1px solid var(--line);
  border-bottom-left-radius: 4px;
}
.message-bubble.mine {
  align-self: flex-end;
  background: var(--dusk);
  color: var(--dawn);
  border-bottom-right-radius: 4px;
}
.thread-form {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 560px;
  margin-inline: auto;
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem calc(0.75rem + env(safe-area-inset-bottom));
  background: var(--dawn);
  border-top: 1px solid var(--line);
}
.thread-form input {
  flex: 1;
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-family: var(--font-body);
}
.post-type-badge {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: var(--dawn);
  color: var(--dusk-2);
  border: 1px solid var(--line);
}
.post-type-badge.prayer { background: #EEE3E9; color: #6B3D57; }
.post-type-badge.testimony { background: #E4EDE4; color: var(--moss); }
.post-author { font-weight: 600; font-size: 0.85rem; }
.post-body { margin: 0 0 0.75rem; line-height: 1.55; }
.post-image {
  width: 100%;
  border-radius: 6px;
  margin-bottom: 0.75rem;
  display: block;
}
.post-reactions { display: flex; gap: 0.4rem; align-items: center; flex-wrap: wrap; }
.comment-toggle {
  margin-left: auto;
  border: none;
  background: none;
  color: var(--cloud);
  font-size: 0.82rem;
  cursor: pointer;
}
.comments-thread { margin-top: 0.85rem; padding-top: 0.75rem; border-top: 1px solid var(--line); }
.comment-row { padding: 0.4rem 0; font-size: 0.85rem; }
.comment-row strong { display: block; font-size: 0.75rem; color: var(--cloud); }
.comment-row p { margin: 0.1rem 0 0; }
.comment-form { display: flex; gap: 0.5rem; margin-top: 0.5rem; }
.comment-form input {
  flex: 1;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-family: var(--font-body);
  font-size: 0.85rem;
}
.reaction-btn {
  border: 1px solid var(--line);
  background: var(--dawn);
  border-radius: 999px;
  padding: 0.3rem 0.65rem;
  font-size: 0.85rem;
  cursor: pointer;
}
.reaction-btn.active { border-color: var(--ember); background: #FBEBD3; }

/* ---------- Compose dialog ---------- */
dialog {
  border: none;
  border-radius: 10px;
  padding: 1.5rem;
  width: min(92vw, 480px);
}
dialog::backdrop { background: rgba(27, 36, 54, 0.55); }
.field { display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: 1rem; font-size: 0.9rem; }
.field select, .field textarea {
  font-family: var(--font-body);
  font-size: 0.95rem;
  padding: 0.6rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  resize: vertical;
}
.hint { font-size: 0.78rem; color: var(--cloud); margin: 0 0 1rem; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 0.6rem; }
.btn-primary, .btn-ghost {
  padding: 0.55rem 1.1rem;
  border-radius: 6px;
  font-size: 0.9rem;
  cursor: pointer;
}
.btn-primary { background: var(--dusk); color: var(--dawn); border: none; }
.btn-ghost { background: transparent; border: 1px solid var(--line); }

/* ---------- Page transitions ---------- */
body {
  opacity: 1;
  transition: opacity 180ms ease;
}
body.page-leaving { opacity: 0; }
body.page-entering { opacity: 0; }
body:not(.page-entering) { opacity: 1; }

@keyframes reveal-word {
  from { opacity: 0; transform: translateY(0.4em); }
  to { opacity: 1; transform: translateY(0); }
}
.reveal-word {
  display: inline-block;
  opacity: 0;
  animation: reveal-word 480ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes card-rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}
.card-enter { animation: card-rise 420ms cubic-bezier(0.22, 1, 0.36, 1) both; }

/* ---------- Bottom nav ---------- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 560px;
  margin-inline: auto;
  display: flex;
  background: var(--dusk);
  border-top: 1px solid rgba(241, 237, 228, 0.1);
  padding: 0.4rem 0 calc(0.4rem + env(safe-area-inset-bottom));
  z-index: 20;
}
.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  padding: 0.4rem 0;
  color: rgba(241, 237, 228, 0.55);
  text-decoration: none;
  font-size: 0.68rem;
  transition: color 160ms ease, transform 160ms ease;
}
.nav-item.active { color: var(--ember); }
.nav-item:active { transform: scale(0.94); }
.nav-icon { font-size: 1.1rem; }
body { padding-bottom: 4.5rem; } /* clear the fixed nav */

/* ---------- Auth ---------- */
.auth-panel { padding: 0 1.25rem 1rem; }
#googleSignInBtn { display: inline-block; }
.profile-chip { display: flex; align-items: center; gap: 0.5rem; color: var(--dawn); font-size: 0.85rem; }
.text-link { background: none; border: none; color: var(--cloud); text-decoration: underline; cursor: pointer; font-size: 0.8rem; }

.hero-signin {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.75rem;
  padding: 1.5rem 0 2rem;
}
.hero-logo {
  width: 6.5rem;
  height: 6.5rem;
  border-radius: 50%;
  box-shadow: 0 8px 24px rgba(27, 36, 54, 0.35);
  animation: hero-float 6s ease-in-out infinite;
}
@keyframes hero-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
.hero-title {
  font-family: var(--font-display);
  font-size: 1.7rem;
  color: var(--dusk);
  margin: 0;
}
.hero-tagline {
  font-size: 0.9rem;
  color: var(--cloud);
  max-width: 24rem;
  margin: 0 0 0.4rem;
  line-height: 1.5;
}
@media (prefers-reduced-motion: reduce) {
  .hero-logo { animation: none; }
}

/* ---------- Journey stage detail ---------- */
.stage-header {
  padding: 1.75rem 1.25rem 1.25rem;
  background: linear-gradient(160deg, var(--dusk) 0%, var(--dusk-2) 100%);
  color: var(--dawn);
}
.stage-title { font-family: var(--font-display); font-size: 1.6rem; margin: 0 0 0.4rem; }
.stage-sub { color: var(--cloud); font-size: 0.9rem; margin: 0; }

.goal-card, .creator-card, .report-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1rem 1.1rem;
  margin: 0 1.25rem 0.9rem;
}
.goal-stage-tag {
  display: inline-block;
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ember);
  margin-bottom: 0.35rem;
}
.milestone-strip { display: flex; gap: 0.5rem; flex-wrap: wrap; padding: 0 1.25rem 1rem; }
.milestone-pill {
  background: #EAF1EA;
  color: var(--moss);
  border-radius: 999px;
  padding: 0.3rem 0.7rem;
  font-size: 0.78rem;
}

.btn-small {
  padding: 0.4rem 0.85rem;
  border-radius: 6px;
  font-size: 0.8rem;
  border: 1px solid var(--line);
  background: var(--dawn);
  cursor: pointer;
}
.btn-small.primary { background: var(--dusk); color: var(--dawn); border: none; }

/* ---------- Lifeline ---------- */
.creator-card { display: flex; justify-content: space-between; align-items: center; }
.creator-status {
  font-size: 0.7rem;
  text-transform: uppercase;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: #FBEBD3;
  color: #8A5A16;
}
.creator-status.approved { background: #E4EDE4; color: var(--moss); }

/* ---------- Admin dashboard ---------- */
.admin-section { padding: 0 1.25rem 1.5rem; }
.admin-section h2 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--dusk);
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.5rem;
  margin: 1.75rem 0 0.9rem;
}
.quota-gauge {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
  margin: 0 1.25rem 1.5rem;
}
.quota-tile {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.85rem;
  text-align: center;
}
.quota-tile .pct { font-family: var(--font-display); font-size: 1.4rem; color: var(--dusk); }
.quota-tile .lbl { font-size: 0.68rem; color: var(--cloud); text-transform: uppercase; }
.quota-state-banner {
  margin: 0 1.25rem 1rem;
  padding: 0.6rem 0.9rem;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
}
.quota-state-banner.normal { background: #E4EDE4; color: var(--moss); }
.quota-state-banner.warn { background: #FBEBD3; color: #8A5A16; }
.quota-state-banner.pause_video { background: #F6DCC9; color: #9A4B1E; }
.quota-state-banner.protect_core { background: #F2DAD5; color: var(--clay); }

.report-card .report-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.6rem; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
  .reveal-word { opacity: 1; animation: none; }
  .card-enter { opacity: 1; animation: none; }
}
