/* Daily Bible Verse & Devotional — premium minimalist, mobile-first */

:root {
  --bg: #f5f0e8;
  --bg-2: #efe7da;
  --card: #fffdf9;
  --ink: #2a2620;
  --ink-soft: #574f43;
  --muted: #8c8275;
  --line: #e8dfd0;
  --accent: #b27a45;
  --accent-ink: #8f5c2c;
  --accent-soft: #f3e7d6;
  --shadow: 0 14px 38px rgba(74, 55, 30, 0.10), 0 3px 10px rgba(74, 55, 30, 0.06);
  --shadow-sm: 0 4px 14px rgba(74, 55, 30, 0.08);
  --radius: 22px;
  --radius-sm: 14px;
  --serif: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --maxw: 680px;
  --t: 0.28s cubic-bezier(0.22, 0.61, 0.36, 1);
}

* { box-sizing: border-box; }

/* Ensure the [hidden] attribute always wins over component display rules
   (e.g. .btn sets display:inline-flex, which would otherwise override it). */
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 50% -10%, var(--bg-2), transparent 60%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  line-height: 1.6;
}

.visually-hidden,
.skip-link {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.skip-link:focus {
  position: fixed;
  top: 12px; left: 12px;
  width: auto; height: auto;
  clip: auto; margin: 0;
  padding: 10px 16px;
  background: var(--card);
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
  z-index: 50;
}

.app {
  min-height: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 18px 20px 40px;
  display: flex;
  flex-direction: column;
}

/* ---- Top bar ---- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 2px 18px;
}

.brand { display: flex; align-items: center; gap: 10px; }

.brand-mark {
  width: 14px; height: 14px;
  border-radius: 5px;
  background: linear-gradient(145deg, var(--accent), var(--accent-ink));
  box-shadow: var(--shadow-sm);
}

.brand-name {
  font-weight: 600;
  letter-spacing: 0.02em;
  font-size: 0.98rem;
  color: var(--ink-soft);
}

.ghost-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font: inherit;
  font-size: 0.92rem;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
  cursor: pointer;
  transition: transform var(--t), box-shadow var(--t), background var(--t), border-color var(--t);
}
.ghost-btn .ic { color: var(--accent); font-size: 1rem; line-height: 1; }
.ghost-btn:hover { background: var(--card); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.ghost-btn:active { transform: translateY(0); }

.badge {
  min-width: 20px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  text-align: center;
}

/* ---- Main ---- */
.main { flex: 1 0 auto; }

.date-line {
  text-align: center;
  color: var(--muted);
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 6px 0 16px;
}

/* ---- Card ---- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(26px, 6vw, 44px);
  text-align: center;
}

.card.anim { animation: rise var(--t); }

.reference {
  margin: 0 0 18px;
  color: var(--accent-ink);
  font-weight: 700;
  font-size: 0.86rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.verse-text {
  font-family: var(--serif);
  font-size: clamp(1.4rem, 4.6vw, 2rem);
  line-height: 1.42;
  color: var(--ink);
  margin: 0 0 8px;
  quotes: "\201C" "\201D";
}
.verse-text::before { content: open-quote; color: var(--accent); margin-right: 1px; }
.verse-text::after  { content: close-quote; color: var(--accent); margin-left: 1px; }

.devotional {
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  text-align: left;
  color: var(--ink-soft);
  font-size: 1.02rem;
}
.devotional p { margin: 0 0 14px; }
.devotional p:last-child { margin-bottom: 0; }

/* ---- Actions ---- */
.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 22px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font: inherit;
  font-size: 0.94rem;
  font-weight: 550;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 11px 18px;
  cursor: pointer;
  transition: transform var(--t), box-shadow var(--t), background var(--t), border-color var(--t), color var(--t);
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); border-color: #ddd0bb; }
.btn:active { transform: translateY(0) scale(0.98); }

.btn-primary {
  background: linear-gradient(145deg, var(--accent), var(--accent-ink));
  border-color: transparent;
  color: #fff;
}
.btn-primary:hover { box-shadow: 0 8px 20px rgba(143, 92, 44, 0.32); }

.btn-quiet { background: transparent; color: var(--ink-soft); }

.btn .heart { font-size: 1.05rem; line-height: 1; color: var(--accent); transition: transform var(--t); }
.btn[aria-pressed="true"] {
  background: var(--accent-soft);
  border-color: #e6cfae;
  color: var(--accent-ink);
}
.btn[aria-pressed="true"] .heart { transform: scale(1.12); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ---- Favorites view ---- */
.fav-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.fav-title { font-size: 1.3rem; margin: 0; }

.search { display: block; margin-bottom: 14px; }
.search input {
  width: 100%;
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 13px 16px;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--t), box-shadow var(--t);
}
.search input::placeholder { color: var(--muted); }
.search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(178, 122, 69, 0.18); }

.fav-status { color: var(--muted); font-size: 0.9rem; margin: 4px 2px 14px; }

.fav-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }

.fav-item {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  padding: 16px 18px;
  animation: rise var(--t);
}
.fav-item .fav-ref { color: var(--accent-ink); font-weight: 700; font-size: 0.78rem; letter-spacing: 0.1em; text-transform: uppercase; margin: 0 0 6px; }
.fav-item .fav-snip { font-family: var(--serif); color: var(--ink); font-size: 1.04rem; line-height: 1.4; margin: 0 0 12px; }
.fav-item .fav-actions { display: flex; gap: 8px; }
.fav-item .mini {
  font: inherit; font-size: 0.86rem; font-weight: 550;
  border-radius: 999px; padding: 7px 14px; cursor: pointer;
  border: 1px solid var(--line); background: var(--bg); color: var(--ink);
  transition: transform var(--t), background var(--t), box-shadow var(--t);
}
.fav-item .mini:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.fav-item .mini.remove { color: var(--accent-ink); }

.empty {
  text-align: center;
  color: var(--muted);
  padding: 40px 16px;
  font-size: 0.98rem;
}

/* ---- Footer ---- */
.footer {
  flex-shrink: 0;
  text-align: center;
  margin-top: 36px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}
.footer-title { font-weight: 600; color: var(--ink-soft); margin: 0 0 4px; font-size: 0.92rem; }
.footer-sub { color: var(--muted); font-size: 0.8rem; margin: 0; }

/* ---- Toast ---- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translate(-50%, 16px);
  background: #2a2620;
  color: #fbf7f0;
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 0.92rem;
  font-weight: 500;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.22);
  opacity: 0;
  pointer-events: none;
  z-index: 60;
  transition: opacity var(--t), transform var(--t);
  max-width: calc(100% - 40px);
  text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---- Animations ---- */
@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---- Larger screens ---- */
@media (min-width: 720px) {
  .app { padding-top: 26px; }
  .actions { gap: 12px; }
}

/* ---- Top nav (Browse + Favorites) ---- */
.topbar { flex-wrap: wrap; gap: 10px; }
.topnav { display: flex; align-items: center; gap: 8px; }

/* ---- Reading streak ---- */
.streak-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: -8px 0 18px;
  color: var(--accent-ink);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.streak-line .flame { color: var(--accent); flex: 0 0 auto; }

/* ---- Quote-doubling guard (verse text already contains quotes) ---- */
.verse-text.no-open-quote::before { content: none; }
.verse-text.no-close-quote::after { content: none; }

/* ---- Dark mode ---- */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c1813;
    --bg-2: #251f17;
    --card: #26211b;
    --ink: #f1eae0;
    --ink-soft: #cdc1b0;
    --muted: #9b8f7d;
    --line: #3a322a;
    --accent: #d29a63;
    --accent-ink: #e3b182;
    --accent-soft: #352a1d;
    --shadow: 0 16px 40px rgba(0, 0, 0, 0.45), 0 4px 12px rgba(0, 0, 0, 0.35);
    --shadow-sm: 0 4px 14px rgba(0, 0, 0, 0.38);
  }
  .btn-primary { color: #241a10; }
  .btn-primary:hover { box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4); }
  .badge { color: #241a10; }
  .toast { background: #0f0d0a; color: #f3ede3; }
  .search input:focus { box-shadow: 0 0 0 3px rgba(210, 154, 99, 0.25); }
}

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
