/* Layout: a phone-width home screen — header, swipeable "What's Happening" cards,
   then coloured drawers stacked like cards in a deck. Each drawer slides up full-screen. */
:root {
  --ink: #201f1f;          /* brand charcoal */
  --paper: #fafafa;        /* brand off-white */
  --tide: #2c4650;         /* Departure Bay slate */
  --driftwood: #e4dbcc;    /* beach log sand */
  --mist: #ecebe8;
  --line: rgba(32, 31, 31, 0.12);
  --muted: #5d5a57;

  --bg: var(--paper);
  --fg: var(--ink);
  --card: #ffffff;
  --card-fg: var(--ink);

  --sheet-message-bg: var(--ink);
  --sheet-message-fg: #f4f2ee;
  --sheet-events-bg: var(--tide);
  --sheet-events-fg: #f1f4f4;
  --sheet-next-bg: var(--driftwood);
  --sheet-next-fg: var(--ink);
  --sheet-prayer-bg: #d3ddd8;   /* sea glass */
  --sheet-prayer-fg: var(--ink);
  --sheet-giving-bg: #ffffff;
  --sheet-giving-fg: var(--ink);
  --sheet-notify-bg: var(--mist);
  --sheet-notify-fg: var(--ink);

  --font-display: "Nanum Myeongjo", "Iowan Old Style", Georgia, serif;
  --font-body: "Inter", -apple-system, "Segoe UI", Roboto, sans-serif;

  --radius-sheet: 28px;
  --radius-card: 18px;
  --gutter: max(20px, env(safe-area-inset-left, 0px));
  --gutter-r: max(20px, env(safe-area-inset-right, 0px));
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #151414; --fg: #eeebe6; --card: #232121; --card-fg: #eeebe6;
    --line: rgba(238, 235, 230, 0.14); --muted: #a8a39d;
    --sheet-message-bg: #2a2827; --sheet-next-bg: #3a342b; --sheet-next-fg: #f0e9dd;
    --sheet-prayer-bg: #26302c; --sheet-prayer-fg: #e6eeea;
    --sheet-giving-bg: #1f1e1e; --sheet-giving-fg: #eeebe6;
    --sheet-notify-bg: #262524; --sheet-notify-fg: #eeebe6;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #151414; --fg: #eeebe6; --card: #232121; --card-fg: #eeebe6;
  --line: rgba(238, 235, 230, 0.14); --muted: #a8a39d;
  --sheet-message-bg: #2a2827; --sheet-next-bg: #3a342b; --sheet-next-fg: #f0e9dd;
  --sheet-prayer-bg: #26302c; --sheet-prayer-fg: #e6eeea;
    --sheet-giving-bg: #1f1e1e; --sheet-giving-fg: #eeebe6;
  --sheet-notify-bg: #262524; --sheet-notify-fg: #eeebe6;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
/* No double-tap zoom: taps act immediately, like a native app. */
html { touch-action: manipulation; -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.5 var(--font-body);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
body.sheet-open { overflow: hidden; }
a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }

.app { max-width: 560px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; }

/* ---- Header ---- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(14px + env(safe-area-inset-top, 0px)) var(--gutter-r) 6px var(--gutter);
}
.logo { height: 48px; margin-left: -8px; width: auto; display: block; }
.logo-dark { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .logo-light { display: none; } :root:not([data-theme="light"]) .logo-dark { display: block; } }
:root[data-theme="dark"] .logo-light { display: none; }
:root[data-theme="dark"] .logo-dark { display: block; }
.icon-btn {
  width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line);
  background: transparent; display: grid; place-items: center; cursor: pointer;
}
.icon-btn svg { width: 20px; height: 20px; }
.service-line {
  padding: 0 var(--gutter-r) 0 var(--gutter);
  font-size: 14px; color: var(--muted);
}

/* ---- What's Happening ---- */
.section-label {
  margin: 14px 0 10px; padding: 0 var(--gutter-r) 0 var(--gutter);
  font: 700 22px/1.2 var(--font-display); letter-spacing: -0.01em;
}
.carousel {
  display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory;
  padding: 2px var(--gutter-r) 18px var(--gutter); scroll-padding-left: var(--gutter);
  scrollbar-width: none;
}
.carousel::-webkit-scrollbar { display: none; }
.post-card {
  flex: 0 0 78%; max-width: 340px; scroll-snap-align: start;
  background: var(--card); color: var(--card-fg); border-radius: var(--radius-card);
  overflow: hidden; text-decoration: none; display: flex; flex-direction: column;
  box-shadow: 0 1px 2px rgba(0,0,0,.06), 0 8px 24px rgba(0,0,0,.06);
}
.post-card img, .post-card .img-ph { width: 100%; aspect-ratio: 2 / 1; object-fit: cover; display: block; background: var(--mist); }
.post-card .body { padding: 14px 16px 18px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.eyebrow { font-size: 11px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; opacity: 0.7; }
.post-card h3 { margin: 0; font: 700 19px/1.25 var(--font-display); text-wrap: balance; }
.post-card p { margin: 0; font-size: 14px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---- Drawer stack ---- */
.drawers { margin-top: auto; padding-top: 8px; display: flex; flex-direction: column; }
.drawer {
  position: relative; display: block; width: 100%; text-align: left; border: 0; cursor: pointer; text-decoration: none;
  border-radius: var(--radius-sheet) var(--radius-sheet) 0 0;
  padding: 16px var(--gutter-r) 46px var(--gutter); margin-top: -26px;
  box-shadow: 0 -6px 18px rgba(0,0,0,.08);
  transition: transform .2s ease;
}
.drawer:first-child { margin-top: 0; }
.drawer:last-child { padding-bottom: calc(26px + env(safe-area-inset-bottom, 0px)); }
.drawer:hover { transform: translateY(-3px); }
.drawer::before {
  content: ""; display: block; width: 40px; height: 4px; border-radius: 2px;
  background: currentColor; opacity: .25; margin: 0 auto 12px;
}
.drawer .d-title { font: 700 21px/1.2 var(--font-display); }
.drawer .d-sub { font-size: 14px; opacity: .75; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.d-message { background: var(--sheet-message-bg); color: var(--sheet-message-fg); }
.d-events { background: var(--sheet-events-bg); color: var(--sheet-events-fg); }
.d-next { background: var(--sheet-next-bg); color: var(--sheet-next-fg); }
.d-prayer { background: var(--sheet-prayer-bg); color: var(--sheet-prayer-fg); }
.d-giving { background: var(--sheet-giving-bg); color: var(--sheet-giving-fg); border-top: 1px solid var(--line); }

/* ---- Install hint ---- */
.install {
  margin: 0 var(--gutter-r) 16px var(--gutter); padding: 12px 14px; border-radius: 14px;
  border: 1px dashed var(--line); font-size: 14px; display: flex; gap: 10px; align-items: center;
}
.install p { margin: 0; flex: 1; min-width: 0; }
.install button { border: 0; background: none; cursor: pointer; font-weight: 600; padding: 6px; }
.install #install-close {
  flex: none; width: 44px; height: 44px; margin: -8px -8px -8px 0; padding: 0;
  display: grid; place-items: center; border-radius: 50%; font-size: 20px; line-height: 1;
}
.install #install-close:active { background: var(--line); }

/* ---- Sheets ---- */
.sheet {
  position: fixed; inset: 0; z-index: 20; overflow-y: auto; -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  transform: translateY(100%); visibility: hidden;
  transition: transform .34s cubic-bezier(.2,.8,.2,1), visibility 0s linear .34s;
}
.sheet.open { transform: none; visibility: visible; transition: transform .34s cubic-bezier(.2,.8,.2,1); }
.sheet-inner {
  max-width: 560px; margin: 0 auto; min-height: 100%;
  padding: calc(18px + env(safe-area-inset-top, 0px)) var(--gutter-r) calc(40px + env(safe-area-inset-bottom, 0px)) var(--gutter);
}
.sheet-head {
  display: flex; justify-content: space-between; align-items: baseline; gap: 16px;
  position: sticky; top: calc(-18px - env(safe-area-inset-top, 0px)); padding: 18px 0 12px; margin-top: -18px;
  background: var(--sb, var(--bg)); z-index: 1;
}
.sheet-head h2 { margin: 0; font: 700 26px/1.15 var(--font-display); letter-spacing: -0.01em; }
.close-btn {
  text-decoration: none; border: 0; background: none; cursor: pointer; padding: 6px 0 6px 12px;
  font-size: 13px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; opacity: .7;
}
.sheet[data-sheet="message"] { --sb: var(--sheet-message-bg); background: var(--sheet-message-bg); color: var(--sheet-message-fg); }
.sheet[data-sheet="events"] { --sb: var(--sheet-events-bg); background: var(--sheet-events-bg); color: var(--sheet-events-fg); }
.sheet[data-sheet="nextsteps"] { --sb: var(--sheet-next-bg); background: var(--sheet-next-bg); color: var(--sheet-next-fg); }
.sheet[data-sheet="prayer"] { --sb: var(--sheet-prayer-bg); background: var(--sheet-prayer-bg); color: var(--sheet-prayer-fg); }
.sheet[data-sheet="giving"] { --sb: var(--sheet-giving-bg); background: var(--sheet-giving-bg); color: var(--sheet-giving-fg); }
.sheet[data-sheet="notifications"] { --sb: var(--sheet-notify-bg); background: var(--sheet-notify-bg); color: var(--sheet-notify-fg); }
.sheet[data-sheet="post"] { --sb: var(--bg); background: var(--bg); color: var(--fg); }
.sheet-inner > * + * { margin-top: 0; }
.stack { display: flex; flex-direction: column; gap: 18px; }

.lede { font-size: 17px; opacity: .85; margin: 0; max-width: 62ch; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 20px; border-radius: 999px; text-decoration: none; cursor: pointer;
  font-weight: 600; font-size: 15px; border: 1.5px solid currentColor; background: transparent;
}
.btn.solid { background: currentColor; }
.btn.solid span { color: var(--sb, var(--bg)); }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }
.rule { border: 0; border-top: 1px solid currentColor; opacity: .18; margin: 6px 0; width: 100%; }

/* Message */
.video-link { position: relative; display: block; border-radius: 16px; overflow: hidden; background: #000; }
.video-link img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; display: block; opacity: .88; }
.video-link .play {
  position: absolute; inset: 0; display: grid; place-items: center;
}
.video-link .play span {
  width: 64px; height: 64px; border-radius: 50%; background: rgba(250,250,250,.94); display: grid; place-items: center;
}
.video-link .play svg { width: 24px; height: 24px; fill: #201f1f; margin-left: 3px; }
.msg-title { margin: 0; font: 800 28px/1.15 var(--font-display); text-wrap: balance; }
.byline { font-size: 13px; letter-spacing: 0.1em; text-transform: uppercase; font-weight: 600; opacity: .8; }
.scripture { display: flex; flex-direction: column; gap: 14px; }
.passage { border-left: 2px solid currentColor; padding-left: 16px; }
.passage h3 { margin: 0 0 6px; font-size: 13px; letter-spacing: 0.1em; text-transform: uppercase; }
.passage .text { font: 400 17px/1.65 var(--font-display); }
.passage .text p { margin: 0 0 10px; }
.passage .text b, .passage .text sup { font-family: var(--font-body); font-size: 11px; font-weight: 700; margin-right: 2px; vertical-align: super; line-height: 0; }
.passage .missing { font-size: 14px; opacity: .8; margin: 0; }
.copyright { font-size: 11px; opacity: .6; line-height: 1.4; }
.empty-note { font-size: 14px; opacity: .75; margin: 0; }

/* Events */
.month { font: 700 14px/1 var(--font-body); letter-spacing: 0.12em; text-transform: uppercase; opacity: .7; margin: 18px 0 2px; }
.event { display: grid; grid-template-columns: 58px 1fr; gap: 14px; padding: 14px 0; border-bottom: 1px solid rgba(255,255,255,.14); }
.event .when { text-align: center; padding-top: 2px; }
.event .when .dow { font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; opacity: .75; }
.event .when .day { font: 800 26px/1.05 var(--font-display); }
.event .what { min-width: 0; }
.event h3 { margin: 0; font: 700 18px/1.25 var(--font-display); }
.event .meta { font-size: 14px; opacity: .8; margin-top: 2px; }
.event .desc { font-size: 14px; opacity: .85; margin: 6px 0 0; white-space: pre-line; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.event-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-top: 10px; }
.event a.more { font-size: 14px; font-weight: 600; }
.cal-btn {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 14px;
  border-radius: 999px; border: 1px solid rgba(255,255,255,.35); text-decoration: none;
  font-size: 13px; font-weight: 600;
}
.cal-btn svg { width: 16px; height: 16px; }
.cal-btn:active { background: rgba(255,255,255,.12); }

/* Next steps */
.step { padding: 18px 0; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.step h3 { margin: 0; font: 700 21px/1.2 var(--font-display); }
.step p { margin: 0; font-size: 15px; opacity: .85; }
.step .btn { align-self: flex-start; margin-top: 4px; }

/* Prayer */
.prayer-item { padding: 18px 0; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.prayer-item h3 { margin: 0; font: 700 21px/1.2 var(--font-display); }
.prayer-item p { margin: 0; font-size: 16px; line-height: 1.55; opacity: .88; max-width: 62ch; }

/* Giving */
.give-block { padding: 16px 0; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.give-block h3 { margin: 0; font: 700 20px/1.2 var(--font-display); }
.give-block p { margin: 0; font-size: 15px; }
.copy-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.copy-row code { font: 600 16px var(--font-body); user-select: all; }
.chip-btn { border: 1px solid var(--line); background: transparent; border-radius: 999px; padding: 6px 12px; font-size: 13px; font-weight: 600; cursor: pointer; }
address { font-style: normal; }

/* Notifications */
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.toggle-row .t { min-width: 0; }
.toggle-row h3 { margin: 0; font: 700 19px/1.2 var(--font-display); }
.toggle-row p { margin: 2px 0 0; font-size: 14px; opacity: .75; }
.switch { position: relative; width: 52px; height: 32px; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--line); transition: background .2s; pointer-events: none; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s; }
.switch input:checked + span { background: var(--tide); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 2px solid currentColor; outline-offset: 2px; }
.notice { font-size: 14px; padding: 12px 14px; border-radius: 12px; background: var(--card); margin: 0; }

/* Post */
.post-hero { width: 100%; border-radius: 16px; aspect-ratio: 16 / 10; object-fit: cover; display: block; }
.post-title { margin: 0; font: 800 28px/1.15 var(--font-display); text-wrap: balance; }
.post-body p { margin: 0 0 14px; max-width: 65ch; white-space: pre-line; }

.updated { text-align: center; font-size: 12px; color: var(--muted); padding: 10px 0 4px; }

@media (prefers-reduced-motion: reduce) {
  .sheet, .sheet.open, .drawer { transition: none; }
}
.sheet-head h2.eyebrow { font: 600 12px/1.2 var(--font-body); letter-spacing: 0.12em; text-transform: uppercase; opacity: .7; }
