/* Collection features: the collection-specific content at the start of each collection (collections.css has
   the strip around them). Pixie C0res: the process card in a film strip; Rubians: polaroids; Zencyclopedia: the comic
   viewer. A new collection's feature gets its own block here */

/* Part title (shared .works-title pill), smaller here */
.collection .works-title { margin: 0 0 16px; font-size: 1.2rem; }
.collection .works-title .icon { width: 26px; }

/* Process: the drawing one stage at a time, on a paper card in an ink film strip. A click or tap transforms
   the card into the next stage (script.js: a magic dissolve, or a round wipe where WebGL can't run); the steps
   show where it is, under the card on phones and beside it from tablets up. To show the card can be tapped,
   a tag hangs off it ("tap to transform!") and a shine sweeps across it until the first tap */
.process-reel {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 40px;
  padding: 36px 16px;
  border: var(--line);
  border-radius: var(--radius);
  background: var(--ink);
  box-shadow: 6px 6px 0 var(--accent);
}
/* The film strip's sprocket holes: color-2 cut out by a mask, so they follow the theme */
.process-reel::before, .process-reel::after {
  position: absolute;
  left: 18px;
  right: 18px;
  height: 12px;
  content: "";
  background: var(--color-2);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='30' height='12' viewBox='0 0 30 12'%3E%3Crect x='8' y='1' width='14' height='10' rx='3'/%3E%3C/svg%3E") 0 0 / 30px 12px repeat-x;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='30' height='12' viewBox='0 0 30 12'%3E%3Crect x='8' y='1' width='14' height='10' rx='3'/%3E%3C/svg%3E") 0 0 / 30px 12px repeat-x;
  opacity: .85;
}
.process-reel::before { top: 13px; }
.process-reel::after { bottom: 13px; }
.process-card { position: relative; display: block; width: min(100%, 300px); padding: 0; border: 0; background: none; color: var(--ink); font: inherit; cursor: pointer; }
.process-frame { display: block; padding: 8px; border-radius: 14px; background: var(--paper); transform: rotate(-2deg); transition: transform .3s cubic-bezier(.34, 1.56, .64, 1); }
.process-card.is-morphing .process-frame { animation: process-wobble .8s ease-in-out; }
.process-media { position: relative; display: block; aspect-ratio: 1; border: var(--line); border-radius: 10px; background: var(--paper); overflow: hidden; }
/* The stages are stacked, only the shown one visible; the shader's canvas (script.js) covers them while it runs */
.process-media > img, .process-canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: cover; }
.process-media > img.is-wiping { animation: process-wipe .5s ease-out; }
.process-media::after {
  position: absolute;
  inset: 0;
  content: "";
  background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, .6) 50%, transparent 65%);
  transform: translateX(-100%);
  animation: process-shine 4s ease-in-out 1.5s infinite;
  pointer-events: none;
}
.process-card.is-touched .process-media::after { display: none; }
/* The tag, like the hero's About button; it nudges until the first tap */
.process-hint {
  position: absolute;
  left: 50%;
  bottom: -22px;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 14px 4px 18px;
  border: 2.5px solid var(--ink);
  border-radius: 99px;
  background: var(--color-2);
  box-shadow: 3px 3px 0 var(--accent);
  font-family: var(--font-hand);
  font-size: 1.3rem;
  line-height: 1.1;
  white-space: nowrap;
  transform: translateX(-50%) rotate(-4deg);
  animation: process-nudge 2s ease-in-out infinite;
  transition: background-color .2s;
}
.process-card.is-touched .process-hint { animation: none; }
/* On the last stage ("tap to start over!") the tag turns color-3 */
.process-card.is-last .process-hint { background: var(--color-3); }
.process-hint svg { width: 16px; height: 16px; fill: var(--accent); stroke: var(--ink); stroke-width: 1.4px; animation: twinkle 2.4s ease-in-out infinite; }
.process-card:active .process-frame { transform: rotate(-2deg) scale(.97); }

/* Steps: numbered dots joined by a dashed line (--step-line), the shown stage filled in */
.process-steps { --step-line: var(--color-1); display: flex; width: 100%; margin: 0; padding: 0; list-style: none; }
.process-step { position: relative; display: grid; flex: 1 1 0; justify-items: center; gap: 6px; color: var(--paper); font-family: var(--font-hand); font-size: 1.15rem; line-height: 1; text-align: center; opacity: .6; transition: opacity .3s; }
.process-step[aria-current] { opacity: 1; }
.process-step:not(:last-child)::after {
  position: absolute;
  top: 14px;
  left: calc(50% + 21px);
  right: calc(-50% + 21px);
  height: 3px;
  content: "";
  background: repeating-linear-gradient(90deg, var(--step-line) 0 6px, transparent 6px 11px);
}
.process-num { display: grid; place-items: center; width: 30px; height: 30px; border: 2.5px solid var(--paper); border-radius: 50%; color: var(--paper); font-family: var(--font-display); font-size: 1rem; line-height: 1; transition: transform .3s cubic-bezier(.34, 1.56, .64, 1), background-color .2s; }
.process-step[aria-current] .process-num { border-color: var(--ink); background: var(--accent); color: var(--on-accent); transform: scale(1.18) rotate(-8deg); }

@keyframes process-shine { 0%, 55% { transform: translateX(-100%); } 85%, 100% { transform: translateX(100%); } }
@keyframes process-nudge { 0%, 100% { transform: translateX(-50%) rotate(-4deg); } 50% { transform: translateX(-50%) rotate(-1deg) scale(1.07); } }
@keyframes process-wobble { 0%, 100% { transform: rotate(-2deg); } 25% { transform: rotate(1deg) scale(1.03); } 60% { transform: rotate(-3deg) scale(1.01); } }
/* --x, --y: where the card was tapped (script.js) */
@keyframes process-wipe { from { clip-path: circle(0 at var(--x) var(--y)); } to { clip-path: circle(150% at var(--x) var(--y)); } }

/* Polaroids: a mini gallery of tilted, taped photos that overlap; the hovered one comes to the front.
   Each opens the lightbox, stepping through its gallery. Phones: two side by side, the third tucked under
   them in the middle; from tablets up all in one row */
.polaroids { display: flex; flex-wrap: wrap; justify-content: center; margin: 0; padding: 14px 0 0; list-style: none; }
.polaroids > li { flex: 0 0 52%; min-width: 0; --tilt: -5deg; }
.polaroids > li + li { margin-left: -8%; }
.polaroids > li:nth-child(3n+2) { --tilt: 4deg; margin-top: 30px; }
.polaroids > li:nth-child(3n) { --tilt: -2deg; }
.polaroids > li:nth-child(3) { margin: -14px 0 0; }
.polaroid {
  position: relative;
  display: block;
  width: 100%;
  padding: 8px 8px 0;
  border: var(--line);
  border-radius: 6px;
  background: var(--paper);
  box-shadow: var(--shadow);
  color: var(--ink);
  font: inherit;
  cursor: zoom-in;
  transform: rotate(var(--tilt));
  transition: transform .35s cubic-bezier(.34, 1.56, .64, 1);
}
.polaroid:focus-visible { z-index: 2; transform: rotate(0) translateY(-10px) scale(1.06); }
/* A strip of washi tape holding each photo */
.polaroid::before { position: absolute; top: -11px; left: 50%; width: 56px; height: 20px; content: ""; border: 2px solid var(--ink); background: color-mix(in srgb, var(--color-2) 85%, transparent); transform: translateX(-50%) rotate(-4deg); }
.polaroids > li:nth-child(even) .polaroid::before { background: color-mix(in srgb, var(--color-3) 75%, transparent); transform: translateX(-50%) rotate(5deg); }
.polaroid img { width: 100%; height: auto; aspect-ratio: 1; border: 2px solid var(--ink); object-fit: cover; }
.polaroid-caption { display: block; padding: 7px 0 9px; font-family: var(--font-hand); font-size: 1.25rem; line-height: 1; text-align: center; }

/* Comic viewer (Zencyclopedia's whole content): one comic at a time in a paper frame (it opens the
   lightbox) on a stack of tilted colored pages, with swirls and stars peeking out behind it. Square color-1
   arrows on its sides step through the comics (script.js); a caption box shows the title and the page
   count. Deliberately unlike the round collection switcher */
.comic-viewer { max-width: 800px; margin: 0 auto; padding: 10px 6px 0; }
.comic-stage { position: relative; isolation: isolate; }
/* The stacked pages behind the comic */
.comic-stage::before, .comic-stage::after { position: absolute; inset: 0; z-index: -1; content: ""; border: var(--line); border-radius: 18px; }
.comic-stage::before { background: var(--color-3); transform: translate(-6px, 6px) rotate(-3deg); }
.comic-stage::after { background: var(--color-1); transform: translate(7px, 7px) rotate(2.5deg); }
.comics { position: relative; z-index: 1; margin: 0; padding: 0; list-style: none; }
.comics > li { animation: rise .35s cubic-bezier(.34, 1.3, .64, 1); }
.comic { display: block; width: 100%; padding: 6px; border: var(--line); border-radius: 14px; background: var(--paper); box-shadow: var(--shadow); cursor: zoom-in; transition: transform .3s cubic-bezier(.34, 1.56, .64, 1); }
.comic:focus-visible { transform: translateY(-4px) rotate(-.6deg); }
.comic img { width: 100%; height: auto; border: 2px solid var(--ink); border-radius: 8px; background: var(--paper); }

/* Flourishes: brand swirl icons curling out from behind opposite corners; brand-icon stars around the edges */
.comic-flourish { position: absolute; z-index: -2; width: 100px; }
.comic-flourish-1 { left: -8px; bottom: -52px; }
.comic-flourish-2 { right: -8px; top: -52px; transform: scale(-1, -1); }
.comic-star { position: absolute; }
.comic-star-1 { top: -22px; left: -18px; width: 46px; animation: bob 4.2s ease-in-out infinite; }
.comic-star-2 { top: -18px; right: 16%; width: 30px; animation: twinkle 2.4s ease-in-out infinite; }
.comic-star-3 { bottom: -22px; left: 24%; width: 28px; animation: twinkle 2.4s ease-in-out -1.2s infinite; }
.comic-star-4 { right: -14px; bottom: -22px; width: 40px; animation: bob 4.8s ease-in-out -1.6s infinite; }

.comic-arrow {
  position: absolute;
  top: 50%;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: var(--line);
  border-radius: 12px;
  background: var(--color-1);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transform: translateY(-50%) rotate(-5deg);
  transition: transform .25s cubic-bezier(.34, 1.56, .64, 1), background-color .2s;
}
.comic-prev { left: -16px; }
.comic-next { right: -16px; transform: translateY(-50%) rotate(5deg); }
.comic-arrow:active { background: var(--color-3); transform: translateY(-50%) scale(.94); }
.comic-arrow svg { width: 22px; height: 22px; fill: none; stroke: var(--ink); stroke-width: 3.4; stroke-linecap: round; stroke-linejoin: round; }

/* Caption box: the title, with the page count on an ink tag */
.comic-caption { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 10px; margin: 30px 0 0; }
.comic-title { padding: 6px 18px; border: var(--line); border-radius: 6px; background: var(--paper); box-shadow: var(--shadow-sm); font-family: var(--font-display); font-size: 1.1rem; line-height: 1.1; transform: rotate(-1.5deg); }
.comic-count { padding: 4px 12px; border-radius: 99px; background: var(--ink); color: var(--paper); font-size: .85rem; font-weight: 900; letter-spacing: .08em; transform: rotate(3deg); }

/* Hover effects only where there's a mouse: on phones a tap would leave them stuck on */
@media (hover: hover) {
  .process-card:hover .process-frame { transform: rotate(0) scale(1.03); }
  .process-card:hover .process-hint { background: var(--color-1); }
  .process-card:active .process-frame { transform: rotate(0) scale(.98); }
  .polaroid:hover { z-index: 2; transform: rotate(0) translateY(-10px) scale(1.06); }
  .comic:hover { transform: translateY(-4px) rotate(-.6deg); }
  .comic-arrow:hover { background: var(--color-3); transform: translateY(-50%) scale(1.1); }
}

@media (min-width: 681px) {
  .collection .works-title { font-size: 1.3rem; }
  /* The card with the steps listed down its right side */
  .process-reel { grid-template-columns: minmax(0, 330px) auto; justify-content: center; align-items: center; gap: 30px 48px; padding: 44px 30px 56px; box-shadow: 8px 8px 0 var(--accent); }
  .process-card { width: 100%; }
  .process-steps { flex-direction: column; gap: 22px; width: auto; }
  .process-step { display: flex; flex: none; align-items: center; gap: 14px; font-size: 1.6rem; text-align: left; }
  .process-step:not(:last-child)::after { top: 100%; left: 19px; right: auto; width: 3px; height: 22px; background: repeating-linear-gradient(180deg, var(--step-line) 0 6px, transparent 6px 11px); }
  .process-num { width: 40px; height: 40px; font-size: 1.2rem; }
  .polaroids { flex-wrap: nowrap; }
  .polaroids > li { flex: 0 1 290px; }
  .polaroids > li + li { margin-left: -34px; }
  .polaroids > li:nth-child(3) { margin: 0 0 0 -34px; }
  .polaroid { padding: 12px 12px 0; }
  .polaroid::before { top: -13px; width: 76px; height: 24px; }
  .polaroid-caption { padding: 10px 0 12px; font-size: 1.55rem; }
  .comic-viewer { padding: 14px 0 0; }
  .comic { padding: 10px; border-radius: 18px; }
  .comic img { border-radius: 10px; }
  .comic-stage::before { transform: translate(-10px, 8px) rotate(-3deg); }
  .comic-stage::after { transform: translate(12px, 10px) rotate(2.5deg); }
  .comic-flourish { width: 220px; }
  .comic-flourish-1 { left: -160px; bottom: -46px; }
  .comic-flourish-2 { right: -160px; top: -46px; }
  .comic-star-1 { top: -36px; left: -42px; width: 76px; }
  .comic-star-2 { top: -28px; width: 46px; }
  .comic-star-3 { bottom: -32px; width: 40px; }
  .comic-star-4 { right: -38px; bottom: -30px; width: 62px; }
  .comic-arrow { width: 56px; height: 56px; border-radius: 16px; }
  .comic-prev { left: -28px; }
  .comic-next { right: -28px; }
  .comic-arrow svg { width: 28px; height: 28px; }
  .comic-caption { margin-top: 36px; }
  .comic-title { font-size: 1.35rem; }
}

@media (min-width: 901px) {
  .process-reel { grid-template-columns: minmax(0, 380px) auto; column-gap: 64px; }
}
