/* alpa.blog/path: one place (the river scene), one card (the verse), nothing else. */

@font-face { font-family: "Tiro Devanagari Sanskrit"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("../../fonts/tiro-devanagari-400-normal.woff2") format("woff2");
  unicode-range: U+0900-097F, U+1CD0-1CF9, U+200C-200D, U+20A8, U+20B9, U+20F0, U+25CC, U+A830-A839, U+A8E0-A8FF, U+11B00-11B09; }
@font-face { font-family: "Tiro Devanagari Sanskrit"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("../../fonts/tiro-latin-ext-400-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Tiro Devanagari Sanskrit"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("../../fonts/tiro-latin-400-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Tiro Devanagari Sanskrit"; font-style: italic; font-weight: 400; font-display: swap;
  src: url("../../fonts/tiro-latin-ext-400-italic.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Tiro Devanagari Sanskrit"; font-style: italic; font-weight: 400; font-display: swap;
  src: url("../../fonts/tiro-latin-400-italic.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("../../fonts/inter-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("../../fonts/inter-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --ink: #fbf6ec;
  --ink-2: rgba(251, 246, 236, 0.78);
  --ink-3: rgba(251, 246, 236, 0.56);
  --gold: #ffd27a;
  --saffron: #f5a524;
  --glass: rgba(16, 12, 30, 0.42);
  --glass-strong: rgba(16, 12, 30, 0.66);
  --edge: rgba(255, 255, 255, 0.18);
  --shadow: 0 10px 44px rgba(0, 0, 0, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.16);
  --deva: "Tiro Devanagari Sanskrit", "Noto Serif Devanagari", serif;
  --serif: "Tiro Devanagari Sanskrit", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --gutter: max(16px, env(safe-area-inset-left), env(safe-area-inset-right));
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }        /* the sections below set display; hidden must still hide them */
html, body { height: 100%; }
body {
  margin: 0;
  color: var(--ink);
  font: 400 16px/1.55 var(--sans);
  background: #140f24;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--gold); text-underline-offset: 3px; text-decoration-thickness: 1px; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 8px; }
button { font: inherit; color: inherit; }
.text-shadow, .ask h1, .mark, .clock, .note { text-shadow: 0 1px 14px rgba(0, 0, 0, 0.55); }

/* ---------- the scene ---------- */
.scene, .scene-fallback { position: fixed; inset: 0; width: 100%; height: 100%; }
.scene { z-index: 0; display: block; }
.scene-fallback {
  z-index: -1;
  background: linear-gradient(180deg, #1c2858 0%, #7a4a76 38%, #ffae6e 50%, #6c4a6a 51%, #24183a 100%);
}

/* ---------- top bar ---------- */
.top {
  position: absolute; top: 0; left: 0; right: 0; z-index: 3;
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: max(14px, env(safe-area-inset-top)) var(--gutter) 0;
}
.clock { margin: 0; font-size: 15px; font-weight: 500; letter-spacing: 0.01em; color: var(--ink); }
.greeting { color: var(--ink-2); font-weight: 400; margin-left: 10px; }
.actions { display: flex; align-items: center; gap: 8px; }
.icon-button {
  width: 40px; height: 40px; display: grid; place-items: center; cursor: pointer;
  border-radius: 999px; border: 1px solid var(--edge); background: var(--glass);
  backdrop-filter: blur(16px) saturate(140%); -webkit-backdrop-filter: blur(16px) saturate(140%);
}
.icon-button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.home { color: var(--ink-2); text-decoration: none; font-size: 14px; padding: 8px 4px 8px 6px; }
.home:hover { color: var(--ink); }

main { position: relative; z-index: 2; min-height: 100%; }

/* ---------- asking ---------- */
.ask {
  min-height: 100svh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 88px var(--gutter) 40px; text-align: center;
}
.mark { margin: 0; font: 400 clamp(76px, 15vw, 150px)/1 var(--deva); color: #fff; letter-spacing: 0.01em; }
.ask h1 { margin: 10px 0 26px; font: 500 clamp(20px, 3.4vw, 28px)/1.3 var(--sans); letter-spacing: -0.01em; }
.feelings {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px;
  width: min(820px, 100%);
}
.feeling {
  --hue: var(--gold);
  display: flex; align-items: center; gap: 12px;
  text-align: left; cursor: pointer; padding: 12px 14px; min-height: 64px;
  border-radius: 18px; border: 1px solid var(--edge); background: var(--glass);
  backdrop-filter: blur(18px) saturate(140%); -webkit-backdrop-filter: blur(18px) saturate(140%);
  box-shadow: var(--shadow);
  transition: transform 0.25s ease, background 0.25s ease, border-color 0.25s ease;
}
.feeling:hover, .feeling:focus-visible { background: var(--glass-strong); border-color: color-mix(in srgb, var(--hue) 65%, transparent); transform: translateY(-1px); }
.feeling .words { min-width: 0; }
.feeling b { display: block; font-weight: 600; font-size: 15.5px; }
.feeling small { display: block; color: var(--ink-3); font-size: 13px; line-height: 1.35; margin-top: 2px; }
/* The feeling's mark: a line drawing in its colour, on a soft disc of the same colour. */
.glyph {
  flex: none; width: 38px; height: 38px; border-radius: 999px; display: grid; place-items: center;
  color: var(--hue); background: color-mix(in srgb, var(--hue) 18%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--hue) 35%, transparent);
}
.glyph svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.glyph.small { width: 24px; height: 24px; display: inline-grid; vertical-align: -6px; margin-right: 8px; }
.glyph.small svg { width: 15px; height: 15px; }
.for b { color: var(--hue, var(--gold)); }
.note { margin: 22px 0 0; color: var(--ink-2); font-size: 14px; max-width: 36ch; }

/* ---------- the verse ---------- */
.verse {
  min-height: 100svh;
  display: flex; align-items: flex-end; justify-content: center;
  padding: 80px var(--gutter) max(18px, env(safe-area-inset-bottom));
}
.card {
  width: min(760px, 100%);
  max-height: calc(100svh - 96px); overflow-y: auto; overscroll-behavior: contain;
  padding: 18px 22px 16px; border-radius: 28px;
  border: 1px solid var(--edge); background: var(--glass);
  backdrop-filter: blur(22px) saturate(150%); -webkit-backdrop-filter: blur(22px) saturate(150%);
  box-shadow: var(--shadow);
  animation: rise 0.7s ease both;
}
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.for { margin: 0 0 6px; color: var(--ink-2); font-size: 14px; }
.for b { font-weight: 600; }
.link { background: none; border: 0; padding: 0 2px; color: var(--ink-3); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font-size: 13px; }
.link:hover { color: var(--ink); }
.recital { margin: 0; }
.verse-text { font: 400 clamp(21px, 3.6vw, 30px)/1.75 var(--deva); text-align: center; text-wrap: balance; overflow-wrap: anywhere; }
.verse-text .line { display: block; }
.verse-text .w { transition: color 0.18s ease, text-shadow 0.18s ease; color: var(--ink-2); }
.verse-text .w.spoken { color: var(--ink); }
.verse-text .w.now { color: var(--gold); text-shadow: 0 0 18px rgba(255, 210, 122, 0.55); }
.verse-text .mark-danda { color: var(--ink-3); margin-left: 0.25em; }
.verse-iast { margin-top: 6px; text-align: center; color: var(--ink-3); font: italic 400 14.5px/1.55 var(--serif); overflow-wrap: anywhere; }
.verse-iast .line { display: block; }
.status { min-height: 1.4em; margin: 10px 0 0; text-align: center; color: var(--ink-3); font-size: 13.5px; }
.status.error { color: #ffb4a8; }
.status button { font-size: 13.5px; }
.load { height: 3px; margin: 8px auto 0; width: min(260px, 70%); border-radius: 3px; background: rgba(255, 255, 255, 0.14); overflow: hidden; }
.load i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--saffron), var(--gold)); transition: width 0.3s ease; }
.meaning { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--edge); animation: rise 0.9s ease both; }
.translation { margin: 0; font: 400 clamp(16.5px, 2.4vw, 19px)/1.6 var(--serif); color: var(--ink); }
.translation .line { display: block; }
.reason { margin: 12px 0 0; color: var(--gold); font-size: 15px; }
.cite { margin: 10px 0 0; color: var(--ink-3); font-size: 12.5px; line-height: 1.5; }
.cite a { color: var(--ink-2); }
.controls {
  display: flex; justify-content: center; align-items: center; gap: 18px;
  position: sticky; bottom: -16px; z-index: 1;
  margin: 10px -22px -16px; padding: 12px 22px 16px;
  background: linear-gradient(180deg, rgba(20, 15, 36, 0) 0%, rgba(20, 15, 36, 0.94) 42%);
}
.round {
  width: 46px; height: 46px; display: grid; place-items: center; cursor: pointer;
  border-radius: 999px; border: 1px solid var(--edge); background: rgba(255, 255, 255, 0.08);
}
.round:hover { background: rgba(255, 255, 255, 0.16); }
.round svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.round.main { width: 58px; height: 58px; background: rgba(255, 233, 196, 0.9); color: #2a1c10; border-color: transparent; }
.round.main:hover { background: #fff1d8; }
.round.main svg { fill: currentColor; stroke: none; width: 24px; height: 24px; }
.round.main .icon-stop, .reciting .round.main .icon-play { display: none; }
.reciting .round.main .icon-stop { display: block; }

/* ---------- sheets ---------- */
.sheet {
  width: min(440px, calc(100% - 32px)); max-height: calc(100svh - 40px); overflow-y: auto;
  padding: 20px 22px; border-radius: 24px; color: var(--ink);
  border: 1px solid var(--edge); background: rgba(22, 17, 40, 0.86);
  backdrop-filter: blur(22px) saturate(150%); -webkit-backdrop-filter: blur(22px) saturate(150%);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.sheet::backdrop { background: rgba(5, 4, 12, 0.35); }
.sheet h2 { margin: 0 0 10px; font-size: 18px; font-weight: 600; }
.sheet p { color: var(--ink-2); font-size: 14.5px; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 10px 0; border: 0; border-bottom: 1px solid rgba(255, 255, 255, 0.08); margin: 0; min-width: 0; }
fieldset.row legend { float: left; padding: 0; }
fieldset.row { display: flex; }
.row select, .row input[type="range"] { accent-color: var(--gold); }
.row select { background: rgba(255, 255, 255, 0.08); color: var(--ink); border: 1px solid var(--edge); border-radius: 10px; padding: 6px 10px; font: inherit; }
.row option { background: #1c1630; }
.row input[type="checkbox"] { accent-color: var(--gold); width: 20px; height: 20px; }
.segmented { display: inline-flex; border: 1px solid var(--edge); border-radius: 999px; overflow: hidden; margin-left: auto; }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.segmented span { display: block; padding: 6px 12px; font-size: 14px; color: var(--ink-2); }
.segmented input:checked + span { background: rgba(255, 210, 122, 0.9); color: #2a1c10; }
.segmented input:focus-visible + span { outline: 2px solid var(--gold); outline-offset: -2px; }
.done { margin-top: 16px; width: 100%; padding: 11px; border-radius: 14px; border: 0; background: rgba(255, 233, 196, 0.9); color: #2a1c10; font-weight: 600; cursor: pointer; }

/* ---------- narrow screens ---------- */
@media (max-width: 720px) {
  .feelings { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .feeling { border-radius: 16px; }
  /* On a phone the marks carry the choice: one line per feeling, the description left to wider screens. */
  .feeling { gap: 10px; min-height: 52px; padding: 8px 10px; }
  .feeling b { font-size: 15px; }
  .feeling small { display: none; }
  .glyph { width: 34px; height: 34px; }
  .glyph svg { width: 20px; height: 20px; }
  .controls { bottom: -14px; margin: 10px -16px -14px; padding: 10px 16px 14px; }
  .ask { justify-content: flex-start; padding-top: 84px; }
  .mark { margin-top: 4vh; }
  .greeting { display: none; }
  .card { padding: 16px 16px 14px; border-radius: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  .card, .meaning { animation: none; }
  .feeling, .verse-text .w { transition: none; }
}
