/* Osbert · heyosbert.com
   One continuous film through Osbert's felt world, driven by scroll. Modern and quiet: bold grotesque
   display type, glass controls, the felt world carries the warmth. */

:root {
  --ink: #221A14;
  --ink-soft: #5E5248;
  --cream: #F6ECDF;
  --paper: #FFFBF6;
  --peach: #EBC1A3;
  --terracotta: #C25E3D;
  --sage: #5B7055;
  --night: #121523;
  --glass: rgba(255, 251, 246, .72);
  --glass-strong: rgba(255, 251, 246, .9);
  --line: rgba(34, 26, 20, .1);
  --display: "Bricolage Grotesque", "Inter", system-ui, sans-serif;
  --sans: Inter, -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Segoe UI", Roboto, sans-serif;
  --ease: cubic-bezier(.2, .7, .1, 1);
  --pad: clamp(18px, 4.5vw, 64px);
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; overflow-x: clip; background: var(--cream); }
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
html.is-loading, html.is-loading body { overflow: hidden; }
body { margin: 0; background: var(--cream); color: var(--ink); font: 400 17px/1.55 var(--sans); -webkit-font-smoothing: antialiased; overflow-x: clip; }
img { display: block; max-width: 100%; }
a { color: inherit; }
button, input { font: inherit; color: inherit; }
p, h1, h2, figure { margin: 0; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 300; background: var(--ink); color: var(--cream); padding: 8px 14px; border-radius: 10px; }
.skip:focus { left: 8px; }
:focus-visible { outline: 2px solid var(--terracotta); outline-offset: 3px; border-radius: 12px; }

/* ---------- Arrival ---------- */
.intro { position: fixed; inset: 0; z-index: 200; display: grid; place-content: center; justify-items: center; gap: 28px; background: var(--cream); }
html:not(.js) .intro { display: none; }
.intro-word { font: 800 clamp(64px, 13vw, 190px)/.9 var(--display); letter-spacing: -.055em; font-variation-settings: "wdth" 88, "opsz" 96; display: flex; overflow: hidden; padding: 0 .04em .06em; }
.intro-word span { display: inline-block; }
.intro-line { width: 160px; height: 2px; border-radius: 2px; background: rgba(34, 26, 20, .12); overflow: hidden; }
.intro-line i { display: block; height: 100%; width: 100%; background: var(--ink); transform-origin: 0 50%; transform: scaleX(0); }

/* ---------- HUD ---------- */
.hud {
  position: fixed; z-index: 100; inset: 0 0 auto 0; display: flex; align-items: center; justify-content: space-between;
  padding: max(18px, env(safe-area-inset-top)) var(--pad) 0; pointer-events: none; transition: color .6s;
}
.hud > * { pointer-events: auto; }
.logo { font: 800 26px/1 var(--display); letter-spacing: -.045em; font-variation-settings: "wdth" 90, "opsz" 40; text-decoration: none; }
.hud-right { display: flex; gap: 8px; }
body.is-dark .hud { color: #FFF6EC; }

.chip {
  display: inline-flex; align-items: center; gap: 10px; height: 44px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--glass); backdrop-filter: blur(16px) saturate(1.5); -webkit-backdrop-filter: blur(16px) saturate(1.5);
  font: 600 14px/1 var(--sans); color: var(--ink); text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: transform .3s var(--ease), background .3s, color .3s, box-shadow .3s;
}
.chip:hover { transform: translateY(-1px); }
.chip:active { transform: scale(.97); }
.chip-ink { background: var(--ink); color: var(--cream); border-color: transparent; }
.chip-peach { background: var(--terracotta); color: #FFF7F0; border-color: transparent; box-shadow: 0 14px 30px -14px rgba(194, 94, 61, .9); }
.chip-lg { height: 56px; padding: 0 26px; font-size: 16px; }
body.is-dark .hud .chip:not(.chip-ink) { background: rgba(255, 255, 255, .12); color: #FFF6EC; border-color: rgba(255, 255, 255, .16); }
body.is-dark .hud .chip-ink { background: #FFF6EC; color: var(--ink); }
.eq { display: inline-flex; align-items: center; gap: 2px; height: 14px; }
.eq i { width: 2.5px; height: 4px; border-radius: 2px; background: currentColor; opacity: .85; }
.eq i:nth-child(2) { height: 9px; } .eq i:nth-child(3) { height: 12px; } .eq i:nth-child(4) { height: 6px; }
.is-on .eq i, .is-speaking .eq i { animation: eq .7s ease-in-out infinite alternate; }
.is-on .eq i:nth-child(2), .is-speaking .eq i:nth-child(2) { animation-delay: .12s; }
.is-on .eq i:nth-child(3), .is-speaking .eq i:nth-child(3) { animation-delay: .24s; }
.is-on .eq i:nth-child(4), .is-speaking .eq i:nth-child(4) { animation-delay: .36s; }
@keyframes eq { from { height: 3px; } to { height: 14px; } }

/* Chapter rail */
.chapters { position: fixed; z-index: 90; right: clamp(12px, 2vw, 28px); top: 50%; transform: translateY(-50%); display: grid; gap: 10px; }
.chapters button { position: relative; width: 10px; height: 10px; padding: 0; border: 0; border-radius: 10px; background: rgba(34, 26, 20, .25); cursor: pointer; transition: height .5s var(--ease), background .4s; }
.chapters button.on { height: 30px; background: var(--ink); }
.chapters span { position: absolute; right: 22px; top: 50%; transform: translate(6px, -50%); opacity: 0; pointer-events: none; white-space: nowrap; font: 600 12px var(--sans); padding: 6px 10px; border-radius: 999px; background: var(--glass-strong); color: var(--ink); transition: opacity .25s, transform .25s; }
.chapters button:hover span, .chapters button:focus-visible span { opacity: 1; transform: translate(0, -50%); }
body.is-dark .chapters button { background: rgba(255, 246, 236, .3); }
body.is-dark .chapters button.on { background: #FFF6EC; }

/* ---------- The film ---------- */
.film { position: relative; height: 1300vh; }
.screen { position: sticky; top: 0; height: 100svh; overflow: hidden; overflow: clip; background: #EADCCB; transition: background 1.2s; }
body.is-dark .screen { background: #15182A; }
.shot { position: absolute; inset: 0; opacity: 0; will-change: transform, opacity, filter; }
.shot[data-shot="house"] { opacity: 1; }
.scene { position: absolute; transform-origin: 50% 50%; }
.plate { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; user-select: none; -webkit-user-drag: none; }
.plate[data-room="evening"], .plate[data-room="night"] { opacity: 0; }

.vignette { position: absolute; inset: 0; pointer-events: none; opacity: 0; }
.vignette-light { background: linear-gradient(90deg, rgba(246, 236, 223, .92) 0%, rgba(246, 236, 223, .68) 26%, rgba(246, 236, 223, 0) 52%); }
.vignette-dark { background: linear-gradient(90deg, rgba(14, 16, 28, .85) 0%, rgba(14, 16, 28, .55) 30%, rgba(14, 16, 28, 0) 58%); }
.glow { position: absolute; inset: 0; pointer-events: none; opacity: 0; background: radial-gradient(circle at 62% 58%, rgba(255, 228, 180, .95), rgba(255, 214, 160, .6) 30%, rgba(255, 210, 160, 0) 70%); mix-blend-mode: screen; }
.stars { position: absolute; inset: 0; pointer-events: none; opacity: 0; }
.stars i { position: absolute; width: 2px; height: 2px; border-radius: 50%; background: #FFF4D8; box-shadow: 0 0 6px rgba(255, 240, 200, .9); animation: twinkle 3s ease-in-out infinite; }
@keyframes twinkle { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }

/* Osbert, alive */
.osbert { position: absolute; left: var(--l); top: var(--t); width: var(--w); cursor: pointer; user-select: none; -webkit-user-select: none; }
.osbert-body { position: relative; transform-origin: 50% 94%; animation: breathe 4.6s ease-in-out infinite; }
.osbert-body > img { width: 100%; pointer-events: none; -webkit-user-drag: none; }
@keyframes breathe { 0%, 100% { transform: scale(1, 1); } 50% { transform: scale(1.008, 1.018); } }
.face { position: absolute; inset: 0; pointer-events: none; transform: translate(var(--fx, 0), var(--fy, 0)); }
.eye { position: absolute; left: var(--ex1); top: var(--ey); width: var(--ew); aspect-ratio: 10 / 12; transform: translate(-50%, -50%); }
.eye + .eye { left: var(--ex2); }
.eye svg { width: 100%; height: 100%; overflow: visible; display: block; transition: transform 70ms ease-in; }
.eye .happy { opacity: 0; }
.is-happy .eye .ball { opacity: 0; }
.is-happy .eye .happy { opacity: 1; }
.eye.blink svg { transform: scaleY(.08); }

.bubble {
  position: absolute; left: 67.5%; top: 18%; z-index: 3; max-width: 17em;
  background: var(--glass-strong); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  padding: .75em 1.1em; border-radius: 1.25em 1.25em 1.25em .3em; box-shadow: 0 20px 40px -18px rgba(34, 26, 20, .4);
  font: 600 clamp(14px, 1.1vw, 17px)/1.35 var(--sans); color: var(--ink);
  opacity: 0; transform: translateY(8px) scale(.96); transform-origin: 0 100%; transition: opacity .4s var(--ease), transform .4s var(--ease);
}
.bubble.on { opacity: 1; transform: none; }

/* Pebbles in his room */
.pile { position: absolute; inset: 0; pointer-events: none; }
.pebble {
  position: absolute; width: 7.6%; padding: 0; border: 0; background: none; cursor: grab;
  touch-action: none; filter: drop-shadow(0 12px 12px rgba(34, 26, 20, .28));
  pointer-events: none; opacity: 0; -webkit-tap-highlight-color: transparent;
}
.carry-live .pebble { pointer-events: auto; }
.pebble-in { display: block; position: relative; }
.pebble img { width: 100%; pointer-events: none; -webkit-user-drag: none; }
.pebble-tag {
  position: absolute; left: 50%; top: 92%; transform: translateX(-50%); white-space: nowrap;
  font: 600 clamp(11px, .9vw, 13px)/1 var(--sans); color: var(--ink); background: var(--glass-strong); padding: 6px 10px; border-radius: 999px;
  box-shadow: 0 8px 18px -10px rgba(34, 26, 20, .5); pointer-events: none;
}
.pebble.dragging { cursor: grabbing; z-index: 5; }
.pebble.gone { display: none !important; }

/* Letters at his desk */
.mail { position: absolute; inset: 0; pointer-events: none; }
.env { position: absolute; left: var(--cx); top: var(--cy); width: 6.4%; opacity: 0; }
.env img { width: 100%; filter: drop-shadow(0 8px 10px rgba(34, 26, 20, .3)); }
.env figcaption {
  position: absolute; left: 50%; top: calc(100% + 6px); transform: translateX(-50%); white-space: nowrap; opacity: 0;
  font: 600 clamp(10px, .82vw, 12px)/1 var(--sans); color: var(--ink); background: var(--glass-strong); padding: 6px 10px; border-radius: 999px;
  box-shadow: 0 8px 16px -10px rgba(34, 26, 20, .5);
}

/* The letterbox */
.slot { position: absolute; left: 66.4%; top: 45.2%; width: 14.2%; height: 3.4%; transform: translate(-50%, -50%); border-radius: 6px; opacity: 0; box-shadow: 0 0 30px 10px rgba(255, 196, 110, .55), inset 0 0 12px rgba(255, 220, 160, .8); }
.slot.on { animation: slot 2.4s ease-in-out infinite; }
@keyframes slot { 0%, 100% { opacity: .35; } 50% { opacity: .9; } }
.flying-env { position: absolute; left: 0; top: 0; width: 110px; opacity: 0; pointer-events: none; z-index: 20; filter: drop-shadow(0 14px 16px rgba(0, 0, 0, .35)); }

/* ---------- Beats: the words ---------- */
.beat { position: absolute; z-index: 10; opacity: 0; pointer-events: none; }
.beat.live { pointer-events: auto; }
.beat-title { left: 0; right: 0; top: clamp(90px, 14vh, 150px); text-align: center; display: grid; justify-items: center; gap: 18px; padding: 0 var(--pad); }
.beat-left { left: var(--pad); bottom: clamp(48px, 11vh, 120px); width: min(580px, 40vw); display: grid; justify-items: start; gap: 18px; }
.beat-center { left: 0; right: 0; top: 50%; display: grid; justify-items: center; gap: 26px; text-align: center; padding: 0 var(--pad); }
.beat-dark { color: #FFF6EC; }
.kicker { font: 600 12px/1 var(--sans); letter-spacing: .18em; text-transform: uppercase; color: var(--terracotta); }
.beat-dark .kicker { color: var(--peach); }
.mega { font: 760 clamp(68px, 13vw, 232px)/.84 var(--display); letter-spacing: -.06em; font-variation-settings: "wdth" 86, "opsz" 96; color: var(--ink); }
.big { font: 680 clamp(40px, 5.2vw, 88px)/.94 var(--display); letter-spacing: -.045em; font-variation-settings: "wdth" 90, "opsz" 96; }
.big.accent { color: var(--terracotta); }
.lede { font: 500 clamp(17px, 1.5vw, 21px)/1.45 var(--sans); color: var(--ink-soft); max-width: 32ch; }
.sub { font: 500 clamp(16px, 1.25vw, 19px)/1.5 var(--sans); color: var(--ink-soft); max-width: 40ch; }
.beat-dark .sub { color: rgba(255, 246, 236, .78); }
.hint { display: inline-flex; align-items: center; gap: 10px; font: 600 13px var(--sans); color: var(--ink-soft); margin-top: 10px; }
.mouse { width: 18px; height: 28px; border-radius: 10px; border: 1.5px solid currentColor; display: grid; justify-items: center; padding-top: 5px; }
.mouse i { width: 2px; height: 6px; border-radius: 2px; background: currentColor; animation: wheel 1.6s ease-in-out infinite; }
@keyframes wheel { 0% { transform: translateY(0); opacity: 1; } 100% { transform: translateY(8px); opacity: 0; } }
.play { width: 14px; height: 14px; fill: currentColor; flex: none; }
.film-cta { pointer-events: auto; margin-top: 4px; }
.film-cta .play { width: 16px; height: 16px; }
.film-cta .dur { font-weight: 500; opacity: .55; margin-left: -2px; }
.split-w { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: .1em; margin-bottom: -.1em; }

/* The film */
html:has(.cinema[open]) { overflow: hidden; }
.cinema { position: fixed; inset: 0; width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: #0B0C12; display: grid; place-items: center; }
.cinema:not([open]) { display: none; }
.cinema::backdrop { background: #0B0C12; }
.cinema video { width: 100%; height: 100%; object-fit: contain; background: #0B0C12; }
.cinema-close { position: absolute; z-index: 2; top: max(18px, env(safe-area-inset-top)); right: var(--pad); background: rgba(255, 255, 255, .12); color: #FFF6EC; border-color: rgba(255, 255, 255, .16); }
.split-w > span { display: inline-block; will-change: transform; }

.tally { display: flex; align-items: baseline; gap: 10px; margin-top: 6px; font: 600 15px var(--sans); color: var(--ink-soft); }
.tally b { font: 760 56px/1 var(--display); letter-spacing: -.05em; color: var(--ink); min-width: 1ch; }
.log { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; width: min(420px, 100%); }
.log li {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 16px; background: var(--glass-strong);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); box-shadow: 0 14px 30px -18px rgba(34, 26, 20, .5); font: 500 14px/1.4 var(--sans);
}
.log li svg { flex: none; width: 18px; height: 18px; margin-top: 1px; }
.log li b { font-weight: 600; }

/* Approval card */
.approve {
  position: relative; width: min(430px, 92vw); text-align: left; padding: 24px 24px 18px; border-radius: 32px; background: var(--glass-strong);
  backdrop-filter: blur(20px) saturate(1.4); -webkit-backdrop-filter: blur(20px) saturate(1.4); box-shadow: 0 40px 80px -30px rgba(34, 26, 20, .55); border: 1px solid rgba(255, 255, 255, .6);
}
.approve-head { display: flex; align-items: center; gap: 8px; font: 600 14px var(--sans); margin-bottom: 16px; }
.approve-head img { border-radius: 7px; }
.approve-head span { margin-left: auto; color: var(--sage); font-size: 13px; }
.approve-title { font: 600 16px var(--sans); color: var(--ink-soft); }
.approve-amount { font: 760 clamp(48px, 5vw, 64px)/1 var(--display); letter-spacing: -.05em; margin: 4px 0 6px; }
.approve-meta { font: 500 14px var(--sans); color: var(--ink-soft); margin-bottom: 20px; }
.slider { position: relative; height: 60px; border-radius: 999px; background: rgba(34, 26, 20, .06); overflow: hidden; display: grid; place-items: center; user-select: none; touch-action: none; cursor: grab; }
.slider-fill { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--peach); border-radius: inherit; }
.slider-label { position: relative; font: 600 15px var(--sans); }
.slider-knob { position: absolute; left: 5px; top: 5px; width: 50px; height: 50px; border-radius: 50%; background: var(--ink); display: grid; place-items: center; box-shadow: 0 6px 14px rgba(34, 26, 20, .3); }
.slider-knob svg { width: 22px; height: 22px; fill: none; stroke: #FFF6EC; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.slider.snap .slider-knob, .slider.snap .slider-fill { transition: transform .45s cubic-bezier(.3, 1.4, .5, 1), width .45s cubic-bezier(.3, 1.4, .5, 1); }
.approve-done { padding: 8px 0 2px; font: 500 17px var(--sans); }
.approve-done b { font-weight: 700; }
.text-btn { margin-top: 6px; background: none; border: 0; padding: 0; color: var(--ink-soft); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font-size: 14px; }
.approve-foot { margin-top: 14px; font: 500 12px/1.45 var(--sans); color: var(--ink-soft); }
.seal { position: absolute; right: 18px; top: 60px; width: 92px; opacity: 0; pointer-events: none; filter: drop-shadow(0 10px 12px rgba(0, 0, 0, .3)); }

/* Post form */
.post { display: flex; gap: 8px; width: min(480px, 100%); margin-top: 6px; }
.post input {
  flex: 1; min-width: 0; height: 56px; padding: 0 22px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .22);
  background: rgba(255, 255, 255, .12); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); color: #FFF6EC; font-size: 16px;
}
.post input::placeholder { color: rgba(255, 246, 236, .55); }
.post input:focus { outline: none; border-color: var(--peach); box-shadow: 0 0 0 4px rgba(235, 193, 163, .25); }
.post-note { font: 500 13px var(--sans); color: rgba(255, 246, 236, .65); }
.post.done { display: none; }
.post.done + .post-note { font: 680 clamp(24px, 2.4vw, 34px)/1.15 var(--display); letter-spacing: -.03em; color: #FFF6EC; }

/* Progress line */
.progress { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; z-index: 30; background: rgba(34, 26, 20, .08); }
.progress i { display: block; height: 100%; width: 100%; background: var(--terracotta); transform-origin: 0 50%; transform: scaleX(0); }

/* Footer */
.foot { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 28px; padding: 34px var(--pad) max(34px, env(safe-area-inset-bottom)); background: var(--night); color: rgba(255, 246, 236, .7); font: 500 14px var(--sans); }
.foot .logo { color: #FFF6EC; font-size: 22px; }
.foot nav { display: flex; gap: 22px; margin-left: auto; flex-wrap: wrap; }
.foot a { text-decoration: none; }
.foot a:hover { color: #FFF6EC; }
.foot-note { flex-basis: 100%; max-width: 72ch; margin: 0; font: 400 13px/1.55 var(--sans); }
.foot-note a { text-decoration: underline; text-underline-offset: 2px; }

/* ---------- Phones ---------- */
@media (max-width: 760px) {
  .chapters { display: none; }
  .hud .chip[data-sound] span:last-child { display: none; }
  .hud .chip[data-sound] { padding: 0 14px; }
  .hud .chip[data-film-open] span { display: none; }
  .hud .chip[data-film-open] { padding: 0 15px; }
  .beat-title { top: 96px; gap: 14px; }
  .mega { font-size: clamp(58px, 18vw, 96px); }
  .big { font-size: clamp(34px, 10vw, 52px); }
  .beat-left { left: var(--pad); right: var(--pad); width: auto; bottom: max(28px, env(safe-area-inset-bottom)); gap: 12px; }
  .vignette-light { background: linear-gradient(0deg, rgba(246, 236, 223, .95) 0%, rgba(246, 236, 223, .8) 30%, rgba(246, 236, 223, 0) 58%); }
  .vignette-dark { background: linear-gradient(0deg, rgba(14, 16, 28, .92) 0%, rgba(14, 16, 28, .7) 34%, rgba(14, 16, 28, 0) 62%); }
  .bubble { left: 48%; top: 12%; font-size: 13px; max-width: 14em; }
  .pebble { width: 8.4%; }
  .pebble-tag { font-size: 10px; padding: 5px 8px; }
  .env { width: 7%; }
  .env figcaption { display: none; }
  .log { display: none; }
  .tally b { font-size: 40px; }
  .approve { padding: 20px 18px 16px; }
  .seal { width: 72px; }
  .post { flex-direction: column; }
  .post .chip { justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  .osbert-body, .stars i, .mouse i, .slot.on { animation: none; }
}
