/*
 * JC Auto Barato — Cyber-Chinatown visual enhancement layer
 * This stylesheet is intentionally scoped to .cyber-upgraded so the legacy
 * layout remains the source of truth and the page still works without JS.
 */

:root {
  --cyber-night: #0d0d11;
  --cyber-night-soft: #171217;
  --cyber-red: #ff003c;
  --cyber-red-soft: #ff3b3b;
  --cyber-gold: #ffd700;
  --cyber-amber: #ff9900;
  --cyber-ivory: #fff8e7;
  --cyber-glow-red: 0 0 8px rgb(255 0 60 / 55%), 0 0 24px rgb(255 0 60 / 24%);
  --cyber-glow-gold: 0 0 8px rgb(255 215 0 / 55%), 0 0 25px rgb(255 153 0 / 28%);
  --cyber-ease: cubic-bezier(.22, 1, .36, 1);
  --cyber-radius: 8px;
}

/* Ambient treatment: preserves the existing dimensions and content flow. */
.cyber-upgraded {
  background-color: var(--cyber-night) !important;
}

body.cyber-upgraded::before {
  background:
    radial-gradient(circle at 15% 10%, rgb(255 0 60 / 12%), transparent 32%),
    radial-gradient(circle at 88% 24%, rgb(255 153 0 / 8%), transparent 28%),
    linear-gradient(180deg, rgb(13 13 17 / 12%), rgb(13 13 17 / 45%)),
    repeating-linear-gradient(90deg, transparent 0 83px, rgb(255 215 0 / 3%) 84px 85px) !important;
}

.cyber-upgraded .c-header.u-bg-primary {
  background: linear-gradient(90deg, #10090c, #6f071f 49%, #10090c) !important;
  border-bottom-color: rgb(255 215 0 / 74%) !important;
  box-shadow: 0 10px 30px rgb(0 0 0 / 48%), 0 1px 16px rgb(255 0 60 / 18%) !important;
}

/* Hero text: high-energy gradient without changing font metrics. */
.cyber-hero-text {
  position: relative;
  isolation: isolate;
  background: linear-gradient(105deg, var(--cyber-ivory) 5%, var(--cyber-gold) 42%, var(--cyber-red-soft) 70%, var(--cyber-ivory) 96%);
  background-size: 220% auto;
  color: var(--cyber-ivory) !important;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 0 rgb(0 0 0 / 70%)) drop-shadow(0 0 10px rgb(255 0 60 / 28%));
  animation: cyber-title-shift 7s linear infinite;
}

.cyber-hero-text::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  z-index: -1;
  color: var(--cyber-red);
  -webkit-text-fill-color: var(--cyber-red);
  clip-path: inset(48% 0 43% 0);
  opacity: 0;
  transform: translateX(0);
  pointer-events: none;
}

.cyber-hero-text:hover::after {
  animation: cyber-glitch-slice 480ms steps(2, end) both;
}

/* Reusable animated electric border utility. */
.cyber-electric-border {
  position: relative;
  isolation: isolate;
}

.cyber-electric-border::before {
  content: "";
  position: absolute;
  inset: -1px;
  z-index: 2;
  border-radius: inherit;
  padding: 1px;
  background: conic-gradient(from var(--cyber-border-angle, 0deg), transparent 0 14%, var(--cyber-gold) 19%, transparent 24% 48%, var(--cyber-red) 54%, transparent 61% 84%, var(--cyber-amber) 90%, transparent 96%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  animation: cyber-electric-spin 4.5s linear infinite, cyber-electric-flicker 2.8s steps(1, end) infinite;
}

.cyber-electric-border::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  box-shadow: var(--cyber-glow-gold), inset 0 0 18px rgb(255 0 60 / 7%);
  opacity: .55;
  pointer-events: none;
  transition: opacity 260ms ease, box-shadow 260ms ease;
}

.cyber-electric-border:hover::after {
  opacity: .95;
  box-shadow: 0 0 11px rgb(255 215 0 / 68%), 0 0 34px rgb(255 0 60 / 24%), inset 0 0 22px rgb(255 153 0 / 10%);
}

/* Progressive 3D tilt for existing cards and gallery. */
.cyber-tilt {
  transform: perspective(1000px) rotateX(var(--cyber-rotate-x, 0deg)) rotateY(var(--cyber-rotate-y, 0deg)) translateZ(0);
  transform-style: preserve-3d;
  transition: transform 420ms var(--cyber-ease), filter 300ms ease, box-shadow 300ms ease;
  will-change: transform;
}

.cyber-tilt.is-tilting {
  transition-duration: 80ms;
  filter: saturate(1.08) contrast(1.03);
}

.cyber-upgraded .wak89-card,
.cyber-upgraded .wak89-featured article,
.cyber-upgraded .wak89-grid section,
.cyber-upgraded .wak89-steps section {
  overflow: hidden;
  transition: transform 320ms var(--cyber-ease), border-color 260ms ease, box-shadow 320ms ease;
}

.cyber-upgraded .wak89-card:hover,
.cyber-upgraded .wak89-featured article:hover,
.cyber-upgraded .wak89-grid section:hover,
.cyber-upgraded .wak89-steps section:hover {
  border-color: rgb(255 153 0 / 78%);
  box-shadow: 0 15px 34px rgb(13 13 17 / 22%), 0 0 18px rgb(255 153 0 / 15%);
}

/* CTA glitch, breathing glow, and stylized corner sparks. */
.cyber-glitch-button {
  position: relative;
  isolation: isolate;
  overflow: visible !important;
  box-shadow: var(--cyber-glow-gold);
  transition: transform 220ms var(--cyber-ease), box-shadow 220ms ease, filter 220ms ease !important;
  animation: cyber-breathe 3.2s ease-in-out infinite;
}

.cyber-glitch-button::before,
.cyber-glitch-button::after {
  content: "";
  position: absolute;
  width: 11px;
  height: 11px;
  pointer-events: none;
  opacity: .72;
}

.cyber-glitch-button::before {
  top: -4px;
  right: -4px;
  border-top: 2px solid var(--cyber-gold);
  border-right: 2px solid var(--cyber-gold);
  filter: drop-shadow(0 0 4px var(--cyber-gold));
}

.cyber-glitch-button::after {
  bottom: -4px;
  left: -4px;
  border-bottom: 2px solid var(--cyber-red);
  border-left: 2px solid var(--cyber-red);
  filter: drop-shadow(0 0 4px var(--cyber-red));
}

.cyber-glitch-button:hover,
.cyber-glitch-button:focus-visible {
  transform: translateY(-2px) scale(1.025);
  box-shadow: 0 0 12px rgb(255 215 0 / 75%), 0 0 32px rgb(255 0 60 / 32%);
  filter: brightness(1.08) saturate(1.08);
  animation: cyber-button-glitch 440ms steps(2, end) 1;
}

.cyber-glitch-button:focus-visible {
  outline: 2px solid var(--cyber-ivory);
  outline-offset: 4px;
}

/* Scroll reveal uses opacity/transform only, keeping layout stable. */
.cyber-reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 700ms var(--cyber-ease), transform 700ms var(--cyber-ease);
}

.cyber-reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@property --cyber-border-angle {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}

@keyframes cyber-title-shift {
  to { background-position: 220% center; }
}

@keyframes cyber-electric-spin {
  to { --cyber-border-angle: 360deg; }
}

@keyframes cyber-electric-flicker {
  0%, 17%, 22%, 68%, 72%, 100% { opacity: .82; }
  18%, 21%, 69%, 71% { opacity: .28; }
}

@keyframes cyber-glitch-slice {
  0%, 100% { opacity: 0; transform: translateX(0); }
  20% { opacity: .7; transform: translateX(-4px); }
  45% { opacity: .5; transform: translateX(5px); clip-path: inset(18% 0 68% 0); }
  70% { opacity: .65; transform: translateX(-2px); clip-path: inset(72% 0 12% 0); }
}

@keyframes cyber-button-glitch {
  0%, 100% { clip-path: inset(0); }
  30% { clip-path: polygon(0 0, 100% 0, 100% 38%, 92% 38%, 92% 48%, 100% 48%, 100% 100%, 0 100%); }
  62% { transform: translate(2px, -2px) scale(1.025); }
}

@keyframes cyber-breathe {
  0%, 100% { box-shadow: 0 0 7px rgb(255 215 0 / 45%), 0 0 20px rgb(255 153 0 / 16%); }
  50% { box-shadow: 0 0 12px rgb(255 215 0 / 67%), 0 0 31px rgb(255 0 60 / 23%); }
}

@media (max-width: 767px) {
  .cyber-tilt { transform: none !important; }
  .cyber-electric-border::after { opacity: .38; }
}

@media (prefers-reduced-motion: reduce) {
  .cyber-upgraded *,
  .cyber-upgraded *::before,
  .cyber-upgraded *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }

  .cyber-reveal { opacity: 1; transform: none; }
  .cyber-tilt { transform: none !important; }
}
