/* Polaroid snapshots: the home-page slideshow and the all-toys page at /collections/.
   The markup is built by scripts/build-collections.mjs; behaviour is in polaroid.js. */
@font-face { font-family: Caveat; src: url('assets/fonts/caveat-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: Caveat; src: url('assets/fonts/caveat-latin-600-normal.woff2') format('woff2'); font-weight: 600; font-display: swap; }

:root {
  --hand: Caveat, 'Bradley Hand', 'Segoe Print', cursive;
  --biro: #2c3a63;
  --polaroid: #f8f5ec;
}

/* ---------- One Polaroid ---------- */
.snap { --tilt: 0deg; --lift: 0px; }
.snap > .snap-frame {
  display: block; width: 100%; border: 0; margin: 0; font: inherit; text-decoration: none; text-align: center; cursor: zoom-in; -webkit-tap-highlight-color: transparent;
  padding: 5.5% 5.5% 0;
  background: var(--polaroid);
  background-image: linear-gradient(160deg, #fffdf7 0%, #f6f2e7 55%, #ede6d6 100%);
  color: var(--biro);
  transform: translateY(var(--lift)) rotate(var(--tilt));
  box-shadow: 0 1px 1px #00000033, 0 6px 10px -2px #00000059, 0 18px 28px -10px #00000066;
  transition: transform .35s ease, box-shadow .35s ease;
}
.snap-photo { position: relative; display: block; width: 100%; aspect-ratio: 1; overflow: hidden; background: #2a2620; border: 0; padding: 0; margin: 0; cursor: zoom-in; font: inherit; }
.snap-photo img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 42%; filter: saturate(.88) contrast(.95) sepia(.1) brightness(1.02); }
/* Faded edges and a little sheen, like an old print. */
.snap-photo::after { content: ""; position: absolute; inset: 0; pointer-events: none; box-shadow: inset 0 0 0 1px #0000002e, inset 0 0 26px #2b1d0c40; background: linear-gradient(125deg, #ffffff1f 0%, #ffffff00 38%, #ffffff00 70%, #ffffff12 100%); }
.snap-caption { display: block; min-height: 5.6em; padding: .55em .2em .9em; font-family: var(--hand); line-height: 1.12; text-align: center; }
.snap-title {
  display: inline; font-weight: 600; font-size: 1.5em; letter-spacing: .2px;
  padding-bottom: 2px; -webkit-box-decoration-break: clone; box-decoration-break: clone;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 6' preserveAspectRatio='none'%3E%3Cpath d='M1 4.2 C 20 2.6, 45 3.4, 70 2.9 S 105 2.2, 119 3.6' fill='none' stroke='%232c3a63' stroke-opacity='.55' stroke-width='1.4' stroke-linecap='round'/%3E%3C/svg%3E") bottom / 100% 6px no-repeat;
}
.snap-note { display: block; margin-top: .3em; font-size: 1.12em; opacity: .86; }
.snap a:focus-visible, .snap button:focus-visible { outline: 3px solid var(--gold); outline-offset: 4px; }
.toy-grid .snap a:focus-visible, .toy-grid .snap button:focus-visible { outline-color: var(--red); }

/* ---------- Home-page slideshow ---------- */
.snapshots { position: relative; margin-top: 8px; }
.snap-row {
  overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory;
  padding: 34px 2% 56px;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 3.5%, #000 96.5%, transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0, #000 3.5%, #000 96.5%, transparent 100%);
}
.snap-track { list-style: none; margin: 0; padding: 0; display: flex; align-items: flex-start; will-change: transform; }
.snap-track .snap { flex: 0 0 35%; scroll-snap-align: start; position: relative; }
.snap-track .snap + .snap { margin-left: -3%; }
.snap-track .snap-caption { font-size: clamp(15px, 1.45vw, 19px); height: 7.4em; overflow: hidden; padding-inline: 8%; }
.snap-track .snap-note { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
/* With JavaScript the row moves by itself instead of scrolling. */
.snapshots.is-live .snap-row { overflow: hidden; scroll-snap-type: none; }
.snapshots.is-live .snap-track { transition: transform .95s cubic-bezier(.55,.06,.25,1); }
/* A little lift on desktop so it feels like something to pick up. */
@media (hover: hover) and (pointer: fine) {
  .snap-track .snap > .snap-frame:hover { transform: translateY(calc(var(--lift) - 10px)) rotate(calc(var(--tilt) * .4)) scale(1.03); box-shadow: 0 2px 2px #00000033, 0 14px 18px -4px #00000059, 0 30px 40px -12px #00000080; position: relative; z-index: 5; }
}
.snap-pause {
  position: absolute; right: 2%; bottom: 6px;
  display: inline-flex; align-items: center; gap: 7px;
  background: transparent; border: 0; padding: 6px 4px; cursor: pointer;
  color: #d5c29b; font: 18px/1 var(--hand);
}
.snap-pause:hover { color: var(--gold); }
.snap-pause:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.snap-pause svg { width: 11px; height: 11px; fill: currentColor; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (max-width: 1000px) { .snap-track .snap { flex-basis: 46%; } .snap-track .snap-caption { font-size: 17px; } }
@media (max-width: 600px) {
  .snap-row { padding: 26px 4% 52px; }
  .snap-track .snap { flex-basis: 64%; }
  .snap-track .snap + .snap { margin-left: -4%; }
  .snap-track .snap-caption { font-size: 15px; }
}

/* ---------- All-toys page ---------- */
.toys-page { padding-block: 34px 30px; }
.toys-jump { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 10px; margin: 0 auto; padding: 0; list-style: none; max-width: 900px; }
.toys-jump a { display: inline-block; padding: 5px 13px; border: 1px solid var(--line); font: 12px/1.5 var(--serif); color: var(--ink); background: #f7edd680; }
.toys-jump a:hover { border-color: var(--red); color: var(--red); }
.toy-shelf { padding-top: 70px; scroll-margin-top: 10px; }
.toy-shelf-heading { text-align: center; border-bottom: 3px double #8d7351; padding-bottom: 18px; margin-bottom: 8px; }
.toy-shelf-heading h2 { font: 400 clamp(28px, 3.6vw, 40px)/1.2 var(--display); color: var(--green); margin: 0; }
.toy-shelf-heading p { margin: 6px 0 0; font-style: italic; color: var(--red); }
.toy-grid { --cols: 5; --gap: 24px; list-style: none; margin: 0; padding: 22px 0 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 30px var(--gap); }
.toy-grid .snap { flex: 0 0 calc((100% - (var(--cols) - 1) * var(--gap)) / var(--cols)); min-width: 0; }
.toy-grid .snap { scroll-margin-top: 30px; }
.toy-grid .snap > .snap-frame { padding: 6% 6% 0; box-shadow: 0 1px 1px #00000033, 0 4px 7px -2px #00000059, 0 10px 16px -8px #00000066; }
.toy-grid .snap-caption { min-height: 0; padding: .4em .1em .75em; font-size: 15px; }
.toy-grid .snap-title { font-size: 1.3em; }
.toy-grid .snap-note, .toy-grid .snap-sub { display: none; }
.toy-waiting { margin: 18px 0 0; text-align: center; font: 20px/1.3 var(--hand); color: var(--muted); }
/* Arriving from the slideshow: that snapshot straightens up and gets pinned. */
.toy-grid .snap:target > .snap-frame { transform: rotate(0deg) scale(1.08); position: relative; z-index: 3; box-shadow: 0 0 0 4px var(--gold), 0 18px 34px -8px #00000080; }
.toy-grid .snap:target > .snap-frame::before { content: ""; position: absolute; top: -9px; left: 50%; width: 18px; height: 18px; margin-left: -9px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #d86b55, var(--red) 60%, #4a1f17); box-shadow: 1px 3px 3px #00000066; z-index: 2; }
.toy-grid .snap > .snap-frame { position: relative; }
.toys-back { text-align: center; margin-top: 70px; }
@media (max-width: 1100px) { .toy-grid { --cols: 4; } }
@media (max-width: 800px) { .toy-grid { --cols: 3; --gap: 18px; row-gap: 24px; } }
@media (max-width: 560px) {
  .toy-grid { --cols: 2; --gap: 16px; row-gap: 22px; }
  .toy-grid .snap-caption { font-size: 13px; }
  .toy-shelf { padding-top: 50px; }
}
@media (prefers-reduced-motion: reduce) {
  .snap > .snap-frame, .snapshots.is-live .snap-track { transition: none !important; }
}

/* ---------- Enlarged photo ---------- */
.zoom { position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: transparent; overflow-y: auto; overscroll-behavior: contain; }
.zoom::backdrop { background: #0e1914e6; }
.zoom[open] { display: flex; align-items: safe center; justify-content: center; padding-block: 24px; }
.zoom-card {
  position: relative; display: flex; flex-direction: column; align-items: center;
  max-width: min(94vw, 760px); padding: 16px 16px 0;
  background: var(--polaroid); background-image: linear-gradient(160deg, #fffdf7 0%, #f6f2e7 55%, #ede6d6 100%);
  color: var(--biro); transform: rotate(-1deg);
  box-shadow: 0 2px 3px #00000055, 0 30px 60px -15px #000000cc;
  animation: zoom-in .28s cubic-bezier(.2,.8,.3,1.1);
}
.zoom-card img { display: block; max-width: 100%; max-height: calc(100vh - 330px); max-height: calc(100dvh - 330px); width: auto; height: auto; filter: saturate(.92) contrast(.97) sepia(.06); box-shadow: inset 0 0 0 1px #0000002e; }
.zoom-caption { display: block; width: 100%; max-width: 600px; box-sizing: border-box; padding: 14px 10px 20px; text-align: center; font-family: var(--hand); line-height: 1.15; color: inherit; text-decoration: none; }
.zoom-caption .snap-title { font-size: 28px; }
.zoom-caption .snap-note { font-size: 20px; margin-top: 6px; }
.zoom-caption .snap-sub { display: block; margin-top: 8px; font: 10px/1.4 var(--sans); letter-spacing: 1.6px; text-transform: uppercase; color: var(--muted); }
.zoom-more { margin: 4px 0 22px; }
.zoom-more[hidden] { display: none; }
.zoom-close, .zoom-step {
  position: absolute; display: flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--paper-light); color: var(--green); box-shadow: 0 3px 8px #00000066;
  font: 26px/1 var(--serif);
}
.zoom-close { top: -16px; right: -16px; background: var(--red); color: var(--paper-light); font-size: 24px; }
.zoom-step { top: 50%; margin-top: -22px; }
.zoom-prev { left: max(12px, calc(50% - 440px)); }
.zoom-next { right: max(12px, calc(50% - 440px)); }
.zoom-close:hover, .zoom-step:hover { background: var(--gold); color: var(--green); }
.zoom button:focus-visible, .zoom a:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
@keyframes zoom-in { from { opacity: 0; transform: rotate(-4deg) scale(.86); } }
@media (max-width: 600px) {
  .zoom-card { max-width: 92vw; padding: 10px 10px 0; }
  .zoom-card img { max-height: calc(100vh - 380px); max-height: calc(100dvh - 380px); }
  .zoom-step { position: fixed; }
  .zoom-caption .snap-title { font-size: 24px; }
  .zoom-caption .snap-note { font-size: 18px; }
  .zoom-close { top: -14px; right: -10px; }
  .zoom-step { top: auto; bottom: 18px; margin: 0; }
  .zoom-prev { left: calc(50% - 60px); }
  .zoom-next { right: calc(50% - 60px); }
  .zoom[open] { padding: 26px 0 84px; }
}
@media (prefers-reduced-motion: reduce) { .zoom-card { animation: none; } }
