/* Desaka. The ground is the clear bowl of 2.13; the Buddha's words are ochre, the robes' colour. */
:root {
  --g: #EEF1EC; --ink: #263033; --soft: #5E6967; --sutta: #6F420F; --note: #616B67;
  --line: #D3D8D1; --raise: #F7F9F5; --scrim: rgb(20 26 28 / .28); --shadow: rgb(0 0 0 / .12);
  --serif-face: "EB Garamond"; --sans-face: "Source Sans 3";
  --serif: var(--serif-face), Georgia, serif;
  --sans: var(--sans-face), "Segoe UI", system-ui, sans-serif;
  /* Each face's size, so x-heights match whichever font is chosen. */
  --serif-size: 1; --sans-size: 1;
  --top: env(safe-area-inset-top, 0px); --bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-scheme="day"]) {
    --g: #0E1416; --ink: #D3DAD6; --soft: #8E9996; --sutta: #E8BC7C; --note: #86908C;
    --line: #243034; --raise: #182023; --scrim: rgb(0 0 0 / .5); --shadow: rgb(0 0 0 / .4);
    color-scheme: dark;
  }
}
:root[data-scheme="night"] {
  --g: #0E1416; --ink: #D3DAD6; --soft: #8E9996; --sutta: #E8BC7C; --note: #86908C;
  --line: #243034; --raise: #182023; --scrim: rgb(0 0 0 / .5); --shadow: rgb(0 0 0 / .4);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--g); color: var(--ink);
  font-family: var(--sans); font-size: calc(17px * var(--sans-size)); line-height: 1.5;
  -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent;
  font-variant-numeric: lining-nums;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: 4px; }
#app { min-height: 100%; }
.loading { padding: 40vh 28px 0; text-align: center; color: var(--note); }

/* ---------- the session column ---------- */
.session { position: fixed; inset: 0; display: flex; flex-direction: column; background: var(--g); }
.top {
  position: relative; z-index: 2; display: flex; align-items: center; gap: 14px;
  width: 100%; max-width: 40rem; margin: 0 auto; padding: calc(var(--top) + 14px) 16px 8px 28px;
}
.progress { flex: 1; height: 2px; border-radius: 1px; background: var(--line); overflow: hidden; }
.progress span { display: block; height: 100%; width: 0; background: var(--note); transition: width .4s; }
.close {
  flex: none; width: 40px; height: 40px; margin: -6px 0; border-radius: 50%;
  color: var(--note); font-size: 26px; line-height: 40px; font-weight: 300;
}
.col {
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; cursor: pointer;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 40px, #000 calc(100% - 28px), transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0, #000 40px, #000 calc(100% - 28px), transparent 100%);
}
.col::-webkit-scrollbar { display: none; }
.inner { max-width: 34rem; margin: 0 auto; padding: 0 28px; }
.spacer-top { height: calc(var(--ph, 600px) * .3); }
.spacer-bottom { height: calc(var(--ph, 600px) * .4 + var(--extra, 0px)); }
.title { display: flex; flex-direction: column; gap: 4px; margin-bottom: 28px; }
.title .num { font-size: 13px; color: var(--note); letter-spacing: .04em; }
.title .name { font-size: calc(25px * var(--sans-size)); font-weight: 500; line-height: 1.25; }

.block { display: flex; flex-direction: column; gap: 18px; transition: opacity .5s; }
.block + .block { margin-top: calc(var(--ph, 600px) * .32); }
.block.past { opacity: .3; }
.reviewing .block.past, .reviewing .item { opacity: 1 !important; }

.item { font-family: var(--sans); font-size: calc(20px * var(--sans-size)); line-height: 1.5; color: var(--ink); transition: opacity .45s; }
.item.S { font-family: var(--serif); font-size: calc(23px * var(--serif-size)); line-height: 1.42; color: var(--sutta); }
.item.held { font-size: calc(16px * var(--sans-size)); opacity: .66; }
.item.S.held { font-size: calc(18.5px * var(--serif-size)); }
.item.prior { font-size: calc(18px * var(--sans-size)); opacity: .74; }
.item.S.prior { font-size: calc(20.5px * var(--serif-size)); }
.item.receded { font-size: calc(15.5px * var(--sans-size)); line-height: 1.42; opacity: .5; }
.item.S.receded { font-size: calc(17.5px * var(--serif-size)); }
.item.faint { opacity: .26; }
.item.spaced { margin-top: 30px; }
.item .cite {
  display: table; margin-top: 8px; padding: 4px 0; font-family: var(--sans); font-size: 12.5px; letter-spacing: .03em;
  color: var(--note); line-height: 1.4;
}
.item.held .cite, .item.receded .cite, .item.prior .cite { margin-top: 4px; font-size: 11.5px; }
.vb { display: block; }
.term { text-decoration: underline dotted; text-decoration-color: var(--note); text-decoration-thickness: 1.5px; text-underline-offset: .28em; cursor: pointer; }
.mark {
  display: inline-block; width: 22px; height: 22px; margin: -4px -8px -4px 0; vertical-align: -2px; position: relative;
}
.mark::after {
  content: ""; position: absolute; left: 7px; top: 7px; width: 7px; height: 7px; border-radius: 50%;
  border: 1.5px solid var(--note);
}

/* a round: the frame holds still while the turn changes */
.item.turn { font-size: calc(22px * var(--sans-size)); margin-bottom: -4px; }
.item.frame { padding-left: 1.15em; }
.item.S.frame { font-size: calc(21px * var(--serif-size)); line-height: 1.38; }
.item.S .vb.q { height: 10px; }
.turns { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 14px; color: var(--note); }
.turns .todo { opacity: .55; }
.turns.faint { opacity: .26; transition: opacity .45s; }
.turns .now { color: var(--ink); font-weight: 500; }

.enter { animation: rise .45s ease backwards; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.swap { animation: swap .35s ease backwards; }
@keyframes swap { from { opacity: 0; } }

.return {
  position: absolute; left: 50%; bottom: calc(var(--bottom) + 22px); transform: translateX(-50%); z-index: 3;
  font-size: 15px; font-weight: 500; color: var(--g); background: var(--ink); border-radius: 999px; padding: 10px 18px;
  box-shadow: 0 4px 16px var(--shadow); white-space: nowrap;
}

/* the end of a session */
.end { display: flex; flex-direction: column; gap: 14px; }
.end .done { font-size: 14px; color: var(--note); }
.end .go {
  align-self: stretch; text-align: left; font-size: 18px; line-height: 1.35; color: var(--ink);
  background: var(--raise); border: 1px solid var(--line); border-radius: 16px; padding: 14px 18px;
}
.end .go small { display: block; font-size: 13px; color: var(--note); margin-bottom: 2px; }
.further { margin-top: 18px; display: flex; flex-direction: column; gap: 4px; }
.further .row { display: flex; flex-direction: column; gap: 3px; padding: 10px 0 6px; border-top: 1px solid var(--line); }
.further .links { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.further a { font-size: 16px; font-weight: 600; text-decoration: none; }
.further .why { font-size: 15px; line-height: 1.45; color: var(--soft); }

/* ---------- the panel ---------- */
.scrim { position: fixed; inset: 0; z-index: 10; background: var(--scrim); opacity: 0; transition: opacity .25s; }
.scrim.open { opacity: 1; }
.sheet {
  position: fixed; z-index: 11; left: 0; right: 0; bottom: 0; max-width: 40rem; margin: 0 auto;
  max-height: var(--sheet-max, 62dvh); overflow-y: auto; overscroll-behavior: contain;
  background: var(--raise); border-top: 1px solid var(--line); border-radius: 24px 24px 0 0;
  padding: 10px 24px calc(var(--bottom) + 26px); display: flex; flex-direction: column; gap: 16px;
  box-shadow: 0 -10px 30px var(--shadow); transform: translateY(100%); transition: transform .28s cubic-bezier(.2,.7,.2,1);
}
.sheet.open { transform: none; }
.sheet .handle { align-self: center; width: 38px; height: 4px; border-radius: 2px; background: var(--line); flex: none; }
.sec { display: flex; flex-direction: column; gap: 6px; }
.sec + .sec { border-top: 1px solid var(--line); padding-top: 16px; }
.kicker { font-size: 12.5px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--note); }
.word { font-size: 19px; font-weight: 600; }
.gloss, .notetext { font-size: 16.5px; line-height: 1.5; color: var(--ink); }
.notetext i, .notetext em { font-style: italic; }
.ref { font-size: 13px; color: var(--note); letter-spacing: .02em; }
.passage { font-family: var(--serif); font-size: calc(19.5px * var(--serif-size)); line-height: 1.42; color: var(--sutta); }
.passage .ctx { opacity: .55; }
.passage + .passage { margin-top: 4px; }
.out { font-size: 15px; color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--line); align-self: flex-start; padding-bottom: 1px; }
.sujato { font-size: 15.5px; line-height: 1.5; color: var(--soft); }
.sujato a { color: var(--soft); }
.sub { margin-top: 6px; }

/* ---------- home ---------- */
.home {
  min-height: 100dvh; max-width: 34rem; margin: 0 auto; display: flex; flex-direction: column;
  padding: calc(var(--top) + 26px) 28px calc(var(--bottom) + 30px);
}
.brand { font-size: 13px; letter-spacing: .16em; text-transform: uppercase; color: var(--note); }
.today { margin-top: auto; padding-top: 48px; display: flex; flex-direction: column; gap: 10px; }
.label { font-size: 13px; color: var(--note); letter-spacing: .02em; }
.cue { margin: 0; font-size: calc(21px * var(--sans-size)); line-height: 1.48; }
.next {
  margin-top: 44px; display: flex; flex-direction: column; gap: 4px; text-decoration: none; color: var(--ink);
  background: var(--raise); border: 1px solid var(--line); border-radius: 20px; padding: 18px 20px 20px;
}
.next .label { margin-bottom: 6px; }
.next .num { font-size: 14px; color: var(--note); }
.next .name { font-size: calc(23px * var(--sans-size)); line-height: 1.25; font-weight: 500; }
.next .part { font-size: 14px; color: var(--note); margin-top: 4px; }
.home .links { margin-top: auto; padding-top: 36px; display: flex; gap: 26px; font-size: 16.5px; }
.home .links a { text-decoration: none; border-bottom: 1px solid var(--line); padding: 6px 0 2px; }

/* ---------- pages ---------- */
.page { max-width: 34rem; margin: 0 auto; min-height: 100dvh; }
.bar {
  position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 14px; background: var(--g);
  padding: calc(var(--top) + 16px) 24px 12px; border-bottom: 1px solid var(--line);
}
.bar .back { font-size: 15px; color: var(--note); text-decoration: none; padding: 6px 0; flex: none; }
.bar .ttl { margin: 0; font-size: 17px; font-weight: 600; line-height: 1.3; }
.pagebody { padding: 4px 24px calc(var(--bottom) + 40px); }
.part { padding-top: 26px; }
.part h2 { margin: 0 0 8px; display: flex; flex-direction: column; gap: 2px; font-weight: 400; }
.pn { font-size: 12.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--note); }
.part .pt { font-size: 18px; font-weight: 500; line-height: 1.3; }
.group { margin: 18px 0 2px; font-size: 15px; font-weight: 600; line-height: 1.3; }
.part h2 + .group { margin-top: 6px; }
.row {
  display: grid; grid-template-columns: 2.7em minmax(0, 1fr) auto; gap: 4px 8px; align-items: baseline;
  padding: 10px 0; border-top: 1px solid var(--line); font-size: 16.5px; line-height: 1.35; color: var(--ink); text-decoration: none;
}
.row .n { color: var(--note); font-size: 14.5px; font-variant-numeric: lining-nums tabular-nums; }
.row .m { font-size: 12.5px; color: var(--note); }
.row.done .t { color: var(--soft); }
.row.done .n::after { content: " ·"; }
.row.here { background: var(--raise); margin: 0 -12px; padding: 12px; border-radius: 14px; border-top-color: transparent; }
.row.here + .row { border-top-color: transparent; }
.row.here .t { font-weight: 600; }
.row.here .m { color: var(--ink); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.reference { padding-top: 34px; }
.reference .row, .pagebody > .row { grid-template-columns: minmax(0, 1fr) auto; }
.intro { font-size: 17px; line-height: 1.5; color: var(--soft); margin: 18px 0 4px; }
.member { display: flex; flex-direction: column; gap: 8px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.member .name { margin: 0; font-size: 19px; font-weight: 600; line-height: 1.3; color: var(--ink); text-decoration: none; }
.field { display: flex; flex-direction: column; gap: 2px; }
.val { font-size: 16px; line-height: 1.45; color: var(--ink); margin: 0; }
.aside { font-size: 14px; color: var(--note); line-height: 1.4; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.chip {
  font-size: 14.5px; color: var(--ink); background: var(--raise); border: 1px solid var(--line); border-radius: 999px;
  padding: 6px 12px; text-decoration: none; line-height: 1.3;
}
.readrow { display: flex; flex-direction: column; gap: 3px; padding-top: 4px; }
.readrow .links { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.readrow a { font-size: 16px; font-weight: 600; text-decoration: none; }
.readrow .val { color: var(--soft); font-size: 15px; }

/* ---------- settings ---------- */
.sample { margin: 22px 0 8px; padding: 18px 20px; background: var(--raise); border: 1px solid var(--line); border-radius: 18px; }
.sample p { margin: 0; }
.sample-guide { font-size: calc(19px * var(--sans-size)); line-height: 1.5; }
.sample-sutta { margin-top: 12px !important; font-family: var(--serif); font-size: calc(21px * var(--serif-size)); line-height: 1.42; color: var(--sutta); }
.setting { padding-top: 24px; display: flex; flex-direction: column; gap: 10px; }
.setting .kicker { margin: 0; }
.choices { display: flex; flex-direction: column; gap: 8px; }
.choice {
  text-align: left; padding: 12px 16px; border: 1px solid var(--line); border-radius: 14px; line-height: 1.3;
}
.choice[aria-checked="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); font-weight: 500; }

/* ---------- meditations ---------- */
.medgroup { display: block; margin: 26px 0 6px; }
.medgroup + .group { margin-top: 8px; }
.group + .med { border-top-color: var(--line); }
.med {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; align-items: baseline;
  padding: 11px 0; border-top: 1px solid var(--line); color: var(--ink); text-decoration: none;
}
.med .name { font-size: 17px; line-height: 1.3; }
.med .why { grid-column: 1; font-size: 14.5px; line-height: 1.35; color: var(--note); }
.med .n { grid-row: 1; grid-column: 2; font-size: 13.5px; color: var(--note); font-variant-numeric: lining-nums tabular-nums; white-space: nowrap; }
.medtop { padding: 22px 0 4px; display: flex; flex-direction: column; gap: 12px; }
.medtop .mt { margin: 0; font-size: calc(26px * var(--sans-size)); font-weight: 500; line-height: 1.2; }
.medtop .quote { margin: 0; font-family: var(--serif); font-size: calc(21px * var(--serif-size)); line-height: 1.38; color: var(--sutta); }
.medtop .plain { margin: 0; font-size: 17px; line-height: 1.45; }
.medtop .cite { display: block; margin-top: 6px; font-family: var(--sans); font-size: 12.5px; color: var(--note); }
.next.begin { margin-top: 18px; padding: 16px 20px; }
.medsec { display: block; margin: 28px 0 6px; }
.read {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; align-items: baseline;
  padding: 10px 0; border-top: 1px solid var(--line); color: var(--ink); text-decoration: none;
}
.read .t { font-size: 16.5px; line-height: 1.3; }
.read .t b { font-weight: 600; margin-right: 6px; }
.read .why { grid-column: 1; font-size: 14px; line-height: 1.4; color: var(--note); }
.read .go { grid-row: 1; grid-column: 2; color: var(--note); font-size: 14px; }
.home .links { flex-wrap: wrap; gap: 8px 26px; }

@media (prefers-reduced-motion: reduce) {
  .enter, .swap { animation: none; }
  .item, .block, .sheet, .scrim, .progress span { transition: none; }
}
