/* The account page's personality: the doorman bird, rubber stamps, the press pass, the perches, the cat, the flock and
   the edition switch. Colours come from the shared tokens, except the bird's own feather cream, which the closed eyelids
   must match in both editions because the drawing does not change at night. */
:root { --bird-cream: #f5eee0; --bird-ink: #1b1a18; }

/* ---------- Header and footer extras */
.header-right, .footer-right { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; justify-content: flex-end; }
.edition-toggle, .sound-toggle, .quip {
  border: 0; background: none; padding: .15rem .35rem; font: inherit; letter-spacing: inherit; text-transform: uppercase; color: inherit;
}
.edition-toggle { border: 1px solid currentColor; }
.edition-toggle:hover, .sound-toggle:hover, .quip:hover { background: var(--acid); color: var(--on-bright); }
.sound-toggle[aria-pressed="false"] { text-decoration: line-through; }
.quip { transition: opacity var(--duration-med) var(--ease); }
.quip.swap { opacity: 0; }

/* ---------- The doorman */
.perch { position: relative; flex: none; width: 9.5rem; height: 9.5rem; }
.perch::before {
  content: ""; position: absolute; inset: .6rem .4rem 0 .6rem; background: var(--paper-deep); border: 1px solid var(--line-strong);
  box-shadow: -.6rem .6rem 0 var(--coral); transform: rotate(-2deg);
}
.bird { position: absolute; inset: 0; border: 0; padding: 0; background: none; cursor: pointer; z-index: 2; -webkit-tap-highlight-color: transparent; }
.bird:hover { background: none; }
.bird:focus-visible { outline-offset: -2px; }
.bird-body { position: absolute; inset: -.3rem; display: block; transform-origin: 50% 88%; animation: bird-bob 3.4s ease-in-out infinite; }
.bird-body img { display: block; width: 100%; height: 100%; user-select: none; -webkit-user-drag: none; }
.lid {
  position: absolute; width: 5.6%; height: 5.4%; border-radius: 50%; background: var(--bird-cream);
  border-bottom: 2px solid var(--bird-ink); transform: scaleY(0); transform-origin: 50% 0; transition: transform 70ms linear;
}
.lid-left { left: 28.9%; top: 25%; }
.lid-right { left: 43.8%; top: 24%; }
.bird.blink .lid, .bird[data-mood="asleep"] .lid { transform: scaleY(1); }
.bird[data-mood="asleep"] .lid { transition-duration: 400ms; }

.bird[data-mood="waiting"] .bird-body { animation: bird-lean 900ms ease-in-out infinite alternate; }
.bird[data-mood="happy"] .bird-body { animation: bird-hop 520ms cubic-bezier(.3,.7,.4,1) 2; }
.bird[data-mood="petted"] .bird-body { animation: bird-squish 360ms ease-out 1; }
.bird[data-mood="ruffled"] .bird-body { animation: bird-ruffle 110ms linear 6, bird-puff 700ms ease-out 1; }
.bird[data-mood="asleep"] .bird-body { animation: bird-breathe 4.8s ease-in-out infinite; }

@keyframes bird-bob { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-3px) rotate(1.5deg); } }
@keyframes bird-lean { from { transform: rotate(-4deg) translateX(-2px); } to { transform: rotate(-13deg) translateX(-8px); } }
@keyframes bird-hop {
  0% { transform: translateY(0) scale(1, 1); } 18% { transform: translateY(0) scale(1.08, .9); }
  45% { transform: translateY(-26px) scale(.94, 1.08) rotate(-4deg); } 75% { transform: translateY(0) scale(1.06, .94); } 100% { transform: translateY(0) scale(1, 1); }
}
@keyframes bird-squish { 0% { transform: scale(1); } 35% { transform: scale(1.12, .86); } 70% { transform: scale(.96, 1.05); } 100% { transform: scale(1); } }
@keyframes bird-ruffle { 0%, 100% { translate: 0; } 25% { translate: -3px 0; } 75% { translate: 3px 0; } }
@keyframes bird-puff { 0% { scale: 1; } 30% { scale: 1.16; } 100% { scale: 1.04; } }
@keyframes bird-breathe { 0%, 100% { transform: scale(1) rotate(3deg); } 50% { transform: scale(1.035, 1.015) rotate(3deg); } }

.bird-fx { position: absolute; inset: 0; pointer-events: none; overflow: visible; }
.fx {
  position: absolute; top: 12%; font-family: var(--mono); font-weight: 700; font-size: 1.25rem; color: var(--coral-ink);
  animation: fx-float 1.5s ease-out forwards; text-shadow: 0 0 2px var(--paper);
}
.fx.zz { color: var(--teal-ink); font-size: 1rem; animation-duration: 2.6s; }
@keyframes fx-float {
  0% { opacity: 0; transform: translate(0, 10px) scale(.6); } 15% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--dx, 10px), -70px) scale(1.15) rotate(var(--rot, 0deg)); }
}

/* ---------- Rubber stamps */
.stampable { position: relative; overflow: hidden; }
.stamp-slam {
  position: absolute; right: clamp(.75rem, 4vw, 2.5rem); top: clamp(.75rem, 3vw, 1.75rem); z-index: 3; pointer-events: none;
  font-family: var(--mono); font-weight: 700; font-size: clamp(1.1rem, 3.4vw, 2.1rem); letter-spacing: .14em; line-height: 1;
  padding: .45rem .85rem .4rem; border: .3rem double currentColor; border-radius: .35rem; color: var(--coral-ink);
  transform: rotate(var(--tilt, -9deg)); opacity: .88; white-space: nowrap;
  -webkit-mask-image: url('/fun/stamp-grit.svg'); mask-image: url('/fun/stamp-grit.svg');
  animation: stamp-slam 420ms cubic-bezier(.2, 1.5, .45, 1) both;
}
.stamp-slam.good { color: var(--teal-ink); }
.stamp-slam.neutral { color: var(--muted); }
@keyframes stamp-slam {
  0% { opacity: 0; transform: scale(2.8) rotate(calc(var(--tilt, -9deg) + 8deg)); }
  55% { opacity: .95; transform: scale(.9) rotate(var(--tilt, -9deg)); }
  100% { opacity: .88; transform: scale(1) rotate(var(--tilt, -9deg)); }
}
.thunk { animation: panel-thunk 260ms ease-out 180ms; }
@keyframes panel-thunk { 0%, 100% { translate: 0; } 30% { translate: 0 3px; } 60% { translate: 0 -1px; } }

/* ---------- The press pass */
.pass-slot { perspective: 900px; margin: 0 0 1.5rem; }
.press-pass {
  --rx: 0deg; --ry: 0deg; --mx: 50%;
  position: relative; max-width: 34rem; overflow: hidden; background: var(--surface); border: 1px solid var(--line-strong);
  box-shadow: 4px 4px 0 var(--paper-deep), 5px 5px 0 var(--ink), 10px 12px 0 var(--coral);
  transform: rotateX(var(--rx)) rotateY(var(--ry)) rotate(-1deg); transition: transform 160ms var(--ease);
}
.press-pass.printing { animation: pass-print 1.3s steps(14, end) both; }
@keyframes pass-print {
  from { clip-path: inset(0 0 100% 0); translate: 0 -1.5rem; }
  to { clip-path: inset(0 0 0 0); translate: 0 0; }
}
.pass-band {
  display: flex; justify-content: space-between; gap: 1rem; padding: .45rem .9rem; background: var(--coral); color: var(--on-bright);
  font-size: var(--text-control); font-weight: 700; letter-spacing: .14em;
}
.press-pass.admin .pass-band { background: var(--acid); }
.pass-body { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); gap: 1.1rem; padding: 1.1rem 1.1rem .6rem; }
.pass-photo { aspect-ratio: 4 / 5; overflow: hidden; display: grid; place-items: center; background: var(--paper-deep); border: 1px solid var(--line-strong); }
.pass-photo img { width: 125%; max-width: none; height: auto; }
.press-pass.admin .pass-photo img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; }
.pass-name { margin: 0; font-size: clamp(1.6rem, 4vw, 2.2rem); line-height: 1; letter-spacing: -.03em; overflow-wrap: anywhere; }
.pass-handle { margin: .35rem 0 .6rem; color: var(--muted); font-size: var(--text-sm); overflow-wrap: anywhere; }
.pass-facts { margin: 0; }
.pass-facts div { grid-template-columns: 5.5rem minmax(0, 1fr); gap: .5rem; padding: .3rem 0; }
.pass-facts dd { font-size: var(--text-sm); }
.pass-foot { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .5rem 1.1rem 1rem; flex-wrap: wrap; }
.barcode { display: block; width: 11rem; height: 2.2rem; }
.pass-motto { font-size: var(--text-label); letter-spacing: .1em; color: var(--muted); text-align: right; }
.pass-sheen {
  position: absolute; inset: 0; pointer-events: none; opacity: 0; mix-blend-mode: soft-light; transition: opacity var(--duration-med) var(--ease);
  background: linear-gradient(115deg, transparent 20%, var(--acid) calc(var(--mx) - 12%), var(--teal) var(--mx), var(--coral) calc(var(--mx) + 12%), transparent 80%);
}
.press-pass:hover .pass-sheen { opacity: .55; }
.session-bar { margin-bottom: 1rem; }
.cluster { display: flex; gap: .8rem; align-items: center; flex-wrap: wrap; }

/* ---------- Perches: the applications this person can open */
.perches { margin: 1.5rem 0 2.5rem; }
.perch-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 14rem), 1fr)); gap: 1rem; }
.perch-list a {
  display: flex; flex-direction: column; gap: .3rem; height: 100%; padding: 1rem 1.1rem 1.1rem; text-decoration: none; color: var(--ink);
  background: var(--paper-deep); border: 1px solid var(--line-strong); border-top: 4px solid var(--ink);
  transition: transform var(--duration-fast) var(--ease), box-shadow var(--duration-fast) var(--ease);
}
.perch-list a:hover { transform: translate(-3px, -3px); box-shadow: 6px 6px 0 var(--coral); }
.perch-list li:nth-child(3n+2) a:hover { box-shadow: 6px 6px 0 var(--teal); }
.perch-list li:nth-child(3n) a:hover { box-shadow: 6px 6px 0 var(--acid); }
.perch-no { font-family: var(--mono); font-size: var(--text-label); color: var(--muted); letter-spacing: .1em; }
.perch-name { font-size: 1.7rem; line-height: 1.05; }
.perch-blurb { font-family: var(--serif-text); font-size: var(--text-sm); color: var(--muted); }
.perch-host { margin-top: auto; padding-top: .4rem; font-family: var(--mono); font-size: var(--text-label); color: var(--teal-ink); overflow-wrap: anywhere; }

/* ---------- The cat, who is curious about the bird */
.stalker {
  position: fixed; right: 0; top: 4.5rem; z-index: 20; width: clamp(9rem, 24vw, 16rem); pointer-events: none;
  transform: translateX(115%) rotate(-14deg); transition: transform 1.3s var(--ease);
  -webkit-mask-image: radial-gradient(closest-side, #000 60%, transparent 100%); mask-image: radial-gradient(closest-side, #000 60%, transparent 100%);
}
.stalker img { display: block; width: 100%; height: auto; }
.stalker.peek { transform: translateX(40%) rotate(-14deg); }
.stalker.lunge { transform: translateX(18%) rotate(-6deg); transition-duration: .35s; }

/* ---------- The flock */
.flock { position: fixed; inset: 0; z-index: 25; pointer-events: none; overflow: hidden; }
.flock img { position: absolute; left: 0; top: 0; height: auto; }

@media (max-width: 600px) {
  .perch { width: 6rem; height: 6rem; }
  .pass-body { grid-template-columns: 5.5rem minmax(0, 1fr); }
  .header-right { gap: .5rem; }
}

@media (prefers-reduced-motion: reduce) {
  .bird-body, .bird[data-mood] .bird-body { animation: none !important; }
  .fx { animation-duration: 1ms; }
  .stamp-slam, .thunk, .press-pass.printing { animation: none; }
  .press-pass { transition: none; }
  .stalker { transition: opacity .4s; transform: translateX(40%) rotate(-14deg); opacity: 0; }
  .stalker.peek, .stalker.lunge { opacity: 1; }
}
