/* REM sleep. Everything scoped under .rm-*. */

.rm-sc { position: relative; width: 100%; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.rm-hero img { display: block; width: 230px; max-width: 100%; max-height: 30vh; object-fit: contain; margin: 0 auto; filter: drop-shadow(0 16px 26px rgba(123, 92, 253, .3)); }
.rm-hero.small img { width: 170px; max-height: 22vh; }

/* the close-up of closed eyes */
.rm-close { width: 100%; max-width: 320px; }
.rm-close svg { display: block; width: 100%; height: auto; }
.rm-skin { fill: #E9B892; }
.rm-lidf { fill: #DDA67E; }
.rm-bulge { fill: #F6CDA9; transition: transform .07s ease-out; transform-box: fill-box; }
.rm-lash { fill: none; stroke: #4A2C1C; stroke-width: 3; stroke-linecap: round; }

/* the sleep lab */
.rm-lab { position: relative; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; width: 100%; max-width: 350px; }
.rm-bed { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 76px 4px 8px; border-radius: 16px; background: var(--raised); border: 1.5px solid var(--line); color: var(--text); font: inherit; cursor: pointer; min-height: 44px; }
.rm-bed b { font: 700 14px var(--sans); }
.rm-head { width: 100%; max-width: 104px; height: auto; display: block; }
.rm-pil { fill: #C9CCE6; }
.rm-face { fill: #E9B892; }
.rm-hair { fill: #5A3A26; }
.rm-cl { fill: none; stroke: #4A2C1C; stroke-width: 2; stroke-linecap: round; }
.rm-head .rm-bulge { fill: #C98E66; }
.rm-open { display: none; }
.rm-open circle { fill: #fff; stroke: #4A2C1C; stroke-width: 1.5; }
.rm-bed.woke .rm-shut { display: none; }
.rm-bed.woke .rm-open { display: inline; }
.rm-pl { font: 700 12px var(--sans); color: var(--dim); margin-top: 2px; }
.rm-pen { width: 84px; height: 22px; display: block; }
.rm-pen path { fill: none; stroke: var(--dim); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.rm-bed.dart .rm-pen path { stroke: var(--violet-bright); }
.rm-say { position: absolute; left: 4px; right: 4px; top: 6px; height: 64px; display: flex; align-items: flex-end; justify-content: center; padding: 6px 7px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); font: 600 12px/1.25 var(--sans); color: var(--dim); text-align: center; opacity: 0; transform: translateY(6px); transition: opacity .3s, transform .3s; }
.rm-say.on { opacity: 1; transform: none; }
.rm-bed.dream .rm-say { color: var(--text); border-color: var(--gold); background: rgba(252, 192, 80, .12); }

/* brain on, body locked */
.rm-meters { display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: 320px; }
.rm-m { display: grid; grid-template-columns: 70px 1fr; grid-template-rows: auto auto; column-gap: 10px; align-items: center; }
.rm-m span { font: 700 14px var(--sans); color: var(--text); grid-row: span 2; }
.rm-mt { height: 12px; border-radius: 6px; background: rgba(255, 255, 255, .06); overflow: hidden; }
.rm-mt i { display: block; height: 100%; width: 0; border-radius: 6px; transition: width 1s cubic-bezier(.2, .8, .2, 1); }
.rm-mt i.brain { background: var(--violet-bright); }
.rm-mt i.mus { background: var(--dim); }
.rm-meters.on i.brain { width: 92%; }
.rm-meters.on i.mus { width: 4%; }
.rm-m b { font: 600 13px var(--sans); color: var(--dim); margin-top: 3px; }

/* the cat and the lock */
.rm-cat { display: flex; flex-direction: column; align-items: center; gap: 12px; width: 100%; max-width: 330px; }
.rm-pad { position: relative; width: 100%; height: 200px; border-radius: 18px; background: radial-gradient(ellipse at 50% 85%, rgba(123, 92, 253, .22), transparent 70%); overflow: hidden; }
.rm-pad img { position: absolute; left: 50%; bottom: 10px; height: 160px; width: auto; transform: translateX(-50%); transition: opacity .5s, transform 1.6s cubic-bezier(.4, .1, .3, 1); filter: drop-shadow(0 10px 18px rgba(0, 0, 0, .5)); }
.rm-c2 { opacity: 0; }
.rm-cat.up .rm-c1 { opacity: 0; }
.rm-cat.up .rm-c2 { opacity: 1; transform: translateX(-85%); }
.rm-cat.pounce .rm-c2 { transform: translate(-25%, -26px) rotate(-6deg); transition: transform .35s cubic-bezier(.3, 1.6, .5, 1); }
.rm-tag { position: absolute; top: 10px; left: 10px; padding: 4px 10px; border-radius: 99px; background: rgba(123, 92, 253, .22); color: var(--violet-bright); font: 700 12px var(--sans); white-space: nowrap; }
.rm-lock { display: flex; align-items: center; gap: 10px; padding: 8px 18px 8px 12px; min-height: 56px; border-radius: 16px; background: var(--raised); border: 1.5px solid var(--line-strong); color: var(--text); font: 700 15px var(--sans); cursor: pointer; }
.rm-lock svg { width: 30px; height: 36px; }
.rm-lock svg rect, .rm-lk svg rect { fill: var(--gold); }
.rm-lock .rm-sh, .rm-lk .rm-sh { fill: none; stroke: var(--gold); stroke-width: 5; stroke-linecap: round; }
.rm-lock.open { border-color: var(--gold); }

/* waking up: a hand that won't move */
.rm-wake { position: relative; width: 100%; max-width: 330px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.rm-clock { font: 700 30px var(--mono); color: var(--violet-bright); letter-spacing: 1px; text-shadow: 0 0 14px rgba(169, 155, 255, .5); }
.rm-sheet { position: relative; width: 100%; height: 150px; display: flex; align-items: center; justify-content: center; }
.rm-hand { width: 200px; height: auto; display: block; transform-origin: 70% 60%; filter: drop-shadow(0 10px 16px rgba(0, 0, 0, .45)); }
.rm-lk { position: absolute; right: 18px; top: 14px; width: 30px; }
.rm-lk svg { width: 30px; height: 36px; display: block; }
.rm-wake.try .rm-hand { animation: rm-strain .9s linear; }
@keyframes rm-strain { 0%, 100% { transform: none; } 20%, 60% { transform: translate(1px, 0); } 40%, 80% { transform: translate(-1px, 0); } }
.rm-wake.free .rm-hand { animation: rm-wiggle .9s ease-in-out; }
@keyframes rm-wiggle { 0%, 100% { transform: none; } 25% { transform: rotate(-5deg) translateY(-6px); } 60% { transform: rotate(3deg); } }

@media (max-height: 700px) {
  .rm-hero img { max-height: 24vh; }
  .rm-hero.small img { max-height: 17vh; }
  .rm-pad { height: 168px; }
  .rm-pad img { height: 136px; }
  .rm-sheet { height: 124px; }
  .rm-hand { width: 168px; }
}
