:root {
  --bg: #0c0c0c;
  --ink: #f5f4f0;
  --muted: #9a9a94;
  --line: rgba(245, 244, 240, 0.18);
  --flame-1: #ff7a1a;
  --flame-2: #ffd23f;
}

html {
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-x: hidden;
  cursor: url('/cursor-fire.svg') 6 4, auto;
}

::selection {
  background: var(--flame-1);
  color: #fff;
}

/* custom scrollbar, in case content overflows on short viewports */
html {
  scrollbar-color: var(--flame-1) transparent;
  scrollbar-width: thin;
}

::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(var(--flame-1), var(--flame-2));
  border-radius: 999px;
  border: 2px solid var(--bg);
}

.embers {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.ember {
  position: absolute;
  bottom: -20px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--flame-2), var(--flame-1) 70%, transparent 100%);
  opacity: 0;
  animation-name: rise;
  animation-timing-function: ease-in;
  animation-iteration-count: infinite;
}

@keyframes rise {
  0% {
    transform: translate(0, 0);
    opacity: 0;
  }
  12% {
    opacity: 0.55;
  }
  85% {
    opacity: 0.2;
  }
  100% {
    transform: translate(var(--drift, 0px), -105vh);
    opacity: 0;
  }
}

.topbar, .stage, .foot {
  position: relative;
  z-index: 1;
}

.topbar {
  display: flex;
  justify-content: center;
  padding: clamp(24px, 5vh, 40px) 24px 0;
}

.logo {
  width: clamp(120px, 20vw, 168px);
  height: auto;
  filter: invert(1);
}

.stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px 20px;
  gap: clamp(20px, 3vh, 32px);
}

.meme {
  position: relative;
  width: min(420px, 82vw);
  background: #161616;
  padding: 14px 14px 20px;
  border-radius: 4px;
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.4),
    0 18px 40px rgba(0, 0, 0, 0.5);
  transform: rotate(-1.6deg);
  transition: transform 0.35s ease, box-shadow 0.35s ease;
}

.meme:focus-visible {
  outline: 2px solid var(--flame-1);
  outline-offset: 4px;
}

.meme img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 2px;
  pointer-events: none;
}

.caption {
  margin: 14px 6px 0;
  font-family: "Permanent Marker", "Comic Sans MS", cursive;
  font-size: clamp(0.9rem, 2.8vw, 1.1rem);
  line-height: 1.3;
  color: #f0f0f0;
  transform: rotate(-1deg);
  transition: opacity 0.15s ease;
}

.caption.fade {
  opacity: 0;
}

@media (hover: hover) and (pointer: fine) {
  .meme:hover {
    transform: rotate(-0.5deg) translateY(-6px) scale(1.015);
    box-shadow:
      0 2px 4px rgba(0, 0, 0, 0.45),
      0 26px 48px rgba(0, 0, 0, 0.55);
  }
}

.meme.wiggle {
  animation: wiggle 0.5s ease;
}

@keyframes wiggle {
  0% { transform: rotate(-1.6deg); }
  25% { transform: rotate(2.5deg) scale(1.04); }
  50% { transform: rotate(-3deg) scale(1.02); }
  75% { transform: rotate(1.4deg) scale(1.03); }
  100% { transform: rotate(-1.6deg); }
}

h1 {
  margin: 0;
  font-size: clamp(2.1rem, 7vw, 3.6rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
}

.lede {
  margin: 0;
  max-width: 34ch;
  font-size: clamp(0.95rem, 2.4vw, 1.1rem);
  line-height: 1.55;
  color: var(--muted);
}

.tag {
  margin: 4px 0 0;
  display: inline-flex;
  align-items: center;
  padding: 9px 20px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink);
  transition: box-shadow 0.3s ease, border-color 0.3s ease, transform 0.3s ease;
}

.tag:hover,
.tag:focus-visible {
  border-color: var(--flame-1);
  box-shadow: 0 0 0 4px rgba(255, 122, 26, 0.16);
  transform: translateY(-1px);
}

.tag:focus-visible {
  outline: none;
}

.tag.bounce {
  animation: bounce 0.4s ease;
  border-color: var(--flame-1);
}

@keyframes bounce {
  0% { transform: scale(1); }
  40% { transform: scale(1.12); }
  100% { transform: scale(1); }
}

.spark {
  position: fixed;
  width: 6px;
  height: 6px;
  margin: -3px 0 0 -3px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--flame-2), var(--flame-1) 70%, transparent 100%);
  pointer-events: none;
  z-index: 10;
  animation: spark-fly 0.55s ease-out forwards;
}

@keyframes spark-fly {
  to {
    transform: translate(var(--tx), var(--ty)) scale(0.2);
    opacity: 0;
  }
}

.foot {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 20px 24px clamp(24px, 5vh, 36px);
  font-size: 0.78rem;
  color: var(--muted);
}

.foot .dot {
  opacity: 0.5;
}

@media (max-width: 420px) {
  .meme {
    padding: 10px 10px 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ember, .spark {
    animation: none;
    display: none;
  }

  .meme, .tag, .meme.wiggle, .tag.bounce {
    transition: none;
    animation: none;
  }
}

