:root {
  --ink: #26201b;
  --paper: #fbf7ee;
  --tape: #efe3c0;
  --sans: "Nunito", system-ui, sans-serif;
  --display: "Unbounded", sans-serif;
  --heading: #3A4048;
  --ink-soft: #545B63;
  --marker: "Permanent Marker", "Comic Sans MS", cursive;
  --ratio: 1.735; /* view width / height, kept in sync by app.js */
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #e9e4da; color: var(--ink); font-family: var(--sans); font-weight: 300; line-height: 1.6; -webkit-font-smoothing: antialiased; overflow: hidden; }

/* ---------- the shelf, framed by an off-white border ---------- */
:root { --mat: 0px; --paper-frame: #C2B6A3;  /* sampled from the wall behind the shelves */ }
html, body { background: var(--paper-frame); }
.scroller { position: fixed; inset: var(--mat); overflow: hidden; }
#shelf { display: block; width: 100%; height: 100%; user-select: none; -webkit-user-select: none; }
/* tall screens (phones): keep the whole shelf height and pan sideways inside the frame */
.pan .scroller { overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.pan .scroller::-webkit-scrollbar { display: none; }
.pan #shelf { width: calc((100vh - 2 * var(--mat)) * var(--ratio)); }
@supports (height: 100dvh) { .pan #shelf { width: calc((100dvh - 2 * var(--mat)) * var(--ratio)); } }

.dim { fill: #120c06; opacity: 0; transition: opacity .25s; pointer-events: none; }
.focus .dim { opacity: .45; }
.focus .spot.art:not(.on) { opacity: .5; transition: opacity .15s; } /* other objects dim with the shelf */
.spot { cursor: pointer; outline: none; }
.spot .cut { opacity: 0; transition: transform .22s cubic-bezier(.3,1.5,.5,1), opacity .15s; transform-box: fill-box; transform-origin: 50% 100%; filter: drop-shadow(0 10px 8px rgba(0,0,0,.45)) drop-shadow(0 0 14px rgba(255,236,190,.55)); pointer-events: none; }
.spot.on .cut { opacity: 1; transform: translateY(-9px) scale(1.04); }
.spot.flat.on .cut { transform: none; filter: brightness(1.1) drop-shadow(0 0 16px rgba(255,236,190,.8)); }
.spot .hit { fill: transparent; stroke: transparent; stroke-width: 6; pointer-events: all; }
.spot:focus-visible .hit { stroke: #ffd36b; stroke-dasharray: 10 8; }
.tape { pointer-events: none; transition: opacity .2s; }
.tape rect { fill: var(--tape); opacity: .94; filter: drop-shadow(0 1px 1px rgba(0,0,0,.35)); }
.tape text { font: 500 17px var(--sans); fill: #2b241d; }
.focus .tape { opacity: .3; }
.focus .tape.on { opacity: 1; }

/* ---------- title badge ---------- */
.badge {
  position: fixed; z-index: 5;
  left: max(16px, env(safe-area-inset-left)); top: max(16px, env(safe-area-inset-top));
  padding: 10px 14px 11px;
  background: rgba(38, 40, 43, .92);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  border-radius: 6px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .28);
  pointer-events: none;
  max-width: calc(100vw - 32px);
}
.badge h1 { margin: 0; font-family: var(--display); font-weight: 700; color: #F4F1EA; font-size: 1.375rem; letter-spacing: -.01em; line-height: 1.05; }
.badge p { margin: 6px 0 0; font-size: .9375rem; line-height: 1.5; color: rgba(244, 241, 234, .78); }

/* ---------- app preview ---------- */
.preview {
  position: fixed; z-index: 10; left: 0; top: 0;
  width: 340px; max-width: calc(100vw - 24px);
  background: var(--paper);
  border-radius: 10px;
  box-shadow: 0 18px 40px rgba(20, 12, 4, .4), 0 2px 6px rgba(20, 12, 4, .2);
  overflow: hidden;
  animation: pop .18s ease-out;
}
.preview[hidden] { display: none; }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.screen { position: relative; width: 100%; aspect-ratio: 16 / 10; background: #ddd6c8; overflow: hidden; border-bottom: 1px solid #e3dccd; }
.screen iframe { position: absolute; left: 0; top: 0; width: 1280px; height: 800px; border: 0; transform-origin: 0 0; pointer-events: none; background: #fff; }
.soon { position: absolute; inset: 0; display: grid; place-items: center; font: 400 .9375rem var(--sans); color: var(--ink-soft); background: repeating-linear-gradient(-45deg, #e7e0d2 0 14px, #e1d9ca 14px 28px); }
.soon[hidden] { display: none; }
.soon::after { content: "Coming soon"; }
.meta { padding: 12px 14px 14px; }
.meta h2 { margin: 0 0 4px; font-family: var(--display); font-weight: 700; color: var(--heading); font-size: 1.0625rem; letter-spacing: -.01em; line-height: 1.15; }
.meta p { margin: 0 0 10px; font-size: .9375rem; line-height: 1.5; color: var(--ink-soft); }
.go { font-size: .9375rem; font-weight: 500; color: var(--ink); text-decoration: none; }
.go:hover { text-decoration: underline; }
.go[aria-disabled="true"] { color: #9b9184; pointer-events: none; }

/* screen-reader / keyboard list of every app */
.index { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.index a:focus { position: fixed; left: 16px; bottom: 16px; width: auto; height: auto; padding: 8px 12px; background: var(--paper); clip-path: none; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
.nolabels .tape { display: none; }

/* 3D illustrated objects (shelf/art/) sit on the photo all the time */
.spot.art .cut { opacity: 1; filter: none; }
/* hover: a smooth 10% zoom, staying seated on the shelf */
.spot.art .cut { transition: transform .25s ease-out, opacity .15s; }
.spot.art.on .cut { transform: scale(1.1); }
.spot.art .art-shadow { transition: transform .25s ease-out; }
.spot.art.on .art-shadow { transform: scale(1.1); }
.noscreen .screen { display: none; }
.nolink .go { display: none; }
.nolink .meta p { margin-bottom: 0; }
/* text-only card hugs the title; the note and link wrap to that width */
.noscreen .preview { width: max-content; min-width: 236px; max-width: min(400px, calc(100vw - 24px)); cursor: pointer; }
.noscreen .meta h2 { text-wrap: balance; }
.noscreen .meta p { width: 0; min-width: 100%; }
.noscreen .meta { padding: 12px 16px 14px; }
/* hover card: dark like the title card */
.preview { background: rgb(38, 40, 43); box-shadow: 0 18px 40px rgba(0,0,0,.4), 0 2px 6px rgba(0,0,0,.25); }
.preview .meta h2 { color: #F4F1EA; }
.preview .meta p { color: rgba(244,241,234,.78); }
.preview .go { color: #F4F1EA; }
/* tone down the shelf photo a touch (photo only, not the 3D objects or cards) */
.photo { filter: brightness(.85) contrast(1.06) saturate(1.06); }

/* 3D objects: a squishy jello bounce every few seconds (pauses on hover) */
.spot.bounce .cut { animation: jello 8s cubic-bezier(.3,.7,.4,1) 1.2s infinite; }
.spot.bounce.on .cut, .spot.bounce.on .art-shadow { animation: none; }
.art-shadow { fill: rgba(20, 12, 4, .38); filter: blur(4px); pointer-events: none; transform-box: fill-box; transform-origin: 50% 50%; }
.spot.bounce .art-shadow { animation: jello-shadow 8s cubic-bezier(.3,.7,.4,1) 1.2s infinite; }
@keyframes jello-shadow {
  0%, 22.5%, 100% { transform: scale(1); opacity: 1; }
  2.2% { transform: scale(1.04, 1); opacity: 1; }
  5.6% { transform: scale(.9); opacity: .8; }
  8.4% { transform: scale(.88); opacity: .78; }
  11.8% { transform: scale(1.06, 1); opacity: 1; }
  14.6% { transform: scale(.97, 1); }
}
@keyframes jello {
  0%, 22.5%, 100% { transform: translateY(0) scale(1, 1); }
  2.2% { transform: translateY(0) scale(1.042, 0.946); }
  5.6% { transform: translateY(-6px) scale(0.964, 1.048); }
  8.4% { transform: translateY(-7px) scale(1, 1); }
  11.8% { transform: translateY(0) scale(1.054, 0.94); }
  14.6% { transform: translateY(0) scale(0.976, 1.03); }
  17.4% { transform: translateY(0) scale(1.018, 0.988); }
  20.2% { transform: translateY(0) scale(0.994, 1.006); }
}

/* tube amp: the glowing tubes flicker every few seconds */
.spot.flicker .glow { animation: flicker 6s linear 2s infinite; }
@keyframes flicker {
  0%, 60%, 100% { opacity: 1; }
  61%   { opacity: .35; }
  62.2% { opacity: .9; }
  63.4% { opacity: .15; }
  64.8% { opacity: 1; }
  66.5% { opacity: .55; }
  68%   { opacity: 1; }
}

/* pencil cup: a drop of wet paint gathers on the brush, falls and splats on the shelf */
.drip ellipse { fill: var(--paint); opacity: 0; pointer-events: none; transform-box: fill-box; }
.drip .drop { transform-origin: 50% 0; animation: drop 7s cubic-bezier(.55,0,1,.45) 2s infinite; }
.drip .splat { transform-origin: 50% 50%; animation: splat 7s ease-out 2s infinite; }
.spot.on .drip { visibility: hidden; }
@keyframes drop {
  0% { opacity: 0; transform: translateY(0) scale(.2); }
  8% { opacity: .95; transform: translateY(0) scale(.6); }
  34% { opacity: .95; transform: translateY(1px) scale(1, 1.25); animation-timing-function: cubic-bezier(.55,0,1,.45); }
  44% { opacity: .95; transform: translateY(var(--fall)) scale(.85, 1.3); }
  45%, 100% { opacity: 0; transform: translateY(var(--fall)) scale(.4); }
}
@keyframes splat {
  0%, 44% { opacity: 0; transform: scale(.2, .5); }
  47% { opacity: .9; transform: scale(1.1, 1); }
  52% { transform: scale(1); }
  80% { opacity: .85; transform: scale(1); }
  100% { opacity: 0; transform: scale(1); }
}
/* message in a bottle: a gentle rock every few seconds */
.spot.rock .cut { animation: rock 7s ease-in-out 3s infinite; }
.spot.rock.on .cut { animation: none; }
/* soft warm glow so the objects stand out from the photo (Casey's pick) */
.spot.art .cut:not(.glow) { filter: drop-shadow(0 0 5px rgba(255,236,200,.55)) drop-shadow(0 0 14px rgba(255,228,180,.35)); }
/* bottle art brightened a touch (Casey) */
.spot.rock .cut { filter: brightness(1.05) saturate(1.08) drop-shadow(0 0 5px rgba(255,236,200,.55)) drop-shadow(0 0 14px rgba(255,228,180,.35)); }
@keyframes rock {
  0%, 30%, 100% { transform: rotate(0deg); }
  6%  { transform: rotate(-3deg); }
  13% { transform: rotate(2.2deg); }
  19% { transform: rotate(-1.2deg); }
  25% { transform: rotate(.5deg); }
}
