:root { --ease: cubic-bezier(0.2, 0.8, 0.2, 1); --s: 1; }
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  min-height: 100vh; color: #2a2118; font-family: Newsreader, Georgia, serif; -webkit-font-smoothing: antialiased;
  background: radial-gradient(1400px 850px at 50% -8%, #f7efdf 0%, #ede6da 55%, #e8e0d3 100%) no-repeat, #e8e0d3;
}
body::after {
  content: ""; position: fixed; inset: 0; z-index: 1; pointer-events: none; opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

.top { display: flex; justify-content: space-between; align-items: baseline; padding: 26px 36px; font-family: "Inter Tight", sans-serif; font-size: 14px; }
.top b { font-weight: 800; letter-spacing: -0.02em; font-size: 17px; }
.top a { opacity: 0.6; transition: opacity 0.2s; }
.top a:hover { opacity: 1; }

.title { text-align: center; padding: 36px 20px 10px; }
.title h1 { font-weight: 400; font-size: clamp(40px, 6vw, 72px); letter-spacing: -0.025em; line-height: 1; }
.title h1 em { font-style: italic; }
.title p { margin-top: 14px; font-size: 18px; opacity: 0.6; font-style: italic; }

/* Shelves */
.case { max-width: 1160px; margin: 40px auto 90px; padding: 0 24px; }
.unit + .unit { margin-top: 64px; }
.row { display: flex; align-items: flex-end; gap: 3px; padding: 60px 20px 0; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.row::-webkit-scrollbar { display: none; }
.row > :first-child { margin-left: auto; }
.row > :last-child { margin-right: auto; }
.plank { position: relative; height: 22px; border-radius: 2px; background: linear-gradient(180deg, #8a6444 0, #6b4a30 30%, #4b321f 100%); box-shadow: inset 0 1px 0 rgba(255, 230, 200, 0.3), 0 22px 30px -10px rgba(60, 35, 15, 0.45); }
.plank span { position: absolute; left: 50%; top: 5px; transform: translateX(-50%); padding: 1px 10px; background: linear-gradient(#ecd49d, #b8924f); color: #3a2a12; font-family: "Inter Tight", sans-serif; font-size: 9px; font-weight: 700; letter-spacing: 0.2em; text-transform: uppercase; white-space: nowrap; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4); }

.spine {
  position: relative; flex: 0 0 auto; width: calc(var(--w) * var(--s) * 1px); height: calc(var(--h) * var(--s) * 1px);
  background: var(--bg); color: var(--ink); border-radius: 2px 2px 0 0;
  display: flex; flex-direction: column; align-items: center; justify-content: space-between; padding: 12px 0 10px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12), 1px 0 2px rgba(45, 28, 12, 0.28), -1px 0 2px rgba(45, 28, 12, 0.14);
  transition: transform 0.45s var(--ease), opacity 0.4s;
}
.spine::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: linear-gradient(90deg, rgba(0, 0, 0, 0.28), rgba(255, 255, 255, 0.16) 18%, transparent 45%, rgba(0, 0, 0, 0.08) 75%, rgba(0, 0, 0, 0.32)); pointer-events: none; }
.spine:hover, .spine:focus-visible { transform: translateY(-16px); outline: none; }
.spine.out { transform: translateY(-70px); opacity: 0; }
.spine .t { flex: 1; min-height: 0; writing-mode: vertical-rl; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: center; font-size: calc(var(--fs) * var(--s) * 1px); line-height: 1; }

/* Books: cloth spines coloured from the real cover */
.spine.book .t { text-transform: uppercase; letter-spacing: 0.12em; }
.spine.book .a { font-size: calc(10px * var(--s)); opacity: 0.75; writing-mode: vertical-rl; white-space: nowrap; margin-top: 10px; }
.spine.book .band { width: 100%; height: 6px; border-top: 1px solid currentColor; border-bottom: 1px solid currentColor; opacity: 0.35; }

/* Documents: archival binders with a paper label */
.spine.doc { padding: 10px 0 12px; gap: 8px; }
.spine.doc .yr { font-family: "Inter Tight", sans-serif; font-size: calc(9px * var(--s)); font-weight: 700; letter-spacing: 0.04em; opacity: 0.8; }
.spine.doc .label { flex: 1; min-height: 0; width: 72%; display: flex; justify-content: center; padding: 8px 0; background: #f5f0e4; color: #2a2118; border-radius: 1px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1), 0 1px 0 rgba(255, 255, 255, 0.2); }
.spine.doc .t { font-family: "Inter Tight", sans-serif; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.spine.doc .hole { width: 46%; aspect-ratio: 1; border-radius: 50%; background: rgba(0, 0, 0, 0.35); box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.55), 0 1px 0 rgba(255, 255, 255, 0.15); }

/* Bookend: knock it and the books topple like dominoes */
.bookend { position: relative; flex: 0 0 auto; width: 12px; height: 130px; margin-left: 8px; border-radius: 2px 2px 0 0; background: linear-gradient(90deg, #3a3a3a, #8a8a8a 45%, #3a3a3a); cursor: pointer; transform-origin: 50% 100%; }
.bookend::before { content: ""; position: absolute; inset: -10px -10px 0; }
.bookend.knock { animation: knock 0.5s ease; }
@keyframes knock { 30% { transform: rotate(-12deg); } 60% { transform: rotate(4deg); } }
.spine.domino { animation: lean 0.9s var(--d) cubic-bezier(0.3, 0.7, 0.4, 1) both; transform-origin: 0% 100%; }
@keyframes lean { 35% { transform: rotate(-7deg); } 65% { transform: rotate(1.5deg); } }

/* Plant: water it until it blooms */
.plant { position: relative; flex: 0 0 auto; width: 70px; height: 130px; margin-right: 18px; zoom: var(--s); cursor: pointer; -webkit-tap-highlight-color: transparent; }
.plant .pot { position: absolute; bottom: 0; left: 12px; width: 46px; height: 44px; border-radius: 3px 3px 10px 10px; background: linear-gradient(90deg, #b8643f, #d98a5f 40%, #a4552f); }
.plant .pot::before { content: ""; position: absolute; top: 0; left: -3px; right: -3px; height: 8px; border-radius: 2px; background: linear-gradient(90deg, #a9583a, #cf7f55 40%, #99502d); }
.plant .leaves { position: absolute; left: 0; bottom: 38px; width: 70px; height: 92px; transform-origin: 50% 100%; transition: transform 0.6s cubic-bezier(0.3, 1.6, 0.5, 1); }
.plant[data-stage="1"] .leaves { transform: scale(1.05); }
.plant[data-stage="2"] .leaves { transform: scale(1.1); }
.plant[data-stage="3"] .leaves { transform: scale(1.15); }
.plant[data-stage="4"] .leaves { transform: scale(1.18); }
.lf { position: absolute; bottom: 0; border-radius: 50%; transform-origin: 50% 100%; rotate: var(--r); transition: rotate 0.5s var(--ease), filter 0.5s; }
.l1 { --r: -14deg; left: 6px; width: 28px; height: 66px; background: linear-gradient(90deg, rgba(0, 0, 0, 0.1), transparent 55%), #5c7a3e; }
.l2 { --r: 0deg; left: 21px; width: 28px; height: 84px; background: linear-gradient(90deg, rgba(0, 0, 0, 0.1), transparent 55%), #6d8f49; }
.l3 { --r: 14deg; left: 37px; width: 26px; height: 62px; background: linear-gradient(90deg, rgba(0, 0, 0, 0.1), transparent 55%), #4f6d33; }
.plant:hover .lf { animation: sway 1.4s ease-in-out infinite; }
.plant.rustle .lf { animation: rustle 0.6s ease; }
@keyframes sway { 50% { rotate: calc(var(--r) + 3deg); } }
@keyframes rustle { 25% { rotate: calc(var(--r) - 7deg); } 50% { rotate: calc(var(--r) + 6deg); } 75% { rotate: calc(var(--r) - 3deg); } }
.plant.droop .lf { animation: none; filter: saturate(0.55) brightness(0.92); }
.plant.droop .l1 { rotate: -40deg; }
.plant.droop .l2 { rotate: 10deg; }
.plant.droop .l3 { rotate: 40deg; }

.flower { position: absolute; left: 35px; top: -14px; }
.flower::before { content: ""; position: absolute; left: -1.5px; top: 2px; width: 3px; height: 22px; border-radius: 2px; background: #4f6d33; transform-origin: 50% 100%; transform: scaleY(0); transition: transform 0.4s 0.1s var(--ease); }
.flower i { position: absolute; left: -6px; top: -6px; width: 12px; height: 12px; border-radius: 50%; background: #f4c542; transform: scale(0) rotate(-90deg); transition: transform 0.7s 0.35s cubic-bezier(0.3, 1.8, 0.5, 1);
  box-shadow: 0 -9px 0 -1px #f28cae, 0 9px 0 -1px #f28cae, 9px 0 0 -1px #f28cae, -9px 0 0 -1px #f28cae, 6px 6px 0 -1px #f5a3bf, -6px 6px 0 -1px #f5a3bf, 6px -6px 0 -1px #f5a3bf, -6px -6px 0 -1px #f5a3bf; }
.plant[data-stage="4"] .flower::before { transform: scaleY(1); }
.plant[data-stage="4"] .flower i { transform: scale(1) rotate(0deg); }

.drop { position: absolute; top: -30px; width: 6px; height: 9px; border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%; background: #7ec3ef; opacity: 0; pointer-events: none; animation: drip 0.7s ease-in both; }
@keyframes drip { 0% { opacity: 0; transform: translateY(-10px); } 15%, 85% { opacity: 1; } 100% { opacity: 0; transform: translateY(95px); } }
.petal { position: absolute; left: 32px; top: -16px; width: 7px; height: 7px; border-radius: 60% 0; background: #f28cae; opacity: 0; pointer-events: none; animation: petal 1.1s ease-out both; }
@keyframes petal { 20% { opacity: 1; } 100% { opacity: 0; transform: translate(var(--x), calc(var(--y) + 40px)) rotate(220deg); } }

.plant .bubble { position: absolute; bottom: calc(100% + 46px); left: 50%; z-index: 2; padding: 6px 10px; border-radius: 10px; background: #2a2118; color: #f4ecdd; font: 600 12px/1.2 "Inter Tight", sans-serif; white-space: nowrap; pointer-events: none; opacity: 0; transform: translate(-50%, 6px) scale(0.9); transition: opacity 0.25s, transform 0.25s var(--ease); }
.plant .bubble::after { content: ""; position: absolute; top: 100%; left: 50%; margin-left: -5px; border: 5px solid transparent; border-top-color: #2a2118; }
.plant .bubble.on { opacity: 1; transform: translate(-50%, 0) scale(1); }

/* Hover preview */
.tip { position: fixed; z-index: 30; pointer-events: none; display: flex; gap: 12px; align-items: center; max-width: 320px; padding: 10px 14px 10px 10px; border-radius: 8px; background: #2a2118; color: #f4ecdd; font-family: "Inter Tight", sans-serif; box-shadow: 0 18px 40px -12px rgba(0, 0, 0, 0.5); transform: translate(-50%, calc(-100% - 12px)) scale(0.96); opacity: 0; transition: opacity 0.18s, transform 0.18s var(--ease); }
.tip.on { opacity: 1; transform: translate(-50%, calc(-100% - 12px)); }
.tip img { width: 52px; max-height: 76px; object-fit: cover; border-radius: 2px; flex: 0 0 auto; }
.tip b { display: block; font-size: 14px; font-weight: 600; line-height: 1.25; }
.tip span { display: block; margin-top: 3px; font-size: 12px; opacity: 0.65; }

/* Viewer */
.viewer { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; }
.viewer[hidden] { display: none; }
.scrim { position: absolute; inset: 0; background: rgba(35, 25, 15, 0.6); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); animation: fade 0.35s both; }
@keyframes fade { from { opacity: 0; } }
.stage { position: relative; display: flex; flex-direction: column; align-items: center; pointer-events: none; }
.flip { perspective: 1600px; pointer-events: auto; cursor: pointer; display: block; }
.b3 { position: relative; width: var(--w); height: var(--h); transform-style: preserve-3d; transform: rotateY(90deg) translateY(40px); transition: transform 1s var(--ease); }
.b3.in { transform: rotateY(-8deg); }
.flip:hover .b3.in { transform: rotateY(0deg) scale(1.02); }
.b3 > div { position: absolute; }
.b3 .fr { inset: 0; transform: translateZ(calc(var(--t) / 2)); box-shadow: 0 40px 80px -30px rgba(0, 0, 0, 0.6); }
.b3 .fr img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 1px 4px 4px 1px; }
.b3 .sp { left: 0; top: 0; height: 100%; width: var(--t); transform: translateX(calc(var(--t) / -2)) rotateY(-90deg); background: linear-gradient(90deg, rgba(0, 0, 0, 0.3), rgba(255, 255, 255, 0.14) 50%, rgba(0, 0, 0, 0.25)), var(--bg); color: var(--ink); display: flex; align-items: center; justify-content: center; }
.b3 .sp span { writing-mode: vertical-rl; white-space: nowrap; font-size: calc(var(--t) * 0.36); text-transform: uppercase; letter-spacing: 0.1em; max-height: 90%; overflow: hidden; }
.b3 .pg { top: 1%; height: 98%; left: calc(100% - var(--t)); width: var(--t); transform: translateX(calc(var(--t) / 2)) rotateY(90deg); background: repeating-linear-gradient(90deg, #f5f0e4 0 1px, #d8d0bf 1px 2px); }

.label-card { margin-top: 32px; text-align: center; color: #fbf5ea; opacity: 0; transform: translateY(10px); transition: 0.6s 0.45s var(--ease); pointer-events: auto; max-width: min(560px, 90vw); }
.viewer.open .label-card { opacity: 1; transform: none; }
.label-card h2 { font-weight: 400; font-size: clamp(24px, 3vw, 32px); letter-spacing: -0.015em; line-height: 1.15; }
.label-card p { margin-top: 6px; font-size: 17px; opacity: 0.8; font-style: italic; }
.label-card small { display: block; margin-top: 4px; font-family: "Inter Tight", sans-serif; font-size: 12px; letter-spacing: 0.02em; opacity: 0.55; }
.cta { display: inline-flex; align-items: center; gap: 8px; margin-top: 18px; padding: 11px 22px; border-radius: 999px; background: #fbf5ea; color: #2a2118; font-family: "Inter Tight", sans-serif; font-size: 15px; font-weight: 600; transition: background 0.2s, transform 0.2s var(--ease); }
.cta:hover { background: #fff; transform: translateY(-1px); }
.close { position: absolute; top: 20px; right: 24px; z-index: 2; color: #fbf5ea; font-family: "Inter Tight", sans-serif; font-size: 14px; opacity: 0.8; }
.close:hover { opacity: 1; }
.nav { position: absolute; top: 50%; z-index: 2; width: 44px; height: 44px; margin-top: -22px; border-radius: 50%; color: #fbf5ea; font-size: 26px; line-height: 1; background: rgba(255, 255, 255, 0.08); transition: background 0.2s; }
.nav:hover { background: rgba(255, 255, 255, 0.18); }
.prev { left: 24px; }
.next { right: 24px; }

@media (max-width: 800px) {
  :root { --s: 0.72; }
  .top { padding: 20px; }
  .plant { margin-right: 10px; }
  .row { padding-top: 40px; }
  .unit + .unit { margin-top: 44px; }
  .nav { top: auto; bottom: 20px; margin-top: 0; }
  .tip { display: none; }
}
