:root {
  --pond: #005897;
  --pond-deep: #003e6d;
  --felt: #7aaf32;
  --felt-deep: #4e7a18;
  --collar: #e6c84a;
  --mouth: #c4453a;
  --paper: #f3ede0;
  --ink: #143018;
  --ink-muted: #3d5c48;
  --mist: #e7f3fb;
  --font-display: "Fraunces", "Iowan Old Style", Palatino, Georgia, serif;
  --font-sans: "Outfit", ui-sans-serif, system-ui, sans-serif;
  --shadow-paper: 0 18px 40px -24px rgb(0 20 40 / 0.45), 0 1px 0 rgb(255 255 255 / 0.35) inset;
  --radius-xl: 28px;
}

* { box-sizing: border-box; }

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
}

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--pond);
  color: var(--mist);
  font-family: var(--font-sans);
}

button:not(:disabled),
[role="button"]:not(:disabled) {
  cursor: pointer;
}

.pond {
  position: relative;
  isolation: isolate;
  min-height: 100dvh;
  background:
    radial-gradient(ellipse 90% 70% at 50% 28%, #0870ae 0%, transparent 58%),
    radial-gradient(ellipse 70% 50% at 50% 100%, #00345c 0%, transparent 55%),
    var(--pond);
  overflow: clip;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}

.pond-grain,
.pond-reeds {
  pointer-events: none;
  position: absolute;
  inset: 0;
}

.pond-grain {
  z-index: 8;
  opacity: 0.07;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.55 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

.pond-reeds {
  inset: auto 0 0 0;
  height: 22vh;
  z-index: 2;
  background:
    radial-gradient(120% 90% at 8% 120%, #0b3a12 0 42%, transparent 43%),
    radial-gradient(90% 80% at 22% 130%, #145218 0 38%, transparent 39%),
    radial-gradient(100% 85% at 48% 125%, #0d4214 0 44%, transparent 45%),
    radial-gradient(80% 70% at 74% 128%, #163f12 0 36%, transparent 37%),
    radial-gradient(110% 90% at 94% 122%, #0a3310 0 40%, transparent 41%);
  opacity: 0.28;
}

.shell {
  position: relative;
  z-index: 10;
  margin: 0 auto;
  min-height: 100dvh;
  max-width: 72rem;
  display: flex;
  flex-direction: column;
  padding: 1.25rem 1.25rem 2.5rem;
  pointer-events: none;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  margin: 0;
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: color-mix(in oklab, var(--mist) 75%, transparent);
}

.tag {
  margin: 0;
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: color-mix(in oklab, var(--mist) 55%, transparent);
}

.layout {
  flex: 1;
  display: grid;
  align-items: center;
  gap: 0.25rem;
}

.portrait-col {
  position: relative;
  display: flex;
  justify-content: center;
}

.kermit-stage {
  --tilt-x: 0deg;
  --tilt-y: 0deg;
  transform: perspective(900px) rotateX(var(--tilt-x)) rotateY(var(--tilt-y));
  transform-origin: 50% 60%;
  transition: transform 180ms cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}

.kermit-stage.is-eating {
  animation: kermit-gulp 420ms cubic-bezier(0.22, 1, 0.36, 1);
}

.kermit-bob {
  animation: kermit-bob 4.6s ease-in-out infinite;
  transform-origin: 50% 80%;
}

.kermit-btn {
  position: relative;
  display: block;
  padding: 0;
  border: 0;
  background: transparent;
  pointer-events: auto;
}

.kermit-btn:focus-visible {
  outline: 2px solid var(--collar);
  outline-offset: 4px;
}

.kermit-photo {
  display: block;
  width: min(58vw, 18.75rem, 36vh);
  height: auto;
  aspect-ratio: 1;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
  background: none;
}

.speech {
  position: absolute;
  right: 0;
  top: 0.25rem;
  z-index: 5;
  max-width: min(16.5rem, 82%);
  margin: 0;
  padding: 0.85rem 1rem 0.95rem;
  border-radius: 4px 20px 20px 20px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow-paper);
  font-family: var(--font-display);
  font-size: 0.98rem;
  font-weight: 500;
  font-style: italic;
  line-height: 1.35;
  text-wrap: balance;
  animation: pop-bubble 250ms cubic-bezier(0.22, 1, 0.36, 1) both;
  pointer-events: none;
}

.speech::after {
  content: "";
  position: absolute;
  left: 1.1rem;
  bottom: -0.45rem;
  width: 0.9rem;
  height: 0.9rem;
  background: var(--paper);
  clip-path: polygon(0 0, 100% 0, 0 100%);
  transform: rotate(18deg);
}

.paper {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 28rem;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 1.6rem;
  border-radius: var(--radius-xl);
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow-paper);
  border: 1px solid rgb(20 48 24 / 0.08);
  pointer-events: auto;
}

.stamp {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  border: 1.5px dashed color-mix(in oklab, var(--felt-deep) 55%, transparent);
  color: var(--felt-deep);
  display: grid;
  place-items: center;
  transform: rotate(-12deg);
  font-family: var(--font-display);
  font-style: italic;
  font-size: 0.62rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.eyebrow {
  margin: 0;
  padding-right: 3rem;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--felt-deep);
}

h1 {
  margin: 0.75rem 0 0;
  padding-right: 3rem;
  font-family: var(--font-display);
  font-size: 2.05rem;
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -0.03em;
  text-wrap: balance;
}

h1 span {
  display: block;
  margin-top: 0.25rem;
  color: var(--felt-deep);
  font-style: italic;
}

.lede,
.aside {
  margin: 1.15rem 0 0;
  max-width: 36ch;
  font-size: 0.98rem;
  line-height: 1.6;
  color: var(--ink-muted);
  text-wrap: pretty;
}

.aside { margin-top: 0.75rem; }

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin: 1.75rem 0 0;
  padding-top: 1.25rem;
  border-top: 1px solid rgb(20 48 24 / 0.1);
}

.stats dt {
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.stats dd {
  margin: 0.25rem 0 0;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.visit {
  margin: 1.5rem 0 0;
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--ink-muted);
}

.home-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 1rem;
  border-radius: 8px;
  background: var(--ink);
  color: var(--paper);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
}

.home-link:hover {
  color: var(--paper);
}

.home-link:active {
  transform: scale(0.96);
}

.error-code {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(4.5rem, 18vw, 6.25rem);
  font-weight: 600;
  line-height: 0.85;
  letter-spacing: -0.07em;
  color: var(--felt-deep);
}

.visit-pixel {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.foot {
  position: relative;
  z-index: 10;
  margin-top: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.75rem;
  color: color-mix(in oklab, var(--mist) 55%, transparent);
}

.foot p { margin: 0; }

.tongue {
  position: absolute;
  z-index: 11;
  height: 14px;
  width: 1px;
  transform-origin: 0 50%;
  border-radius: 999px;
  background: linear-gradient(90deg, #9a2f2a 0%, var(--mouth) 35%, #e07a72 100%);
  pointer-events: none;
  box-shadow: 0 0 0 1px rgb(90 20 18 / 0.15);
}

.tongue::after {
  content: "";
  position: absolute;
  right: -9px;
  top: 50%;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #d4544a;
  transform: translateY(-50%);
}

.fly {
  position: absolute;
  z-index: 12;
  width: 44px;
  height: 44px;
  margin: -22px 0 0 -22px;
  display: grid;
  place-items: center;
  background: transparent;
  border: 0;
  padding: 0;
  touch-action: manipulation;
  transition: opacity 120ms linear;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.fly:focus {
  outline: none;
}

.fly:focus-visible {
  outline: 2px solid var(--collar);
  outline-offset: 2px;
}

.fly-body {
  position: relative;
  width: 11px;
  height: 16px;
  border-radius: 40% 40% 45% 45%;
  background: #1a1a14;
  box-shadow: 0 1px 0 #3a3a28 inset;
}

.fly-body::before,
.fly-body::after {
  content: "";
  position: absolute;
  top: 2px;
  width: 15px;
  height: 11px;
  border-radius: 50%;
  background: rgb(16 22 20 / 0.48);
  box-shadow:
    0 0 0 1px rgb(8 12 10 / 0.78),
    inset 0 1px 0 rgb(255 255 255 / 0.18);
}

.fly-body::before {
  left: -13px;
  animation: wing-l 90ms linear infinite;
  transform-origin: 100% 50%;
}

.fly-body::after {
  right: -13px;
  animation: wing-r 90ms linear infinite;
  transform-origin: 0 50%;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.stagger-in > * {
  opacity: 0;
  animation: rise-in 500ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
.stagger-in > *:nth-child(1) { animation-delay: 40ms; }
.stagger-in > *:nth-child(2) { animation-delay: 120ms; }
.stagger-in > *:nth-child(3) { animation-delay: 200ms; }
.stagger-in > *:nth-child(4) { animation-delay: 280ms; }
.stagger-in > *:nth-child(5) { animation-delay: 360ms; }
.stagger-in > *:nth-child(6) { animation-delay: 420ms; }

@keyframes kermit-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-7px); }
}

@keyframes kermit-gulp {
  0% { transform: perspective(900px) rotateX(var(--tilt-x)) rotateY(var(--tilt-y)) scale(1); }
  35% { transform: perspective(900px) rotateX(var(--tilt-x)) rotateY(var(--tilt-y)) scale(0.965, 1.03); }
  100% { transform: perspective(900px) rotateX(var(--tilt-x)) rotateY(var(--tilt-y)) scale(1); }
}

@keyframes wing-l {
  from { transform: scaleX(1) rotate(-8deg); }
  to { transform: scaleX(0.35) rotate(12deg); }
}

@keyframes wing-r {
  from { transform: scaleX(1) rotate(8deg); }
  to { transform: scaleX(0.35) rotate(-12deg); }
}

@keyframes rise-in {
  from { opacity: 0; transform: translateY(12px); filter: blur(4px); }
  to { opacity: 1; transform: translateY(0); filter: blur(0); }
}

@keyframes pop-bubble {
  from { opacity: 0; transform: translateY(8px) scale(0.96); filter: blur(3px); }
  to { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}

@media (min-width: 900px) {
  .shell { padding-left: 2.5rem; padding-right: 2.5rem; }
  .layout {
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
    gap: 1.5rem;
  }
  .portrait-col { justify-content: flex-end; }
  .paper { margin: 0; padding: 2rem; }
  .kermit-photo {
    width: min(40vw, 26rem, 68vh);
  }
  .speech {
    left: 58%;
    right: auto;
    top: 6%;
    max-width: 18rem;
  }
  h1 { font-size: 2.55rem; }
}

@media (prefers-reduced-motion: reduce) {
  .kermit-bob,
  .kermit-stage.is-eating,
  .fly-body::before,
  .fly-body::after,
  .stagger-in > *,
  .speech {
    animation: none !important;
  }
  .stagger-in > * {
    opacity: 1;
    filter: none;
    transform: none;
  }
  .kermit-stage { transition: none; }
}
