/* ===========================
   FAANG-GRADE TIKTOK EMBED OPTIMIZATION
   CSS with L7+ Performance & CEO-Proof Features
   =========================== */

/* ===========================
   Critical Performance Reset
   =========================== */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: #0a0a0a;
  color: #e5e5e5;
  line-height: 1.6;
  overflow-x: hidden;
}

/* ===========================
   OPTIMIZED TIKTOK EMBED
   CEO-Proof Implementation
   =========================== */

/* Container with CSS Containment for performance */
.ttk {
  max-width: 420px;
  margin: 0 auto 12px;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
  
  /* CRITICAL: CSS Containment - tells browser this element's internals 
     don't affect external layout, enables rendering optimizations */
  contain: layout style paint;
  
  /* Ensure aspect ratio stability */
  position: relative;
}

/* Poster button (before iframe loads) */
.ttk__poster {
  display: block;
  position: relative;
  width: 100%;
  aspect-ratio: 9/16;
  border: none;
  padding: 0;
  cursor: pointer;
  background: #000;
  overflow: hidden;
  
  /* Accessible focus state (WCAG 2.4.7 compliance) */
  transition: outline-offset 0.15s ease;
}

.ttk__poster:focus {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.ttk__poster:focus:not(:focus-visible) {
  outline: none;
}

/* Support for keyboard navigation */
.ttk__poster:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

/* Poster image */
.ttk__poster-img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Play button overlay */
.ttk__play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 60px;
  height: 60px;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: #fff;
  transition: all 0.2s ease;
}

.ttk__poster:hover .ttk__play {
  transform: translate(-50%, -50%) scale(1.1);
  background: rgba(0, 0, 0, 0.85);
}

/* Frame wrapper with bulletproof aspect ratio */
.ttk__frame {
  position: relative;
  width: 100%;
  aspect-ratio: 9/16;
  background: #000;
  overflow: hidden;
}

/* TRIPLE-LAYER SCROLL LOCK for iframe */
.ttk__frame > iframe {
  /* Layer 1: Absolute positioning lock */
  position: absolute;
  inset: 0; /* Shorthand for top:0 right:0 bottom:0 left:0 */
  width: 100% !important;
  height: 100% !important;
  border: 0;
  
  /* Layer 2: Modern CSS scroll prevention */
  overflow: hidden !important;
  overscroll-behavior: none !important;
  -webkit-overflow-scrolling: auto !important;
  touch-action: manipulation;
  
  /* Layer 3: Hide scrollbars completely */
  scrollbar-width: none !important; /* Firefox */
  -ms-overflow-style: none !important; /* IE/Edge */
  
  /* GPU ACCELERATION for 60fps scroll */
  will-change: transform;
  transform: translateZ(0);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  perspective: 1000px;
}

/* Webkit scrollbar hiding (Chrome, Safari, newer Edge) */
.ttk__frame > iframe::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

/* Error state styling */
.ttk__error {
  padding: 40px 20px;
  text-align: center;
  color: #999;
}

.ttk__error p {
  margin: 0 0 16px;
  font-size: 14px;
}

.ttk__error a {
  color: #fff;
  text-decoration: none;
  font-weight: 500;
  padding: 8px 16px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  display: inline-block;
  transition: all 0.2s ease;
}

.ttk__error a:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.4);
}

/* ===========================
   Reduced Motion Support
   =========================== */
@media (prefers-reduced-motion: reduce) {
  /* Disable autoplay behaviors */
  .ttk__frame > iframe {
    animation: none !important;
    transition: none !important;
  }
  
  .ttk__play,
  .ttk__poster {
    transition: none;
  }
  
  /* Show explicit play controls */
  .ttk__play::after {
    content: '(Click to play)';
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 12px;
    white-space: nowrap;
  }
}

/* ===========================
   Original Styles (preserved)
   =========================== */

/* Press cards */
.press {
  margin: 48px 0;
}

.press-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  overflow: hidden;
  transition: all 0.3s ease;
}

.press-card:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.12);
  transform: translateY(-2px);
}

.press-card--video {
  max-width: 600px;
  margin: 0 auto;
}

.press-toprule {
  height: 4px;
  background: linear-gradient(90deg, #ff6b6b, #4ecdc4, #45b7d1);
}

.press-link {
  display: flex;
  padding: 24px;
  color: inherit;
  text-decoration: none;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
}

.press-kicker {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #999;
  margin-bottom: 8px;
}

.press-headline {
  font-size: 20px;
  font-weight: 600;
  line-height: 1.3;
  margin: 0 0 8px;
  color: #fff;
}

.press-dek {
  font-size: 14px;
  line-height: 1.5;
  color: #aaa;
  margin: 0 0 12px;
}

.press-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #777;
}

.press-dot {
  width: 3px;
  height: 3px;
  background: #555;
  border-radius: 50%;
}

.press-cta {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
}

.press-cta svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

/* Voice moments */
.voice-moment {
  margin: 64px auto;
  max-width: 680px;
  padding: 32px;
  background: rgba(255, 255, 255, 0.02);
  border-left: 3px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

.voice-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #999;
  margin-bottom: 12px;
}

.voice-text {
  font-size: 18px;
  line-height: 1.7;
  color: #e5e5e5;
  margin: 0;
}

/* Story cards */
.story-card {
  margin: 80px 0;
  padding: 40px;
  background: rgba(255, 255, 255, 0.01);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
}

.story-header {
  margin-bottom: 32px;
}

.story-kicker {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: #ff6b6b;
  margin-bottom: 12px;
}

.story-title {
  font-size: 32px;
  font-weight: 700;
  line-height: 1.2;
  margin: 0 0 12px;
  color: #fff;
}

.story-subtitle {
  font-size: 18px;
  line-height: 1.5;
  color: #aaa;
  margin-bottom: 16px;
}

.story-byline {
  font-size: 12px;
  color: #777;
}

.story-lede {
  font-size: 16px;
  line-height: 1.6;
  color: #ccc;
  margin: 24px 0;
  padding-bottom: 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.story-chart {
  margin: 32px 0;
  min-height: 400px;
}

.story-notes,
.story-source {
  font-size: 13px;
  line-height: 1.6;
  color: #999;
  margin: 24px 0;
}

/* Hero section */
.hero {
  padding: 120px 0 80px;
  text-align: center;
}

.hero-title {
  font-size: clamp(48px, 8vw, 72px);
  font-weight: 800;
  line-height: 1.1;
  margin: 0 0 24px;
  letter-spacing: -0.02em;
}

.hero-subtitle {
  font-size: 20px;
  line-height: 1.5;
  color: #aaa;
  max-width: 600px;
  margin: 0 auto;
}

/* Holographic text effect */
.holo {
  background: linear-gradient(
    135deg,
    #667eea 0%,
    #764ba2 25%,
    #f093fb 50%,
    #667eea 75%,
    #764ba2 100%
  );
  background-size: 200% 200%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: holo 8s ease infinite;
}

@keyframes holo {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

/* Container */
.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Header */
header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  padding: 16px 24px;
  background: rgba(10, 10, 10, 0.8);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.05em;
}

/* Backgrounds */
.bg-grit,
.bg-paper,
.bg-vignette {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: -1;
}

.bg-grit {
  opacity: 0.03;
  mix-blend-mode: multiply;
}

.bg-paper {
  opacity: 0.02;
  mix-blend-mode: screen;
}

.bg-vignette {
  background: radial-gradient(ellipse at center, transparent 0%, rgba(0, 0, 0, 0.5) 100%);
}

/* Progress bar */
.progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  background: linear-gradient(90deg, #ff6b6b, #4ecdc4);
  width: 0%;
  z-index: 1001;
  transition: width 0.2s ease;
}

/* Back to top */
.back-to-top {
  position: fixed;
  bottom: 32px;
  right: 32px;
  width: 56px;
  height: 56px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
}

.back-to-top:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
}

/* Loader */
#loader {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #0a0a0a;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.5s ease;
}

#loader.hidden {
  opacity: 0;
  pointer-events: none;
}

.loader-text {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: #666;
  margin-bottom: 24px;
}

.loader-bar {
  width: 200px;
  height: 2px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 1px;
  overflow: hidden;
}

.loader-progress {
  height: 100%;
  background: linear-gradient(90deg, #ff6b6b, #4ecdc4);
  width: 0%;
  animation: loader 1.5s ease infinite;
}

@keyframes loader {
  0% { width: 0%; }
  50% { width: 70%; }
  100% { width: 100%; }
}

/* Canvas background */
#three-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -2;
  opacity: 0.3;
}

/* Custom cursor */
#custom-cursor {
  width: 20px;
  height: 20px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  position: fixed;
  pointer-events: none;
  z-index: 9998;
  transition: transform 0.1s ease;
  display: none;
}

@media (hover: hover) {
  #custom-cursor {
    display: block;
  }
}

/* Mobile responsiveness */
@media (max-width: 768px) {
  .ttk {
    max-width: 100%;
  }
  
  .press-link {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .hero-title {
    font-size: 40px;
  }
  
  .story-card {
    padding: 24px;
  }
}

/* Print styles */
@media print {
  .ttk__frame,
  #three-bg,
  #custom-cursor,
  .back-to-top,
  .progress-bar,
  header {
    display: none !important;
  }
  
  body {
    background: white;
    color: black;
  }
}
