/* The Art Lab. Its layout (the fixed overlay, the two-sided grid, the room layers
   and the creature slot) is shared with the other rooms in potions.css; this file
   is only what is the painting corner's own. See STORYBOOK-PLAN.md. */

#artlab {
  --rock-far: #5a4652; --rock: #6e5a63; --rock-lit: #9a8279; --rock-edge: #c4ab95; --rock-fore: #3e2f38;
  --crayon: #2f6fe0;
}

/* ---------------------------------------------------------------- the room */

.al-ceiling { fill: #7a6670; }
.al-floor   { fill: #8a7468; }
.al-splat   { opacity: 0.55; }
.al-sheet   { fill: #f3ece0; stroke: #d8cbb5; stroke-width: 3; }
.al-leg, .al-leg-back { fill: none; stroke: #a8713f; stroke-width: 16; stroke-linecap: round; }
.al-leg-back { stroke: #7a5130; }
.al-top, .al-ledge, .al-shelf { fill: #c48a52; stroke: #8a5a2e; stroke-width: 3; }

/* The creature stands beside the easel, behind the paper, and never takes a
   touch meant for the paper. */
#artlab .creature-slot { width: 26%; pointer-events: none; }

/* --------------------------------------------------------------- the paper */

.al-paper {
  position: absolute; pointer-events: auto; z-index: 2;
  border-radius: 6px; overflow: hidden; background: #fffdf6;
  box-shadow: 0 10px 22px rgba(40, 20, 30, 0.35), 0 0 0 4px #ffffff;
}
.al-paper canvas { width: 100%; height: 100%; display: block; touch-action: none; cursor: crosshair; }

/* ---------------------------------------------------------- the prompt card */

.al-card {
  position: absolute; transform: translate(-50%, -50%); z-index: 2; pointer-events: auto;
  display: flex; align-items: center; gap: clamp(6px, 1vw, 14px);
}
.al-book { position: relative; display: grid; place-items: center; }
.al-thumb {
  width: clamp(78px, 10vw, 128px); aspect-ratio: 4 / 3; padding: 0; overflow: hidden;
  border-radius: 6px; background: #fffdf6; display: grid; place-items: center;
  border: 5px solid #c4706e; box-shadow: 0 4px 10px rgba(40, 20, 30, 0.3);
}
.al-thumb-pic { width: 100%; height: 100%; object-fit: cover; display: block; }
.al-thumb { position: relative; overflow: visible; }
/* the open book's own picture, pinned to the card's corner */
.al-thumb-badge {
  position: absolute; right: -14px; top: -14px; width: 40%; pointer-events: none;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.35));
}
.al-thumb-pic { border-radius: 2px; }
.al-thumb-pencil { width: 46%; rotate: 25deg; animation: pencil-wiggle 1.6s ease-in-out infinite; }
@keyframes pencil-wiggle { 50% { rotate: 10deg; translate: -4% 4%; } }
/* under the little book, outside the card's width so they never push the arrows
   into the Done tick on a phone */
.al-dots { position: absolute; top: calc(100% + 6px); left: 50%; translate: -50% 0; display: flex; gap: 4px; }
.al-dots span { width: 8px; height: 8px; border-radius: 50%; background: rgba(255, 255, 255, 0.55); border: 1px solid #8a5a2e; }
.al-dots span.drawn { background: #ffc46b; }
.al-dots span.here { scale: 1.5; box-shadow: 0 0 0 2px #ffffff; }

.al-turn, .al-say, .al-done {
  width: max(48px, 4.6vw); aspect-ratio: 1; border-radius: 50%; padding: 0; display: grid; place-items: center;
  background: radial-gradient(circle at 40% 35%, #ffd27a, #e09a3a); border: 3px solid #fff3c8;
  box-shadow: 0 4px 10px rgba(40, 20, 30, 0.35);
}
.al-turn svg, .al-say svg, .al-done svg { width: 60%; height: 60%; }
.al-turn path { fill: none; stroke: #5a2e12; stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; }
.al-say { background: radial-gradient(circle at 40% 35%, #b9e9ff, #5cb4e0); }
.al-say path { fill: #1d3a5a; }
.al-say .wave { fill: none; stroke: #1d3a5a; stroke-width: 3; stroke-linecap: round; }

/* Done: a big green tick, glowing once there is something on the paper. */
.al-done {
  position: absolute; transform: translate(-50%, -50%); z-index: 2; pointer-events: auto;
  width: max(64px, 7.4vw);
  background: radial-gradient(circle at 40% 35%, #b6f0a0, #4cb85a); border-color: #eaffe0; opacity: 0.6;
}
.al-done path { fill: none; stroke: #ffffff; stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; }
.al-done.ready { opacity: 1; animation: done-glow 1.8s ease-in-out infinite; }
@keyframes done-glow { 50% { box-shadow: 0 0 0 6px rgba(182, 240, 160, 0.6), 0 4px 10px rgba(40, 20, 30, 0.35); } }
.al-fx { position: absolute; inset: 0; pointer-events: none; z-index: 4; }

.al-thumb.bump, .al-turn.bump, .al-say.bump, .al-done.bump, .al-tool.bump, .al-crayon.bump {
  animation: al-bump 0.35s cubic-bezier(.3, 1.5, .5, 1);
}
@keyframes al-bump { 40% { scale: 1.12; } }

.al-ghost {
  position: fixed; border-radius: 6px; z-index: 70; pointer-events: none;
  box-shadow: 0 10px 22px rgba(40, 20, 30, 0.4); transform-origin: 50% 50%;
}

/* --------------------------------------------------------------- the benches */

.bench-crayons {
  --bench-edge: #ffd27a;
  background: linear-gradient(180deg, #6e5a63, #4a3a44);
}
.bench-tools {
  --bench-edge: #ff9ec4;
  background: linear-gradient(180deg, #6e5a63, #4a3a44);
}
.al-crayons, .al-tools { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; justify-items: center; }
.al-crayon {
  width: 60px; height: 86px; padding: 4px 0 0; border-radius: 14px; display: grid; place-items: end center;
  background: rgba(255, 255, 255, 0.08); border: 2px solid transparent; overflow: hidden;
}
.al-crayon svg { width: 34px; height: auto; transition: translate 0.15s ease; translate: 0 10px; }
.al-crayon[aria-pressed="true"] { border-color: #ffffff; background: rgba(255, 255, 255, 0.22); }
.al-crayon[aria-pressed="true"] svg { translate: 0 -2px; }

.al-tool {
  width: 64px; height: 64px; padding: 0; border-radius: 16px; display: grid; place-items: center;
  background: rgba(255, 255, 255, 0.08); border: 2px solid rgba(255, 255, 255, 0.25);
}
.al-tool[aria-pressed="true"] { border-color: #ffffff; background: rgba(255, 255, 255, 0.24); }
.al-tool.off { opacity: 0.45; }
.al-tool svg { width: 70%; height: 70%; }
.al-size span { width: var(--d); aspect-ratio: 1; border-radius: 50%; background: var(--crayon); box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.25); }
.al-undo path, .al-bin path { fill: none; stroke: #ffffff; stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round; }

@media (max-width: 1100px), (max-height: 560px) {
  .al-crayon { width: 54px; height: 76px; }
  .al-crayon svg { width: 30px; }
  .al-tool { width: 56px; height: 56px; }
}
@media (max-height: 560px) and (min-aspect-ratio: 5/6) {
  /* a phone on its side: no room for the speaker beside the Done tick, and a tap
     on the little book says the prompt too */
  .al-say { display: none; }
  .al-done { width: 56px; }
  .al-crayons, .al-tools { gap: 4px; }
  .al-crayon { width: 48px; height: 62px; }
  .al-crayon svg { width: 26px; }
  .al-tool { width: 48px; height: 48px; }
}
@media (max-aspect-ratio: 5/6) {
  .al-crayons { grid-template-columns: repeat(auto-fill, minmax(48px, 1fr)); }
  .al-tools { grid-template-columns: repeat(auto-fill, minmax(56px, 1fr)); }
  #artlab .creature-slot { width: 26%; }
}
