* {
  box-sizing: border-box;
}

:root {
  --black: #050505;
  --black-soft: #111;
  --white: #f5f5f5;
  --muted: #8a8a8a;
  --accent: #e61919;
  --stroke: #e91e8c;
  --lime: #c8f542;
  --page-bg: #1a1028;
}

@keyframes blur-frame {
  0%,
  49.99% {
    backdrop-filter: blur(10px) saturate(1.1);
    -webkit-backdrop-filter: blur(10px) saturate(1.1);
  }

  50%,
  100% {
    backdrop-filter: blur(14px) saturate(1.25);
    -webkit-backdrop-filter: blur(14px) saturate(1.25);
  }
}

.sticker-idle--blur {
  animation: blur-frame calc(var(--frame-ms, 600ms) * 2) steps(1, end) infinite;
  animation-delay: var(--anim-delay, 0ms);
}

.sticker-paused .sticker-idle--blur {
  animation-play-state: paused;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: system-ui, sans-serif;
  background:
    radial-gradient(ellipse 70% 45% at 15% 0%, rgba(230, 25, 25, 0.18), transparent),
    radial-gradient(ellipse 55% 40% at 90% 10%, rgba(233, 30, 140, 0.14), transparent),
    var(--page-bg);
  color: var(--white);
}

.playground {
  max-width: 980px;
  margin: 0 auto;
  padding: 1.5rem 1rem 4rem;
}

.playground__header h1 {
  margin: 0 0 0.35rem;
  font-family: 'Rubik', system-ui, sans-serif;
  font-weight: 900;
  font-size: clamp(1.5rem, 4vw, 2rem);
  letter-spacing: -0.03em;
}

.playground__header p {
  margin: 0;
  max-width: 58ch;
  color: var(--muted);
  line-height: 1.55;
}

.playground__header strong {
  color: var(--stroke);
}

.playground__controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  align-items: center;
  margin: 1.25rem 0 2rem;
  padding: 0.85rem 1rem;
  background: var(--black-soft);
  border: 2px solid #222;
}

.playground__controls label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
}

.playground__controls input[type='range'] {
  width: 100px;
}

.playground__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2.5rem;
}

.demo {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.demo__label {
  margin: 0;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.demo__title {
  margin: 0;
  font-family: 'Rubik', system-ui, sans-serif;
  font-weight: 900;
  font-size: 1.15rem;
}

.demo__note {
  margin: 0;
  font-size: 0.88rem;
  color: #b0b0b0;
  line-height: 1.45;
}

.demo__stage {
  position: relative;
  min-height: 120px;
  padding: 1.5rem 0;
}

.jagged__content--on-dark {
  color: var(--white);
}

.panel-demo {
  max-width: 520px;
}

.panel-demo .jagged__content {
  padding: 1.35rem 1.5rem;
}

.panel-demo .jagged__content h3 {
  font-size: 1.35rem;
}

.panel-demo .jagged__content p {
  font-size: 0.92rem;
}

/* --- Button row --- */

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
}

.jagged-btn {
  position: relative;
  display: inline-block;
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
  font: inherit;
  text-decoration: none;
  color: inherit;
}

.jagged-btn__svg {
  display: block;
  overflow: visible;
}

.jagged-btn__label {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  padding: 0.85rem 1.6rem;
  font-family: 'Rubik', system-ui, sans-serif;
  font-weight: 900;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--black);
  pointer-events: none;
}

.jagged-btn--dark .jagged-btn__label {
  color: var(--white);
}

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

.playground .img-sticker {
  width: min(100%, 340px);
}

/* --- Mask hero --- */

.mask-hero {
  position: relative;
  min-height: 280px;
  overflow: hidden;
}

.mask-hero__bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: contrast(1.05) saturate(1.1);
}

.mask-hero__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(5, 5, 5, 0.55), rgba(230, 25, 25, 0.25));
  mix-blend-mode: multiply;
  pointer-events: none;
}

.mask-hero__panel {
  position: absolute;
  left: 1rem;
  bottom: 1rem;
  right: 1rem;
  max-width: 360px;
}

.mask-hero__panel .jagged__content {
  padding: 1.1rem 1.25rem;
}

.mask-hero__panel h3 {
  margin: 0 0 0.25rem;
  font-family: 'Rubik', system-ui, sans-serif;
  font-weight: 900;
  font-size: 1.2rem;
}

.mask-hero__panel p {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.45;
}

.mask-hero__masked {
  position: absolute;
  top: 2.75rem;
  right: 1.25rem;
  z-index: 2;
}

/* --- Frost panel --- */

.frost-stage {
  position: relative;
  min-height: 220px;
  padding: 2rem 1rem;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.frost-stage__bg {
  position: absolute;
  inset: -10%;
  width: 120%;
  height: 120%;
  object-fit: cover;
  filter: blur(2px) saturate(1.15);
}

.frost-panel {
  position: relative;
  z-index: 1;
  width: min(100%, 420px);
}

.frost-panel .jagged__glass {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: rgba(245, 245, 245, 0.12);
  backdrop-filter: blur(12px) saturate(1.15);
  -webkit-backdrop-filter: blur(12px) saturate(1.15);
  clip-path: var(--clip-current, var(--clip-a));
  animation: blur-frame calc(var(--frame-ms, 600ms) * 2) steps(1, end) infinite;
  animation-delay: var(--anim-delay, 0ms);
}

.frost-panel .jagged__content {
  color: var(--white);
}

/* --- Comic strip --- */

.comic-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
}

.comic-cell {
  position: relative;
  aspect-ratio: 4 / 5;
}

.comic-cell__shadow {
  position: absolute;
  inset: 0;
  background: var(--black);
  clip-path: var(--clip-current, var(--clip-a));
  transform: translate(var(--shadow-a, 5px), var(--shadow-a, 5px));
  animation: shadow-frame calc(var(--frame-ms, 600ms) * 2) steps(1, end) infinite;
  animation-delay: var(--anim-delay, 0ms);
}

.comic-cell__inner {
  position: relative;
  z-index: 1;
  height: 100%;
  clip-path: var(--clip-current, var(--clip-a));
  overflow: hidden;
  border: 3px solid var(--black);
}

.comic-cell__inner img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.comic-cell__caption {
  position: absolute;
  z-index: 2;
  left: 0.5rem;
  right: 0.5rem;
  bottom: 0.5rem;
  padding: 0.35rem 0.5rem;
  background: var(--white);
  color: var(--black);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  clip-path: polygon(0 0, 100% 4%, 98% 100%, 2% 96%);
}

/* --- Duotone card --- */

.duotone {
  position: relative;
  width: min(100%, 380px);
  aspect-ratio: 16 / 10;
}

.duotone__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  clip-path: var(--clip-current, var(--clip-a));
}

.duotone__tint {
  position: absolute;
  inset: 0;
  background: linear-gradient(145deg, rgba(233, 30, 140, 0.55), rgba(200, 245, 66, 0.35));
  mix-blend-mode: hard-light;
  clip-path: var(--clip-current, var(--clip-a));
  pointer-events: none;
}

.duotone__rim {
  position: absolute;
  inset: 0;
  box-shadow:
    inset 0 0 0 4px var(--black),
    inset 0 0 0 8px var(--white);
  clip-path: var(--clip-current, var(--clip-a));
  pointer-events: none;
}

.duotone__tag {
  position: absolute;
  z-index: 2;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.3rem 0.65rem;
  background: var(--black);
  color: var(--lime);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* --- Badge cluster --- */

.badge-cluster {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  align-items: center;
}

.badge {
  position: relative;
  width: 72px;
  height: 72px;
}

.badge__shadow {
  position: absolute;
  inset: 0;
  background: var(--black);
  clip-path: var(--clip-current, var(--clip-a));
  transform: translate(var(--shadow-a, 4px), var(--shadow-a, 4px));
  animation: shadow-frame calc(var(--frame-ms, 600ms) * 2) steps(1, end) infinite;
  animation-delay: var(--anim-delay, 0ms);
}

.badge__face {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  clip-path: var(--clip-current, var(--clip-a));
  overflow: hidden;
  border: 2px solid var(--black);
}

.badge__face img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* --- Profile burst (radial comic spikes) --- */

.profile-burst {
  position: relative;
  width: var(--burst-size, 200px);
  height: var(--burst-size, 200px);
  margin: 0;
  overflow: visible;
}

.profile-burst__stage {
  position: relative;
  width: 100%;
  height: 100%;
}

.profile-burst__svg {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  overflow: visible;
  pointer-events: none;
}

.profile-burst__spike {
  fill: var(--stroke);
  stroke: var(--black);
  stroke-width: 4;
  stroke-linejoin: miter;
}

.profile-burst__ring {
  fill: none;
  stroke: var(--black);
}

.profile-burst__photo {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 1;
  width: calc(100% - 18px);
  height: calc(100% - 18px);
  transform: translate(-50%, -50%);
  border-radius: 50%;
  object-fit: cover;
}

.profile-burst__ring-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  border-radius: 50%;
  box-shadow: inset 0 0 0 7px var(--black);
  pointer-events: none;
}

.profile-burst-row {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  align-items: center;
  justify-content: center;
}

.profile-burst-row .profile-burst {
  flex-shrink: 0;
}

/* ─── TEXT EFFECT DEMOS ────────────────────────────────────────────── */

/* T1: Gradient fill + stacked shadow pop */

@keyframes txt-gradient-pop {
  0%,
  49.99% {
    background-position: 0% 0%;
    -webkit-text-stroke-width: 6px;
    text-shadow:
      6px 6px 0 #050505,
      12px 12px 0 #e91e8c;
  }

  50%,
  100% {
    background-position: 0% 100%;
    -webkit-text-stroke-width: 9px;
    text-shadow:
      10px 10px 0 #050505,
      19px 19px 0 #e91e8c,
      26px 26px 0 #c8f542;
  }
}

.txt-gradient {
  margin: 0;
  padding: 0 0.15em 0.2em 0;
  font-family: 'Rubik', system-ui, sans-serif;
  font-weight: 900;
  font-size: clamp(5rem, 20vw, 12rem);
  line-height: 1;
  letter-spacing: -0.04em;
  white-space: nowrap;
  background-image: linear-gradient(0deg, rgb(219, 197, 187) 16.964%, rgb(225, 99, 182) 103.482%);
  background-size: 100% 200%;
  background-position: 0% 0%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-stroke: 6px #050505;
  paint-order: stroke fill;
  text-shadow:
    6px 6px 0 #050505,
    12px 12px 0 #e91e8c;
  animation: txt-gradient-pop calc(var(--frame-ms, 600ms) * 2) steps(1, end) infinite;
  animation-delay: var(--anim-delay, 0ms);
}

.demo__stage--text {
  overflow: visible;
  padding-bottom: 2.5rem;
}

/* T2: Photo background revealed through letterforms */

@keyframes txt-photo-drift {
  0%,
  49.99% {
    background-position: 20% center;
  }

  50%,
  100% {
    background-position: 70% center;
  }
}

@keyframes txt-photo-bloom {
  0%,
  49.99% {
    filter: blur(10px) brightness(1.5) saturate(1.6);
    opacity: 0.7;
  }

  50%,
  100% {
    filter: blur(18px) brightness(2) saturate(2.1);
    opacity: 1;
  }
}

@keyframes txt-photo-tint {
  0%,
  49.99% {
    filter: brightness(1.1) saturate(1.4);
  }

  50%,
  100% {
    filter: brightness(1.35) saturate(1.85);
  }
}

.txt-photo {
  position: relative;
  margin: 0;
  font-family: 'Rubik', system-ui, sans-serif;
  font-weight: 900;
  font-size: clamp(4.5rem, 16vw, 9rem);
  line-height: 1;
  letter-spacing: -0.04em;
  white-space: nowrap;
  color: transparent;
  -webkit-text-stroke: 8px #050505;
  paint-order: stroke fill;
}

.txt-photo::before,
.txt-photo::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  background-image: url('/resources/img/drone4bratti.jpg');
  background-size: 200%;
  background-position: 20% center;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-stroke: 0 transparent;
  pointer-events: none;
}

.txt-photo::before {
  z-index: 0;
  mix-blend-mode: screen;
  filter: blur(10px) brightness(1.5) saturate(1.6);
  opacity: 0.7;
  animation:
    txt-photo-drift calc(var(--frame-ms, 600ms) * 2) steps(1, end) infinite,
    txt-photo-bloom calc(var(--frame-ms, 600ms) * 2) steps(1, end) infinite;
  animation-delay: var(--anim-delay, 0ms);
}

.txt-photo::after {
  z-index: 1;
  filter: brightness(1.1) saturate(1.4);
  animation:
    txt-photo-drift calc(var(--frame-ms, 600ms) * 2) steps(1, end) infinite,
    txt-photo-tint calc(var(--frame-ms, 600ms) * 2) steps(1, end) infinite;
  animation-delay: var(--anim-delay, 0ms);
}

/* T3: Stacked hard-shadow layers, offset pulses */

@keyframes txt-stack-shadow {
  0%,
  49.99% {
    text-shadow:
      6px 6px 0 #050505,
      12px 12px 0 #e91e8c;
  }

  50%,
  100% {
    text-shadow:
      10px 10px 0 #050505,
      19px 19px 0 #e91e8c;
  }
}

.txt-stack {
  margin: 0;
  font-family: 'Rubik', system-ui, sans-serif;
  font-weight: 900;
  font-size: clamp(4.5rem, 16vw, 9rem);
  line-height: 1;
  letter-spacing: -0.04em;
  white-space: nowrap;
  color: var(--white);
  -webkit-text-stroke: 3px #050505;
  paint-order: stroke fill;
  text-shadow:
    6px 6px 0 #050505,
    12px 12px 0 #e91e8c;
  animation: txt-stack-shadow calc(var(--frame-ms, 600ms) * 2) steps(1, end) infinite;
  animation-delay: var(--anim-delay, 0ms);
}

/* T4: Ghost hollow outline, colour alternates pink ↔ lime */

@keyframes txt-ghost-color {
  0%,
  49.99% {
    -webkit-text-stroke-color: #e91e8c;
  }

  50%,
  100% {
    -webkit-text-stroke-color: #c8f542;
  }
}

.txt-ghost {
  margin: 0;
  font-family: 'Rubik', system-ui, sans-serif;
  font-weight: 900;
  font-size: clamp(3.5rem, 13vw, 8rem);
  line-height: 1;
  letter-spacing: -0.03em;
  white-space: nowrap;
  color: transparent;
  -webkit-text-stroke: 6px #e91e8c;
  animation: txt-ghost-color calc(var(--frame-ms, 600ms) * 2) steps(1, end) infinite;
  animation-delay: var(--anim-delay, 0ms);
}

/* Pause support for text animations */
.sticker-paused .txt-gradient,
.sticker-paused .txt-photo::before,
.sticker-paused .txt-photo::after,
.sticker-paused .txt-stack,
.sticker-paused .txt-ghost {
  animation-play-state: paused;
}

/* ─────────────────────────────────────────────────────────────────── */

.playground__back {
  display: inline-block;
  margin-top: 2.5rem;
  color: var(--accent);
  text-decoration: none;
  font-size: 0.9rem;
}

.playground__back:hover {
  text-decoration: underline;
}

@media (min-width: 640px) {
  .playground {
    padding-inline: 1.5rem;
  }

  .playground__grid--split {
    grid-template-columns: 1fr 1fr;
    gap: 2rem 1.5rem;
  }

  .playground__grid--split .demo--wide {
    grid-column: 1 / -1;
  }
}
