@font-face { font-family: "Source Serif 4"; font-style: normal; font-weight: 200 900; font-display: block; src: url("./vendor/fonts/source-serif-4-latin-wght-normal.woff2") format("woff2-variations"); }
@font-face { font-family: "Source Serif 4"; font-style: italic; font-weight: 200 900; font-display: block; src: url("./vendor/fonts/source-serif-4-latin-wght-italic.woff2") format("woff2-variations"); }
@font-face { font-family: "Caveat"; font-style: normal; font-weight: 400 700; font-display: block; src: url("./vendor/fonts/caveat-latin-wght-normal.woff2") format("woff2-variations"); }

:root {
  --ink: #1c2433; --ink2: rgba(28, 36, 51, 0.64); --accent: #9a3b2a; --dye: #6a2fe8; --head: #0e9fc0;
  --paper: #fbf8f0; --serif: "Source Serif 4", Georgia, serif; --hand: "Caveat", cursive;
  --glass: rgba(251, 248, 240, 0.62); --glass-edge: rgba(255, 255, 255, 0.7); --shadow: 0 10px 34px rgba(28, 36, 51, 0.18), 0 2px 6px rgba(28, 36, 51, 0.1);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #b9ae9b; color: var(--ink); font-family: var(--serif); -webkit-font-smoothing: antialiased; overscroll-behavior: none; }
canvas#c { display: block; width: 100%; height: 100%; touch-action: none; outline: none; }
canvas#c:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
#ui { position: fixed; inset: 0; pointer-events: none; }
.glass { pointer-events: auto; background: var(--glass); -webkit-backdrop-filter: blur(16px) saturate(1.3); backdrop-filter: blur(16px) saturate(1.3); box-shadow: var(--shadow), inset 0 1px 0 var(--glass-edge), inset 0 0 0 1px rgba(255, 255, 255, 0.35); }
button { font: inherit; color: inherit; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* the capsule */
.capsule { position: fixed; left: 50%; transform: translateX(-50%); bottom: max(18px, env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 4px; padding: 6px 8px; border-radius: 26px; width: min(760px, calc(100vw - 24px)); }
.capsule .ic { width: 36px; height: 36px; border: 0; border-radius: 18px; background: transparent; cursor: pointer; font-size: 18px; line-height: 1; display: grid; place-items: center; flex: none; }
.capsule .ic:hover { background: rgba(28, 36, 51, 0.07); }
.capsule a.ic { color: inherit; text-decoration: none; }
.capsule a.ic[hidden] { display: none; }
.capsule .ic[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.capsule #bSound[aria-pressed="true"] { background: transparent; color: inherit; }
.capsule #bSound[aria-pressed="false"] { opacity: .4; text-decoration: line-through; }
.capsule .cap { flex: 1; min-width: 0; display: grid; gap: 3px; padding: 0 8px; }
.capsule #caption { font: 400 14.5px/1.3 var(--serif); }
.capsule .dots { display: flex; gap: 5px; }
.capsule .dots i { width: 6px; height: 6px; border-radius: 3px; background: rgba(28, 36, 51, 0.18); transition: width .3s, background .3s; }
.capsule .dots i.on { width: 16px; background: var(--ink); }
.capsule .pill { flex: none; border: 0; border-radius: 18px; padding: 9px 15px; background: var(--ink); color: var(--paper); font: 600 13.5px/1 var(--serif); cursor: pointer; white-space: nowrap; }
.capsule .pill[hidden] { display: none; }
.capsule .sep { width: 1px; height: 22px; background: rgba(28, 36, 51, 0.15); margin: 0 4px; flex: none; }

#credit { position: fixed; right: 16px; bottom: max(26px, calc(env(safe-area-inset-bottom) + 14px)); margin: 0; padding: 6px 11px; border-radius: 12px; background: rgba(251, 248, 240, 0.78); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); box-shadow: 0 2px 10px rgba(28, 36, 51, 0.1); font: 400 11.5px/1.35 var(--serif); letter-spacing: .02em; color: rgba(28, 36, 51, 0.72); pointer-events: none; max-width: 232px; text-align: right; }
@media (max-width: 1240px) { #credit { display: none; } }

/* the bench card */
.bench { position: fixed; right: 16px; top: 16px; width: 300px; border-radius: 20px; padding: 6px 16px 14px; max-height: calc(100vh - 110px); overflow: auto; }
.bench .grip { display: flex; justify-content: space-between; align-items: center; width: 100%; border: 0; background: none; padding: 8px 0 4px; cursor: pointer; font: 600 11px/1 var(--serif); letter-spacing: .22em; text-transform: uppercase; color: var(--accent); }
.bench .grip .chev { transition: transform .25s; letter-spacing: 0; }
.bench.closed .grip .chev { transform: rotate(-90deg); }
.bench.closed .body { display: none; }
.big { display: flex; align-items: baseline; gap: 10px; margin: 6px 0 4px; }
.big b { font: 600 40px/1 var(--hand); letter-spacing: .01em; font-variant-numeric: tabular-nums; color: var(--dye); }
.big span { font: italic 400 15px/1.2 var(--serif); color: var(--ink2); }
.slider { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; margin: 10px 0 0; font-size: 14px; }
.slider output { font: 600 13px/1.3 var(--serif); font-variant-numeric: tabular-nums; }
.slider input { grid-column: 1 / -1; width: 100%; accent-color: var(--ink); margin: 4px 0 0; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.actions button { border: 0; border-radius: 16px; padding: 8px 12px; background: rgba(28, 36, 51, 0.08); cursor: pointer; font: 600 13px/1 var(--serif); }
.actions button:hover { background: rgba(28, 36, 51, 0.14); }
.actions button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.readings { display: grid; grid-template-columns: 1fr auto; gap: 5px 10px; margin: 14px 0 0; font-size: 13px; }
.readings dt { color: var(--ink2); }
.readings dd { margin: 0; text-align: right; font: 600 12.5px/1.45 var(--serif); font-variant-numeric: tabular-nums; }
.readings .key { color: var(--accent); }

/* the text version: hidden until focused */
.sr { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.sr:focus-within, .sr.open { position: fixed !important; width: auto; height: auto; clip: auto; left: 12px; top: 12px; max-width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 110px); overflow: auto; background: var(--paper); color: var(--ink); padding: 18px 20px; border-radius: 16px; box-shadow: var(--shadow); z-index: 7; white-space: normal; font-size: 15px; line-height: 1.5; }
.sr h1 { font-size: 26px; margin: 0 0 8px; }
.sr h2 { font-size: 16px; margin: 16px 0 4px; }
.sr button { margin: 3px 6px 3px 0; border: 1px solid rgba(28, 36, 51, 0.3); border-radius: 14px; padding: 6px 10px; background: none; cursor: pointer; text-align: left; }
.sr button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }

/* the loader: the title writes itself in ink; a drop of dye falls in as the dot of the i */
#loader { position: fixed; inset: 0; display: grid; place-items: center; background: radial-gradient(ellipse at 50% 44%, #fbf6ea 0%, #efe6d3 58%, #ddd1b9 100%); z-index: 5; transition: opacity .8s; padding: 24px; text-align: center; }
#loader .mark { display: grid; justify-items: center; }
#loader .ta { font: italic 560 clamp(46px, 9vw, 96px)/1.05 var(--serif); display: inline-flex; align-items: baseline; color: var(--ink); }
#loader .ta i { font-style: inherit; display: inline-block; clip-path: inset(-20% 100% -20% 0); animation: write .15s linear forwards; }
#loader .ta i:nth-child(1) { animation-delay: .15s } #loader .ta i:nth-child(2) { animation-delay: .27s } #loader .ta i:nth-child(3) { animation-delay: .38s } #loader .ta i:nth-child(4) { animation-delay: .5s } #loader .ta i:nth-child(5) { animation-delay: .62s } #loader .ta i:nth-child(6) { animation-delay: .73s } #loader .ta i:nth-child(7) { animation-delay: .83s } #loader .ta i:nth-child(8) { animation-delay: .95s } #loader .ta i:nth-child(9) { animation-delay: 1.05s } #loader .ta i:nth-child(10) { animation-delay: 1.1s } #loader .ta i:nth-child(11) { animation-delay: 1.18s } #loader .ta i:nth-child(13) { animation-delay: 1.42s } #loader .ta i:nth-child(14) { animation-delay: 1.52s }
@keyframes write { to { clip-path: inset(-20% 0 -20% 0); } }
#loader .ta .ii { position: relative; clip-path: none; animation: none; }
#loader .ta .ii b { display: inline-block; clip-path: inset(-20% 100% -20% 0); animation: write .15s 1.3s linear forwards; font-weight: inherit; }
#loader .ta .drop { position: absolute; left: 40%; top: 0.1em; width: 0.15em; height: 0.15em; margin-left: -0.06em; border-radius: 50%; background: var(--dye); box-shadow: 0 0 0.1em var(--dye), 0 0 0.35em var(--dye); opacity: 0; transform: translateY(-1.4em); animation: drop .55s 1.7s cubic-bezier(.55, 0, 1, .45) forwards; }
@keyframes drop { 0% { opacity: 0; transform: translateY(-1.4em); } 20% { opacity: 1; } 78% { transform: translateY(0) scale(1.25, .75); } 90% { transform: translateY(-0.06em) scale(.92, 1.08); } 100% { opacity: 1; transform: none; } }
#loader .thread { width: clamp(200px, 34vw, 360px); height: auto; margin-top: 6px; overflow: visible; }
#loader .thread path { fill: none; stroke: var(--dye); stroke-width: 2; stroke-linecap: round; stroke-dasharray: 300; stroke-dashoffset: 300; animation: thread 1.4s 1.9s cubic-bezier(.4, 0, .2, 1) forwards; filter: drop-shadow(0 0 3px rgba(122, 60, 255, .55)); }
@keyframes thread { to { stroke-dashoffset: 0; } }
#loader .sub { margin-top: 12px; font: italic 400 15px/1.3 var(--serif); color: #5a5448; opacity: 0; animation: fade .6s 2.1s forwards; }
@keyframes fade { to { opacity: 1; } }
body.ready #loader { opacity: 0; pointer-events: none; }
#nogl { position: fixed; inset: 0; display: none; place-items: center; background: #e9e3d6; z-index: 6; padding: 24px; text-align: center; }
#nogl h1 { font: 600 24px var(--serif); margin: 0 0 10px; }
#nogl p { font: 16px/1.5 var(--serif); max-width: 460px; margin: 0 auto; }
body.nogl #nogl { display: grid; }
.noscript { position: fixed; inset: auto 0 0 0; padding: 12px; background: #fff; text-align: center; }

@media (prefers-reduced-motion: reduce) {
  #loader .ta i, #loader .ta .ii b { animation: none; clip-path: none; }
  #loader .ta .drop { animation: none; opacity: 1; transform: none; }
  #loader .thread path { animation: none; stroke-dashoffset: 0; }
  #loader .sub { animation: none; opacity: 1; }
}
body.still *, body.still *::before, body.still *::after { transition: none !important; }

@media (max-width: 860px) {
  .bench { left: 12px; right: 12px; top: max(12px, env(safe-area-inset-top)); width: auto; max-height: 52vh; padding: 2px 14px 10px; }
  .capsule { width: calc(100vw - 16px); padding: 5px 6px; }
  .capsule #caption { font-size: 12.5px; }
  .capsule .sep, #bFold { display: none; }
}
@media (max-width: 520px) {
  /* the caption gets its own row above the buttons, so it never squeezes to a word per line */
  .capsule { flex-wrap: wrap; justify-content: center; row-gap: 2px; border-radius: 22px; }
  .capsule .cap { order: -1; flex: 1 1 100%; padding: 4px 8px 2px; text-align: center; }
  .capsule .dots { justify-content: center; }
  .capsule .pill { padding: 8px 11px; font-size: 12.5px; }
  .capsule .ic { width: 32px; height: 32px; }
  #bPrev, #bNext { display: none; }
}
