@font-face {
  font-family: AltarTibetan;
  src: url("assets/noto-serif-tibetan.woff2") format("woff2");
  font-display: swap;
}

.wordmark { display: grid; justify-items: center; gap: 8px; }
.brand-seal {
  display: block; width: clamp(54px, 5.4vw, 77px); height: auto; border-radius: 50%;
  box-shadow: 0 0 0 1px #c3a66f91, 0 2px 14px #00191b9c, 0 0 25px #ffe0a21e;
}
.brand-type { display: block; text-align: center; }
.brand-name {
  font-size: clamp(29px, 2.75vw, 43px); font-variant: small-caps; letter-spacing: .045em;
  line-height: 1; color: #fff2cd; -webkit-text-fill-color: currentColor; background: none;
  text-shadow: 0 2px 5px #061b1b, 0 0 15px #031819;
}
.brand-subtitle {
  font-size: 10px; letter-spacing: .24em; text-transform: uppercase; margin-top: 7px;
  color: #f7e5be; text-shadow: 0 1px 5px #061b1b;
}

.painted-drum { position: absolute; z-index: 2; pointer-events: none; display: block; }
.painted-drum[hidden] { display: none; }
.wheel-hotspot {
  position: absolute; z-index: 4; min-width: 44px; min-height: 44px;
  transform: translate(-50%, -50%); background: none; border: 0; padding: 0;
  border-radius: 35%; touch-action: manipulation;
}
.wheel-hotspot:focus-visible { outline: 1px solid #ffedb0; outline-offset: 4px; }
.wheel-inscription {
  position: absolute; bottom: calc(100% + 5px); left: 0; right: 0; margin: 0; text-align: center;
  pointer-events: none; visibility: hidden; opacity: 0; transition: opacity .2s;
  font: 14px/1.35 var(--serif); font-variant-numeric: tabular-nums; color: #fff1ce;
  text-shadow: 0 1px 4px #071a1b, 0 0 8px #071a1b;
}
@media (hover:hover) {
  .sanctuary:has(.wheel-hotspot:hover) .mantra-player[hidden] + .wheel-inscription { visibility: visible; opacity: 1; }
}
.sanctuary:has(.wheel-hotspot:focus-visible, .wheel-hotspot[aria-disabled="true"]) .mantra-player[hidden] + .wheel-inscription {
  visibility: visible; opacity: 1;
}
.contemplating .wheel-hotspot { pointer-events: none; }
.ready-to-play .mantra-dock-icon { color: #fff2bf; }

.prayer-book {
  --page-ink: #2e3c35; --paper-line: #ccbd9b; color-scheme: light;
  position: fixed; inset: 0; margin: auto; width: min(845px, calc(100vw - 52px));
  max-width: none; max-height: calc(100dvh - 44px); padding: 0; overflow: hidden;
  background: #f5edd9; color: var(--page-ink); border: 1px solid #c7aa6e;
  box-shadow: 0 24px 80px #021418b8, 0 0 0 4px #eed8a021; font: 16px/1.5 var(--serif);
}
.prayer-book::backdrop { background: #03171b95; backdrop-filter: blur(3px); }
.prayer-book [hidden] { display: none !important; }
.prayer-book button { background: none; border: 0; color: inherit; min-height: 44px; touch-action: manipulation; }
.prayer-book button:focus-visible, .prayer-book a:focus-visible, .prayer-book summary:focus-visible, .book-page:focus-visible { outline: 2px solid #9e6332; outline-offset: 2px; }
.prayer-close {
  position: absolute; top: 4px; right: 4px; z-index: 3; width: 44px;
  font: 25px/1 var(--serif); color: #46564b; text-shadow: 0 1px 4px #f9f2df;
}
.book-layout { display: grid; grid-template-columns: minmax(180px, 31%) minmax(0, 1fr); }
.prayer-niche {
  position: relative; display: grid; align-items: center; text-align: center; color: #f9eaca;
  padding: 30px 20px; overflow: hidden; background-color: #123034;
  background-image: radial-gradient(ellipse at 50% 36%, #55766a91, #142e2e33 53%, #071b21a6),
    linear-gradient(115deg,#112c33,#1c4341 45%,#143334 80%,#102a2f);
  border-right: 1px solid #aa905b;
}
.prayer-niche::before {
  content: ""; position: absolute; inset: 12px; border: 1px solid #d4bc7a54;
  border-radius: 105px 105px 1px 1px; pointer-events: none;
}
.niche-inner { position: relative; padding: 12px 0; }
.prayer-book .reader-vignette { display:block; width:85%; margin:0 auto; padding:0; color:#f9e7bd; }
.reader-painting {
  display: block; position: relative; width:100%; aspect-ratio:1; overflow:hidden; isolation:isolate;
  border-radius: 50% 50% 3px 3px; outline:1px solid #d3b67894; outline-offset:2px;
  background-size:100% 100%; background-repeat:no-repeat; box-shadow: 0 4px 16px #051a1b6b;
}
.reader-spin-caption { display:block; font: 14px/1.35 var(--serif); margin-top: 9px; text-decoration:underline; text-underline-offset:3px; }
.prayer-book .reader-vignette:focus-visible { outline-color: #fbe3a3; }
.receipt { margin:3px 0 0; font-size:13px; color:#e0d5b4; }

.niche-count { margin: 6px 0 0; color: #f2d69c; font-size: 15px; font-variant-numeric: tabular-nums; }
.niche-dedication { margin: 25px auto 0; max-width: 18em; font-size: 15px; line-height: 1.56; }
.niche-dedication::before, .niche-dedication::after { content: ""; display: block; width: 58px; height: 1px; margin: 13px auto; background: linear-gradient(90deg,transparent,#d7bf82,transparent); }
.book-page {
  max-height: min(660px, calc(100dvh - 46px)); min-height: min(490px, calc(100dvh - 46px)); overflow: auto; overscroll-behavior: contain;
  padding: clamp(27px, 4vw, 54px) clamp(23px, 4.1vw, 54px) 26px;
  background: linear-gradient(108deg,#e6dabe 0,#f7f0e0 6%,#f9f2e4 64%,#f0e6ce);
  scrollbar-color: #bba980 #f2e9d4;
}
.book-page h2 { margin: 3px 24px 15px 0; font: 400 clamp(30px, 3.3vw, 47px)/1.03 var(--serif); color: #244439; letter-spacing: -.035em; }
.book-intro { margin: 0 10px 8px 0; font-size:16px; color:#4f6053; line-height:1.45; }
.prayer-finish { margin: 20px 0 10px; border-left: 2px solid #b79c69; padding-left: 13px; }
.prayer-finish p { margin: 6px 0; }
.book-tools { display: flex; align-items: center; justify-content: space-between; gap: 10px; border-bottom: 1px solid var(--paper-line); }
.book-languages { display: flex; gap: 14px; }
.book-tools button, .verse-navigation button { font: 15px var(--serif); padding: 4px 0; color: #485c4d; }
.book-tools button[aria-pressed="true"] { color: #213d32; box-shadow: inset 0 -2px #9b7443; }
.book-tools button:hover, .verse-navigation button:hover:not(:disabled), .prayer-source a:hover { text-decoration: underline; text-underline-offset: 4px; }
#prayer-mode { color: #755a32; }
.reader-opening { color: #536654; font-size: 16px; margin: 22px 0 17px; }
.book-page h3 { font: 400 14px/1.4 var(--serif); letter-spacing: .055em; color: #795c31; margin: 0 0 7px; }
.current-praise, .all-praises p, .prayer-benefits p, .prayer-colophon, .reader-opening { white-space: pre-line; }
.current-praise { margin: 0 0 13px; font-size: clamp(18px, 1.62vw, 22px); line-height: 1.47; }
.verse-navigation { border-top: 1px solid var(--paper-line); margin-top: 17px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.verse-navigation button:disabled { opacity: .42; }
.prayer-book [lang=bo] { font-family: AltarTibetan, "Noto Serif Tibetan", serif; line-height: 2; }
.prayer-book[data-language=en] .tibetan-text, .prayer-book[data-language=bo] .english-text { display: none; }
.all-praises { list-style: none; padding: 0; margin: 0; }
.all-praises li { padding: 16px 0; border-bottom: 1px solid #c9b9998a; }
.all-praises p, .prayer-benefits p { font-size: 18px; line-height: 1.55; margin: 0; }
.prayer-benefits { margin-top: 18px; }
.prayer-benefits summary { cursor: pointer; padding: 7px 0; color: #4b654f; }
.prayer-benefits p { margin: 16px 0; }
.prayer-colophon { font-size: 16px; color:#526154; }
.prayer-source { font-size: 13px; line-height: 1.55; margin: 21px 0 0; color: #626b5c; }
.prayer-source a { color: #45604c; text-underline-offset: 2px; }

/* Glints are mapped to stone, water and metal in the two paintings. */
.jewel-flare {
  position: absolute; left: var(--land-x); top: var(--land-y); width: var(--flare-size); aspect-ratio: 1;
  color: var(--flare-color); opacity: 0; pointer-events: none; filter: drop-shadow(0 0 5px currentColor);
  animation: jewel-catch var(--flare-time) ease-in-out var(--flare-delay) infinite;
}
.jewel-flare::before, .touch-glint::before {
  content: ""; position: absolute; inset: 0; background: currentColor;
  clip-path: polygon(50% 0,53% 39%,70% 26%,59% 44%,100% 50%,59% 54%,73% 71%,54% 60%,50% 100%,46% 61%,29% 74%,40% 55%,0 50%,41% 46%,27% 29%,46% 40%);
}
.jewel-flare::after {
  content: ""; position: absolute; inset: 25%; background: radial-gradient(circle, #fff 4%, currentColor 20%, transparent 70%);
}
@keyframes jewel-catch {
  0%, 35%, 75%, 100% { opacity: 0; transform: translate(-50%,-50%) scale(.3) rotate(-9deg); }
  49% { opacity: .55; }
  55% { opacity: 1; transform: translate(-50%,-50%) scale(1) rotate(3deg); }
  67% { opacity: .22; }
}
.touch-glint {
  position: absolute; z-index: 4; width: 15px; aspect-ratio: 1; pointer-events: none; color: #fff3cf;
  filter: drop-shadow(0 0 4px #eeb65a); animation: trace-light .8s ease-out forwards;
}
@keyframes trace-light {
  0% { transform: translate(-50%,-50%) scale(.4); opacity: 0; }
  23% { transform: translate(-50%,-60%) scale(1); opacity: .95; }
  100% { transform: translate(-50%,-125%) scale(.15) rotate(28deg); opacity: 0; }
}
.motion-paused .jewel-flare { animation-play-state: paused; }

@media (orientation:portrait) {
  .wordmark { display: flex; align-items: center; gap: 9px; }
  .brand-seal { width: clamp(44px, 10.8vw, 65px); }
  .brand-name { font-size: clamp(28px, 7vw, 40px); letter-spacing:.024em; }
  .brand-subtitle { font-size: 9px; letter-spacing: .18em; margin-top: 4px; }
  .altar-dock { grid-template-columns:repeat(6,minmax(0,1fr)); }
  .altar-dock .mantra-dock-label { white-space:normal; }
  .jewel-flare { left: var(--phone-x); top: var(--phone-y); }
}
@media (max-width:620px) {
  .prayer-book { width: calc(100vw - 20px); max-height: calc(100dvh - 20px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); }
  .book-layout { display: flex; flex-direction: column; max-height: inherit; }
  .prayer-niche { flex: none; border-right: 0; border-bottom: 1px solid #b59c66; padding: 4px 35px 4px 12px; }
  .prayer-niche::before { inset: 5px; border-radius: 0; border-color: #c1a76b50; }
  .niche-inner { display: grid; grid-template-columns: 60px minmax(0, 1fr); grid-template-rows: auto auto auto; align-items: center; column-gap: 10px; padding: 3px; text-align:left; }
  .prayer-book .reader-vignette { width:54px; grid-column:1; grid-row:1/4; margin:0 auto; }
  .reader-spin-caption { display:none; }
  .niche-count,.receipt,.niche-dedication { grid-column:2; }
  .receipt { margin:0; font-size:12px; }

  .niche-count { font-size: 13px; margin: 0; align-self: end; }
  .niche-dedication { font-size: 14px; margin: 2px 0 0; line-height: 1.32; max-width: none; align-self: start; }
  .niche-dedication::before,.niche-dedication::after { content:none; }
  .niche-dedication br { display: none; }
  .prayer-close { color: #fff1cb !important; text-shadow: 0 1px 3px #072629; top: 2px; right: 3px; }
  .book-page { min-height: 0; max-height: none; padding: 22px 22px 19px; }
  .book-page h2 { font-size: clamp(30px,7.7vw,40px); margin: 0 0 10px; }
  .book-page h2 br { display: none; }
  .reader-opening { margin: 16px 0 13px; }
  .prayer-source { margin-top: 12px; }
}
@media (max-height:560px) and (orientation:landscape) {
  .wordmark { display:flex; align-items:center; gap:8px; }
  .brand-seal { width:40px; }.brand-name { font-size:26px; }.brand-subtitle { font-size:9px; margin-top:3px; }
  .altar-dock { gap:3px; }
  .prayer-book { max-height:calc(100dvh - 16px); }
  .book-layout { display:grid; grid-template-columns: 26% 1fr; max-height:none; }
  .prayer-niche { padding:10px; }.niche-inner { display:block; text-align:center; padding:4px; }
  .prayer-book .reader-vignette { width:70px; }.niche-dedication { font-size:13px; margin-top:10px; }
  .book-page { max-height:calc(100dvh - 18px); min-height:0; padding:18px 36px 18px 22px; }
  .prayer-close { color: #46564b !important; text-shadow:none; }
}
@media (prefers-reduced-motion:reduce) {
  .wheel-inscription { transition:none; }
  .jewel-flare { animation:none; opacity:.4; transform:translate(-50%,-50%) scale(.42); }
  .touch-glint { display:none; }
}
