/* Rhypple — about4 film chrome */

:root {
  --bar: #050404;
  --cream: #f2e9d8;
  --cream-dim: rgba(242, 233, 216, 0.62);
  --ink: #26221f;
  --ink-dim: rgba(38, 34, 31, 0.64);
  --accent: #c9a26b;
  --bar-h: 0px;
  --rail-w: min(34vw, 240px);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scrollbar-width: none; }
html::-webkit-scrollbar { display: none; }

html, body {
  background: #0b0a09;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  font-family: "Nunito", ui-rounded, system-ui, sans-serif;
  color: var(--cream);
  overscroll-behavior: none;
}

#scroll-space { width: 1px; pointer-events: none; }

#stage {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  display: block;
  z-index: 1;
}

/* ---------- cinematic frame ---------- */

#frame { position: fixed; inset: 0; z-index: 4; pointer-events: none; }
#frame .bar {
  position: absolute; left: 0; right: 0;
  height: var(--bar-h);
  background: var(--bar);
}
#frame .bar-top { top: 0; }
#frame .bar-bottom { bottom: 0; }

/* ---------- chrome ---------- */

#brand {
  position: fixed;
  top: calc(max(var(--bar-h), 14px) * 0.5);
  transform: translateY(-50%);
  left: clamp(18px, 3.4vw, 44px);
  z-index: 6;
  font-family: "Raleway", sans-serif;
  font-weight: 300;
  font-size: 15px;
  letter-spacing: 0.42em;
  color: var(--cream-dim);
  user-select: none;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1.2s ease;
}

#chapter {
  position: fixed;
  bottom: calc(max(var(--bar-h), 16px) * 0.5);
  transform: translateY(50%);
  left: clamp(18px, 3.4vw, 44px);
  z-index: 6;
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-family: "Raleway", sans-serif;
  pointer-events: none;
  user-select: none;
  opacity: 0;
  transition: opacity 0.9s ease;
}
#chapter .ch-num {
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.3em;
  color: rgba(242, 233, 216, 0.34);
}
#chapter .ch-name {
  font-size: 11.5px;
  font-weight: 300;
  letter-spacing: 0.34em;
  text-transform: lowercase;
  color: var(--cream-dim);
  transition: opacity 0.5s ease;
}

#rail {
  position: fixed;
  bottom: calc(max(var(--bar-h), 16px) * 0.5);
  left: 50%;
  transform: translate(-50%, 50%);
  width: var(--rail-w);
  height: 12px;
  z-index: 6;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.9s ease;
}
#rail .rail-track,
#rail .rail-fill {
  position: absolute;
  top: 50%;
  left: 0;
  height: 1px;
}
#rail .rail-track { width: 100%; background: rgba(242, 233, 216, 0.16); }
#rail .rail-fill { width: 0%; background: rgba(242, 233, 216, 0.66); transition: none; }
#rail .tick {
  position: absolute;
  top: 50%;
  left: calc(var(--at) * 100%);
  width: 1px;
  height: 5px;
  transform: translateY(-50%);
  background: rgba(242, 233, 216, 0.34);
}

#soundbtn {
  position: fixed;
  bottom: calc(max(var(--bar-h), 16px) * 0.5);
  transform: translateY(50%);
  right: calc(clamp(18px, 3.4vw, 44px) + 46px);
  z-index: 7;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 50%;
  background: rgba(242, 233, 216, 0.07);
  cursor: pointer;
  display: grid;
  place-items: center;
  opacity: 0;
  transition: opacity 0.9s ease, background 0.3s ease;
}
#soundbtn:hover { background: rgba(242, 233, 216, 0.16); }
#soundbtn svg { width: 15px; height: 15px; fill: var(--cream-dim); color: var(--cream-dim); }
#soundbtn .ic-off { display: none; }
#soundbtn.muted .ic-on { display: none; }
#soundbtn.muted .ic-off { display: block; }

#playbtn {
  position: fixed;
  bottom: calc(max(var(--bar-h), 16px) * 0.5);
  transform: translateY(50%);
  right: clamp(18px, 3.4vw, 44px);
  z-index: 7;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 50%;
  background: rgba(242, 233, 216, 0.07);
  cursor: pointer;
  display: grid;
  place-items: center;
  opacity: 0;
  transition: opacity 0.9s ease, background 0.3s ease;
}
#playbtn:hover { background: rgba(242, 233, 216, 0.16); }
#playbtn svg { width: 13px; height: 13px; fill: var(--cream-dim); }
#playbtn .ic-pause { display: none; }
#playbtn.playing .ic-play { display: none; }
#playbtn.playing .ic-pause { display: block; }

#hint {
  position: fixed;
  left: 50%;
  bottom: calc(max(var(--bar-h), 16px) + 26px);
  transform: translateX(-50%);
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1.4s ease;
}
#hint .hint-word {
  font-family: "Raleway", sans-serif;
  font-weight: 300;
  font-size: 11px;
  letter-spacing: 0.52em;
  text-indent: 0.52em;
  color: var(--cream-dim);
}
#hint .hint-line {
  width: 1px;
  height: 34px;
  background: linear-gradient(to bottom, rgba(242,233,216,0.55), rgba(242,233,216,0));
  animation: hintdrop 2.4s cubic-bezier(0.6, 0, 0.3, 1) infinite;
  transform-origin: top;
}
@keyframes hintdrop {
  0% { transform: scaleY(0); opacity: 0; }
  35% { transform: scaleY(1); opacity: 1; }
  78% { transform: scaleY(1); opacity: 0; }
  100% { transform: scaleY(1); opacity: 0; }
}

/* ---------- captions ---------- */

#captions { position: fixed; inset: 0; z-index: 5; pointer-events: none; }
.caption {
  position: absolute;
  font-family: "Raleway", sans-serif;
  font-weight: 300;
  font-size: clamp(14px, 1.55vw, 19px);
  letter-spacing: 0.3em;
  text-transform: lowercase;
  white-space: nowrap;
  opacity: 0;
  transform: translateY(14px);
  will-change: opacity, transform;
}
.caption.bl { left: clamp(26px, 7vw, 110px); bottom: calc(max(var(--bar-h), 16px) + clamp(40px, 9vh, 96px)); }
.caption.br { right: clamp(26px, 7vw, 110px); bottom: calc(max(var(--bar-h), 16px) + clamp(40px, 9vh, 96px)); text-align: right; }
.caption.on-light { color: var(--ink-dim); text-shadow: 0 0 18px rgba(244, 236, 220, 0.5); }
.caption.on-dark { color: var(--cream-dim); text-shadow: 0 1px 24px rgba(5, 4, 4, 0.55); }
@media (max-width: 700px) {
  .caption { letter-spacing: 0.18em; white-space: normal; max-width: 72vw; line-height: 1.7; }
}

/* ---------- title card ---------- */

#title-card {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  pointer-events: none;
  opacity: 0;
}
#title-card .tc-word {
  font-family: "Raleway", sans-serif;
  font-weight: 200;
  font-size: clamp(44px, 8.5vw, 110px);
  letter-spacing: 0.34em;
  text-indent: 0.34em;
  color: var(--cream);
}
#title-card .tc-sub {
  font-family: "Raleway", sans-serif;
  font-weight: 300;
  font-size: clamp(10px, 1.25vw, 14px);
  letter-spacing: 0.4em;
  color: rgba(242, 233, 216, 0.42);
}

/* ---------- final card ---------- */

#final-card {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(max(var(--bar-h), 16px) + 16px);
  z-index: 5;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 22px;
  pointer-events: none;
  opacity: 0;
}
#final-card .fc-mark { display: none; }
#final-card .fc-word { display: none; }
#final-card .fc-line {
  font-family: "Raleway", sans-serif;
  font-weight: 300;
  font-size: clamp(9px, 1vw, 12px);
  letter-spacing: 0.3em;
  line-height: 1.9;
  text-align: center;
  color: rgba(242, 233, 216, 0.55);
}
#final-card .fc-line br { display: none; }
#final-card #replay { margin-top: 0; }
#final-card .fc-line em { font-style: normal; color: rgba(242, 233, 216, 0.92); }
#final-card #replay {
  pointer-events: auto;
  margin-top: 6px;
  border: none;
  background: rgba(242, 233, 216, 0.08);
  color: var(--cream-dim);
  font-family: "Raleway", sans-serif;
  font-weight: 400;
  font-size: 11px;
  letter-spacing: 0.34em;
  text-indent: 0.34em;
  padding: 13px 26px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.3s ease, color 0.3s ease;
}
#final-card #replay:hover { background: rgba(242, 233, 216, 0.18); color: var(--cream); }
#final-card.live { pointer-events: auto; }

/* ---------- loader ---------- */

#loader {
  position: fixed;
  inset: 0;
  z-index: 9;
  background: #070606;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  transition: opacity 1.1s ease;
}
#loader.done { opacity: 0; pointer-events: none; }
#loader-mark { width: 78px; height: 80px; animation: markbreathe 2.8s ease-in-out infinite; }
#loader-mark .lm-hash {
  opacity: 0;
  animation: markin 2.8s cubic-bezier(0.3, 0, 0.2, 1) infinite;
  transform-origin: 50% 50%;
}
#loader-mark .lm-heart {
  opacity: 0;
  animation: heartin 2.8s cubic-bezier(0.34, 1.4, 0.5, 1) infinite;
  transform-origin: 38% 32%;
}
@keyframes markin {
  0% { opacity: 0; transform: scale(0.92); }
  22% { opacity: 1; transform: scale(1); }
  82% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.015); }
}
@keyframes heartin {
  0%, 18% { opacity: 0; transform: scale(0.4); }
  34% { opacity: 1; transform: scale(1.12); }
  44% { transform: scale(1); }
  82% { opacity: 1; }
  100% { opacity: 0; }
}
@keyframes markbreathe {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}
#loader .ld-word {
  font-family: "Raleway", sans-serif;
  font-weight: 300;
  font-size: 13px;
  letter-spacing: 0.5em;
  text-indent: 0.5em;
  color: var(--cream-dim);
}
#loader .ld-bar {
  width: 132px;
  height: 1px;
  background: rgba(242, 233, 216, 0.14);
  overflow: hidden;
}
#loader .ld-bar i {
  display: block;
  height: 100%;
  width: 0%;
  background: rgba(242, 233, 216, 0.75);
  transition: width 0.3s ease;
}

/* ---------- fallback ---------- */

#fallback[hidden] { display: none; }
#fallback {
  position: fixed;
  inset: 0;
  z-index: 10;
  background:
    radial-gradient(120% 90% at 50% 10%, #161311 0%, #070606 70%);
  display: grid;
  place-items: center;
}
#fallback .fb-inner {
  max-width: 520px;
  padding: 0 28px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
#fallback .fb-word {
  font-family: "Raleway", sans-serif;
  font-weight: 200;
  font-size: 54px;
  letter-spacing: 0.3em;
  text-indent: 0.3em;
  color: var(--cream);
}
#fallback p {
  font-family: "Raleway", sans-serif;
  font-weight: 300;
  font-size: 15px;
  letter-spacing: 0.06em;
  line-height: 1.9;
  color: var(--cream-dim);
}
#fallback .fb-small { font-size: 12px; color: rgba(242, 233, 216, 0.4); }

@media (prefers-reduced-motion: reduce) {
  #hint .hint-line { animation: none; }
  #loader-s path { animation-iteration-count: 1; animation-fill-mode: forwards; }
}

/* ---------- satchel: collected notes ---------- */

#satchel {
  position: fixed;
  left: clamp(18px, 3.4vw, 44px);
  bottom: calc(max(var(--bar-h), 16px) + 34px);
  z-index: 7;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.satchel-toast {
  font-family: "Nunito", sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: #2c2722;
  background: rgba(246, 240, 228, 0.95);
  border-radius: 999px;
  padding: 9px 16px 9px 14px;
  box-shadow: 0 8px 28px rgba(10, 8, 6, 0.35);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.45s ease, transform 0.45s cubic-bezier(0.2, 0.9, 0.3, 1);
}
.satchel-toast.on { opacity: 1; transform: translateY(0); }
.satchel-toast em {
  font-style: normal;
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 0.14em;
  color: rgba(44, 39, 34, 0.45);
  margin-right: 8px;
  text-transform: uppercase;
}
.satchel-toast b {
  font-weight: 700;
  font-size: 11px;
  padding: 2px 9px;
  border-radius: 999px;
  margin-left: 8px;
}
.satchel-toast .tag-task { background: #dce6d0; color: #5b7050; }
.satchel-toast .tag-reminder { background: #f2dfcd; color: #8a6248; }
.satchel-toast .tag-timetracking { background: #d8e2ea; color: #54707f; }
.satchel-toast .tag-observation { background: #e6d9e8; color: #7a5c80; }
.satchel-toast .tag-lab { background: #e8e0cc; color: #7a6c44; }
.satchel-toast .tag-idea { background: #f0e4d0; color: #8a7448; }
.satchel-toast .tag-sync { background: #d6e4e0; color: #4f7a6d; }

#satchel-badge {
  position: fixed;
  left: calc(clamp(18px, 3.4vw, 44px) + 150px);
  bottom: calc(max(var(--bar-h), 16px) * 0.5);
  transform: translateY(50%);
  z-index: 6;
  display: none;
  align-items: center;
  gap: 7px;
  font-family: "Raleway", sans-serif;
  font-size: 11px;
  color: var(--cream-dim);
  pointer-events: none;
}
#satchel-badge.on { display: flex; }
#satchel-badge i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #93a87e;
}
#satchel-badge.pulse i { animation: satchelpulse 0.7s ease; }
@keyframes satchelpulse {
  0% { transform: scale(1); }
  40% { transform: scale(2.1); }
  100% { transform: scale(1); }
}
