/* ---------- the grid: 4 across (2 on phones); big pieces are 2×2 ---------- */
.board { position: relative; display: grid; justify-items: center; }

.grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-flow: dense;
  gap: clamp(12px, 1.8vw, 22px);
  width: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
  perspective: 1400px;
}
@media (max-width: 900px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 600px) { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.tile { aspect-ratio: 4 / 5; }
.tile.feature { grid-column: span 2; grid-row: span 2; }

/* every second big piece sits on the right, so the rhythm alternates down the page */
@media (min-width: 901px) { .tile.feature.right { grid-column: 3 / span 2; } }

/* arriving: rises out of the paper, slightly turned, and settles */
.tile {
  opacity: 0;
  translate: 0 28px;
  rotate: x 12deg;
  transition:
    opacity 0.7s ease calc(var(--i) % 4 * 0.08s),
    translate 0.9s cubic-bezier(0.2, 0.9, 0.3, 1) calc(var(--i) % 4 * 0.08s),
    rotate 0.9s cubic-bezier(0.2, 0.9, 0.3, 1) calc(var(--i) % 4 * 0.08s);
}
.tile.in { opacity: 1; translate: 0 0; rotate: x 0deg; }

/* ---------- a piece: paper with an iPad-shaped frame (the art is drawn on one) ---------- */
.art {
  width: 100%;
  height: 100%;
  border-radius: clamp(14px, 1.8vw, 22px);
  transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition: transform 0.6s cubic-bezier(0.2, 0.9, 0.3, 1), box-shadow 0.4s ease;
  box-shadow: 0 1px 2px rgba(30, 28, 34, 0.05), 0 18px 36px -26px rgba(30, 28, 34, 0.35);
}
.art.tilting {
  transition: transform 0.12s linear, box-shadow 0.4s ease;
  box-shadow: 0 1px 2px rgba(30, 28, 34, 0.05), 0 30px 50px -28px rgba(30, 28, 34, 0.45);
}

.ipad {
  position: absolute;
  inset: 9% 10% 13%;
  border-radius: 8%/6.4%;
  border: 1.5px solid rgba(36, 31, 38, 0.1);
  background: rgba(255, 255, 255, 0.22);
}
.screen {
  position: absolute;
  inset: 5%;
  border-radius: 5%/4%;
  border: 1.5px dashed rgba(36, 31, 38, 0.1);
}
.feature .ipad { inset: 8% 9% 11%; }

/* play badge (reels), top right */
.badge {
  position: absolute;
  top: 5%;
  right: 5%;
  width: clamp(18px, 2vw, 24px);
  aspect-ratio: 1;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.5);
}

/* caption lines, bottom left */
.lines {
  position: absolute;
  left: 8%;
  right: 30%;
  bottom: 4.5%;
  display: grid;
  gap: 6px;
}
.line { height: 7px; border-radius: 99px; background: rgba(36, 31, 38, 0.08); }
.line.short { width: 55%; }

/* the light catching the glossy surface, following the cursor */
.glare {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(circle at var(--gx, 50%) var(--gy, 0%), rgba(255, 255, 255, 0.55), transparent 55%);
  opacity: 0;
  transition: opacity 0.4s ease;
  mix-blend-mode: soft-light;
  pointer-events: none;
}
.art.tilting .glare { opacity: 1; }

/* ---------- a real piece: the art fills the tile; reels get a play badge; the title slides up on
   hover (always shown on touch screens). Tapping opens the viewer. ---------- */
.art.real {
  position: relative;
  display: block;
  padding: 0;
  border: 0;
  overflow: hidden;
  isolation: isolate;
  cursor: zoom-in;
  color: inherit;
  text-decoration: none;
  background: var(--color-paper);
  -webkit-tap-highlight-color: transparent;
}
.art.real .framed { transition: scale 0.6s cubic-bezier(0.2, 0.9, 0.3, 1); }
.art.real:hover .framed { scale: 1.04; }
.art.real:focus-visible { outline: 2.5px solid var(--color-leaf); outline-offset: 4px; }
.play {
  position: absolute;
  top: 10px;
  right: 10px;
  display: grid;
  place-items: center;
  width: clamp(28px, 2.6vw, 34px);
  aspect-ratio: 1;
  border-radius: 50%;
  color: var(--color-ink);
  background: color-mix(in srgb, var(--color-paper) 72%, transparent);
  backdrop-filter: blur(10px) saturate(1.5);
  -webkit-backdrop-filter: blur(10px) saturate(1.5);
  border: 1px solid rgba(255, 255, 255, 0.6);
}
.play svg { width: 55%; translate: 6% 0; }
.caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 36px 14px 12px;
  font: 700 clamp(20px, 2vw, 26px)/1.1 var(--font-hand);
  color: #fff;
  text-align: left;
  background: linear-gradient(transparent, rgba(36, 31, 38, 0.62));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  translate: 0 12px;
  transition: opacity 0.35s ease, translate 0.45s cubic-bezier(0.2, 0.9, 0.3, 1);
}
.art.real:hover .caption, .art.real:focus-visible .caption { opacity: 1; translate: 0 0; }
/* phones and tablets have no hover: the title simply stays visible */
@media (hover: none) { .caption { opacity: 1; translate: 0 0; } }

/* ---------- "see all" ---------- */
.see-all {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  padding: 15px 22px 15px 26px;
  border-radius: 99px;
  font: italic 600 19px/1 var(--font-serif);
  letter-spacing: 0.02em;
  color: var(--color-paper);
  background: var(--color-ink);
  border: 0;
  box-shadow: 0 14px 30px -16px rgba(36, 31, 38, 0.7);
  cursor: pointer;
  transition: translate 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.see-all b { font-style: normal; font-weight: 700; font-family: var(--font-ui); font-size: 0.85em; }
.see-all-arrow {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font: 600 16px/1 var(--font-ui);
  color: var(--color-ink);
  background: linear-gradient(180deg, var(--color-petal-light), var(--color-petal));
  transition: translate 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.see-all:hover { translate: 0 -2px; }
.see-all:hover .see-all-arrow { translate: 3px 0; }
.see-all:focus-visible { outline: 2.5px solid var(--color-leaf); outline-offset: 4px; }

/* ---------- the whole sketchbook: a full-screen paper sheet that slides up ---------- */
.sheet {
  width: 100vw;
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  color: var(--color-ink);
  background:
    radial-gradient(ellipse 60% 40% at 15% 0%, rgba(242, 170, 182, 0.2), transparent 70%),
    radial-gradient(ellipse 50% 40% at 100% 30%, rgba(240, 216, 112, 0.14), transparent 70%),
    #fbf8f4;
  overflow: hidden;
}
.sheet[open] { display: flex; flex-direction: column; animation: sheet-in 0.5s cubic-bezier(0.2, 0.9, 0.3, 1); }
.sheet.closing { animation: sheet-out 0.32s cubic-bezier(0.5, 0, 0.8, 0.4) forwards; }
.sheet::backdrop { background: rgba(36, 31, 38, 0.3); backdrop-filter: blur(4px); }
@keyframes sheet-in { from { translate: 0 100%; } }
@keyframes sheet-out { to { translate: 0 100%; } }

.sheet-head {
  display: flex;
  align-items: center;
  gap: 14px;
  width: min(1120px, 90vw);
  margin: 0 auto;
  padding: 18px 0 14px;
}
.sheet-head .title { font-size: clamp(38px, 5vw, 56px); }
.sheet-count {
  flex: 1;
  padding-top: 0.5em;
  font: italic 600 17px/1 var(--font-serif);
  color: var(--color-name);
}
.close {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  flex: none;
  border-radius: 50%;
  color: var(--color-ink);
  background: color-mix(in srgb, var(--color-paper) 75%, transparent);
  border: 1.5px solid rgba(36, 31, 38, 0.14);
  box-shadow: 0 10px 24px -16px rgba(36, 31, 38, 0.5);
  cursor: pointer;
  transition: rotate 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.2s ease;
}
.close svg { width: 22px; }
.close:hover { rotate: 90deg; background: #fff; }
.close:focus-visible { outline: 2.5px solid var(--color-leaf); outline-offset: 3px; }

.sheet-body {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 6px max(5vw, calc((100vw - 1120px) / 2)) 48px;
  /* the grid fades under the header as it scrolls */
  mask-image: linear-gradient(transparent, #000 18px);
}
.sheet-end {
  margin: 36px 0 0;
  text-align: center;
  font: italic 600 18px/1.3 var(--font-serif);
  color: var(--color-name);
}
.sheet-end a { color: var(--color-ink); }
.sentinel { display: block; height: 1px; }

/* ---------- end of the sketchbook ---------- */
.end {
  display: grid;
  justify-items: center;
  gap: 10px;
  margin-top: clamp(28px, 4vw, 44px);
}
/* ---------- "meet the artist": a paper ticket with the little flower ---------- */
.meet {
  display: inline-flex;
  align-items: center;
  gap: 16px;
  padding: 12px 14px 12px 12px;
  border-radius: 999px;
  color: var(--color-ink);
  text-decoration: none;
  background:
    radial-gradient(ellipse 60% 120% at 0% 50%, rgba(242, 170, 182, 0.35), transparent 70%),
    var(--color-paper);
  border: 2px solid var(--color-ink);
  box-shadow: 0 5px 0 var(--color-ink), 0 22px 40px -22px rgba(36, 31, 38, 0.55);
  transition: translate 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease;
}
.meet:hover { translate: 0 -3px; box-shadow: 0 8px 0 var(--color-ink), 0 28px 44px -22px rgba(36, 31, 38, 0.55); }
.meet:active { translate: 0 3px; box-shadow: 0 2px 0 var(--color-ink); }
.meet:focus-visible { outline: 2.5px solid var(--color-leaf); outline-offset: 4px; }
.meet-face {
  display: grid;
  place-items: end center;
  width: 58px;
  height: 58px;
  flex: none;
  overflow: hidden;
  border-radius: 50%;
  border: 2px solid var(--color-ink);
  background: linear-gradient(170deg, var(--color-face-light), var(--color-petal-light));
}
.meet-face ss-flower { --flower-size: 30px; margin-bottom: -4px; transition: rotate 0.4s cubic-bezier(0.34, 1.56, 0.64, 1); transform-origin: 50% 100%; }
.meet:hover .meet-face ss-flower { rotate: -10deg; }
.meet-text { display: grid; gap: 2px; text-align: left; }
.meet-text small { font: italic 600 15px/1.1 var(--font-serif); color: var(--color-name); }
.meet-text b { font: 700 clamp(28px, 3.2vw, 34px)/1 var(--font-hand); }
.meet-arrow {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: none;
  border-radius: 50%;
  font: 600 18px/1 var(--font-ui);
  color: var(--color-paper);
  background: var(--color-ink);
  transition: translate 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.meet:hover .meet-arrow { translate: 4px 0; }

/* ---------- couldn't fetch ---------- */
.offline-note { position: absolute; top: clamp(80px, 14vw, 180px); }
.note-icon { display: inline-flex; width: 18px; color: var(--color-petal-shade); }

@media (prefers-reduced-motion: reduce) {
  .tile { opacity: 1; translate: none; rotate: none; transition: none; }
  .sheet[open], .sheet.closing { animation: none; }
}
