/* ==========================================================================
   CASEANDWRAP — CYBERPUNK COMING SOON
   Minimal, premium, futuristic landing page
   Zero-dependency, Cloudflare Pages first
   ========================================================================== */

/* --------------------------------------------------------------------------
   Design Tokens
   -------------------------------------------------------------------------- */
:root {
  --bg-color: #000000;
  --color-primary: #00A3FF;       /* Electric Blue */
  --color-accent: #00E5FF;        /* Cyan Blue (glitch highlight) */
  --color-primary-dim: rgba(0, 163, 255, 0.65);
  --color-primary-faint: rgba(0, 163, 255, 0.15);
  --color-primary-glow: rgba(0, 163, 255, 0.35);
  
  --font-heading: 'Orbitron', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Courier New', Courier, monospace;
}

/* --------------------------------------------------------------------------
   Reset & Base Styles
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  width: 100%;
  height: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  background-color: var(--bg-color);
  color: var(--color-primary);
  font-family: var(--font-heading);
  overflow-x: hidden;
  overflow-y: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background: #000000;
}

/* --------------------------------------------------------------------------
   Background & Environmental Effects
   -------------------------------------------------------------------------- */

/* Center radial glow behind the main typography */
.ambient-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background: radial-gradient(
    ellipse 65vw 45vh at 50% 50%,
    rgba(0, 163, 255, 0.08) 0%,
    rgba(0, 229, 255, 0.02) 35%,
    rgba(0, 0, 0, 0.8) 70%,
    #000000 100%
  );
  animation: ambientPulse 6s ease-in-out infinite alternate;
}

@keyframes ambientPulse {
  0% {
    opacity: 0.8;
    transform: scale(0.98);
  }
  100% {
    opacity: 1;
    transform: scale(1.02);
  }
}

/* Subtle CRT Scanlines */
.crt-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.3) 0px,
    rgba(0, 0, 0, 0.3) 1px,
    transparent 1px,
    transparent 2.5px
  );
  opacity: 0.45;
}

/* Slow, faint interference line rolling across the screen */
.scanline-bar {
  position: fixed;
  left: 0;
  right: 0;
  height: 8px;
  background: linear-gradient(
    180deg,
    transparent,
    rgba(0, 229, 255, 0.08),
    rgba(0, 163, 255, 0.12),
    transparent
  );
  pointer-events: none;
  z-index: 11;
  opacity: 0.6;
  top: -10px;
  animation: rollScanline 7s linear infinite;
}

@keyframes rollScanline {
  0% {
    transform: translateY(-20px);
  }
  100% {
    transform: translateY(105vh);
  }
}

/* Initial entrance faint flash of electric-blue light */
.entrance-flash {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 20;
  background: radial-gradient(circle at center, rgba(0, 229, 255, 0.4) 0%, rgba(0, 163, 255, 0.2) 40%, transparent 75%);
  opacity: 0;
  animation: initialFlash 1.4s ease-out forwards;
}

@keyframes initialFlash {
  0% {
    opacity: 0;
  }
  15% {
    opacity: 0.65;
  }
  35% {
    opacity: 0.1;
  }
  45% {
    opacity: 0.35;
  }
  75% {
    opacity: 0;
  }
  100% {
    opacity: 0;
  }
}

/* --------------------------------------------------------------------------
   Stage / Main Content Container
   -------------------------------------------------------------------------- */
.stage {
  position: relative;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  width: 100%;
  max-width: 1400px;
  padding: 2rem 1.5rem;
  box-sizing: border-box;
}

/* --------------------------------------------------------------------------
   Brand Name: CASEANDWRAP
   Clean, understated, generous letter spacing
   -------------------------------------------------------------------------- */
.brand-container {
  margin-bottom: clamp(1rem, 2.5vw, 2rem);
  opacity: 0;
  animation: brandEntrance 1.4s cubic-bezier(0.2, 0.9, 0.3, 1) forwards;
  animation-delay: 0.3s;
}

.brand-name {
  display: inline-block;
  font-family: var(--font-heading);
  font-size: clamp(0.75rem, 1.6vw, 1.05rem);
  font-weight: 700;
  color: var(--color-primary-dim);
  letter-spacing: clamp(0.35em, 0.6vw, 0.55em);
  text-indent: clamp(0.35em, 0.6vw, 0.55em); /* Compensate trailing letter-spacing */
  text-transform: uppercase;
  transition: color 0.3s ease, text-shadow 0.3s ease;
  position: relative;
}

.brand-name:hover {
  color: var(--color-accent);
  text-shadow: 0 0 12px var(--color-accent);
}

@keyframes brandEntrance {
  0% {
    opacity: 0;
    transform: translateY(-8px);
    filter: blur(4px);
  }
  40% {
    opacity: 0.3;
    transform: translateY(0);
    filter: blur(0);
  }
  50% {
    opacity: 0;
  }
  65% {
    opacity: 0.8;
  }
  80% {
    opacity: 0.4;
  }
  100% {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

/* --------------------------------------------------------------------------
   Main Heading: COMING SOON
   Dominant visual element with RGB channel separation & digital glitch slices
   -------------------------------------------------------------------------- */
.title-container {
  position: relative;
  margin-bottom: clamp(1.2rem, 3vw, 2.4rem);
  opacity: 0;
  animation: titleEntrance 1.4s cubic-bezier(0.1, 0.8, 0.2, 1) forwards;
  animation-delay: 0.55s;
}

@keyframes titleEntrance {
  0% {
    opacity: 0;
    transform: scale(0.96) translateY(6px);
    filter: brightness(2) blur(3px);
  }
  30% {
    opacity: 0.7;
    transform: scale(1.02) translateY(-2px);
  }
  45% {
    opacity: 0.1;
  }
  60% {
    opacity: 1;
    transform: scale(0.99);
    filter: brightness(1.5) blur(1px);
  }
  85% {
    opacity: 0.85;
    transform: scale(1.01);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
    filter: brightness(1) blur(0);
  }
}

.main-heading {
  position: relative;
  font-family: var(--font-heading);
  font-size: clamp(2.5rem, 9.2vw, 7.5rem);
  font-weight: 900;
  color: var(--color-primary);
  text-transform: uppercase;
  letter-spacing: clamp(0.06em, 0.15vw, 0.12em);
  line-height: 1;
  white-space: nowrap;
  text-shadow: 
    0 0 16px rgba(0, 163, 255, 0.55),
    0 0 35px rgba(0, 163, 255, 0.25);
  cursor: default;
}

.text-base {
  display: block;
}

/* Glitch Pseudo-elements */
.main-heading::before,
.main-heading::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* Pseudo-element 1: Cyan shift with upper/middle horizontal clip slices */
.main-heading::before {
  color: var(--color-accent);
  z-index: -1;
  text-shadow: -2px 0 6px var(--color-accent);
  clip-path: polygon(0 0, 100% 0, 100% 0, 0 0);
  animation: glitchSliceTop 3.6s infinite steps(1, end);
}

/* Pseudo-element 2: Electric blue shift with middle/lower horizontal clip slices */
.main-heading::after {
  color: var(--color-primary);
  z-index: -2;
  text-shadow: 2px 0 8px var(--color-primary);
  clip-path: polygon(0 0, 100% 0, 100% 0, 0 0);
  animation: glitchSliceBottom 3.6s infinite steps(1, end);
}

/* Idle Glitch Animation Keyframes:
   Stable 90% of the time.
   Bursts every ~3.6s lasting ~250-350ms with clipped horizontal slices,
   cyan/blue RGB displacement, and quick snaps.
*/
@keyframes glitchSliceTop {
  0%, 86% {
    clip-path: polygon(0 0, 100% 0, 100% 0, 0 0);
    transform: translate(0, 0);
    opacity: 0;
  }
  87% {
    clip-path: polygon(0 12%, 100% 12%, 100% 28%, 0 28%);
    transform: translate(-3px, -1px);
    opacity: 0.95;
  }
  89% {
    clip-path: polygon(0 45%, 100% 45%, 100% 58%, 0 58%);
    transform: translate(3px, 1px);
    opacity: 0.85;
  }
  91% {
    clip-path: polygon(0 5%, 100% 5%, 100% 22%, 0 22%);
    transform: translate(-4px, 0.5px);
    opacity: 1;
  }
  93% {
    clip-path: polygon(0 75%, 100% 75%, 100% 92%, 0 92%);
    transform: translate(2px, -1px);
    opacity: 0.9;
  }
  95% {
    clip-path: polygon(0 30%, 100% 30%, 100% 42%, 0 42%);
    transform: translate(-2px, 1px);
    opacity: 0.8;
  }
  96%, 100% {
    clip-path: polygon(0 0, 100% 0, 100% 0, 0 0);
    transform: translate(0, 0);
    opacity: 0;
  }
}

@keyframes glitchSliceBottom {
  0%, 86% {
    clip-path: polygon(0 0, 100% 0, 100% 0, 0 0);
    transform: translate(0, 0);
    opacity: 0;
  }
  87% {
    clip-path: polygon(0 60%, 100% 60%, 100% 82%, 0 82%);
    transform: translate(4px, 1px);
    opacity: 0.9;
  }
  89% {
    clip-path: polygon(0 20%, 100% 20%, 100% 36%, 0 36%);
    transform: translate(-3px, -0.5px);
    opacity: 0.85;
  }
  91% {
    clip-path: polygon(0 68%, 100% 68%, 100% 85%, 0 85%);
    transform: translate(3px, 1px);
    opacity: 0.95;
  }
  93% {
    clip-path: polygon(0 15%, 100% 15%, 100% 32%, 0 32%);
    transform: translate(-2px, -1px);
    opacity: 0.75;
  }
  95% {
    clip-path: polygon(0 84%, 100% 84%, 100% 98%, 0 98%);
    transform: translate(1px, 0.5px);
    opacity: 0.9;
  }
  96%, 100% {
    clip-path: polygon(0 0, 100% 0, 100% 0, 0 0);
    transform: translate(0, 0);
    opacity: 0;
  }
}

/* Subtle micro-twitch on the base text during glitch burst */
.main-heading {
  animation: mainJitter 3.6s infinite steps(1, end);
}

@keyframes mainJitter {
  0%, 86% {
    transform: translate(0, 0);
    filter: drop-shadow(0 0 16px rgba(0, 163, 255, 0.55));
  }
  87% {
    transform: translate(1.5px, 0);
    filter: drop-shadow(-1px 0 12px var(--color-accent));
  }
  89% {
    transform: translate(-1.5px, 0.5px);
    filter: drop-shadow(1px 0 18px var(--color-primary));
  }
  91% {
    transform: translate(1px, -0.5px);
  }
  93% {
    transform: translate(-0.5px, 0);
  }
  95%, 100% {
    transform: translate(0, 0);
    filter: drop-shadow(0 0 16px rgba(0, 163, 255, 0.55));
  }
}

/* Dynamic JS-triggered burst class (adds organic variability) */
.main-heading.is-bursting::before {
  animation: singleGlitchBurst 0.3s steps(2, end) forwards;
}
.main-heading.is-bursting::after {
  animation: singleGlitchBurstAlt 0.3s steps(2, end) forwards;
}

@keyframes singleGlitchBurst {
  0% {
    clip-path: polygon(0 15%, 100% 15%, 100% 38%, 0 38%);
    transform: translate(-4px, -1px);
    opacity: 1;
  }
  35% {
    clip-path: polygon(0 50%, 100% 50%, 100% 70%, 0 70%);
    transform: translate(3px, 1px);
    opacity: 0.85;
  }
  70% {
    clip-path: polygon(0 5%, 100% 5%, 100% 25%, 0 25%);
    transform: translate(-2px, 0.5px);
    opacity: 0.95;
  }
  100% {
    clip-path: polygon(0 0, 100% 0, 100% 0, 0 0);
    transform: translate(0, 0);
    opacity: 0;
  }
}

@keyframes singleGlitchBurstAlt {
  0% {
    clip-path: polygon(0 55%, 100% 55%, 100% 75%, 0 75%);
    transform: translate(4px, 1px);
    opacity: 0.9;
  }
  40% {
    clip-path: polygon(0 20%, 100% 20%, 100% 40%, 0 40%);
    transform: translate(-3px, -1px);
    opacity: 1;
  }
  75% {
    clip-path: polygon(0 78%, 100% 78%, 100% 95%, 0 95%);
    transform: translate(2px, 0);
    opacity: 0.8;
  }
  100% {
    clip-path: polygon(0 0, 100% 0, 100% 0, 0 0);
    transform: translate(0, 0);
    opacity: 0;
  }
}

/* --------------------------------------------------------------------------
   Status Subtitle Line
   // SOMETHING NEW IS INITIALIZING with terminal cursor
   -------------------------------------------------------------------------- */
.status-container {
  opacity: 0;
  animation: statusEntrance 1.4s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
  animation-delay: 0.85s;
}

@keyframes statusEntrance {
  0% {
    opacity: 0;
    transform: translateY(10px);
  }
  60% {
    opacity: 0.4;
  }
  80% {
    opacity: 0.2;
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.status-line {
  font-family: var(--font-mono);
  font-size: clamp(0.7rem, 1.4vw, 0.95rem);
  font-weight: 500;
  color: var(--color-primary-dim);
  letter-spacing: clamp(0.12em, 0.25vw, 0.22em);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.4em;
}

.status-prefix {
  color: var(--color-accent);
  font-weight: 700;
  opacity: 0.9;
}

.status-text {
  color: var(--color-primary-dim);
  text-transform: uppercase;
}

.cursor {
  display: inline-block;
  color: var(--color-accent);
  font-weight: 700;
  animation: cursorBlink 1s steps(2, start) infinite;
  text-shadow: 0 0 8px var(--color-accent);
  margin-left: 2px;
}

@keyframes cursorBlink {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0;
  }
}

/* --------------------------------------------------------------------------
   Mobile & Responsive Optimization
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  .stage {
    padding: 1.5rem 1rem;
  }

  .main-heading {
    letter-spacing: 0.05em;
  }

  .status-line {
    letter-spacing: 0.12em;
    font-size: 0.75rem;
  }
}

@media (max-width: 420px) {
  .brand-name {
    letter-spacing: 0.3em;
    text-indent: 0.3em;
  }
  
  .status-line {
    font-size: 0.68rem;
    letter-spacing: 0.08em;
  }
}

/* --------------------------------------------------------------------------
   Accessibility: prefers-reduced-motion
   Respect user preferences by suppressing flickering, rapid clips & displacements
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .entrance-flash,
  .scanline-bar {
    display: none !important;
  }

  .ambient-glow {
    animation: none !important;
    opacity: 0.9 !important;
  }

  .brand-container,
  .title-container,
  .status-container {
    opacity: 1 !important;
    transform: none !important;
    filter: none !important;
    animation: none !important;
  }

  .main-heading {
    animation: none !important;
    transform: none !important;
  }

  .main-heading::before,
  .main-heading::after {
    display: none !important;
  }

  .cursor {
    animation: none !important;
    opacity: 1 !important;
  }
}
