@font-face {
  font-family: "Beatrix Alt";
  src: url(/fonts/BeatrixAlt.ttf) format("truetype");
  font-display: swap;
}
/* Palette shared with the Daily Practice app */
:root {
  --sand: #f4ece2;
  --cream: #fbf7f1;
  --earth: #3d342c;
  --sage: #7c8466;
  --clay: #c87f5e;
  --bg: var(--sand);
  --surface: var(--cream);
  --ink: var(--earth);
  --muted: #6b5e51;
  --line: #e7d3c1;
  --accent: #a85f42;
  --accent-soft: #ecd9c8;
  --mark-filter: none;
  --radius: 16px;
  --serif: "DM Serif Display", Georgia, serif;
  --script: "Beatrix Alt", "DM Serif Display", Georgia, serif;
  --sans: "DM Sans", system-ui, -apple-system, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #211A15; --surface: #2C231D; --ink: #ECE5D7; --muted: #B3A694;
    --line: #43372E; --accent: #D07A52; --accent-soft: #4A3226;
    --mark-filter: grayscale(1) invert(.85);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #211A15; --surface: #2C231D; --ink: #ECE5D7; --muted: #B3A694;
  --line: #43372E; --accent: #D07A52; --accent-soft: #4A3226;
  --mark-filter: grayscale(1) invert(.85);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.6 var(--sans);
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
}
a { color: inherit; }
img { max-width: 100%; height: auto; }
h1, h2, h3 { font-family: var(--serif); font-weight: 400; line-height: 1.15; margin: 0; }

.topbar {
  position: sticky; top: 0; z-index: 5;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-family: var(--serif); letter-spacing: .28em; font-size: 17px; }
.brand img { border-radius: 8px; }

main { max-width: 760px; margin: 0 auto; padding: 20px 16px 32px; outline: none; }
.loading, .empty { color: var(--muted); text-align: center; padding: 48px 0; }

/* Home */
.hero { padding: 12px 0 24px; }
.hero h1 { font-size: clamp(32px, 8vw, 46px); }
.hero p { color: var(--muted); margin: 8px 0 0; max-width: 46ch; }
.kicker { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); font-weight: 600; margin: 0 0 6px; }

.section-title { display: flex; justify-content: space-between; align-items: baseline; margin: 28px 0 12px; }
.section-title h2 { font-size: 24px; }
.section-title a { font-size: 14px; color: var(--accent); text-decoration: none; font-weight: 500; }

.feature {
  display: block; text-decoration: none; border-radius: var(--radius); overflow: hidden;
  background: var(--surface); border: 1px solid var(--line);
}
.feature .thumb { aspect-ratio: 16/9; }
.feature .meta { padding: 14px 16px 16px; }
.feature h3 { font-size: 22px; margin-top: 2px; }

.modules { display: grid; gap: 12px; }
.module-card {
  display: flex; flex-direction: column; justify-content: flex-end; gap: 4px;
  min-height: 120px; padding: 18px; border-radius: var(--radius); text-decoration: none;
  background: var(--surface); border: 1px solid var(--line); position: relative; overflow: hidden;
}
.module-card::after {
  content: ""; position: absolute; right: -30px; top: -30px; width: 130px; height: 130px;
  background: url(/icons/mark.svg) center/contain no-repeat; opacity: .08; filter: var(--mark-filter);
}
.module-card h3 { font-size: 22px; }
.module-card.photo { min-height: 180px; color: #fff; border: 0; background: var(--bg-img) center/cover; }
.module-card.photo::before { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(30,24,19,0) 25%, rgba(30,24,19,.72)); }
.module-card.photo::after { display: none; }
.module-card.photo > * { position: relative; }
.module-card.photo .sub { color: rgba(255,255,255,.85); }
.module-card.photo .bar { background: rgba(255,255,255,.3); }
.daily {
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px;
  padding: 16px 18px; border-radius: var(--radius); text-decoration: none;
  background: var(--sage); color: #fff; margin-top: 4px;
}
.daily h3 { font-size: 21px; }
.daily p { margin: 2px 0 0; font-size: 14px; opacity: .9; }
.daily .go { font-size: 22px; }
.module-banner { margin: 0 -16px 16px; aspect-ratio: 16/8; background: var(--bg-img) center/cover; }
@media (min-width: 700px) { .module-banner { margin: 0 0 16px; border-radius: var(--radius); } }
.module-card .sub { color: var(--muted); font-size: 14px; }
.bar { height: 4px; border-radius: 4px; background: var(--line); margin-top: 10px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--sage); }

/* Lists */
.rail { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; margin: 0 -16px; padding: 0 16px 6px; scrollbar-width: none; }
.rail::-webkit-scrollbar { display: none; }
.tile { flex: 0 0 210px; scroll-snap-align: start; text-decoration: none; }
.tile .thumb { aspect-ratio: 16/10; border-radius: 12px; }
.tile .t { font-size: 14px; font-weight: 500; margin-top: 8px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.thumb { position: relative; background: var(--accent-soft) center/cover no-repeat; display: block; }
.thumb .badge {
  position: absolute; left: 8px; bottom: 8px; font-size: 12px; font-weight: 600;
  background: rgba(33,26,21,.72); color: #fff; padding: 2px 8px; border-radius: 99px;
}
.thumb .done { position: absolute; right: 8px; top: 8px; background: var(--sage); color: #fff; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; }
.thumb.text-thumb { display: grid; place-items: center; }
.thumb.text-thumb::before { content: ""; width: 38%; aspect-ratio: 1; background: url(/icons/mark.svg) center/contain no-repeat; opacity: .35; filter: var(--mark-filter); }

.list { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--line); }
.row { display: grid; grid-template-columns: 104px 1fr auto; gap: 14px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); text-decoration: none; }
.row .thumb { aspect-ratio: 16/10; border-radius: 10px; }
.row .t { font-weight: 500; line-height: 1.35; }
.row .s { font-size: 13px; color: var(--muted); }
.row .chev { color: var(--muted); }

.module-head { padding: 8px 0 12px; }
.module-head h1 { font-size: clamp(30px, 7vw, 40px); }
.module-head p { color: var(--muted); margin: 6px 0 0; }
h2.sub-h { font-size: 20px; margin: 28px 0 10px; }
.back { display: inline-block; color: var(--muted); text-decoration: none; font-size: 14px; margin-bottom: 8px; }

/* Library */
.search { width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0 8px; }
.chip { border: 1px solid var(--line); background: transparent; color: var(--ink); padding: 6px 14px; border-radius: 99px; font: 500 14px var(--sans); cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* Lesson */
.player { margin: 0 -16px 18px; background: #000; }
.player.video { aspect-ratio: 16/9; }
.player.audio { background: transparent; margin: 0 0 18px; }
.player.audio .art { aspect-ratio: 16/9; border-radius: var(--radius); margin-bottom: 10px; }
.player iframe { width: 100%; height: 100%; border: 0; display: block; }
.player.audio iframe { height: 64px; border-radius: 12px; }
.lesson h1 { font-size: clamp(28px, 6.5vw, 38px); }
.lesson .crumbs { font-size: 13px; color: var(--muted); margin: 0 0 6px; }
.actions { display: flex; gap: 10px; margin: 16px 0 6px; flex-wrap: wrap; }
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); padding: 10px 16px; border-radius: 99px; font: 500 15px var(--sans); cursor: pointer; text-decoration: none; }
.btn.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.done-on { background: var(--sage); border-color: var(--sage); color: #fff; }
.prose { font-size: 17px; margin-top: 18px; }
.prose img { border-radius: 12px; display: block; margin: 12px auto; float: none !important; }
.prose blockquote { border-left: 3px solid var(--accent); margin: 16px 0; padding: 2px 0 2px 16px; font-family: var(--serif); font-size: 20px; }
.prose span[style] { color: inherit !important; }
.prose h3, .prose h4 { font-family: var(--serif); font-weight: 400; margin-top: 24px; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 24px 0; }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 32px; }
.pager a { padding: 14px; border: 1px solid var(--line); border-radius: 12px; text-decoration: none; font-size: 14px; background: var(--surface); }
.pager a.next { text-align: right; grid-column: 2; }
.pager small { display: block; color: var(--muted); font-size: 12px; }

/* Tab bar */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  display: grid; grid-template-columns: repeat(3, 1fr);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
}
.tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; text-decoration: none; font-size: 12px; color: var(--muted); padding: 6px; }
.tabbar svg { width: 24px; height: 24px; fill: currentColor; }
.tabbar a.active { color: var(--accent); }

@media (min-width: 700px) {
  .modules { grid-template-columns: 1fr 1fr; }
  .player { margin: 0 0 18px; border-radius: var(--radius); overflow: hidden; }
}

/* Beatrix Alt (brand script) for short headings only; long titles stay in the serif */
.hero h1, .section-title h2, .module-card h3, .module-head h1, .daily h3, h2.sub-h { font-family: var(--script); }
.hero h1 { font-size: clamp(40px, 11vw, 60px); }
.section-title h2 { font-size: 32px; }
.module-card h3 { font-size: 30px; }
.daily h3 { font-size: 28px; }
h2.sub-h { font-size: 28px; }
.module-head h1 { font-size: clamp(38px, 10vw, 52px); }

/* Meditation / audio lessons: headphones on earth */
.thumb.audio-thumb { background: #302b26 url(/icons/headphones.svg) 50% 30%/auto 72% no-repeat; }
.thumb.audio-thumb .badge { left: auto; right: 8px; }
.thumb.audio-thumb::before { display: none; }
.row .thumb.audio-thumb .badge { display: none; }
.row .thumb.audio-thumb { background-position: 50% 50%; }
