/* Come, Follow Me for Littles — kids' scripture stories
   Mobile-first, soft & warm storybook aesthetic. */

:root {
  --cream: #fdf6ea;
  --cream-deep: #fcefd8;
  --peach: #ffd9b0;
  --rose: #ffb6a8;
  --sky: #bfe3e0;
  --gold: #e8a13a;
  --gold-soft: #f6c87a;
  --ink: #4a3b2f;
  --ink-soft: #6f5d4d;
  --card: #ffffff;
  --shadow: 0 10px 30px rgba(120, 85, 40, 0.12);
  --shadow-soft: 0 4px 14px rgba(120, 85, 40, 0.10);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent; /* no blue flash on tap (iOS Safari) */
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%; /* prevent auto-zoom on rotate (iOS Safari) */
  text-size-adjust: 100%;
  touch-action: manipulation; /* removes 300ms tap delay on iOS Safari */
}

body {
  margin: 0;
  overflow-x: hidden; /* prevent horizontal scroll (iOS Safari) */
  font-family: "Nunito", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 50% -120px, var(--cream-deep), transparent 70%),
    linear-gradient(180deg, var(--cream) 0%, #fbeede 100%);
  background-attachment: fixed;
  line-height: 1.6;
  font-size: 18px;
}

/* ---------- HERO ---------- */
.hero {
  text-align: center;
  /* top: push below notch / Dynamic Island; sides: account for landscape notch */
  padding: max(56px, calc(env(safe-area-inset-top) + 24px))
           max(22px, calc(env(safe-area-inset-right) + 14px))
           40px
           max(22px, calc(env(safe-area-inset-left) + 14px));
  background:
    radial-gradient(700px 320px at 50% -60px, rgba(255, 221, 168, 0.55), transparent 70%);
}
.hero-inner { max-width: 640px; margin: 0 auto; }
.hero-kicker {
  font-family: "Baloo 2", sans-serif;
  font-weight: 600;
  color: var(--gold);
  letter-spacing: 0.04em;
  margin: 0 0 8px;
  font-size: 0.98rem;
}
.hero h1 {
  font-family: "Baloo 2", sans-serif;
  font-weight: 800;
  font-size: clamp(2.3rem, 9vw, 3.6rem);
  line-height: 1.02;
  margin: 0 0 14px;
  color: var(--ink);
  text-wrap: balance;
}
.hero-for {
  display: block;
  font-size: 0.56em;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 0.01em;
  margin-top: 4px;
}
/* Week badge that doubles as the week dropdown (native <details>) */
.weekbadge {
  position: relative;
  display: inline-block;
  margin: 0 0 10px;
  text-align: left;
}
.weekbadge > summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: "Baloo 2", sans-serif;
  font-weight: 700;
  background: var(--peach);
  color: #8a5a1c;
  padding: 7px 17px;
  min-height: 44px; /* Apple HIG tap target minimum */
  border-radius: 999px;
  font-size: 0.95rem;
  box-shadow: var(--shadow-soft);
  transition: filter 0.12s ease;
}
.weekbadge > summary:hover { filter: brightness(0.98); }
.weekbadge > summary::-webkit-details-marker { display: none; }
.weekbadge > summary:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.weekbadge .caret {
  font-size: 0.8em;
  line-height: 1;
  transition: transform 0.15s ease;
}
.weekbadge[open] .caret { transform: rotate(180deg); }
.hero-scripture {
  font-family: "Baloo 2", sans-serif;
  font-weight: 600;
  font-size: 1.15rem;
  color: var(--ink-soft);
  margin: 0 0 16px;
}
.hero-blurb {
  color: var(--ink-soft);
  margin: 0 auto 24px;
  max-width: 30em;
}

/* ---------- WEEK DROPDOWN MENU (opens from the badge) ---------- */
.weekmenu {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  width: max-content;
  min-width: 240px;
  max-width: 86vw;
  list-style: none;
  margin: 0;
  padding: 6px;
  background: #fff;
  border: 1px solid rgba(232, 161, 58, 0.22);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.weekmenu li { margin: 0; }
.weekmenu li a {
  display: flex;
  align-items: center;
  min-height: 44px; /* Apple HIG tap target minimum */
  text-decoration: none;
  color: var(--ink);
  font-weight: 600;
  padding: 11px 12px;
  border-radius: 12px;
  font-size: 0.95rem;
  transition: background 0.12s ease;
}
.weekmenu li a:hover { background: var(--cream-deep); }
.weekmenu li a[aria-current="page"] { background: #fff4e1; }
.weekmenu li a em {
  font-style: normal;
  color: var(--gold);
  font-weight: 700;
  font-size: 0.82em;
  margin-left: 4px;
}

/* ---------- DAY BAR ---------- */
.daybar {
  position: sticky;
  top: env(safe-area-inset-top, 0); /* stick below notch in full-screen (iOS Safari) */
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
  padding: 8px max(12px, calc(env(safe-area-inset-right) + 8px))
               8px max(12px, calc(env(safe-area-inset-left) + 8px));
  background: rgba(253, 246, 234, 0.86);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(232, 161, 58, 0.18);
}
.daybar a {
  font-family: "Baloo 2", sans-serif;
  font-weight: 700;
  font-size: 0.92rem;
  text-decoration: none;
  text-align: center;
  color: #8a5a1c;
  background: #fff;
  padding: 6px 4px;
  min-height: 44px; /* Apple HIG tap target minimum */
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  box-shadow: var(--shadow-soft);
  transition: transform 0.12s ease, background 0.12s ease;
}
.daybar a:hover { background: var(--peach); transform: translateY(-1px); }
/* Scroll-spy: the day whose story is currently in view (set by JS in the page template).
   Filled gold pill + soft glow; keeps the 44px tap target and warm palette. */
.daybar a.active {
  background: var(--gold);
  color: #fff;
  box-shadow: 0 5px 16px rgba(232, 161, 58, 0.5);
}
.daybar a.active:hover { background: var(--gold); transform: translateY(-1px); }

/* ---------- CARDS ---------- */
main {
  max-width: 720px;
  margin: 0 auto;
  /* side padding accounts for landscape notch/home-bar insets */
  padding: 28px max(18px, calc(env(safe-area-inset-right) + 10px))
               10px max(18px, calc(env(safe-area-inset-left) + 10px));
  display: flex;
  flex-direction: column;
  gap: 34px;
}
.card {
  background: var(--card);
  border-radius: 26px;
  overflow: hidden;
  box-shadow: var(--shadow);
  scroll-margin-top: 64px;
  border: 1px solid rgba(232, 161, 58, 0.12);
}
.card-media {
  width: 100%;
  background: var(--cream-deep);
  line-height: 0;
}
.card-media img {
  width: 100%;
  height: auto;
  display: block;
}
.card-body { padding: 24px 22px 26px; }

.day-label {
  font-family: "Baloo 2", sans-serif;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.82rem;
  color: var(--gold);
  margin: 0 0 2px;
}
.card h2 {
  font-family: "Baloo 2", sans-serif;
  font-weight: 800;
  font-size: clamp(1.6rem, 6vw, 2.1rem);
  line-height: 1.1;
  margin: 0 0 6px;
  color: var(--ink);
  text-wrap: balance;
}
.ref {
  font-family: "Baloo 2", sans-serif;
  font-weight: 600;
  color: var(--ink-soft);
  margin: 0 0 16px;
  font-size: 0.98rem;
}
.reflink {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: rgba(232, 161, 58, 0.55);
  text-underline-offset: 3px;
  text-decoration-thickness: 2px;
  transition: color 0.12s ease;
}
.reflink:hover { color: var(--gold); }
.hero-scripture .reflink { text-decoration-color: rgba(232, 161, 58, 0.7); }
/* Expand tap targets on scripture links to Apple HIG 44px minimum */
.hero-scripture .reflink,
.ref .reflink {
  display: inline-block;
  padding: 10px 2px;
}
.idea {
  background: linear-gradient(135deg, #fff4e1, #ffe9cf);
  border: 1px solid rgba(232, 161, 58, 0.22);
  border-radius: 16px;
  padding: 14px 16px;
  margin: 0 0 20px;
  font-weight: 600;
  color: #7a5320;
}
.idea span {
  display: block;
  font-family: "Baloo 2", sans-serif;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.72rem;
  color: var(--gold);
  margin-bottom: 3px;
}
.card-body p { margin: 0 0 14px; }
.card-body p:last-child { margin-bottom: 0; }

.footer-row {
  margin-top: 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.think {
  border-radius: 14px;
  padding: 13px 15px;
  font-size: 0.98rem;
  margin: 0 !important;
  background: var(--sky);
  color: #2c5a57;
}
.think strong {
  font-family: "Baloo 2", sans-serif;
  font-style: normal;
}

/* ---------- FOOTER ---------- */
.site-footer {
  text-align: center;
  max-width: 560px;
  margin: 28px auto 0;
  /* bottom: clear the home indicator bar on iPhone X+ (iOS safe-area) */
  padding: 30px 26px max(54px, calc(env(safe-area-inset-bottom) + 20px));
  color: var(--ink-soft);
}
.footer-heart { font-size: 1.6rem; margin: 0 0 8px; }
.site-footer em { color: var(--ink); font-style: italic; }
.footer-small { font-size: 0.66rem; opacity: 0.65; margin-top: 10px; color: var(--ink-soft); }

/* ---------- LARGER SCREENS ---------- */
@media (min-width: 720px) {
  body { font-size: 19px; }
  .card-body { padding: 30px 34px 32px; }
  .footer-row .think { flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .daybar a { transition: none; }
}
