/**
 * Signal Morph Landing Page - Design System
 */

:root {
  --primary: 270 80% 65%;
  --primary-foreground: 0 0% 100%;
  --background: 225 20% 4%;
  --foreground: 210 20% 92%;
  --card: 225 15% 7%;
  --card-foreground: 210 20% 92%;
  --border: 225 12% 12%;
  --muted: 225 12% 10%;
  --muted-foreground: 220 10% 45%;
  --secondary: 225 12% 10%;
  --secondary-foreground: 210 20% 92%;
}

* { box-sizing: border-box; }
html, body { 
  margin: 0; 
  padding: 0;
  font-family: 'Inter', system-ui, -apple-system, sans-serif; 
  background-color: hsl(var(--background)); 
  color: hsl(var(--foreground)); 
  line-height: 1.5; 
  overflow-x: hidden !important; /* Force no horizontal scroll */
  width: 100% !important;
  position: relative;
}

/* ── Mockup Container ── */
.mockup-window { background: #0b0d10; border: 1px solid rgba(255,255,255,0.1); border-radius: 12px; overflow: hidden; box-shadow: 0 30px 60px -12px rgba(0,0,0,0.5), 0 18px 36px -18px rgba(0,0,0,0.5); }
.mockup-header { height: 38px; background: #1a1c20; display: flex; align-items: center; padding: 0 16px; gap: 16px; border-bottom: 1px solid rgba(255,255,255,0.05); }
.mockup-dots { display: flex; gap: 6px; }
.mockup-dots span { width: 9px; height: 9px; border-radius: 50%; background: rgba(255,255,255,0.15); }
.mockup-tabs { display: flex; gap: 4px; height: 100%; align-items: flex-end; }
.mockup-tab { background: #0f1115; padding: 6px 16px; border-radius: 6px 6px 0 0; font-size: 11px; color: #e2e8f0; display: flex; align-items: center; gap: 6px; }
.mockup-tab-icon { width: 12px; height: 12px; background: hsl(270, 80%, 65%); border-radius: 2px; }
.mockup-body { background: #0b0d10; }

/* ── Mockup App (Replicated from Extension Source) ── */
.m-app { 
  background: #0f1115; 
  color: #e2e8f0; 
  font-family: 'Inter', system-ui, sans-serif; 
  display: flex; 
  flex-direction: column; 
  height: 640px; 
  overflow: hidden;
  border-radius: 12px;
  box-shadow: 0 30px 60px rgba(0,0,0,0.6);
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.m-header {
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  background-color: #1a1c20;
}

.m-brand { display: flex; align-items: center; gap: 10px; }
.m-brand-name { font-weight: 600; font-size: 14px; color: #e2e8f0; }
.m-brand-tag { font-size: 12px; color: #475569; padding-left: 10px; border-left: 1px solid rgba(255, 255, 255, 0.08); margin-left: 4px; }

.m-header-right { display: flex; align-items: center; gap: 12px; }
.m-search-box { 
  background: #0d0f12; 
  border: 1px solid rgba(255, 255, 255, 0.08); 
  border-radius: 9px; 
  padding: 6px 12px; 
  font-size: 13px; 
  color: #475569; 
  width: 200px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.m-nav-link { font-size: 13px; color: #94a3b8; display: flex; align-items: center; gap: 6px; font-weight: 400; cursor: pointer; padding: 5px 11px; border-radius: 6px; }
.m-nav-link:hover { background: #22252a; color: #e2e8f0; }

.m-quick-bar {
  height: 52px;
  padding: 0 32px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  background-color: #1a1c20;
}
.m-pill { 
  background: #22252a; 
  border: 1px solid rgba(255, 255, 255, 0.08); 
  border-radius: 20px; 
  padding: 5px 12px; 
  font-size: 12px; 
  color: #94a3b8; 
  display: flex; 
  align-items: center; 
  gap: 6px; 
}
.m-dot { width: 6px; height: 6px; border-radius: 50%; }

.m-main-layout { display: flex; flex: 1; overflow: hidden; }
.m-col-content { width: 65%; display: flex; flex-direction: column; gap: 20px; overflow-y: hidden; padding: 20px 20px 48px 32px; border-right: 1px solid rgba(255, 255, 255, 0.04); }
.m-col-sidebar { width: 35%; display: flex; flex-direction: column; gap: 20px; padding: 20px 32px 48px 20px; }

.m-stats-grid { display: flex; gap: 12px; }
.m-card-v1 { background: #1a1c20; border: 1px solid rgba(255, 255, 255, 0.04); border-radius: 9px; padding: 12px 20px; flex: 1; display: flex; flex-direction: column; gap: 3px; box-shadow: 0 4px 10px -2px rgba(0,0,0,0.3); }
.m-stat-v { font-size: 20px; font-weight: 600; color: #e2e8f0; line-height: 1.2; }
.m-stat-l { font-size: 11px; color: #94a3b8; font-weight: 400; }

.m-feed-head { display: flex; justify-content: space-between; align-items: center; }
.m-feed-title { font-size: 16px; font-weight: 600; color: #e2e8f0; letter-spacing: -0.015em; }
.m-feed-tabs { display: flex; background: #22252a; border-radius: 6px; border: 1px solid rgba(255, 255, 255, 0.04); padding: 2px; gap: 2px; }
.m-feed-tab { font-size: 12px; padding: 4px 10px; color: #475569; font-weight: 400; cursor: pointer; border-radius: 4px; }
.m-feed-tab.active { background: #5b7fa6; color: #fff; }

.m-article-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.m-article-card { background: #1a1c20; border: 1px solid rgba(255, 255, 255, 0.04); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; box-shadow: 0 4px 10px -2px rgba(0,0,0,0.3); }
.m-article-img { height: 130px; background-size: cover; background-position: center; border-bottom: 1px solid rgba(255, 255, 255, 0.04); }
.m-article-body { padding: 12px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.m-article-meta { display: flex; align-items: center; gap: 6px; font-size: 11px; color: #64748b; font-weight: 500; }
.m-article-title { font-size: 13px; font-weight: 500; color: #e2e8f0; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.m-article-foot { display: flex; justify-content: space-between; align-items: center; margin-top: auto; padding-top: 8px; border-top: 1px solid rgba(255, 255, 255, 0.04); }
.m-article-tags { display: flex; gap: 4px; }
.m-article-tags span { font-size: 10px; font-family: 'JetBrains Mono', monospace; color: #475569; background: rgba(255, 255, 255, 0.03); padding: 1px 6px; border-radius: 3px; border: 1px solid rgba(255, 255, 255, 0.08); }

.m-side-header { margin-bottom: 20px; }
.m-side-head-t { font-size: 16px; font-weight: 600; color: #e2e8f0; }
.m-side-head-s { font-size: 12px; color: #475569; font-weight: 400; }

.m-side-card { background: #1a1c20; border: 1px solid rgba(255, 255, 255, 0.04); border-radius: 12px; padding: 16px; margin-bottom: 20px; box-shadow: 0 4px 10px -2px rgba(0,0,0,0.3); }
.m-side-card-t { font-size: 14px; font-weight: 600; color: #e2e8f0; margin-bottom: 12px; }
.m-row-item { display: flex; justify-content: space-between; font-size: 12px; color: #94a3b8; padding: 8px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.04); }
.m-row-item:last-child { border-bottom: none; }
.m-row-val { color: #5b7fa6; font-weight: 500; }

/* Utility classes */
.m-gradient-text { background-clip: text; -webkit-background-clip: text; color: transparent; background-image: linear-gradient(135deg, hsl(270, 80%, 65%), hsl(195, 90%, 50%)); }
.gradient-btn { background-image: linear-gradient(135deg, hsl(270, 80%, 65%), hsl(195, 90%, 50%)); transition: all 0.3s ease; border: none; cursor: pointer; }
.gradient-btn:hover { background-image: linear-gradient(135deg, hsl(270, 80%, 72%), hsl(195, 90%, 58%)); box-shadow: 0 8px 32px hsl(270 80% 65% / 0.3); transform: translateY(-1px); }

#features a.group, #how-it-works .bg-secondary\/30, #privacy .bg-secondary\/30 { transition: transform 0.25s ease, border-color 0.25s ease, background 0.25s ease; }

/* ── Responsiveness ── */

section {
  overflow-x: hidden !important; /* Contain all sections */
}

.hero-visual {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  width: 100%;
  overflow: hidden !important; /* Contain the scaled mockup layout box */
  height: 680px;
  margin-top: 40px;
  position: relative;
}

.mockup-window {
  width: 1100px;
  flex-shrink: 0;
  transform-origin: top center;
  transition: transform 0.3s ease;
}

@media (max-width: 1200px) {
  .mockup-window { transform: scale(0.9); }
  .hero-visual { height: 620px; }
}

@media (max-width: 1024px) {
  .mockup-window { transform: scale(0.8); }
  .hero-visual { height: 550px; }
}

@media (max-width: 850px) {
  .mockup-window { transform: scale(0.7); }
  .hero-visual { height: 480px; }
}

@media (max-width: 768px) {
  .mockup-window { transform: scale(0.6); }
  .hero-visual { height: 420px; }
}

@media (max-width: 640px) {
  .mockup-window { transform: scale(0.5); }
  .hero-visual { height: 350px; }
  .container { padding-left: 1.25rem; padding-right: 1.25rem; }
}

@media (max-width: 540px) {
  .mockup-window { transform: scale(0.4); }
  .hero-visual { height: 280px; }
}

@media (max-width: 440px) {
  .mockup-window { transform: scale(0.3); }
  .hero-visual { height: 200px; }
}

@media (max-width: 375px) {
  .mockup-window { transform: scale(0.28); }
  .hero-visual { height: 190px; }
}

@media (max-width: 340px) {
  .mockup-window { transform: scale(0.26); }
  .hero-visual { height: 170px; }
}

@media (max-width: 400px) {
  nav span { font-size: 14px; }
  nav .container { padding-left: 1rem; padding-right: 1rem; }
  .gradient-btn { padding-left: 10px; padding-right: 10px; font-size: 10px; }
}

@media (max-width: 360px) {
  nav span { display: none !important; } /* Hide "Signal Morph" text to save space */
}

/* ── Global Section Refinements ── */

@media (max-width: 640px) {
  section { padding-top: 4rem !important; padding-bottom: 4rem !important; }
  .hero-visual { margin-top: 20px; }
  
  /* Hero Typography Edge Cases */
  #typed-text { 
    display: block !important; 
    width: 100% !important; 
    text-align: center !important; 
    font-size: 0.85rem !important;
  }
}

/* Fix stats row wrapping */
.hero-stats-row {
  display: flex !important;
  flex-wrap: wrap !important;
  justify-content: center !important;
  gap: 2rem !important;
}

@media (max-width: 480px) {
  .hero-stats-row { 
    flex-direction: column !important; 
    align-items: center !important; 
    gap: 2rem !important; 
  }
  .hero-stats-row > div { width: 100% !important; }
  
  /* Subtitle clipping fix */
  p.uppercase.tracking-\[0\.25em\] { 
    letter-spacing: 0.1em !important; 
    font-size: 0.7rem !important; 
    line-height: 1.6 !important;
    padding: 0 1.5rem !important;
    min-height: 3em !important;
  }
}

/* Footer Mobile Centering */
@media (max-width: 640px) {
  footer, footer section { overflow: hidden !important; }
  footer .container { 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    text-align: center; 
  }
  footer .grid { 
    grid-template-columns: 1fr !important;
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    gap: 2.5rem !important;
  }
  footer ul { 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    width: 100%;
  }
  footer .md\:col-span-2 { 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
  }
}

/* Smooth grid transitions */
#features .grid, #how-it-works .grid, #privacy .grid {
  display: grid;
  gap: 1rem;
}

@media (max-width: 1024px) {
  #features .grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  #features .grid, #how-it-works .grid, #privacy .grid { grid-template-columns: 1fr !important; }
}