/* Japan A to Z: the shelf. Same family as Mofu Mofu Shrine (tokens from its css/base.css).
   Every size and position below that depends on the window is set by js/layout.js as a CSS variable
   or an inline left/top/width/height; this file only says how things look and move. */
:root {
  --ink: #4a4560;
  --ink-soft: #857ea3;
  --paper: #fffdf8;
  --lilac: #cfc4ff;
  --lilac-deep: #b3a5f2;
  --logo: #7466c2;
  --coral: #ffd6c8;
  --coral-mid: #ffb9a8;
  --coral-deep: #eaa08c;
  --coral-ink: #8a4433;
  --mint: #d4f3e6;
  --mint-deep: #a9e2cb;
  --straw: #f3dfa6;
  --gold: #f6cf63;
  --plank: #ddd5ff;
  --plank-hi: #eeeaff;
  --letter: #6f60b8;            /* locked letters: deep lilac, readable on the lilac plank */
  --title: #e58a76;             /* the title and unlocked letters: warm coral, so they stand apart from the lilac planks */
  --font: 'Fredoka', 'Arial Rounded MT Bold', 'Trebuchet MS', system-ui, sans-serif;
  /* set by layout.js */
  --m: 16px; --ts: 30px; --btn: 44px; --pill: 36px; --b: 36px; --fs: 28px; --foot: 46px;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
html { overflow: hidden; }
body {
  position: fixed; inset: 0;
  font-family: var(--font); font-weight: 500; color: var(--ink);
  background: linear-gradient(180deg, #eaf7f0 0%, #f3faf2 55%, #fdf7ea 100%) #eef8f1;
  overflow: hidden; overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
button { font: inherit; color: inherit; }
svg { display: block; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
:focus-visible { outline: 3px solid var(--lilac-deep); outline-offset: 3px; border-radius: 12px; }

#stage { position: fixed; left: 0; top: 0; width: 100vw; height: 100vh; height: 100dvh; overflow: hidden; }

/* filming: the cursor goes away after 2 s without movement (main.js, only with a URL switch) */
html.hide-cursor, html.hide-cursor * { cursor: none !important; }

/* ---------- the floor strip ---------- */
.floor {
  position: absolute; left: 0; right: 0; bottom: 0; height: calc(var(--foot) * .9);
  background: #fbead0; border-top: 5px solid #f1d9b4;
}

/* ---------- header ---------- */
.top { position: absolute; inset: 0 0 auto 0; pointer-events: none; }
.top > * { pointer-events: auto; }
.titles { position: absolute; top: calc(var(--m) + var(--sa-t, 0px)); left: 0; right: 0; text-align: center; pointer-events: none; }
h1 {
  margin: 0; font-size: var(--ts); line-height: 1.05; font-weight: 700; color: var(--title); letter-spacing: -.01em;
}
.sub { text-wrap: balance; margin: .25em 0 0; font-size: calc(var(--ts) * .36); line-height: 1.2; font-weight: 500; color: var(--ink-soft); }
.counter {
  position: absolute; top: calc(var(--m) + var(--sa-t, 0px)); left: calc(var(--m) + var(--sa-l, 0px));
  height: var(--pill); min-width: calc(var(--pill) * 2.5); padding: 0 .9em; border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, .9); box-shadow: 0 3px 0 #dff0e6, 0 6px 14px rgba(110, 95, 170, .1);
  font-size: calc(var(--pill) * .5); font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums;
}
.counter .of { white-space: pre; }
#count { display: inline-block; }
#count.bump { animation: bump .55s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes bump { 0% { transform: scale(1); } 30% { transform: scale(1.7) translateY(-8%); color: var(--logo); } 100% { transform: scale(1); } }

/* the round sound button: the shrine's .icon-btn, scaled with the window */
.icon-btn {
  position: absolute; top: calc(var(--m) + var(--sa-t, 0px)); right: calc(var(--m) + var(--sa-r, 0px));
  width: var(--btn); height: var(--btn); border-radius: 50%;
  display: grid; place-items: center; padding: 0;
  border: 0; background: rgba(255, 255, 255, .8);
  box-shadow: 0 3px 0 #e6dfff, 0 6px 14px rgba(110, 95, 170, .12);
  color: var(--ink); cursor: pointer;
}
.icon-btn svg { width: 50%; height: 50%; }
.icon-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #e6dfff; }
#muteBtn .snd-off { display: none; }
#muteBtn.muted .snd-on { display: none; }
#muteBtn.muted .snd-off { display: inline; }
#muteBtn.muted { color: var(--ink-soft); }

/* portrait phone: title on the left, counter and sound button on the right */
.portrait .titles { text-align: left; left: calc(var(--m) + var(--sa-l, 0px) + 4px); right: auto; }
.portrait .sub { font-size: max(13px, calc(var(--ts) * .5)); }
.portrait .counter { left: auto; right: calc(var(--m) + var(--sa-r, 0px) + var(--btn) + 10px); top: calc(var(--m) + var(--sa-t, 0px) + (var(--btn) - var(--pill)) / 2); }

/* ---------- footer link ---------- */
.credit {
  position: absolute; right: calc(var(--m) + var(--sa-r, 0px)); bottom: calc(var(--foot) * .45 - .6em + var(--sa-b, 0px) * .5);
  font-size: var(--credit, 13px); font-weight: 500; color: var(--ink-soft); text-decoration: none; padding: 4px 2px;
}
.credit:hover { color: var(--logo); text-decoration: underline; text-underline-offset: 3px; }

/* ---------- the shelf ---------- */
#shelf { position: absolute; inset: 0; pointer-events: none; }   /* only the objects and the waiting slots take clicks */
.row { position: absolute; transform-origin: 50% 100%; }
.row.busy { z-index: 5; }
.plank {
  position: absolute; inset: 0; border-radius: calc(var(--b) * .3);
  background: var(--plank);
  box-shadow: 0 5px 0 rgba(138, 123, 184, .13);
}
.plank::after {      /* the highlight along the top of the board */
  content: ''; position: absolute; left: calc(var(--b) * .2); right: calc(var(--b) * .2); top: calc(var(--b) * .1);
  height: max(3px, calc(var(--b) * .12)); border-radius: 3px; background: var(--plank-hi);
}
.bracket {
  position: absolute; top: calc(var(--b) - 4px); background: #f6dfa2;
  border-radius: 0 0 calc(var(--bh) * .7) calc(var(--bh) * .7);
}

.slot { position: absolute; top: 0; height: 100%; }
.letter {
  position: absolute; left: 0; right: 0; top: 0; height: var(--b);
  display: grid; place-items: center;
  font-size: var(--fs); font-weight: 650; line-height: 1; color: var(--letter);
  transform-origin: 50% 85%; pointer-events: none;
}
.letter span { display: block; position: relative; z-index: 1; transform: translateY(4%); }
.letter::before {    /* the tag an unlocked letter sits on */
  content: ''; position: absolute; left: 50%; top: 50%;
  width: var(--tagw); height: calc(var(--b) * .84); translate: -50% -50%;
  border-radius: calc(var(--b) * .3); background: var(--paper);
  box-shadow: 0 2px 0 #f0b9a8; opacity: 0; scale: .6;
  transition: opacity .2s, scale .35s cubic-bezier(.3, 1.6, .5, 1);
}
.slot.on .letter { color: #d9705c; }
.slot.on .letter::before { opacity: 1; scale: 1; }
.slot.flip .letter span { animation: flip .5s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes flip { 0% { transform: translateY(4%) scale(.5); } 60% { transform: translateY(-6%) scale(1.25); } 100% { transform: translateY(4%) scale(1); } }

/* the soft glow above the plank: "this one is next" (straw) and "tap me" (warm coral) */
.glow {
  position: absolute; left: 50%; bottom: calc(100% - var(--b) * .2); width: max(105%, var(--cellh)); height: calc(var(--cellh) * .95);
  translate: -50% 0;
  background: radial-gradient(ellipse 50% 90% at 50% 100%, rgba(255, 252, 236, 1) 0%, rgba(255, 236, 170, .8) 35%, rgba(246, 207, 99, .28) 65%, rgba(246, 207, 99, 0) 100%);
  opacity: 0; pointer-events: none; transform-origin: 50% 100%;
}
.slot.next .glow { animation: glowPulse 2.2s ease-in-out infinite; }
.slot.next .letter { animation: sway 2.2s ease-in-out infinite; }
@keyframes glowPulse { 0%, 100% { opacity: .4; transform: scale(.8, .6); } 50% { opacity: 1; transform: scale(1.05, 1.05); } }
@keyframes sway { 0%, 100% { transform: rotate(-11deg); } 50% { transform: rotate(11deg); } }

.slot.invite .glow {
  background: radial-gradient(ellipse 50% 90% at 50% 100%, rgba(255, 250, 247, 1) 0%, rgba(255, 190, 172, .95) 32%, rgba(255, 170, 150, .45) 62%, rgba(255, 170, 150, 0) 100%);
  animation: glowPulse 1.3s ease-in-out infinite;
}
.slot.invite .letter { animation: invite 1.3s cubic-bezier(.4, 0, .4, 1) infinite; color: var(--coral-ink); }
@keyframes invite {
  0%, 100% { transform: translateY(0) scale(1, 1); }
  12% { transform: translateY(0) scale(1.15, .85); }
  35% { transform: translateY(-34%) scale(.94, 1.08) rotate(-7deg); }
  55% { transform: translateY(0) scale(1.12, .9); }
  70% { transform: translateY(-10%) scale(1) rotate(5deg); }
  85% { transform: translateY(0) scale(1); }
}

/* the click target of an empty slot waiting for its drop: the space above the plank and the letter */
.wait {
  position: absolute; left: 0; right: 0; bottom: 0; height: calc(var(--cellh) + var(--b));
  margin: 0; padding: 0; border: 0; background: transparent; border-radius: 14px; cursor: pointer;
  display: none; pointer-events: auto;
}
.slot.waiting .wait { display: block; }
.slot.plain .wait { cursor: default; }
.slot.plain .wait:focus-visible { outline: none; }

/* ---------- objects ---------- */
.obj {
  position: absolute; display: block; width: var(--s); height: var(--s);
  left: calc(50% - var(--s) / 2); bottom: calc(100% - var(--feet));
  visibility: hidden; pointer-events: none; color: inherit; text-decoration: none; border-radius: 12px;
}
.slot.on .obj { visibility: visible; pointer-events: auto; cursor: pointer; }
.slot.dropping .obj { visibility: visible; pointer-events: none; }
.obj .shadow {
  position: absolute; left: 10%; right: 10%; bottom: calc(var(--s) * -.05); height: calc(var(--s) * .1);
  border-radius: 50%; background: rgba(74, 69, 96, .13);
}
.obj .bob { position: absolute; inset: 0; transform-origin: 50% 100%; }
.obj svg { width: 100%; height: 100%; overflow: visible; }
@media (hover: hover) {
  .slot.on:not(.still) .obj:hover .bob { animation: hop .8s cubic-bezier(.4, 0, .4, 1) infinite; }
}
.slot.on .obj:focus-visible .bob { animation: hop .8s cubic-bezier(.4, 0, .4, 1) infinite; }
@keyframes hop {
  0%, 100% { transform: translateY(0) scale(1, 1) rotate(0); }
  14% { transform: translateY(0) scale(1.12, .88); }
  40% { transform: translateY(-24%) scale(.95, 1.06) rotate(-6deg); }
  58% { transform: translateY(-20%) scale(1) rotate(6deg); }
  78% { transform: translateY(0) scale(1.1, .9) rotate(0); }
  90% { transform: translateY(0) scale(.98, 1.02); }
}

/* the hover label: "S is for Shrine" */
.label {
  position: absolute; left: 0; top: 0; z-index: 20; pointer-events: none; white-space: nowrap;
  padding: .35em .85em .4em; border-radius: 999px; background: #fff; color: var(--ink);
  font-size: var(--labelfs, 16px); font-weight: 600;
  box-shadow: 0 3px 0 var(--lilac), 0 8px 18px rgba(110, 95, 170, .16);
  opacity: 0; transform: translateY(8px) scale(.9); transition: opacity .15s, transform .25s cubic-bezier(.3, 1.6, .5, 1);
}
.label.show { opacity: 1; transform: none; }
.label b { color: var(--logo); font-weight: 700; }

/* sparkles at a landing (main.js makes 4) */
.spark { position: absolute; width: var(--sz); height: var(--sz); pointer-events: none; z-index: 6; }
.spark svg { width: 100%; height: 100%; }

@media (prefers-reduced-motion: reduce) {
  .slot.next .letter, .slot.invite .letter { animation: none; }
  .slot.next .glow, .slot.invite .glow { animation: none; opacity: .9; }
  .slot.on .obj:hover .bob, .slot.on .obj:focus-visible .bob { animation: none; transform: translateY(-6%); }
  #count.bump, .slot.flip .letter span { animation: none; }
}

/* the floor strip and the supports under the planks were removed on review (2026-12-03): the planks float */
.floor, .bracket { display: none; }
