/*
 * TechPulse Futuristic Cyber-Dark Glassmorphic Design System
 * Aesthetic: #08090d base, neon cyan (#06b6d4) & tech emerald (#10b981), glassmorphism
 */

:root {
  --bg-primary: #08090d;
  --bg-secondary: #0d1117;
  --bg-card: rgba(255, 255, 255, 0.04);
  --bg-card-hover: rgba(255, 255, 255, 0.08);
  --border-glass: rgba(255, 255, 255, 0.09);
  --border-glass-hover: rgba(6, 182, 212, 0.5);
  
  --neon-cyan: #06b6d4;
  --neon-cyan-bright: #22d3ee;
  --neon-cyan-glow: rgba(6, 182, 212, 0.28);
  
  --tech-emerald: #10b981;
  --tech-emerald-glow: rgba(16, 185, 129, 0.28);
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-body: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;
  
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  
  --shadow-glow: 0 0 25px rgba(6, 182, 212, 0.25);
  --shadow-card: 0 10px 30px -10px rgba(0, 0, 0, 0.7);
}

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

html {
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  touch-action: pan-y;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-primary);
  overflow-x: hidden;
  position: relative;
  touch-action: pan-y;
}

/* GPU Hardware-Accelerated Fixed Background (Eliminates CPU repaint jank from background-attachment: fixed) */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background: 
    radial-gradient(circle at 15% 15%, rgba(6, 182, 212, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 85% 75%, rgba(16, 185, 129, 0.06) 0%, transparent 40%),
    var(--bg-primary);
  pointer-events: none;
  transform: translate3d(0, 0, 0);
}

/* Typography Defaults */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}

a {
  color: var(--neon-cyan);
  text-decoration: none;
  transition: color 0.2s ease, text-shadow 0.2s ease;
}

a:hover {
  color: var(--neon-cyan-bright);
  text-shadow: 0 0 8px var(--neon-cyan-glow);
}

/* Glassmorphism Surface Base */
.glass-panel {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
}

/* Navbar */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(8, 9, 13, 0.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-glass);
  transform: translateZ(0);
  will-change: transform;
}

.header-container {
  max-width: 1300px;
  margin: 0 auto;
  padding: 0.9rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
}

.brand-logo-img {
  height: 38px;
  width: auto;
  filter: drop-shadow(0 0 8px rgba(6, 182, 212, 0.4));
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  list-style: none;
}

.nav-link {
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 500;
  transition: all 0.2s ease;
  position: relative;
  padding: 0.25rem 0;
}

.nav-link:hover, .nav-link.active {
  color: var(--text-main);
}

.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--neon-cyan), var(--tech-emerald));
  border-radius: 2px;
}

.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.8rem;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: var(--radius-full);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--tech-emerald);
  letter-spacing: 0.5px;
}

.pulse-dot {
  width: 7px;
  height: 7px;
  background-color: var(--tech-emerald);
  border-radius: 50%;
  animation: pulse-glow 2s infinite ease-in-out;
}

@keyframes pulse-glow {
  0% { transform: scale(0.9); opacity: 0.7; box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6); }
  70% { transform: scale(1.1); opacity: 1; box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.9); opacity: 0.7; box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Hero Section */
.hero-section {
  position: relative;
  padding: 3.5rem 1.5rem 2rem;
  text-align: center;
  max-width: 900px;
  margin: 0 auto;
}

.hero-glow-aura {
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translate3d(-50%, -50%, 0);
  will-change: transform;
  width: 480px;
  height: 200px;
  background: radial-gradient(ellipse at center, rgba(6, 182, 212, 0.25) 0%, rgba(16, 185, 129, 0.1) 40%, transparent 70%);
  filter: blur(50px);
  z-index: -1;
  pointer-events: none;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--neon-cyan);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 0.75rem;
  padding: 0.25rem 0.75rem;
  background: rgba(6, 182, 212, 0.08);
  border: 1px solid rgba(6, 182, 212, 0.2);
  border-radius: var(--radius-full);
}

.hero-title {
  font-size: clamp(2.2rem, 5vw, 3.5rem);
  font-weight: 900;
  letter-spacing: -1px;
  margin-bottom: 1rem;
}

.gradient-text {
  background: linear-gradient(135deg, #ffffff 30%, var(--neon-cyan-bright) 70%, var(--tech-emerald) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  font-size: 1.15rem;
  color: var(--text-muted);
  max-width: 680px;
  margin: 0 auto 2rem;
}

/* Search & Category Filter Section */
.controls-wrapper {
  max-width: 1300px;
  margin: 0 auto 2.5rem;
  padding: 0 1.5rem;
}

.search-box-container {
  max-width: 620px;
  margin: 0 auto 1.5rem;
  position: relative;
}

.search-icon {
  position: absolute;
  left: 1.1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  pointer-events: none;
  font-size: 1.1rem;
}

.search-input {
  width: 100%;
  padding: 0.95rem 1rem 0.95rem 3rem;
  background: rgba(13, 17, 23, 0.92);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-full);
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 1rem;
  outline: none;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.search-input:focus {
  border-color: var(--neon-cyan);
  box-shadow: 0 0 20px var(--neon-cyan-glow);
  background: rgba(13, 17, 23, 0.95);
}

.search-input::placeholder {
  color: var(--text-dim);
}

.search-shortcut-badge {
  position: absolute;
  right: 1.1rem;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 4px;
  padding: 0.15rem 0.45rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-dim);
}

/* Category Filter Pills */
.category-filter-pills {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.category-pill {
  appearance: none;
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-full);
  color: var(--text-muted);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.88rem;
  padding: 0.5rem 1.1rem;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.category-pill:hover {
  background: var(--bg-card-hover);
  color: var(--text-main);
  border-color: rgba(255, 255, 255, 0.2);
}

.category-pill.active {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.22) 0%, rgba(16, 185, 129, 0.22) 100%);
  border-color: var(--neon-cyan);
  color: #ffffff;
  box-shadow: 0 0 15px var(--neon-cyan-glow);
}

/* Results Status Bar */
.results-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 1.25rem;
  font-size: 0.85rem;
  color: var(--text-dim);
}

/* Stories Grid */
.stories-container {
  max-width: 1300px;
  margin: 0 auto;
  padding: 0 1.5rem 4rem;
  width: 100%;
}

.stories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.75rem;
}

/* 2:3 Vertical Aspect Ratio Story Card */
.story-card {
  position: relative;
  aspect-ratio: 2 / 3;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: #0d1117;
  border: 1px solid var(--border-glass);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), 
              border-color 0.25s ease, 
              box-shadow 0.25s ease;
  content-visibility: auto;
  contain-intrinsic-size: 0 420px;
}

@media (hover: hover) and (pointer: fine) {
  .story-card:hover {
    transform: translateY(-6px) scale(1.015);
    border-color: var(--neon-cyan);
    box-shadow: 0 16px 36px -10px rgba(0, 0, 0, 0.85), var(--shadow-glow);
  }
}

.story-card:focus-visible {
  outline: 2px solid var(--neon-cyan-bright);
  outline-offset: 4px;
}

/* Background Image with Dark Cyber Gradient Scrim */
.story-card-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
  z-index: 1;
}

@media (hover: hover) and (pointer: fine) {
  .story-card:hover .story-card-bg {
    transform: scale(1.05);
  }
}

.story-card-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(8, 9, 13, 0.15) 0%,
    rgba(8, 9, 13, 0.4) 40%,
    rgba(8, 9, 13, 0.85) 70%,
    rgba(8, 9, 13, 0.98) 100%
  );
  z-index: 2;
  transition: opacity 0.3s ease;
}

@media (hover: hover) and (pointer: fine) {
  .story-card:hover .story-card-scrim {
    background: linear-gradient(
      180deg,
      rgba(8, 9, 13, 0.1) 0%,
      rgba(8, 9, 13, 0.35) 35%,
      rgba(8, 9, 13, 0.9) 70%,
      #08090d 100%
    );
  }
}

/* Card Header (Category Badge & Watch Icon) */
.story-card-top {
  position: absolute;
  top: 1rem;
  left: 1rem;
  right: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 3;
}

.story-cat-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  color: #ffffff;
  padding: 0.3rem 0.65rem;
  background: rgba(13, 17, 23, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-full);
  letter-spacing: 0.5px;
}

.story-duration-badge {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--neon-cyan-bright);
  background: rgba(6, 182, 212, 0.15);
  border: 1px solid rgba(6, 182, 212, 0.3);
  padding: 0.25rem 0.55rem;
  border-radius: var(--radius-full);
}

/* High-CTR Urgency Badge */
.story-urgency-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #fbbf24;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.4);
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  margin-bottom: 0.5rem;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.25);
}

/* Card Content Area */
.story-card-body {
  position: relative;
  z-index: 3;
  padding: 1.25rem;
}

.story-card-title {
  font-size: 1.15rem;
  font-weight: 800;
  line-height: 1.35;
  color: #ffffff;
  margin-bottom: 0.5rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
  transition: color 0.2s ease;
}

@media (hover: hover) and (pointer: fine) {
  .story-card:hover .story-card-title {
    color: var(--neon-cyan-bright);
  }
}

.story-card-snippet {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin-bottom: 0.9rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.story-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.6rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.78rem;
  color: var(--text-dim);
}

.story-source {
  font-weight: 600;
  color: var(--text-dim);
}

.tap-to-view-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 700;
  font-size: 0.78rem;
  color: #08090d;
  background: linear-gradient(135deg, var(--neon-cyan), var(--tech-emerald));
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-full);
  box-shadow: 0 0 12px var(--neon-cyan-glow);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease;
}

@media (hover: hover) and (pointer: fine) {
  .story-card:hover .tap-to-view-cta {
    transform: scale(1.06);
    box-shadow: 0 0 18px rgba(6, 182, 212, 0.6);
  }
}

.play-arrow {
  font-size: 0.65rem;
}

/* Empty State */
.no-stories-found {
  grid-column: 1 / -1;
  text-align: center;
  padding: 4rem 1rem;
}

/* Lightbox Modal Dialog (Modern top layer with @starting-style) */
dialog#story-dialog {
  margin: auto;
  border: none;
  background: transparent;
  padding: 0;
  overflow: visible;
  max-width: 95vw;
  max-height: 95vh;
  outline: none;
}

/* Modern backdrop with blur */
dialog#story-dialog::backdrop {
  background-color: rgba(8, 9, 13, 0.85);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  transition: opacity 0.3s ease-out, display 0.3s allow-discrete, overlay 0.3s allow-discrete;
}

/* Dialog entry/exit styles */
dialog#story-dialog[open] {
  opacity: 1;
  transform: scale(1);

  @starting-style {
    opacity: 0;
    transform: scale(0.92);
  }
}

dialog#story-dialog {
  opacity: 0;
  transform: scale(0.92);
  transition-property: opacity, transform, display, overlay;
  transition-duration: 0.28s;
  transition-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
  transition-behavior: allow-discrete;
}

/* Modal Frame (Cyber Smartphone Wrapper) */
.modal-phone-frame {
  position: relative;
  width: 420px;
  height: min(780px, 90vh);
  max-width: 94vw;
  background: #08090d;
  border-radius: 36px;
  border: 2px solid rgba(6, 182, 212, 0.4);
  box-shadow: 0 0 50px rgba(0, 0, 0, 0.9), 0 0 30px var(--neon-cyan-glow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Phone Dynamic Island / Speaker Notch */
.modal-frame-notch {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: 96px;
  height: 20px;
  background: #000000;
  border-radius: 12px;
  z-index: 20;
  pointer-events: none;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

/* Modal Controls Header */
.modal-top-bar {
  position: absolute;
  top: 12px;
  left: 14px;
  right: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 30;
}

.modal-btn {
  background: rgba(8, 9, 13, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #ffffff;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
  transition: all 0.2s ease;
}

.modal-btn:hover {
  background: rgba(6, 182, 212, 0.3);
  border-color: var(--neon-cyan);
  color: var(--neon-cyan-bright);
}

.modal-close-cross {
  font-weight: 300;
}

/* Modal Story Iframe */
.modal-story-iframe {
  width: 100%;
  height: 100%;
  border: none;
  background: #08090d;
}

/* Legal & Policy Pages Architecture */
.legal-container {
  max-width: 860px;
  margin: 2rem auto 4rem;
  padding: 0 1.5rem;
}

.legal-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  box-shadow: var(--shadow-card);
}

.legal-header {
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--border-glass);
  padding-bottom: 1.5rem;
}

.legal-title {
  font-size: 2.2rem;
  margin-bottom: 0.5rem;
}

.legal-last-updated {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--neon-cyan);
}

.legal-content h2 {
  font-size: 1.4rem;
  margin: 1.75rem 0 0.75rem;
  color: var(--neon-cyan-bright);
}

.legal-content p, .legal-content ul {
  font-size: 0.98rem;
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 1.25rem;
}

.legal-content ul {
  padding-left: 1.5rem;
}

.legal-content li {
  margin-bottom: 0.4rem;
}

.contact-highlight-box {
  background: rgba(6, 182, 212, 0.08);
  border: 1px solid rgba(6, 182, 212, 0.25);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  margin: 1.5rem 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.contact-email-link {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1.05rem;
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

/* Site Footer */
.site-footer {
  margin-top: auto;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-glass);
  padding: 3rem 1.5rem 2rem;
}

.footer-container {
  max-width: 1300px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 2.5rem;
  margin-bottom: 2.5rem;
}

.footer-brand p {
  color: var(--text-muted);
  font-size: 0.9rem;
  max-width: 440px;
  margin-top: 0.75rem;
}

.footer-col-title {
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #ffffff;
  margin-bottom: 1rem;
}

.footer-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.footer-links a {
  color: var(--text-muted);
  font-size: 0.9rem;
  transition: color 0.2s ease;
}

.footer-links a:hover {
  color: var(--neon-cyan);
}

.footer-bottom {
  max-width: 1300px;
  margin: 0 auto;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.8rem;
  color: var(--text-dim);
}

/* Responsive Breakpoints */
@media (max-width: 900px) {
  .footer-container {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
}

@media (max-width: 640px) {
  .header-container {
    padding: 0.75rem 1rem;
  }
  
  .nav-links {
    display: none;
  }
  
  .hero-section {
    padding: 2.5rem 1rem 1.5rem;
  }

  /* Smooth horizontal pill swipe on mobile */
  .category-filter-pills {
    flex-wrap: nowrap;
    overflow-x: auto;
    justify-content: flex-start;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 0.5rem;
    padding-left: 0.25rem;
    padding-right: 0.25rem;
  }

  .category-filter-pills::-webkit-scrollbar {
    display: none;
  }

  .category-pill {
    flex-shrink: 0;
    white-space: nowrap;
  }
  
  .stories-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.25rem;
  }
  
  .modal-phone-frame {
    width: 100vw;
    height: 100vh;
    max-width: 100vw;
    border-radius: 0;
    border: none;
  }
  
  .legal-card {
    padding: 1.5rem;
  }
}
