/* The cover: the family photo is the menu. */

.cover {
  --mast-h: clamp(88px, 15vh, 156px);
  --frame: 6px;
  min-height: 100svh;
  display: grid;
  grid-template-rows: var(--mast-h) 1fr;
  background: var(--yellow);
}

/* ---------- masthead ---------- */
.masthead {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: clamp(.6rem, 2vw, 2rem);
  padding: 0 clamp(.8rem, 2.5vw, 2.5rem);
  border-bottom: var(--rule-thick) solid var(--ink);
  overflow: hidden;
}
.masthead__no, .masthead__ed {
  margin: 0;
  font-family: var(--f-mast);
  text-transform: uppercase;
  line-height: 1;
  border: 4px solid var(--ink);
  background: #fff;
  padding: .45em .6em;
  font-size: clamp(.7rem, 1.25vw, 1.05rem);
  text-align: center;
}
.masthead__no b { display: block; font-size: 2.3em; font-weight: 400; color: var(--red); }
.masthead__ed { background: var(--red); color: #fff; transform: rotate(4deg); }
.masthead__title {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: .18em;
  font-family: var(--f-mast);
  font-weight: 400;
  text-transform: uppercase;
  font-size: clamp(1.7rem, min(6.4vw, 9.5vh), 6rem);
  letter-spacing: -.01em;
  line-height: .9;
  white-space: nowrap;
}
.masthead__name {
  color: var(--red);
  -webkit-text-stroke: .045em var(--ink);
  paint-order: stroke fill;
  text-shadow: .06em .06em 0 var(--blue);
}
.masthead__fam {
  font-size: .78em;
  color: var(--yellow);
  background: var(--ink);
  padding: .08em .22em .12em;
  transform: rotate(-5deg) translateY(-.06em);
  display: inline-block;
}

/* ---------- stage ---------- */
.cover__body {
  display: grid;
  place-items: center;
  padding: var(--gutter);
  min-height: 0;
}
.stage {
  position: relative;
  width: min(100%, calc((100svh - var(--mast-h) - var(--rule-thick) - 2 * var(--gutter)) * 1.4556));
  aspect-ratio: 2048 / 1407;
  border: var(--frame) solid var(--ink);
  background: var(--ink);
  touch-action: manipulation;
  cursor: default;
  -webkit-tap-highlight-color: transparent;
}
.stage.has-active { cursor: pointer; }
.stage__photo {
  width: 100%; height: 100%;
  object-fit: cover;
  /* resting: the real photo in full colour; greys out only while someone is picked */
  filter: grayscale(0) contrast(1) brightness(1);
  transition: filter .45s var(--ease-out);
}
.stage__screen {
  position: absolute; inset: 0;
  background-image: radial-gradient(circle at center, rgba(20, 20, 20, .5) 26%, transparent 30%);
  background-size: 5px 5px;
  mix-blend-mode: multiply;
  opacity: 0;
  pointer-events: none;
  transition: opacity .45s var(--ease-out);
}
.stage.has-active .stage__photo { filter: grayscale(1) contrast(1.05) brightness(.5); }
.stage.has-active .stage__screen { opacity: .85; }

.stage__figures { position: absolute; inset: 0; pointer-events: none; }
.cutout {
  position: absolute;
  height: auto;
  max-width: none;
  opacity: 0;
  transform-origin: 50% 100%;
  transform: scale(1);
  filter: url(#ink-pop) drop-shadow(0 14px 18px rgba(0, 0, 0, .55));
  transition: opacity .18s linear, transform .5s var(--ease-pop);
  will-change: transform, opacity;
}
.cutout.is-on { opacity: 1; transform: scale(1.08); z-index: 2; }

/* focus targets sit on each face (keyboard + screen readers); pointer uses the photo map */
.stage__hits { position: absolute; inset: 0; }
.hit {
  position: absolute;
  translate: -50% -50%;
  border-radius: 50%;
  pointer-events: none;
}
.hit:focus-visible { outline: 4px solid var(--yellow); outline-offset: 4px; }

/* ---------- the trait label above the head ---------- */
.stage__label {
  position: absolute;
  left: 0; top: 0;
  z-index: 5;
  pointer-events: none;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  opacity: 0;
  transform: translate(-50%, -100%);
}
.stage__label.is-on { opacity: 1; }
.stage__label .sfx { --sfx-size: clamp(1.5rem, 3.4vw, 3.1rem); }
.stage__label .sfx { animation: print-pop .55s var(--ease-pop) both; }
.stage__label .who {
  font-family: var(--f-letter);
  font-size: clamp(.85rem, 1.15vw, 1.05rem);
  line-height: 1;
  background: #fff;
  border: 3px solid var(--ink);
  padding: .3em .6em;
  white-space: nowrap;
  animation: print-pop .55s .06s var(--ease-pop) both;
}
.stage__label .who b { font-weight: 400; color: var(--red); }
.stage__label.is-on .sfx--relax .l { animation: drift 3s ease-in-out infinite alternate; animation-delay: calc(var(--i) * -.3s); }
.stage__label.is-on .sfx--ineng { animation: print-pop .55s var(--ease-pop) both, tremble .18s .55s linear 6; }
.stage__label.is-on .sfx--bunso .l { animation: bob 1.4s ease-in-out infinite alternate; animation-delay: calc(var(--i) * -.18s); }
/* letters stay hidden only while they wait their turn; nothing relies on a forward fill */
.stage__label.is-on .sfx--pasensya .l { animation: type-in 1ms linear backwards; animation-delay: calc(var(--i) * 90ms); }
.stage__label.is-on .sfx--totoy .l { animation: hop .5s var(--ease-pop) both; animation-delay: calc(var(--i) * 45ms); }

@keyframes print-pop {
  0% { opacity: 0; transform: scale(.3) rotate(-6deg); filter: drop-shadow(6px -4px 0 var(--cyan)) drop-shadow(-5px 4px 0 var(--magenta)); }
  60% { opacity: 1; }
  100% { transform: scale(1) rotate(var(--r, 0deg)); filter: drop-shadow(0 0 0 transparent); }
}
@keyframes drift { to { translate: 0 -5px; } }
@keyframes bob { to { translate: 0 -7px; } }
@keyframes tremble { 25% { translate: -2px 1px; } 50% { translate: 2px -1px; } 75% { translate: -1px -2px; } }
@keyframes type-in { from, to { opacity: 0; } }
@keyframes hop { from { translate: 0 18px; opacity: 0; } to { translate: 0 0; opacity: 1; } }

.stage__hint {
  position: absolute;
  left: clamp(8px, 1.6%, 22px);
  top: clamp(8px, 2.2%, 24px);
  z-index: 4;
  margin: 0;
  font-size: clamp(.85rem, 1.3vw, 1.2rem);
  transition: opacity .3s var(--ease-out), transform .3s var(--ease-out);
}
.stage.has-active .stage__hint { opacity: 0; transform: translateY(-6px); }
.hint--touch { display: none; }
@media (hover: none) {
  .hint--touch { display: inline; }
  .hint--pointer { display: none; }
}

/* ---------- the cast (below the cover) ---------- */
.cast {
  background: var(--ink);
  padding: clamp(2.5rem, 6vw, 5rem) var(--gutter) var(--gutter);
}
.cast__head {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 1rem 2.5rem;
  padding: 0 clamp(.5rem, 2vw, 1.5rem) clamp(1.5rem, 3vw, 2.5rem);
}
.cast__head h2 {
  font-family: var(--f-mast);
  font-weight: 400;
  text-transform: uppercase;
  font-size: clamp(2.6rem, 8vw, 6rem);
  color: var(--yellow);
  text-shadow: .05em .05em 0 var(--red);
}
.cast__balloon { max-width: 24rem; font-size: 1.2rem; margin-bottom: 1.6rem; --tail-x: 12%; --tail-skew: 40deg; }

.cast__grid {
  list-style: none; margin: 0; padding: 0;
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-auto-rows: clamp(220px, 26vw, 360px);
  gap: var(--gutter);
}
.panel { position: relative; grid-column: span 4; }
.panel:nth-child(1) { grid-column: span 5; }
.panel:nth-child(3) { grid-column: span 3; }
.panel:nth-child(4) { grid-column: span 3; }
.panel:nth-child(5) { grid-column: span 6; }
.panel:nth-child(6) { grid-column: span 3; }
.panel:nth-child(10) { grid-column: span 6; }
.panel:nth-child(11), .panel:nth-child(12) { grid-column: span 3; }
.panel:nth-child(13) { grid-column: span 3; }
.panel:nth-child(15) { grid-column: span 5; }

.panel a {
  position: absolute; inset: 0;
  display: block;
  overflow: hidden;
  background: var(--panel, #fff);
  color: var(--ink);
  text-decoration: none;
  isolation: isolate;
}
.panel a::before {
  content: "";
  position: absolute; inset: 0;
  z-index: 1;
  mix-blend-mode: multiply;
  background-image: radial-gradient(circle at center, rgba(20, 20, 20, .18) 26%, transparent 30%);
  background-size: 8px 8px;
  -webkit-mask-image: linear-gradient(200deg, #000, transparent 70%);
          mask-image: linear-gradient(200deg, #000, transparent 70%);
  pointer-events: none;
}
.panel--dark a { color: #fff; }
.panel--dark a::before { background-image: radial-gradient(circle at center, rgba(255, 255, 255, .14) 26%, transparent 30%); }
.panel__world {
  position: absolute; left: 0; top: 0;
  transform-origin: 0 0;
}
.panel__photo {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  max-width: none;
  filter: grayscale(1) contrast(1.15) brightness(1.1);
}
.panel__tint {
  position: absolute; inset: 0;
  background: var(--panel, #fff);
  mix-blend-mode: multiply;
}
.panel--dark .panel__tint { background: #3a3a3a; }
.panel__fig {
  position: absolute;
  height: auto;
  max-width: none;
  filter: url(#ink-outline-wide);
  transform-origin: 50% 100%;
  transition: transform .5s var(--ease-pop);
}
.panel__name {
  position: absolute; left: 0; top: 0; z-index: 2;
  margin: 0;
  font-family: var(--f-letter);
  font-size: 1.15rem;
  line-height: 1.1;
  background: var(--yellow);
  color: var(--ink);
  border-right: 3px solid var(--ink);
  border-bottom: 3px solid var(--ink);
  padding: .4em .7em;
}
.panel__name small { display: block; font-size: .8em; opacity: .75; }
.panel__sfx { position: absolute; right: 6%; bottom: 8%; z-index: 3; }
.panel__sfx .sfx { --sfx-size: clamp(1.4rem, 2.6vw, 2.3rem); transform-origin: 100% 100%; }
.panel a:hover .panel__fig, .panel a:focus-visible .panel__fig { transform: scale(1.07) rotate(-1.5deg); }
.panel a:focus-visible { outline: 5px solid var(--yellow); outline-offset: -5px; }

/* ---------- colophon ---------- */
.colophon { background: var(--ink); color: #fff; }
.colophon__line {
  margin: 0; padding: clamp(2rem, 5vw, 3.5rem) var(--gutter) 1.5rem;
  text-align: center;
  font-size: 1.3rem;
}
.colophon__line b { font-family: var(--f-mast); font-weight: 400; color: var(--yellow); }

/* ---------- small screens ---------- */
@media (max-width: 760px) {
  .cover { --mast-h: auto; min-height: auto; grid-template-rows: auto auto; }
  .masthead { grid-template-columns: 1fr auto; padding: .7rem .8rem; row-gap: .4rem; }
  .masthead__no { display: none; }
  .masthead__title { justify-content: flex-start; font-size: clamp(1.45rem, 8.4vw, 2.6rem); flex-wrap: wrap; white-space: normal; }
  .masthead__ed { font-size: .7rem; }
  .stage { width: 100%; --frame: 4px; }
  .stage__hint { font-size: .8rem; }
  .cast__grid { grid-template-columns: repeat(2, 1fr); grid-auto-rows: 250px; }
  .panel, .panel:nth-child(n) { grid-column: span 1; }
  .panel:nth-child(5n+1) { grid-column: span 2; }
}
