/* ============ Tokens ============ */
:root {
  --bg: #f5f1e8;
  --surface: #fffdf8;
  --surface-2: #eee9dd;
  --ink: #1c2420;
  --muted: #5e6660;
  --line: #e2dccd;
  --night: #13291f;
  --night-2: #1f4337;
  --pine: #2f5a4a;
  --flame: #f2b34a;
  --gold: #b9832a;
  --purple: #5e3f86;
  --rose: #c26a86;
  --accent: var(--pine);
  --radius: 18px;
  --shadow: 0 1px 2px rgb(20 36 30 / 0.04), 0 8px 24px rgb(20 36 30 / 0.06);
  --serif: 'Fraunces', Georgia, serif;
  --scripture: 'Literata', Georgia, serif;
  --sans: 'Inter', system-ui, -apple-system, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1714;
    --surface: #16201c;
    --surface-2: #1c2924;
    --ink: #eef0ea;
    --muted: #9aa59f;
    --line: #26352f;
    --pine: #7fb59e;
    --gold: #e0a94a;
    --purple: #a88bd6;
    --rose: #e08aa6;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 8px 24px rgb(0 0 0 / 0.25);
    color-scheme: dark;
  }
}

/* ============ Base ============ */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 17px/1.65 var(--sans);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main {
  flex: 1;
  outline: none;
}
h1,
h2,
h3 {
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0;
}
p {
  margin: 0 0 1em;
}
a {
  color: var(--accent);
}
em {
  font-style: italic;
}
button,
select,
textarea {
  font: inherit;
  color: inherit;
}
:focus-visible {
  outline: 2.5px solid var(--flame);
  outline-offset: 2px;
  border-radius: 6px;
}
.wrap {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 0 20px;
}
.wrap-wide {
  max-width: 1080px;
}
.skip-link {
  position: absolute;
  left: -999px;
  top: 8px;
  background: var(--surface);
  padding: 8px 14px;
  border-radius: 8px;
  z-index: 10;
}
.skip-link:focus {
  left: 8px;
}
.eyebrow {
  font: 600 0.75rem/1 var(--sans);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 12px;
}

/* ============ Top bar ============ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  background: color-mix(in srgb, var(--night) 92%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 12px 20px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #f1ece3;
  text-decoration: none;
  font: 600 1rem/1 var(--serif);
}
.brand-mark {
  width: 22px;
  height: 22px;
  color: #c9d6cc;
}

/* ============ Hero ============ */
.hero {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(1200px 400px at 50% 110%, rgb(242 179 74 / 0.09), transparent 60%),
    linear-gradient(180deg, var(--night) 0%, var(--night-2) 100%);
  color: #f6f1e7;
  padding: 56px 0 64px;
  text-align: center;
}
.hero::before {
  /* soft starfield */
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(1px 1px at 12% 22%, #fff9 50%, transparent 51%),
    radial-gradient(1px 1px at 28% 68%, #fff6 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 44% 14%, #fffa 50%, transparent 51%),
    radial-gradient(1px 1px at 63% 40%, #fff7 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 78% 18%, #fff9 50%, transparent 51%),
    radial-gradient(1px 1px at 90% 60%, #fff6 50%, transparent 51%),
    radial-gradient(1px 1px at 6% 80%, #fff5 50%, transparent 51%);
  pointer-events: none;
}
.hero .eyebrow {
  color: #c9d6cc;
}
.hero h1 {
  font-size: clamp(2.4rem, 7vw, 3.75rem);
  font-weight: 400;
}
.hero h1 em {
  color: var(--flame);
  font-style: italic;
}
.hero-tagline {
  margin: 14px auto 0;
  max-width: 34ch;
  color: #d6e0d8;
  font-size: 1.1rem;
}

/* ============ Candles ============ */
.candles {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: clamp(14px, 4vw, 28px);
  margin: 40px auto 10px;
  position: relative;
}
.candle {
  --wax: var(--purple);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  color: inherit;
}
.candle[data-candle='rose'] {
  --wax: #c26a86;
}
.candle[data-candle='purple'] {
  --wax: #5e3f86;
}
.candle[data-candle='gold'] {
  --wax: #f3ead8;
}
.candle-body {
  width: clamp(22px, 5vw, 30px);
  height: var(--h, 72px);
  border-radius: 5px 5px 3px 3px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--wax) 80%, #000) 0%, var(--wax) 35%, color-mix(in srgb, var(--wax) 85%, #fff) 60%, color-mix(in srgb, var(--wax) 85%, #000) 100%);
  box-shadow: 0 6px 18px rgb(0 0 0 / 0.3);
}
.candle-wick {
  width: 2px;
  height: 8px;
  background: #2b2236;
  border-radius: 1px;
}
.flame {
  width: 14px;
  height: 24px;
  margin-bottom: -2px;
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  background: radial-gradient(circle at 50% 75%, #fff6d8 0%, var(--flame) 45%, #e0702a 80%, transparent 82%);
  transform-origin: 50% 90%;
  opacity: 0;
  transform: scale(0.4);
  transition:
    opacity 0.5s,
    transform 0.5s;
}
.candle.lit .flame {
  opacity: 1;
  transform: scale(1);
  animation: flicker 2.6s ease-in-out infinite;
  filter: drop-shadow(0 0 10px rgb(242 179 74 / 0.8)) drop-shadow(0 0 26px rgb(242 179 74 / 0.45));
}
.candle-label {
  margin-top: 10px;
  font: 500 0.72rem/1 var(--sans);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #c9d6cc;
}
@keyframes flicker {
  0%,
  100% {
    transform: scale(1) rotate(-1deg);
  }
  30% {
    transform: scale(1.04, 0.96) rotate(1.5deg);
  }
  60% {
    transform: scale(0.97, 1.05) rotate(-1.5deg);
  }
}
.candles-caption {
  font-size: 0.85rem;
  color: #a9bcb0;
  margin: 8px 0 0;
}
@media (prefers-reduced-motion: reduce) {
  .candle.lit .flame {
    animation: none;
  }
}

/* ============ Sections ============ */
.section {
  padding: 48px 0;
}
.section + .section {
  padding-top: 8px;
}
.section-head {
  margin-bottom: 20px;
}
.section-head h2 {
  font-size: clamp(1.6rem, 4vw, 2rem);
}
.lead {
  color: var(--muted);
}

/* Inductive steps */
.steps {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  margin: 22px 0;
  counter-reset: step;
}
.step {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.step-num {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--accent);
  font: 600 0.9rem/1 var(--sans);
  margin-bottom: 12px;
}
.step h3 {
  font-size: 1.2rem;
}
.step .q {
  font-family: var(--serif);
  font-style: italic;
  color: var(--accent);
  margin: 4px 0 8px;
}
.step > p:not(.q) {
  font-size: 0.93rem;
  color: var(--muted);
  margin: 0;
}
.step .qgroup {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.step .qgroup + .qgroup {
  border-top: none;
  padding-top: 0;
}

/* Guiding questions */
.qlabel {
  font: 600 0.72rem/1.2 var(--sans);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 6px;
}
.qgroup ul {
  margin: 0;
  padding-left: 1.1em;
  font-size: 0.92rem;
  line-height: 1.5;
}
.qgroup li {
  margin: 0 0 6px;
}
.qgroup li::marker {
  color: var(--accent);
}
.qgroup ul ul {
  margin-top: 6px;
  list-style: circle;
  color: var(--muted);
}
.qs {
  margin: 0 0 12px;
}
.qs summary {
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--accent);
  width: fit-content;
}
.qs[open] summary {
  margin-bottom: 10px;
}
.qs .qgroup + .qgroup {
  margin-top: 12px;
}

/* Devotional cards */
.cards {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
}
.card {
  --c: var(--purple);
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 22px 20px;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
  overflow: hidden;
  transition:
    transform 0.2s,
    box-shadow 0.2s,
    border-color 0.2s;
}
.card::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: var(--c);
}
.card:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--c) 40%, var(--line));
  box-shadow: 0 2px 4px rgb(20 36 30 / 0.05), 0 16px 32px rgb(20 36 30 / 0.1);
}
[data-candle='gold'] {
  --c: var(--gold);
}
[data-candle='rose'] {
  --c: var(--rose);
}
[data-candle='purple'] {
  --c: var(--purple);
}
.card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.card-num {
  font: 600 0.75rem/1 var(--sans);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--c);
}
.badge-done {
  font: 500 0.75rem/1 var(--sans);
  color: var(--muted);
  display: inline-flex;
  gap: 4px;
  align-items: center;
}
.card h3 {
  font-size: 1.75rem;
  margin-bottom: 4px;
}
.card .term {
  font-family: var(--serif);
  font-style: italic;
  color: var(--muted);
  margin: 0 0 16px;
}
.card .passage-ref {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 0.92rem;
  font-weight: 500;
}
.card .arrow {
  color: var(--c);
  transition: transform 0.2s;
}
.card:hover .arrow {
  transform: translateX(4px);
}

/* ============ Devotional page ============ */
.dev-hero {
  --c: var(--purple);
  background:
    radial-gradient(800px 300px at 50% 120%, color-mix(in srgb, var(--c) 35%, transparent), transparent 70%),
    linear-gradient(180deg, var(--night) 0%, var(--night-2) 100%);
  color: #f6f1e7;
  padding: 36px 0 44px;
}
.dev-hero[data-candle='gold'] {
  --c: var(--flame);
}
.dev-hero[data-candle='rose'] {
  --c: #e58aac;
}
.dev-hero[data-candle='purple'] {
  --c: #b89be0;
}
.back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #c9d6cc;
  text-decoration: none;
  font-size: 0.9rem;
  margin-bottom: 28px;
}
.back:hover {
  color: #fff;
}
.dev-hero .eyebrow {
  color: var(--c);
}
.dev-hero h1 {
  font-size: clamp(2.6rem, 9vw, 4.25rem);
  font-weight: 400;
}
.word {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  margin-top: 18px;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgb(255 255 255 / 0.07);
  border: 1px solid rgb(255 255 255 / 0.12);
  font-size: 0.95rem;
  color: #d6e0d8;
}
.word strong {
  font: italic 400 1.15rem/1 var(--serif);
  color: #fff;
}
.word small {
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--c);
}

.prose {
  font-size: 1.06rem;
}
.prose p:first-of-type::first-letter {
  font-family: var(--serif);
  float: left;
  font-size: 3.4em;
  line-height: 0.9;
  padding: 6px 8px 0 0;
  color: var(--accent);
}
.dev-page {
  --accent: var(--purple);
}
.dev-page[data-candle='gold'] {
  --accent: var(--gold);
}
.dev-page[data-candle='rose'] {
  --accent: var(--rose);
}

/* Passage card */
.passage {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin: 32px 0;
  overflow: hidden;
  scroll-margin-top: 72px;
}
.passage-head {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  justify-content: space-between;
  align-items: center;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}
.passage-head h2 {
  font-size: 1.35rem;
}
.passage-head .eyebrow {
  margin-bottom: 6px;
}
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.select {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.select label {
  position: absolute;
  left: 12px;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  pointer-events: none;
}
.select select {
  appearance: none;
  -webkit-appearance: none;
  background: var(--surface)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5l3 3 3-3' fill='none' stroke='%23888' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E")
    no-repeat right 10px center;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 32px 8px 12px;
  font-size: 0.92rem;
  font-weight: 500;
  cursor: pointer;
  min-height: 40px;
}
.select select:hover {
  border-color: var(--accent);
}
.select.labeled select {
  padding-left: 76px;
}
.passage-body {
  padding: 22px 22px 8px;
  font-family: var(--scripture);
  font-size: 1.1rem;
  line-height: 1.85;
  min-height: 120px;
}
.verse {
  margin: 0 0 0.6em;
}
.verse sup {
  font: 600 0.62em/1 var(--sans);
  color: var(--accent);
  margin-right: 4px;
  vertical-align: 0.45em;
}
.compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 28px;
}
.compare-grid .col-head {
  font: 600 0.72rem/1 var(--sans);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  padding-bottom: 10px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.compare-grid .verse {
  font-size: 0.98rem;
  padding-bottom: 0.5em;
}
.compare-grid .verse .tag {
  display: none;
}
@media (max-width: 640px) {
  .compare-grid {
    grid-template-columns: 1fr;
  }
  .compare-grid .col-head {
    display: none;
  }
  .compare-grid .verse .tag {
    display: inline-block;
    font: 600 0.62rem/1 var(--sans);
    letter-spacing: 0.08em;
    color: var(--muted);
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 3px 5px;
    margin-right: 6px;
    vertical-align: 0.2em;
  }
  .compare-grid .verse.b {
    margin-bottom: 1.2em;
    padding-bottom: 1em;
    border-bottom: 1px dashed var(--line);
  }
}
.passage-foot {
  padding: 12px 22px 18px;
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--muted);
}
.passage-foot p {
  margin: 0 0 6px;
}
.passage-foot a {
  font-weight: 500;
}
.skeleton {
  height: 14px;
  border-radius: 6px;
  margin: 12px 0;
  background: linear-gradient(90deg, var(--surface-2) 0%, var(--line) 50%, var(--surface-2) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite linear;
}
@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}
.error {
  font-family: var(--sans);
  font-size: 0.95rem;
  color: var(--muted);
  padding: 8px 0 16px;
}
.error button,
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 999px;
  padding: 10px 18px;
  font-weight: 500;
  font-size: 0.95rem;
  cursor: pointer;
  text-decoration: none;
  color: var(--ink);
}
.btn:hover {
  border-color: var(--accent);
}
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-primary:hover {
  filter: brightness(1.08);
}
.btn-primary.done {
  background: transparent;
  color: var(--accent);
}

/* Reflect */
.reflect {
  border-left: 3px solid var(--accent);
  padding: 4px 0 4px 20px;
  margin: 32px 0;
  font-family: var(--serif);
  font-size: 1.15rem;
  line-height: 1.6;
}
.reflect .eyebrow {
  font-family: var(--sans);
}

/* Notes */
.notes {
  display: grid;
  gap: 14px;
  margin: 18px 0 8px;
}
.note {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 18px;
}
.note label {
  display: block;
  font-weight: 600;
}
.note .hint {
  display: block;
  font-size: 0.88rem;
  color: var(--muted);
  font-family: var(--serif);
  font-style: italic;
  margin: 2px 0 10px;
}
.note textarea {
  width: 100%;
  min-height: 92px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--bg);
  line-height: 1.55;
}
.note textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
}
.small-print {
  font-size: 0.82rem;
  color: var(--muted);
}

/* Save notes */
.save-notes {
  margin: 20px 0 8px;
  padding: 18px 20px;
  border: 1px dashed color-mix(in srgb, var(--accent) 45%, var(--line));
  border-radius: 14px;
}
.save-all {
  margin-top: 24px;
}
.save-title {
  font-weight: 600;
  margin: 0 0 2px;
}
.save-notes .small-print {
  margin: 0 0 12px;
}
.save-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.btn-sm {
  padding: 7px 14px;
  font-size: 0.88rem;
}
.btn svg {
  width: 16px;
  height: 16px;
  flex: none;
}
.save-status {
  font-size: 0.85rem;
  color: var(--accent);
}

/* Resource */
.resource {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  background: var(--surface-2);
  border-radius: 14px;
  padding: 16px 18px;
  margin: 28px 0;
}
.resource svg {
  flex: none;
  width: 22px;
  height: 22px;
  color: var(--accent);
  margin-top: 2px;
}
.resource p {
  margin: 0;
}
.resource .title {
  font-weight: 600;
}
.resource .source {
  font-size: 0.88rem;
  color: var(--muted);
}
.resource-link {
  text-decoration: none;
  color: var(--ink);
  border: 1px solid transparent;
  transition: border-color 0.2s;
}
.resource-link:hover {
  border-color: var(--accent);
}
.resource-link > div {
  flex: 1;
}
.resource-link .arrow {
  color: var(--accent);
  font-size: 1.1rem;
}
.resource-podcast {
  display: block;
}
.resource-head {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 14px;
}
.podcast-embed {
  display: block;
  width: 100%;
  height: 175px;
  border: 0;
  border-radius: 12px;
  overflow: hidden;
  background: transparent;
}
.resource-out {
  display: inline-block;
  margin-top: 10px;
  font-size: 0.88rem;
  font-weight: 500;
}

/* Complete + pager */
.complete-row {
  display: flex;
  justify-content: center;
  margin: 36px 0 12px;
}
.pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 24px 0 56px;
}
.pager a {
  display: block;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  text-decoration: none;
  color: var(--ink);
  background: var(--surface);
}
.pager a:hover {
  border-color: var(--accent);
}
.pager small {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.pager strong {
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 600;
}
.pager .next {
  text-align: right;
  grid-column: 2;
}

.site-footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  padding: 28px 20px 36px;
  border-top: 1px solid var(--line);
}
.site-footer p {
  margin: 0;
}

@media (max-width: 520px) {
  body {
    font-size: 16px;
  }
  .wrap {
    padding: 0 16px;
  }
  .passage-head,
  .passage-body,
  .passage-foot {
    padding-left: 16px;
    padding-right: 16px;
  }
  .controls,
  .select,
  .select select {
    width: 100%;
  }
}
