:root {
  --bg: #050608;
  --fg: #f5f5f5;
  --muted: #9ea2aa;
  --accent: #8ab4ff; /* swap to your chrome/blue */
  --card: #101218;
  --border: #232633;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
  background: radial-gradient(circle at top, #0d1117 0, #050608 45%, #000 100%);
  color: var(--fg);
  line-height: 1.6;
}

/* NAVIGATION */
.main-nav {
  border-bottom: 1px solid var(--border);
  background: rgba(5, 6, 8, 0.8);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-container {
  max-width: 960px;
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-logo {
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--fg);
  text-decoration: none;
  transition: color 0.2s;
}

.nav-logo:hover {
  color: var(--accent);
}

.nav-links {
  display: flex;
  gap: 2rem;
  align-items: center;
}

.nav-link {
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
  padding: 0.4rem 0.8rem;
  border-radius: 0.4rem;
  transition: all 0.2s;
  position: relative;
}

.nav-link:hover {
  color: var(--fg);
  background: rgba(138, 180, 255, 0.06);
}

.nav-link.active {
  color: var(--accent);
  background: rgba(138, 180, 255, 0.1);
}

.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 50%;
  transform: translateX(-50%);
  width: 40%;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
}

.page {
  max-width: 960px;
  margin: 0 auto;
  padding: 3rem 1.5rem 4rem;
  position: relative;
  z-index: 2;
}

header,
section {
  margin-bottom: 4rem;
  text-align: center;
}

.label {
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

h1, h2 {
  font-weight: 500;
  letter-spacing: 0.05em;
}

h1 {
  font-size: 3rem;
  margin-bottom: 1rem;
}

h2 {
  font-size: 1.25rem;
  margin-bottom: 1rem;
}

p {
  margin-bottom: 0.75rem;
  color: #d4d7df;
}

.hero {
  text-align: center;
  padding-top: 2rem;
}

.logo {
  max-width: 352px;
  width: 60%;
  height: auto;
  margin-bottom: 1.5rem;
  margin-top: -3rem;
  display: block;
  margin-left: auto;
  margin-right: auto;
  mix-blend-mode: screen;
}

.hero-sub {
  max-width: 520px;
  font-size: 0.95rem;
  margin-bottom: 1rem;
  margin-left: auto;
  margin-right: auto;
}

.hero-micro {
  font-size: 1.0rem;
  color: var(--muted);
  margin-bottom: 1.75rem;
}

.btn-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: center;
}

.btn-primary,
.btn-ghost {
  padding: 0.7rem 1.2rem;
  border-radius: 999px;
  border: 1px solid var(--accent);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  cursor: pointer;
  background: transparent;
}

.btn-primary {
  background: var(--accent);
  color: #050608;
}

.btn-ghost {
  color: var(--accent);
  background: rgba(138, 180, 255, 0.06);
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
}

.card {
  background: linear-gradient(145deg, #080a10, #0f1218);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 1.3rem 1.2rem;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.55);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(
    circle 200px at var(--mouse-x, 50%) var(--mouse-y, 50%),
    rgba(138, 180, 255, 0.08),
    transparent
  );
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  z-index: 0;
}

.card:hover::before {
  opacity: 1;
}

.card > * {
  position: relative;
  z-index: 1;
}

.card-title {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.card h3 {
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

.muted {
  color: var(--muted);
  font-size: 0.8rem;
}

.disclosure {
  font-size: 0.8rem;
  color: var(--muted);
}

.form {
  max-width: 480px;
  margin-top: 1rem;
  margin-left: auto;
  margin-right: auto;
}

.field {
  margin-bottom: 1rem;
}

label {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin-bottom: 0.3rem;
}

input, textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border-radius: 0.5rem;
  border: 1px solid var(--border);
  background: #050609;
  color: var(--fg);
  font-size: 0.85rem;
}

.input-with-prefix {
  position: relative;
  display: flex;
  align-items: center;
}

.input-prefix {
  position: absolute;
  left: 0.75rem;
  color: var(--fg);
  font-size: 0.85rem;
  pointer-events: none;
  z-index: 1;
}

.input-with-prefix input {
  padding-left: 1.75rem;
}

textarea {
  min-height: 120px;
  resize: vertical;
}

footer {
  font-size: 0.7rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
  padding-top: 1.5rem;
}

footer a {
  color: var(--muted);
  text-decoration: none;
  margin-right: 0.75rem;
  font-size: 0.7rem;
}

.checkbox-line {
  margin-top: 0.75rem;
  font-size: 0.75rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.checkbox-line input[type="checkbox"] {
  width: auto;
  cursor: pointer;
  accent-color: var(--accent);
}

.checkbox-line label {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: none;
  letter-spacing: normal;
  margin: 0;
}

.form .checkbox-line {
  margin-bottom: 1.25rem;
  margin-top: 1rem;
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: var(--muted);
  border-color: var(--muted);
}

/* PASSWORD PROTECTION STYLES */
.password-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.password-overlay.hidden {
  display: none;
}

.password-box {
  background: linear-gradient(145deg, #0a0c12, #12151d);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 2.5rem 2rem;
  max-width: 400px;
  width: 90%;
  text-align: center;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.7);
}

.password-box h2 {
  margin-bottom: 0.5rem;
  font-size: 1.5rem;
}

.password-box p {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

.password-box input {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  border: 1px solid var(--border);
  background: #050609;
  color: var(--fg);
  font-size: 1rem;
  margin-bottom: 1rem;
  text-align: center;
}

.password-box input:focus {
  outline: none;
  border-color: var(--accent);
}

.password-box .btn-primary {
  width: 100%;
  padding: 0.75rem;
}

.password-error {
  color: #fca5a5;
  font-size: 0.85rem;
  margin-top: 0.75rem;
  min-height: 20px;
}

/* MODAL STYLES */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
}

.modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background: linear-gradient(145deg, #0a0c12, #12151d);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 2rem;
  max-width: 400px;
  width: 90%;
  position: relative;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.7);
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 1.8rem;
  cursor: pointer;
  line-height: 1;
  padding: 0;
  width: 30px;
  height: 30px;
  transition: color 0.2s;
}

.modal-close:hover {
  color: var(--fg);
}

.modal-content h3 {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
}

.modal-text {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 1.5rem;
}

.modal-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.modal-form input {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border-radius: 0.5rem;
  border: 1px solid var(--border);
  background: #050609;
  color: var(--fg);
  font-size: 0.9rem;
}

.modal-form input:focus {
  outline: none;
  border-color: var(--accent);
}

.modal-form .btn-primary {
  width: 100%;
  padding: 0.75rem;
  margin-top: 0.25rem;
}

.form-message {
  margin-top: 1rem;
  font-size: 0.85rem;
  text-align: center;
  padding: 0.5rem;
  border-radius: 0.5rem;
}

.form-message.success {
  color: #6ee7b7;
  background: rgba(110, 231, 183, 0.1);
  border: 1px solid rgba(110, 231, 183, 0.3);
}

.form-message.error {
  color: #fca5a5;
  background: rgba(252, 165, 165, 0.1);
  border: 1px solid rgba(252, 165, 165, 0.3);
}

/* CASE STUDY PAGE STYLES */

/* Case Study Background Image */
body.case-study-page {
  background-image: url('NEW BACK.jpg');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  background-repeat: no-repeat;
}

/* Fix mobile background glitch */
@media (max-width: 768px) {
  body.case-study-page {
    background-attachment: scroll;
    background-size: cover;
    background-position: center top;
  }
  
  body.case-study-page::before {
    position: absolute;
    min-height: 100%;
    height: auto;
    bottom: 0;
    background: linear-gradient(to bottom, rgba(5, 6, 8, 0.7) 0%, rgba(0, 0, 0, 0.85) 100%);
  }
  
  .bg-grid {
    display: none;
  }
  
  .bg-scanline {
    display: none;
  }
}

body.case-study-page::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at top, rgba(13, 17, 23, 0.6) 0, rgba(5, 6, 8, 0.75) 45%, rgba(0, 0, 0, 0.85) 100%);
  z-index: -1;
  pointer-events: none;
}

/* Animated Background Elements */
.bg-grid {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: 
    linear-gradient(rgba(138, 180, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(138, 180, 255, 0.03) 1px, transparent 1px);
  background-size: 50px 50px;
  pointer-events: none;
  z-index: 0;
  opacity: 0.2;
  animation: gridShift 20s linear infinite;
}

@keyframes gridShift {
  0% {
    transform: translate(0, 0);
  }
  100% {
    transform: translate(50px, 50px);
  }
}

.bg-scanline {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  pointer-events: none;
  z-index: 1;
  opacity: 0;
  filter: blur(1px);
  animation: scanline 6s linear infinite;
  /* Subtle white noise static effect */
  background: 
    repeating-linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.5) 0px,
      transparent 1px,
      rgba(255, 255, 255, 0.3) 2px,
      transparent 4px,
      rgba(255, 255, 255, 0.4) 5px,
      transparent 7px,
      rgba(255, 255, 255, 0.25) 8px,
      transparent 10px,
      rgba(255, 255, 255, 0.35) 12px,
      transparent 14px
    );
  box-shadow: 
    0 0 12px rgba(255, 255, 255, 0.15),
    0 0 25px rgba(138, 180, 255, 0.1);
}

/* Subtle flickering noise overlay */
.bg-scanline::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: 
    repeating-linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.15) 0px,
      transparent 2px,
      rgba(255, 255, 255, 0.2) 4px,
      transparent 6px
    );
  animation: noiseShift 0.08s steps(4) infinite;
}

@keyframes noiseShift {
  0% { transform: translateX(0); opacity: 0.6; }
  25% { transform: translateX(-2px); opacity: 1; }
  50% { transform: translateX(1px); opacity: 0.4; }
  75% { transform: translateX(-1px); opacity: 0.8; }
  100% { transform: translateX(2px); opacity: 0.5; }
}

@keyframes scanline {
  0% {
    transform: translateY(-10px);
    opacity: 0;
  }
  3% {
    opacity: 0.25;
  }
  8% {
    opacity: 0.35;
  }
  /* Glitch stutter - quick flicker */
  12% {
    transform: translateY(12vh);
    opacity: 0.3;
  }
  12.2% {
    transform: translateY(11.5vh);
    opacity: 0.5;
  }
  12.4% {
    transform: translateY(12.5vh);
    opacity: 0.15;
  }
  12.6% {
    transform: translateY(11vh);
    opacity: 0.45;
  }
  13% {
    transform: translateY(13vh);
    opacity: 0.25;
  }
  /* Calm section */
  35% {
    transform: translateY(35vh);
    opacity: 0.3;
  }
  /* Another glitch burst */
  55% {
    transform: translateY(55vh);
    opacity: 0.35;
  }
  55.15% {
    transform: translateY(54.5vh);
    opacity: 0.5;
  }
  55.3% {
    transform: translateY(55.5vh);
    opacity: 0.1;
  }
  55.5% {
    transform: translateY(54vh);
    opacity: 0.4;
  }
  56% {
    transform: translateY(56vh);
    opacity: 0.25;
  }
  /* Final glitch near bottom */
  82% {
    transform: translateY(82vh);
    opacity: 0.3;
  }
  82.1% {
    transform: translateY(81.5vh);
    opacity: 0.45;
  }
  82.2% {
    transform: translateY(82.5vh);
    opacity: 0.15;
  }
  82.4% {
    transform: translateY(83vh);
    opacity: 0.35;
  }
  95% {
    opacity: 0.2;
  }
  100% {
    transform: translateY(100vh);
    opacity: 0;
  }
}

.case-study-header {
  text-align: center;
  padding-top: 1.5rem;
  margin-bottom: 1.5rem;
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.case-study-label {
  display: inline-flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  justify-content: center;
}

.label-dot {
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
  box-shadow: 0 0 10px var(--accent);
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.5;
    transform: scale(1.2);
  }
}

.header-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 1.5rem;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

.divider-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
}

.divider-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
}

.glowy-logo {
  max-width: 60px;
  height: auto;
  filter: 
    drop-shadow(0 0 15px #8ab4ff) 
    drop-shadow(0 0 30px rgba(138, 180, 255, 0.8))
    drop-shadow(0 0 50px rgba(138, 180, 255, 0.6))
    drop-shadow(0 0 70px rgba(138, 180, 255, 0.4));
  animation: logoGlow 2s ease-in-out infinite alternate;
  position: relative;
  transform: translateX(-3px);
}

.glowy-logo::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 120%;
  height: 120%;
  background: radial-gradient(circle, rgba(138, 180, 255, 0.4) 0%, transparent 70%);
  border-radius: 50%;
  z-index: -1;
  animation: pulseGlow 2s ease-in-out infinite alternate;
}

@keyframes logoGlow {
  from {
    filter: 
      drop-shadow(0 0 15px #8ab4ff) 
      drop-shadow(0 0 30px rgba(138, 180, 255, 0.8))
      drop-shadow(0 0 50px rgba(138, 180, 255, 0.6))
      drop-shadow(0 0 70px rgba(138, 180, 255, 0.4));
    opacity: 0.95;
  }
  to {
    filter: 
      drop-shadow(0 0 25px #8ab4ff) 
      drop-shadow(0 0 50px rgba(138, 180, 255, 1))
      drop-shadow(0 0 80px rgba(138, 180, 255, 0.8))
      drop-shadow(0 0 120px rgba(138, 180, 255, 0.6));
    opacity: 1;
  }
}

@keyframes pulseGlow {
  from {
    opacity: 0.5;
    transform: translate(-50%, -50%) scale(0.95);
  }
  to {
    opacity: 0.8;
    transform: translate(-50%, -50%) scale(1.1);
  }
}

.case-study-title {
  font-size: 4rem;
  font-weight: 400;
  letter-spacing: 0.1em;
  margin-bottom: 0.5rem;
  position: relative;
  display: block;
  width: 100%;
  text-align: center;
}

.title-glitch {
  background: linear-gradient(135deg, var(--fg) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  position: relative;
  text-shadow: 
    0 0 20px rgba(138, 180, 255, 0.3),
    0 0 40px rgba(138, 180, 255, 0.1);
  animation: 
    glow 3s ease-in-out infinite alternate,
    glitch-main 8s infinite;
  filter: blur(0);
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
}

.title-glitch::before,
.title-glitch::after {
  content: 'BAYBE';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--fg) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  opacity: 0;
}

.title-glitch::before {
  clip-path: polygon(0 0, 100% 0, 100% 35%, 0 35%);
  animation: glitch-top 6s infinite;
  color: #ff0080;
}

.title-glitch::after {
  clip-path: polygon(0 65%, 100% 65%, 100% 100%, 0 100%);
  animation: glitch-bottom 7s infinite;
  color: #00ffff;
}

@keyframes glow {
  from {
    filter: brightness(1);
  }
  to {
    filter: brightness(1.2);
  }
}

@keyframes glitch-main {
  0%, 100% {
    transform: translate(0);
    filter: blur(0) contrast(1);
    opacity: 1;
  }
  10% {
    transform: translate(-2px, 2px);
    filter: blur(0.5px) contrast(1.2);
    opacity: 0.95;
  }
  20% {
    transform: translate(3px, -2px);
    filter: blur(0.3px) contrast(0.9);
    opacity: 1;
  }
  25% {
    transform: translate(-3px, 1px) scale(1.02);
    filter: blur(1px) contrast(1.3) saturate(1.5);
    opacity: 0.9;
  }
  25.5% {
    transform: translate(-3px, 1px) scale(1.02);
    filter: blur(2px) contrast(2) brightness(1.3);
    opacity: 0.7;
  }
  26% {
    transform: translate(2px, -1px) scale(1);
    filter: blur(0) contrast(1);
    opacity: 1;
  }
  40% {
    transform: translate(-1px, 0);
    filter: blur(0) contrast(1);
    opacity: 1;
  }
  50% {
    transform: translate(4px, -3px);
    filter: blur(0.8px) contrast(1.4);
    opacity: 0.85;
  }
  51% {
    transform: translate(-2px, 2px);
    filter: blur(0.2px) contrast(0.8);
    opacity: 1;
  }
  60% {
    transform: translate(2px, -1px);
    filter: blur(0.5px) contrast(1.1);
    opacity: 0.95;
  }
  70% {
    transform: translate(-4px, 3px) skew(1deg);
    filter: blur(1.2px) contrast(1.5);
    opacity: 0.8;
  }
  70.3% {
    transform: translate(-4px, 3px) skew(1deg);
    filter: blur(3px) contrast(2.5) brightness(1.5);
    opacity: 0.6;
  }
  70.6% {
    transform: translate(-4px, 3px) skew(1deg);
    filter: blur(1px) contrast(1.8);
    opacity: 0.85;
  }
  71% {
    transform: translate(3px, -2px) skew(-1deg);
    filter: blur(0.3px) contrast(0.9);
    opacity: 1;
  }
  80% {
    transform: translate(0, 1px);
    filter: blur(0) contrast(1);
    opacity: 1;
  }
  85% {
    transform: translate(-2px, -2px) scale(0.98);
    filter: blur(0.6px) contrast(1.2);
    opacity: 0.9;
  }
  86% {
    transform: translate(2px, 2px) scale(1.01);
    filter: blur(0.4px) contrast(0.85);
    opacity: 1;
  }
  90% {
    transform: translate(-1px, -1px) skew(0.5deg);
    filter: blur(0.3px) contrast(1.1);
    opacity: 0.95;
  }
  92% {
    transform: translate(1px, 1px) skew(-0.5deg);
    filter: blur(0.3px) contrast(0.95);
    opacity: 1;
  }
  94% {
    transform: translate(0) skew(0);
    filter: blur(0) contrast(1);
    opacity: 1;
  }
}

@keyframes glitch-top {
  0%, 100% {
    opacity: 0;
    transform: translate(-2px, -2px);
    clip-path: polygon(0 0, 100% 0, 100% 35%, 0 35%);
  }
  15% {
    opacity: 0;
  }
  15.5% {
    opacity: 0.8;
    transform: translate(-3px, -4px);
    clip-path: polygon(0 0, 100% 0, 100% 33%, 0 37%);
  }
  16% {
    opacity: 0;
    transform: translate(2px, 1px);
    clip-path: polygon(0 2%, 98% 0, 100% 35%, 0 35%);
  }
  48% {
    opacity: 0;
  }
  48.5% {
    opacity: 0.6;
    transform: translate(-4px, -3px);
    clip-path: polygon(0 0, 102% 0, 100% 34%, -2% 36%);
  }
  49% {
    opacity: 0;
    transform: translate(3px, 2px);
  }
  85% {
    opacity: 0;
  }
  85.5% {
    opacity: 0.7;
    transform: translate(-2px, -3px);
    clip-path: polygon(0 0, 100% 0, 99% 36%, 1% 34%);
  }
  86% {
    opacity: 0;
    transform: translate(1px, 1px);
  }
}

@keyframes glitch-bottom {
  0%, 100% {
    opacity: 0;
    transform: translate(2px, 2px);
    clip-path: polygon(0 65%, 100% 65%, 100% 100%, 0 100%);
  }
  18% {
    opacity: 0;
  }
  18.5% {
    opacity: 0.8;
    transform: translate(3px, 4px);
    clip-path: polygon(0 67%, 100% 63%, 100% 100%, 0 100%);
  }
  19% {
    opacity: 0;
    transform: translate(-2px, -1px);
    clip-path: polygon(2% 65%, 100% 65%, 98% 100%, 0 100%);
  }
  52% {
    opacity: 0;
  }
  52.5% {
    opacity: 0.6;
    transform: translate(4px, 3px);
    clip-path: polygon(0 63%, 102% 67%, 100% 100%, -2% 100%);
  }
  53% {
    opacity: 0;
    transform: translate(-3px, -2px);
  }
  88% {
    opacity: 0;
  }
  88.5% {
    opacity: 0.7;
    transform: translate(2px, 3px);
    clip-path: polygon(0 66%, 99% 64%, 100% 100%, 1% 100%);
  }
  89% {
    opacity: 0;
    transform: translate(-1px, -1px);
  }
}

.case-study-subtitle {
  font-size: 1rem;
  color: var(--muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 1.25rem;
}

.chat-btn {
  padding: 0.65rem 1.5rem;
  border-radius: 999px;
  border: 1px solid var(--accent);
  background: rgba(138, 180, 255, 0.1);
  color: var(--accent);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  cursor: pointer;
  transition: all 0.25s ease;
  backdrop-filter: blur(8px);
  box-shadow: 0 0 20px rgba(138, 180, 255, 0.15);
}

.chat-btn:hover {
  background: var(--accent);
  color: #050608;
  box-shadow: 0 0 30px rgba(138, 180, 255, 0.4);
}

/* BAYBE Chat Popup */
.chat-popup {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  z-index: 10000;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.chat-popup.active {
  display: flex;
}

.chat-popup-content {
  position: relative;
  width: 100%;
  max-width: 400px;
  height: 70vh;
  max-height: 580px;
  background: linear-gradient(145deg, #0a0c12, #12151d);
  border: 1px solid var(--accent);
  border-radius: 1.25rem;
  overflow: hidden;
  box-shadow: 
    0 0 60px rgba(138, 180, 255, 0.2),
    0 24px 60px rgba(0, 0, 0, 0.7);
}

.chat-popup-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 32px;
  height: 32px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.chat-popup-close:hover {
  background: rgba(138, 180, 255, 0.2);
  color: var(--fg);
  border-color: var(--accent);
}

.chat-popup iframe {
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 1.25rem;
}

/* Mobile adjustments */
@media (max-width: 600px) {
  .chat-popup {
    padding: 2rem 1rem;
    align-items: center;
  }
  
  .chat-popup-content {
    max-width: 95%;
    height: 65vh;
    max-height: 500px;
    border-radius: 1rem;
  }
  
  .chat-popup iframe {
    border-radius: 1rem;
  }
}

.case-study-animation {
  margin-bottom: 5rem;
  margin-top: 2rem;
  position: relative;
  z-index: 2;
}

.animation-container {
  max-width: 700px;
  margin: 0 auto;
  position: relative;
}

.animation-frame {
  position: relative;
  padding: 20px;
  background: linear-gradient(145deg, rgba(138, 180, 255, 0.05), rgba(5, 6, 8, 0.8));
  border-radius: 1rem;
  box-shadow: 
    0 24px 60px rgba(0, 0, 0, 0.4),
    0 0 60px rgba(138, 180, 255, 0.1);
}

.frame-corner {
  position: absolute;
  width: 30px;
  height: 30px;
  border: 2px solid var(--accent);
  z-index: 3;
}

.frame-corner-tl {
  top: 20px;
  left: 20px;
  border-right: none;
  border-bottom: none;
  border-top-left-radius: 8px;
}

.frame-corner-tr {
  top: 20px;
  right: 20px;
  border-left: none;
  border-bottom: none;
  border-top-right-radius: 8px;
}

.frame-corner-bl {
  bottom: 20px;
  left: 20px;
  border-right: none;
  border-top: none;
  border-bottom-left-radius: 8px;
}

.frame-corner-br {
  bottom: 20px;
  right: 20px;
  border-left: none;
  border-top: none;
  border-bottom-right-radius: 8px;
}

.animation-placeholder {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: linear-gradient(145deg, #080a10, #0f1218);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

.animation-placeholder:hover {
  border-color: var(--accent);
  box-shadow: 0 0 30px rgba(138, 180, 255, 0.2);
}

.animation-placeholder::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(
    circle at center,
    rgba(138, 180, 255, 0.05),
    transparent 70%
  );
}

.placeholder-content {
  position: relative;
  z-index: 1;
  text-align: center;
}

.placeholder-icon {
  font-size: 3rem;
  color: var(--muted);
  opacity: 0.3;
  margin-bottom: 1rem;
  position: relative;
  display: inline-block;
  animation: rotate 10s linear infinite;
}

.icon-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 80px;
  height: 80px;
  border: 2px dashed var(--accent);
  border-radius: 50%;
  opacity: 0.3;
  animation: rotate 15s linear infinite reverse;
}

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

.placeholder-text {
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  opacity: 0.5;
  animation: blink 2s ease-in-out infinite;
}

@keyframes blink {
  0%, 100% {
    opacity: 0.5;
  }
  50% {
    opacity: 0.2;
  }
}

.animation-placeholder img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 1rem;
  mix-blend-mode: screen;
}

.case-study-content {
  margin-bottom: 4rem;
  position: relative;
  z-index: 2;
}

.content-wrapper {
  max-width: 800px;
  margin: 0 auto;
}

.stats-bar {
  display: flex;
  align-items: center;
  justify-content: space-around;
  background: linear-gradient(145deg, rgba(8, 10, 16, 0.8), rgba(15, 18, 24, 0.8));
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 2rem 1.5rem;
  margin-bottom: 3rem;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
  position: relative;
  overflow: hidden;
}

.stats-bar::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.5;
}

.stat-item {
  text-align: center;
  flex: 1;
}

.stat-label {
  font-size: 0.65rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.stat-value {
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.1em;
  text-shadow: 0 0 10px rgba(138, 180, 255, 0.3);
}

.stat-divider {
  width: 1px;
  height: 40px;
  background: linear-gradient(180deg, transparent, var(--border), transparent);
}

.copy-section {
  background: linear-gradient(145deg, #080a10, #0f1218);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 3rem 2.5rem;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.55);
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

.copy-section:hover {
  border-color: rgba(138, 180, 255, 0.5);
  box-shadow: 
    0 18px 45px rgba(0, 0, 0, 0.55),
    0 0 40px rgba(138, 180, 255, 0.1);
}

.section-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.section-number {
  font-size: 2rem;
  font-weight: 600;
  color: var(--accent);
  opacity: 0.3;
  font-variant-numeric: tabular-nums;
  min-width: 60px;
}

.section-title {
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}

.copy-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.5;
}

.copy-section::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  width: 4px;
  height: 60%;
  background: linear-gradient(180deg, transparent, var(--accent), transparent);
  opacity: 0.2;
  transform: translateY(-50%);
}

.copy-text {
  font-size: 1rem;
  line-height: 1.8;
  color: #d4d7df;
  text-align: left;
  margin: 0;
  position: relative;
  z-index: 1;
}

.copy-text p {
  margin-bottom: 1.5rem;
}

.copy-text p:last-child {
  margin-bottom: 0;
}

@media (max-width: 600px) {
  .page {
    padding: 2.5rem 1.25rem 3rem;
  }
  
  .modal-content {
    padding: 1.5rem;
    max-width: 340px;
  }
  
  .logo {
    max-width: 75%;
    width: 75%;
  }
  
  h1 {
    font-size: 1.6rem;
  }

  .nav-container {
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
  }

  .nav-links {
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
  }

  .case-study-title {
    font-size: 2.5rem;
  }

  .title-glitch {
    font-size: 2.5rem;
  }

  .stats-bar {
    flex-direction: column;
    gap: 1.5rem;
  }

  .stat-divider {
    width: 60px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border), transparent);
  }

  .copy-section {
    padding: 2rem 1.5rem;
  }

  .copy-text {
    font-size: 0.95rem;
  }

  .animation-frame {
    padding: 15px;
  }

  .frame-corner {
    width: 20px;
    height: 20px;
  }

  .frame-corner-tl,
  .frame-corner-tr {
    top: 15px;
  }

  .frame-corner-tl {
    left: 15px;
  }

  .frame-corner-tr {
    right: 15px;
  }

  .frame-corner-bl,
  .frame-corner-br {
    bottom: 15px;
  }

  .frame-corner-bl {
    left: 15px;
  }

  .frame-corner-br {
    right: 15px;
  }
}