/* === TV Screen — Stacked Card Flipper === */

/* Flip-in / flip-out keyframes */
@keyframes tv-flip-in {
  0% {
    opacity: 0;
    transform: translateY(30%) scaleY(0.4);
    filter: brightness(2.5) blur(2px);
  }
  40% {
    opacity: 1;
    filter: brightness(1.4) blur(0);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scaleY(1);
    filter: brightness(1) blur(0);
  }
}

@keyframes tv-flip-out {
  0% {
    opacity: 1;
    transform: translateY(0) scaleY(1);
    filter: brightness(1);
  }
  60% {
    filter: brightness(1.6);
  }
  100% {
    opacity: 0;
    transform: translateY(-30%) scaleY(0.4);
    filter: brightness(2.5) blur(2px);
  }
}

@keyframes tv-static {
  0% { opacity: 0; }
  5% { opacity: 0.08; }
  10% { opacity: 0; }
  15% { opacity: 0.05; }
  20% { opacity: 0; }
  100% { opacity: 0; }
}

/* Container — acts as the TV screen */
.window-strip {
  position: relative;
  width: 100%;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* All cards stacked via absolute positioning */
.window-card {
  position: absolute;
  inset: 0;
  padding: 2.5rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  z-index: 1;
}

/* Active card */
.window-card.active {
  opacity: 1;
  pointer-events: auto;
  z-index: 2;
  animation: tv-flip-in 0.5s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

/* Exiting card */
.window-card.exiting {
  opacity: 1;
  z-index: 1;
  animation: tv-flip-out 0.45s cubic-bezier(0.55, 0, 1, 0.45) forwards;
}

/* Hover focus — pause + enlarge */
.tv-screen:hover .window-card.active {
  transform: scale(1.03);
  transition: transform 0.3s ease;
}

.tv-screen:hover .window-card.active h4 {
  text-shadow: 0 0 20px rgba(118, 211, 255, 0.4);
}

/* Always-on ambient glow when effects are active */
.tv-screen[class*="fx-"] {
  box-shadow:
    inset 0 0 60px rgba(118, 211, 255, 0.12),
    0 0 30px rgba(118, 211, 255, 0.08),
    0 0 60px rgba(182, 119, 255, 0.05);
}

/* Typography */
.window-card h4 {
  margin: 0 0 1rem 0;
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--accent-1);
  letter-spacing: 0.02em;
  transition: text-shadow 0.3s ease;
}

.window-card p {
  margin: 0;
  font-size: 1.05rem;
  color: var(--muted);
  line-height: 1.7;
  max-width: 90%;
}

/* Keyboard focus */
.window-card:focus-visible {
  outline: 3px solid rgba(118, 211, 255, 0.5);
  outline-offset: -6px;
  z-index: 10;
}

/* === TV Aesthetic — Scanlines === */
.tv-scanlines {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.04) 2px,
    rgba(0, 0, 0, 0.04) 4px
  );
  border-radius: inherit;
}

/* Static flash during transitions */
.tv-screen::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(118,211,255,0.03) 0%, transparent 40%, transparent 60%, rgba(182,119,255,0.03) 100%);
  border-radius: inherit;
  opacity: 0;
}

.tv-screen.flipping::after {
  animation: tv-static 0.5s ease forwards;
}

/* === Channel Indicator Dots === */
.tv-channel-dots {
  position: absolute;
  bottom: 0.75rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  z-index: 5;
}

.tv-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(118, 211, 255, 0.2);
  border: 1px solid rgba(118, 211, 255, 0.15);
  transition: all 0.3s ease;
}

.tv-dot.active {
  background: var(--accent-1);
  box-shadow: 0 0 8px rgba(118, 211, 255, 0.5);
  transform: scale(1.3);
}

/* =============================================
   SCI-FI HOVER EFFECTS — Holographic Command Terminal
   Each effect is toggled via .fx-* class on .tv-screen
   ============================================= */

/* --- Effect 1: Chromatic Glitch --- */
@keyframes chromatic-glitch {
  0%   { text-shadow: none; clip-path: inset(0); }
  10%  { text-shadow: -3px 0 #ff0040, 3px 0 #00d4ff; clip-path: inset(20% 0 60% 0); }
  20%  { text-shadow: 2px 0 #ff0040, -2px 0 #00d4ff; clip-path: inset(55% 0 10% 0); }
  30%  { text-shadow: -4px 0 #ff0040, 4px 0 #00d4ff; clip-path: inset(5% 0 80% 0); }
  40%  { text-shadow: none; clip-path: inset(0); }
  100% { text-shadow: none; clip-path: inset(0); }
}

@keyframes glitch-shift {
  0%   { transform: translate(0); }
  10%  { transform: translate(-2px, 1px); }
  20%  { transform: translate(3px, -1px); }
  30%  { transform: translate(-1px, 2px); }
  40%  { transform: translate(0); }
  100% { transform: translate(0); }
}

.tv-screen.fx-glitch .window-card.active {
  animation: glitch-shift 0.4s steps(4) forwards;
}

.tv-screen.fx-glitch .window-card.active h4 {
  animation: chromatic-glitch 0.4s steps(6) forwards;
}

/* --- Effect 2: HUD Targeting Brackets --- */
@keyframes hud-lock-tl {
  from { transform: translate(-20px, -20px); opacity: 0; }
  to   { transform: translate(0, 0); opacity: 1; }
}
@keyframes hud-lock-tr {
  from { transform: translate(20px, -20px); opacity: 0; }
  to   { transform: translate(0, 0); opacity: 1; }
}
@keyframes hud-lock-bl {
  from { transform: translate(-20px, 20px); opacity: 0; }
  to   { transform: translate(0, 0); opacity: 1; }
}
@keyframes hud-lock-br {
  from { transform: translate(20px, 20px); opacity: 0; }
  to   { transform: translate(0, 0); opacity: 1; }
}

.hud-brackets {
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
  opacity: 0;
}

.hud-brackets::before,
.hud-brackets::after {
  content: '';
  position: absolute;
  width: 28px;
  height: 28px;
  border-color: rgba(118, 211, 255, 0.7);
  border-style: solid;
  border-width: 0;
  opacity: 0;
}

/* Top-left & bottom-right via ::before/::after on .hud-brackets */
.hud-brackets::before {
  top: 12px;
  left: 12px;
  border-top-width: 2px;
  border-left-width: 2px;
}

.hud-brackets::after {
  bottom: 12px;
  right: 12px;
  border-bottom-width: 2px;
  border-right-width: 2px;
}

/* Top-right & bottom-left via .tv-scanlines pseudo (repurpose since scanlines already have ::before unused) */
.tv-screen.fx-hud .tv-scanlines::before {
  content: '';
  position: absolute;
  top: 12px;
  right: 12px;
  width: 28px;
  height: 28px;
  border-top: 2px solid rgba(118, 211, 255, 0.7);
  border-right: 2px solid rgba(118, 211, 255, 0.7);
  opacity: 0;
  animation: hud-lock-tr 0.35s cubic-bezier(0.22, 1, 0.36, 1) 0.05s forwards;
  z-index: 6;
}

.tv-screen.fx-hud .tv-scanlines::after {
  content: '';
  position: absolute;
  bottom: 12px;
  left: 12px;
  width: 28px;
  height: 28px;
  border-bottom: 2px solid rgba(118, 211, 255, 0.7);
  border-left: 2px solid rgba(118, 211, 255, 0.7);
  opacity: 0;
  animation: hud-lock-bl 0.35s cubic-bezier(0.22, 1, 0.36, 1) 0.1s forwards;
  z-index: 6;
  background: none;
}

.tv-screen.fx-hud .hud-brackets {
  opacity: 1;
}

.tv-screen.fx-hud .hud-brackets::before {
  opacity: 0;
  animation: hud-lock-tl 0.35s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.tv-screen.fx-hud .hud-brackets::after {
  opacity: 0;
  animation: hud-lock-br 0.35s cubic-bezier(0.22, 1, 0.36, 1) 0.15s forwards;
}

/* --- Effect 3: Flowing Circuit Border --- */
@keyframes circuit-flow {
  from { --circuit-angle: 0deg; }
  to   { --circuit-angle: 360deg; }
}

@property --circuit-angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}

.tv-screen.fx-circuit {
  border-color: transparent;
  background-origin: border-box;
  background-clip: padding-box, border-box;
}

.tv-screen.fx-circuit::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  padding: 2px;
  background: conic-gradient(
    from var(--circuit-angle),
    rgba(118, 211, 255, 0) 0%,
    rgba(118, 211, 255, 0.8) 10%,
    rgba(182, 119, 255, 0.6) 20%,
    rgba(118, 211, 255, 0) 30%
  );
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: circuit-flow 2s linear infinite;
  z-index: 6;
  pointer-events: none;
}

/* --- Effect 4: Rising Data Particles --- */
@keyframes particle-rise {
  0% {
    transform: translateY(0);
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  90% {
    opacity: 0.6;
  }
  100% {
    transform: translateY(-100%);
    opacity: 0;
  }
}

@keyframes particle-rise-alt {
  0% {
    transform: translateY(0) translateX(0);
    opacity: 0;
  }
  15% {
    opacity: 0.8;
  }
  85% {
    opacity: 0.3;
  }
  100% {
    transform: translateY(-100%) translateX(20px);
    opacity: 0;
  }
}

.data-particles {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.tv-screen.fx-particles .data-particles {
  opacity: 1;
}

.data-particles::before,
.data-particles::after {
  content: '';
  position: absolute;
  bottom: 0;
  width: 100%;
  height: 100%;
}

.data-particles::before {
  box-shadow:
    10% 90% 0 1px rgba(118, 211, 255, 0.6),
    25% 95% 0 0.5px rgba(182, 119, 255, 0.5),
    40% 88% 0 1px rgba(118, 211, 255, 0.4),
    55% 92% 0 0.5px rgba(118, 211, 255, 0.7),
    70% 87% 0 1px rgba(182, 119, 255, 0.5),
    85% 93% 0 0.5px rgba(118, 211, 255, 0.6),
    15% 96% 0 1px rgba(182, 119, 255, 0.4),
    90% 89% 0 0.5px rgba(118, 211, 255, 0.5);
  animation: particle-rise 3s linear infinite;
}

.data-particles::after {
  box-shadow:
    5% 91% 0 0.5px rgba(118, 211, 255, 0.5),
    20% 94% 0 1px rgba(182, 119, 255, 0.6),
    35% 87% 0 0.5px rgba(118, 211, 255, 0.4),
    50% 96% 0 1px rgba(182, 119, 255, 0.5),
    65% 90% 0 0.5px rgba(118, 211, 255, 0.7),
    80% 93% 0 1px rgba(118, 211, 255, 0.4),
    45% 89% 0 0.5px rgba(182, 119, 255, 0.6),
    95% 95% 0 1px rgba(118, 211, 255, 0.5);
  animation: particle-rise-alt 4s linear 1.5s infinite;
}

/* --- Effect 5: Text Decrypt (JS-driven via .decrypting class) --- */
.window-card h4.decrypting {
  font-family: 'Courier New', monospace;
  letter-spacing: 0.08em;
  color: rgba(118, 211, 255, 0.9);
  text-shadow: 0 0 8px rgba(118, 211, 255, 0.4);
}

/* === AI Stylist Section - Hero Card Dimensions === */
.assistant-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--section-gap);
  align-items: stretch;
}

.assistant-card {
  position: relative;
  border-radius: var(--card-radius);
  background: linear-gradient(135deg, var(--surface), rgba(255,255,255,0.01));
  border: 1px solid rgba(255,255,255,0.04);
  padding: var(--space-2xl);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  min-height: 500px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.assistant-card .eyebrow {
  display: block;
  color: var(--accent-1);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 1rem;
}

.assistant-card h2 {
  font-size: 2.2rem;
  margin: 0 0 1rem 0;
  background: linear-gradient(135deg, var(--accent-1) 0%, var(--accent-2) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.assistant-card > p:nth-of-type(1) {
  font-size: 1.05rem;
  color: var(--muted);
  line-height: 1.8;
  margin: 0 0 1.5rem 0;
}

.input-group {
  display: flex;
  gap: var(--space-sm);
  margin: var(--space-lg) 0;
  align-items: stretch;
}

.ai-stylist-input {
  flex: 1;
  padding: var(--space-md) 1rem;
  border-radius: 12px;
  border: 1px solid rgba(118,211,255,0.15);
  background: rgba(118,211,255,0.04);
  color: var(--text-strong);
  font-size: 1rem;
  transition: all 0.3s ease;
  placeholder-text: var(--muted);
}

.ai-stylist-input:focus {
  outline: none;
  background: rgba(118,211,255,0.08);
  border-color: rgba(118,211,255,0.4);
  box-shadow: 0 0 20px rgba(118,211,255,0.2);
}

.ai-stylist-input::placeholder {
  color: var(--muted);
}

.recommendation-panel {
  background: linear-gradient(135deg, rgba(118,211,255,0.08) 0%, rgba(182,119,255,0.06) 100%);
  border: 1px solid rgba(118,211,255,0.2);
  border-radius: 16px;
  padding: var(--space-lg);
  margin: var(--space-lg) 0;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.recommendation-panel h3 {
  font-size: 1.1rem;
  color: var(--accent-1);
  margin: 0 0 0.75rem 0;
}

.recommendation-text {
  color: var(--muted);
  font-size: 0.95rem;
  margin: 0;
  line-height: 1.6;
}

.ai-art-preview {
  width: 100%;
  height: 300px;
  border-radius: 16px;
  object-fit: cover;
  margin-top: var(--space-lg);
}

/* === Shop Section - Horizontal Rolling Frames === */
.products {
  position: relative;
  overflow: hidden;
}

.product-grid-carousel {
  display: flex;
  gap: 1.5rem;
  padding: 1rem 0;
  overflow-x: auto;
  scroll-behavior: smooth;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}

.product-grid-carousel::-webkit-scrollbar {
  height: 6px;
}

.product-grid-carousel::-webkit-scrollbar-track {
  background: rgba(118,211,255,0.1);
  border-radius: 10px;
}

.product-grid-carousel::-webkit-scrollbar-thumb {
  background: rgba(118,211,255,0.3);
  border-radius: 10px;
}

.product-grid-carousel::-webkit-scrollbar-thumb:hover {
  background: rgba(118,211,255,0.5);
}

.product-card {
  flex: 0 0 calc(25% - 1.125rem);
  min-width: 240px;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}

@media (max-width: 1024px) {
  .product-card {
    flex: 0 0 calc(33.333% - 1rem);
  }
}

@media (max-width: 768px) {
  .product-card {
    flex: 0 0 calc(50% - 0.75rem);
  }
}

@media (max-width: 480px) {
  .product-card {
    flex: 0 0 100%;
  }

  .window-card h4 {
    font-size: 1.2rem;
  }

  .window-card p {
    font-size: 0.9rem;
  }
}

@media (max-width: 768px) {
  .window-card {
    padding: 1.5rem;
  }

  .window-card h4 {
    font-size: 1.3rem;
  }

  .window-card p {
    font-size: 0.95rem;
    line-height: 1.5;
  }
}

  .hero-copy h1 {
    font-size: 1.6rem;
  }
}

/* === Premium Input Enhancement === */
.input-group .btn {
  padding: var(--space-md) var(--space-lg);
  white-space: nowrap;
  font-weight: 700;
  letter-spacing: 0.05em;
}

/* === Section heading improvements === */
.section-heading {
  text-align: center;
  margin-bottom: var(--space-2xl);
  animation: fadeInUp 0.8s ease-out;
}

.section-heading .eyebrow {
  display: inline-block;
  color: var(--accent-1);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: var(--space-sm);
}

.section-heading h2 {
  font-size: 2.8rem;
  margin: var(--space-sm) 0 var(--space-md) 0;
  background: linear-gradient(135deg, var(--text-strong) 0%, var(--accent-1) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.section-heading p {
  font-size: 1.05rem;
  color: var(--muted);
  max-width: 600px;
  margin: 1rem auto 0;
  line-height: 1.7;
}

/* === Responsive Adjustments === */
@media (max-width: 1024px) {
  .assistant-card {
    min-height: auto;
  }
}

@media (max-width: 768px) {
  .window-strip {
    min-height: 200px;
  }

  .assistant-card {
    padding: var(--space-xl);
  }

  .assistant-card h2 {
    font-size: 1.8rem;
  }

  .input-group {
    flex-direction: column;
  }

  .product-grid-carousel {
    gap: 1rem;
  }
}

/* === Loading and transition states === */
.loading {
  position: relative;
  pointer-events: none;
  opacity: 0.6;
}

.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 30px;
  height: 30px;
  border: 3px solid rgba(118,211,255,0.2);
  border-top-color: var(--accent-1);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* === Smooth scroll prefernces === */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
