:root {
  --bg: #f7f3ec;
  --surface: #fffdf9;
  --surface-2: #f1ebe1;
  --text: #2b2520;
  --muted: #776b60;
  --border: #e4dacb;
  --accent: #3d3129;
  --accent-ink: #fffdf9;
  --accent-soft: #efe7da;
  --danger: #b4412f;
  --shadow: 0 1px 2px rgba(60, 40, 20, .06), 0 6px 24px rgba(60, 40, 20, .06);
  --radius: 14px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #171513;
    --surface: #211e1b;
    --surface-2: #2b2723;
    --text: #efe8de;
    --muted: #a99d90;
    --border: #3a342e;
    --accent: #eadfcd;
    --accent-ink: #1d1916;
    --accent-soft: #3a322b;
    --danger: #ec8a78;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 24px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}

/* Manual choice from the theme toggle (overrides the device setting). */
:root[data-theme="dark"] {
  --bg: #171513;
  --surface: #211e1b;
  --surface-2: #2b2723;
  --text: #efe8de;
  --muted: #a99d90;
  --border: #3a342e;
  --accent: #eadfcd;
  --accent-ink: #1d1916;
  --accent-soft: #3a322b;
  --danger: #ec8a78;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 24px rgba(0, 0, 0, .25);
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  /* The footer sits at the bottom of the window even when the page is short. */
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
body > main { flex: 1 0 auto; width: 100%; }

.wrap { max-width: 1400px; margin: 0 auto; padding: 0 16px; }

h1, h2 { font-family: Fraunces, Georgia, serif; font-weight: 650; letter-spacing: -.01em; }

/* Header */
.site-header { border-bottom: 1px solid var(--border); background: var(--surface); }
.header-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 18px; padding-bottom: 18px; }
.brand { display: flex; align-items: center; gap: 12px; }
/* Notes' own mark: the smiley page on a peach tile, and its own font (Quicksand), like each Pray2U app has its own */
.brand-tile { width: 48px; height: 48px; flex-shrink: 0; border-radius: 13px; background: #fbe7d6;
  display: inline-flex; align-items: center; justify-content: center; box-shadow: 0 1px 3px rgba(60, 40, 20, .12); }
.brand-tile svg { width: 36px; height: 36px; }
.brand h1 { margin: 0; font-size: clamp(1.5rem, 4vw, 2rem); line-height: 1.1; }
.brand h1.wordmark { font-family: Quicksand, Inter, system-ui, sans-serif; font-weight: 700; letter-spacing: -.01em; }
.wordmark .by { font-size: .5em; opacity: .7; letter-spacing: 0; }
.tagline { margin: 2px 0 0; color: var(--muted); font-size: .95rem; }
.header-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* Buttons */
.btn {
  font: inherit; font-weight: 600; font-size: .92rem;
  border-radius: 999px; padding: 8px 16px; cursor: pointer;
  border: 1px solid transparent; transition: filter .15s, background .15s;
}
.btn:disabled { opacity: .6; cursor: default; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover:not(:disabled) { filter: brightness(1.08); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: transparent; color: var(--danger); border-color: currentColor; }
.icon-btn { font-size: 1.6rem; line-height: 1; background: none; border: 0; color: var(--muted); cursor: pointer; padding: 4px 8px; }
.link-btn { font: inherit; font-size: .9rem; font-weight: 600; color: var(--accent); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: none; }
.link-btn:hover { text-decoration: underline; }
.theme-btn { width: 40px; height: 40px; padding: 0; display: inline-grid; place-items: center; }
.theme-btn svg { width: 18px; height: 18px; }
[hidden] { display: none !important; }

/* Banner */
.banner {
  margin-top: 20px; padding: 12px 16px; border-radius: var(--radius);
  background: var(--accent-soft); border: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: .95rem;
}
.banner .spacer { flex: 1; }

/* Toolbar */
.toolbar { padding: 24px 0 8px; }
#search {
  width: 100%; font: inherit; padding: 12px 16px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
}
#search:focus, .field input:focus, .field textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.tag-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chip {
  font: inherit; font-size: .85rem; padding: 4px 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
}
.chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.count { color: var(--muted); font-size: .88rem; margin: 12px 0 0; }

/* Card grid */
.cards {
  display: grid; gap: 14px; padding: 12px 0 64px;
  grid-template-columns: 1fr;
}
@media (min-width: 520px) { .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 760px) { .cards { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 880px) { .cards { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.card {
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); color: inherit; text-decoration: none;
  transition: transform .15s, border-color .15s;
}
.card-thumb { position: relative; aspect-ratio: 16 / 9; background: var(--surface-2); }
.card-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-thumb .badge { position: absolute; top: 8px; left: 8px; }
.badge {
  display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .72rem; font-weight: 600;
  background: var(--accent); color: var(--accent-ink); letter-spacing: .02em;
}
.card-thumb .play {
  position: absolute; inset: 0; margin: auto; width: 56px; height: 40px; border-radius: 12px;
  background: rgba(20, 20, 20, .75); opacity: 0; transition: opacity .15s, background .15s;
}
.card-thumb .play::after {
  content: ""; position: absolute; left: 22px; top: 12px;
  border-style: solid; border-width: 8px 0 8px 14px; border-color: transparent transparent transparent #fff;
}
.card:hover .play, .card:focus-visible .play { opacity: 1; background: #e62117; }
.card-body { display: flex; flex-direction: column; gap: 4px; flex: 1; padding: 10px 12px 12px; }
.card-title.loading, .note-title.loading { color: var(--muted); font-style: italic; }
.card:hover, .card:focus-visible { transform: translateY(-2px); border-color: var(--accent); }
.card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.card-title { margin: 0; font-size: .95rem; line-height: 1.3; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card-meta { margin: 0; color: var(--muted); font-size: .75rem; }
.card-meta:empty { display: none; }
.card-points { margin: 4px 0 0; padding-left: 1.3em; font-size: .78rem; line-height: 1.4; display: grid; gap: 3px; }
.card-points li > span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-points li.more { list-style: none; color: var(--muted); font-style: italic; }
.card-points li::marker { color: var(--accent); font-weight: 600; }
.card-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: auto; padding-top: 8px; }
.card-tags:empty { display: none; }

/* Detail view */
.detail-wrap { padding: 24px 0 64px; }
.detail { max-width: 820px; margin: 0 auto; }
.back { display: inline-block; margin-bottom: 16px; color: var(--accent); font-weight: 600; font-size: .92rem; text-decoration: none; }
.back:hover { text-decoration: underline; }
.detail-video { aspect-ratio: 16 / 9; border-radius: var(--radius); overflow: hidden; background: #000; box-shadow: var(--shadow); }
.detail-video iframe { width: 100%; height: 100%; border: 0; display: block; }
.detail .note-title { margin: 20px 0 0; font-size: clamp(1.4rem, 3.5vw, 1.9rem); line-height: 1.25; overflow-wrap: anywhere; }
.note-meta { margin: 4px 0 0; color: var(--muted); font-size: .9rem; }
.note-meta:empty { display: none; }
.note-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.note-tags:empty { display: none; }
.tag { font-size: .78rem; padding: 2px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--text); border: 0; cursor: pointer; font-family: inherit; }
.note-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 18px; margin-top: 12px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.detail .summary { margin-top: 20px; font-size: 1.02rem; }

/* Summary text */
.prose { margin-top: 12px; overflow-wrap: anywhere; }
.prose > :first-child { margin-top: 0; }
.prose p { margin: .9em 0 .35em; }
.prose ol { padding-left: 1.4em; margin: 1em 0 .3em; font-weight: 600; }
.prose ol > li::marker { color: var(--accent); }
.prose ul { padding-left: 1.25em; margin: .3em 0; }
.prose > ul { padding-left: 2.55em; }
.prose .bottom-line { margin: 1.2em 0 0; }
.prose .bottom-line-head { margin: 0 0 .3em; font-weight: 600; }
.prose .bottom-line p:not(.bottom-line-head) { margin: 0; }
.prose li { margin: .25em 0; }
.prose ul li { font-weight: 400; }
.prose strong { font-weight: 650; }
.prose h1, .prose h2, .prose h3 { font-size: 1.05rem; margin: 1.1em 0 .3em; }
.prose blockquote { margin: .8em 0; padding-left: 12px; border-left: 3px solid var(--border); color: var(--muted); }

.empty { text-align: center; color: var(--muted); padding: 48px 0; }
/* Pray2U footer: the same footer as pray2u.com, sunday.pray2u.com and crew.pray2u.com
   (copied from pray/welcome.css, scoped to .site-foot so it can't clash with this page). */
.site-foot {
  --ease: cubic-bezier(.22, .61, .36, 1);
  --ink: #ffffff; --ink2: rgba(255,255,255,.78); --faint: rgba(255,255,255,.5);
  --card: rgba(226,234,255,.07); --card2: rgba(226,234,255,.13); --line: rgba(226,234,255,.12);
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #0b0d13; border-top: 1px solid var(--line); color: var(--ink); margin-top: 24px;
}
.site-foot .fwrap { max-width: 940px; margin: 0 auto; padding: 34px 20px 44px; }
.site-foot .ftop { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding-bottom: 26px; flex-wrap: wrap; row-gap: 18px; }
.site-foot .brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink);
  font: 700 clamp(22px, 3vw, 26px)/1 Quicksand, var(--sans); }
.site-foot .brand .tile { width: 36px; height: 36px; border-radius: 10px; background: #fbe7d6;
  display: inline-flex; align-items: center; justify-content: center; }
.site-foot .brand .tile svg { width: 27px; height: 27px; }
.site-foot .social { display: flex; gap: 10px; flex-wrap: wrap; }
.site-foot .social a { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--line); color: var(--ink2);
  transition: background .7s var(--ease), color .7s var(--ease), transform .7s var(--ease); }
.site-foot .social a:hover { background: var(--card2); color: var(--ink); }
.site-foot .social a:active { transform: scale(.96); }
.site-foot .social svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.site-foot .social svg[fill="currentColor"] { fill: currentColor; }
.site-foot .fbot { display: flex; align-items: center; justify-content: space-between; gap: 14px 24px; flex-wrap: wrap;
  border-top: 1px solid var(--line); padding-top: 22px;
  font: 500 11px/1.5 var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--faint); }
.site-foot .fbot a { color: var(--faint); text-decoration: none; }
.site-foot .fbot a:hover { color: var(--ink2); }
.site-foot .ftag { font-style: italic; letter-spacing: .08em; color: var(--ink2); text-transform: none; }
@media (max-width: 620px) { .site-foot .fbot { justify-content: center; text-align: center; } .site-foot .fmid { order: 3; } }

/* Editor dialog */
.editor {
  width: min(760px, calc(100vw - 24px)); max-height: calc(100vh - 24px); padding: 0;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .3);
}
.editor::backdrop { background: rgba(20, 15, 10, .45); }
.editor form { display: flex; flex-direction: column; max-height: calc(100vh - 26px); }
.editor-head, .editor-foot { display: flex; align-items: center; gap: 8px; padding: 14px 20px; }
.editor-head { border-bottom: 1px solid var(--border); justify-content: space-between; }
.editor-head h2 { margin: 0; font-size: 1.25rem; }
.editor-where { margin: 2px 0 0; color: var(--muted); font-size: .82rem; }
.editor-foot { border-top: 1px solid var(--border); }
.editor-foot .spacer { flex: 1; }
.editor-body { padding: 16px 20px; overflow-y: auto; display: grid; gap: 14px; }
.field { display: grid; gap: 6px; font-size: .9rem; font-weight: 600; }
.field small { font-weight: 400; color: var(--muted); }
.field input, .field textarea {
  font: inherit; font-weight: 400; font-size: .95rem; width: 100%;
  padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text);
}
.field textarea { resize: vertical; min-height: 220px; line-height: 1.5; }
.field-row { display: grid; grid-template-columns: 180px 1fr; gap: 12px; }
.hint { min-height: 1em; }
.hint.error { color: var(--danger); }
.summary-head { display: flex; align-items: center; justify-content: space-between; }
.tabs { display: flex; gap: 4px; }
.tab { font: inherit; font-size: .85rem; padding: 3px 10px; border-radius: 8px; border: 1px solid transparent; background: none; color: var(--muted); cursor: pointer; }
.tab[aria-selected="true"] { border-color: var(--border); background: var(--bg); color: var(--text); }
#summaryPreview { margin: 0; padding: 10px 14px; border: 1px solid var(--border); border-radius: 10px; min-height: 220px; font-weight: 400; font-size: .95rem; }
.url-preview { display: flex; gap: 12px; align-items: center; padding: 8px; border-radius: 10px; background: var(--surface-2); }
.url-preview img { width: 120px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 6px; }
.url-preview div { display: grid; font-size: .9rem; }
.url-preview span { color: var(--muted); font-size: .85rem; }
.form-error { margin: 0; color: var(--danger); font-size: .9rem; }
.ai-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ai-row .hint { flex: 1; min-width: 200px; }
#fTranscript { min-height: 120px; }

/* Full transcript on the note page */
.transcript { margin-top: 28px; border-top: 1px solid var(--border); padding-top: 16px; }
.transcript > summary { cursor: pointer; font-weight: 600; color: var(--accent); }
.transcript-body { margin-top: 12px; color: var(--text); font-size: .95rem; line-height: 1.7; overflow-wrap: anywhere; }
.transcript-body p { margin: 0 0 .9em; }

@media (max-width: 760px) {
  .field-row { grid-template-columns: 1fr; }
  .header-row { flex-wrap: wrap; }
}
