/* Opt-in FX: suppress legacy ::before/::after when data-tt-fx is set */
[data-tt-fx] {
  --tt-fx-a: 0.5;
  position: relative;
}
[data-tt-fx][data-tt-fx-i="soft"] { --tt-fx-a: 0.32; }
[data-tt-fx][data-tt-fx-i="mid"] { --tt-fx-a: 0.55; }
[data-tt-fx][data-tt-fx-i="strong"] { --tt-fx-a: 0.82; }

[data-tt-fx]::before,
[data-tt-fx]::after {
  content: none !important;
  animation: none !important;
  background-image: none !important;
  box-shadow: none !important;
}

[data-tt-fx="none"]::before,
[data-tt-fx="none"]::after {
  content: none !important;
}

/* Hover mode: effect layer only on hover */
[data-tt-fx][data-tt-fx-m="hover"] .tt-fx-layer {
  opacity: 0;
  transition: opacity .2s steps(2);
}
[data-tt-fx][data-tt-fx-m="hover"]:hover .tt-fx-layer,
[data-tt-fx][data-tt-fx-m="hover"]:focus-within .tt-fx-layer {
  opacity: 1;
}

.tt-fx-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
}

@media (prefers-reduced-motion: reduce) {
  html:not(.tt-fx-ignore-prm) [data-tt-fx] .tt-fx-layer,
  html:not(.tt-fx-ignore-prm) [data-tt-fx]::before,
  html:not(.tt-fx-ignore-prm) [data-tt-fx]::after {
    animation: none !important;
  }
}
[data-tt-fx="neon"] {
  overflow: visible;
  z-index: 1;
  box-shadow:
    0 0 0 1px rgba(255, 61, 138, calc(var(--tt-fx-a) * 0.9)),
    0 0 calc(10px + var(--tt-fx-a) * 22px) rgba(255, 61, 138, calc(var(--tt-fx-a) * 0.85)),
    0 0 calc(22px + var(--tt-fx-a) * 36px) rgba(255, 26, 60, calc(var(--tt-fx-a) * 0.55));
  animation: tt-fx-neon 2.4s steps(2) infinite;
}
[data-tt-fx="neon"][data-tt-fx-m="hover"] {
  box-shadow: none;
  animation: none;
  transition: box-shadow .2s steps(2);
}
[data-tt-fx="neon"][data-tt-fx-m="hover"]:hover {
  box-shadow:
    0 0 0 1px rgba(255, 61, 138, 0.85),
    0 0 18px rgba(255, 61, 138, 0.9),
    0 0 36px rgba(255, 26, 60, 0.55);
  animation: tt-fx-neon 2.4s steps(2) infinite;
}
/* Photo stays original — glow/outline only, no filter / blend / color wash on img */
[data-tt-fx="neon"] img {
  filter: none;
}
@keyframes tt-fx-neon {
  50% {
    box-shadow:
      0 0 0 1px rgba(255, 61, 138, calc(var(--tt-fx-a))),
      0 0 calc(16px + var(--tt-fx-a) * 28px) rgba(255, 61, 138, calc(var(--tt-fx-a))),
      0 0 calc(30px + var(--tt-fx-a) * 40px) rgba(255, 26, 60, calc(var(--tt-fx-a) * 0.7));
  }
}
.card:has([data-tt-fx="neon"]),
.model-card:has([data-tt-fx="neon"]) {
  overflow: visible;
}
.models-rail:has([data-tt-fx="neon"]) {
  padding-top: 14px;
  padding-bottom: 18px;
}
@media (prefers-reduced-motion: reduce) {
  html:not(.tt-fx-ignore-prm) [data-tt-fx="neon"] { animation: none !important; }
}
[data-tt-fx="glitch"] {
  isolation: isolate;
}
[data-tt-fx="glitch"] img {
  animation: tt-fx-glitch-shift calc(1.05s - var(--tt-fx-a) * 0.45s) steps(2) infinite;
}
[data-tt-fx="glitch"][data-tt-fx-m="hover"] img {
  animation: none;
}
[data-tt-fx="glitch"][data-tt-fx-m="hover"]:hover img {
  animation: tt-fx-glitch-shift 0.4s steps(2) infinite;
}
[data-tt-fx="glitch"]::after,
[data-tt-fx="glitch"] .tt-fx-layer--glitch {
  content: "" !important;
  display: block;
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(255, 26, 60, calc(var(--tt-fx-a) * 0.7)), transparent 46%),
    linear-gradient(270deg, rgba(80, 220, 255, calc(var(--tt-fx-a) * 0.55)), transparent 46%) !important;
  mix-blend-mode: screen;
  opacity: calc(var(--tt-fx-a) * 0.85);
  animation: tt-fx-glitch-flash 2.1s steps(3) infinite !important;
}
[data-tt-fx="glitch"][data-tt-fx-m="always"]::after { content: "" !important; }
[data-tt-fx="glitch"][data-tt-fx-m="hover"]::after { content: "" !important; opacity: 0; animation: none !important; }
[data-tt-fx="glitch"][data-tt-fx-m="hover"]:hover::after {
  opacity: calc(var(--tt-fx-a) * 0.85);
  animation: tt-fx-glitch-flash 2.1s steps(3) infinite !important;
}
@keyframes tt-fx-glitch-shift {
  0%, 86%, 100% { transform: translate(0, 0); filter: none; }
  88% { transform: translate(-3px, 1px); filter: hue-rotate(28deg); }
  91% { transform: translate(3px, -1px); }
  94% { transform: translate(-2px, 0); filter: hue-rotate(-22deg); }
  97% { transform: translate(2px, 1px); }
}
@keyframes tt-fx-glitch-flash {
  0%, 86%, 100% { clip-path: inset(0 0 0 0); opacity: calc(var(--tt-fx-a) * 0.35); }
  89% { clip-path: inset(8% 0 62% 0); opacity: 1; }
  92% { clip-path: inset(58% 0 8% 0); }
  95% { clip-path: inset(30% 0 40% 0); opacity: calc(var(--tt-fx-a)); }
}
@media (prefers-reduced-motion: reduce) {
  html:not(.tt-fx-ignore-prm) [data-tt-fx="glitch"] img,
  html:not(.tt-fx-ignore-prm) [data-tt-fx="glitch"]::after {
    animation: none !important; transform: none !important; filter: none !important;
  }
}
[data-tt-fx="pixel_grid"][data-tt-fx-m="always"]::after,
[data-tt-fx="pixel_grid"] .tt-fx-layer--grid {
  content: "" !important;
  display: block;
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(246, 240, 242, calc(var(--tt-fx-a) * 0.55)) 1px, transparent 1px),
    linear-gradient(90deg, rgba(246, 240, 242, calc(var(--tt-fx-a) * 0.55)) 1px, transparent 1px),
    radial-gradient(ellipse at center, transparent 40%, rgba(0, 0, 0, calc(var(--tt-fx-a) * 0.45)) 100%) !important;
  background-size: 4px 4px, 4px 4px, 100% 100% !important;
  mix-blend-mode: soft-light;
  opacity: 1;
}
[data-tt-fx="pixel_grid"][data-tt-fx-m="always"]::after { content: "" !important; }
[data-tt-fx="pixel_grid"][data-tt-fx-m="hover"]::after {
  content: "" !important;
  opacity: 0;
  transition: opacity .15s steps(2);
}
[data-tt-fx="pixel_grid"][data-tt-fx-m="hover"]:hover::after { opacity: 1; }
@media (prefers-reduced-motion: reduce) {
  html:not(.tt-fx-ignore-prm) [data-tt-fx="pixel_grid"]::after,
  html:not(.tt-fx-ignore-prm) .tt-fx-layer--grid { animation: none !important; }
}
