/* ==========================================================================
   Power Scraper Pro - Apple-Inspired Design System
   Modern CSS with Display P3 colors, scroll animations, and glassmorphism
   ========================================================================== */

/* CSS Custom Properties - Design Tokens */
:root {
  /* Colors - Display P3 for wider gamut on supported displays */
  --color-bg: #000000;
  --color-bg-elevated: #1c1c1e;
  --color-bg-secondary: #2c2c2e;
  --color-text: #f5f5f7;
  --color-text-secondary: #86868b;
  --color-text-tertiary: #6e6e73;
  --color-accent: color(display-p3 0.35 0.5 1);
  --color-accent-fallback: #5B7FFF;
  --color-border: rgba(255, 255, 255, 0.08);

  /* Typography */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Display', sans-serif;
  --font-size-xs: 0.75rem;
  --font-size-sm: 0.875rem;
  --font-size-base: 1rem;
  --font-size-lg: 1.125rem;
  --font-size-xl: 1.25rem;
  --font-size-2xl: 1.5rem;
  --font-size-3xl: 2rem;
  --font-size-4xl: 2.5rem;
  --font-size-5xl: 3.5rem;
  --font-size-hero: clamp(3rem, 8vw, 6rem);

  /* Spacing */
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 1.5rem;
  --space-lg: 2rem;
  --space-xl: 3rem;
  --space-2xl: 4rem;
  --space-3xl: 6rem;
  --space-section: clamp(5rem, 12vw, 10rem);

  /* Layout */
  --max-width: 1200px;
  --max-width-narrow: 800px;

  /* Effects */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-full: 9999px;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 24px 64px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 60px rgba(91, 127, 255, 0.3);

  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);

  /* Glassmorphism */
  --glass-bg: rgba(28, 28, 30, 0.8);
  --glass-border: rgba(255, 255, 255, 0.1);
  --glass-blur: 20px;
}

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

/* Base */
html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  line-height: 1.6;
  color: var(--color-text);
  background-color: var(--color-bg);
  overflow-x: hidden;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ==========================================================================
   Navigation
   ========================================================================== */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: var(--glass-bg);
  backdrop-filter: saturate(180%) blur(var(--glass-blur));
  -webkit-backdrop-filter: saturate(180%) blur(var(--glass-blur));
  border-bottom: 1px solid var(--glass-border);
}

.nav-container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-md);
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-weight: 600;
  font-size: var(--font-size-lg);
  color: var(--color-text);
  transition: opacity var(--transition-fast);
}

.nav-logo:hover {
  opacity: 0.8;
}

.nav-logo svg {
  width: 28px;
  height: 28px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
}

.nav-links a {
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text-secondary);
  transition: color var(--transition-fast);
}

.nav-links a:hover {
  color: var(--color-text);
}

.nav-cta {
  background: var(--color-accent-fallback);
  background: var(--color-accent);
  color: white !important;
  padding: 8px 20px;
  border-radius: var(--radius-full);
  font-weight: 600 !important;
}

.nav-cta:hover {
  filter: brightness(1.1);
}

/* ==========================================================================
   Hero Section
   ========================================================================== */
.hero {
  min-height: 100vh;
  padding: calc(56px + var(--space-3xl)) var(--space-md) var(--space-3xl);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  overflow: hidden;
}

/* Gradient background */
.hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 150%;
  height: 100%;
  background:
    radial-gradient(ellipse 80% 50% at 50% 0%, rgba(91, 127, 255, 0.15) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 70% 20%, rgba(139, 92, 246, 0.1) 0%, transparent 50%);
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: var(--max-width-narrow);
  animation: fadeInUp 0.8s ease-out;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-md);
  padding: 8px 16px;
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
}

.status-dot {
  width: 8px;
  height: 8px;
  background: #30d158;
  border-radius: 50%;
  animation: pulse 2s infinite;
}

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

.hero-title {
  font-size: var(--font-size-hero);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.05;
  margin-bottom: var(--space-md);
  background: linear-gradient(135deg, #fff 0%, #fff 40%, var(--color-accent-fallback) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: var(--font-size-xl);
  color: var(--color-text-secondary);
  line-height: 1.5;
  margin-bottom: var(--space-xl);
}

.hero-buttons {
  display: flex;
  gap: var(--space-sm);
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: var(--space-3xl);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  padding: 16px 32px;
  font-size: var(--font-size-base);
  font-weight: 600;
  border-radius: var(--radius-full);
  border: none;
  cursor: pointer;
  transition: all var(--transition-base);
}

.btn-primary {
  background: var(--color-accent-fallback);
  background: var(--color-accent);
  color: white;
  box-shadow: var(--shadow-glow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 80px rgba(91, 127, 255, 0.4);
}

.btn-secondary {
  background: var(--color-bg-elevated);
  color: var(--color-text);
  border: 1px solid var(--color-border);
}

.btn-secondary:hover {
  background: var(--color-bg-secondary);
}

.btn svg {
  width: 20px;
  height: 20px;
}

/* Hero Window */
.hero-window {
  position: relative;
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  animation: fadeInUp 1s ease-out 0.2s both;
}

.window-chrome {
  height: 52px;
  background: linear-gradient(180deg, #3a3a3c 0%, #2c2c2e 100%);
  display: flex;
  align-items: center;
  padding: 0 20px;
  position: relative;
}

.window-buttons {
  display: flex;
  gap: 8px;
}

.window-btn {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  transition: filter var(--transition-fast);
}

.window-btn:hover {
  filter: brightness(1.2);
}

.window-btn.close { background: #ff5f57; }
.window-btn.minimize { background: #febc2e; }
.window-btn.maximize { background: #28c840; }

.window-title {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-size: var(--font-size-sm);
  color: var(--color-text-tertiary);
  font-weight: 500;
}

.window-content {
  background: #1d1d1f;
}

.window-content img {
  width: 100%;
  display: block;
}

/* ==========================================================================
   Sections Common
   ========================================================================== */
section {
  padding: var(--space-section) var(--space-md);
}

.section-intro {
  text-align: center;
  max-width: var(--max-width-narrow);
  margin: 0 auto var(--space-3xl);
}

.section-title {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin-bottom: var(--space-md);
}

.section-subtitle {
  font-size: var(--font-size-lg);
  color: var(--color-text-secondary);
  line-height: 1.6;
}

/* ==========================================================================
   Features Section
   ========================================================================== */
.features {
  background: var(--color-bg);
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: var(--space-lg);
  max-width: var(--max-width);
  margin: 0 auto;
}

.feature-card {
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  transition: all var(--transition-slow);
}

.feature-card:hover {
  transform: translateY(-4px);
  border-color: rgba(91, 127, 255, 0.3);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.feature-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--color-accent-fallback), #8B5CF6);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-md);
}

.feature-icon svg {
  width: 24px;
  height: 24px;
  fill: white;
}

.feature-card h3 {
  font-size: var(--font-size-xl);
  font-weight: 600;
  margin-bottom: var(--space-xs);
}

.feature-card p {
  color: var(--color-text-secondary);
  line-height: 1.6;
}

/* ==========================================================================
   Gallery Section
   ========================================================================== */
.gallery {
  background: linear-gradient(180deg, var(--color-bg) 0%, var(--color-bg-elevated) 100%);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: var(--space-lg);
  max-width: var(--max-width);
  margin: 0 auto;
}

.gallery-item {
  position: relative;
  aspect-ratio: 16 / 11;
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: zoom-in;
  transition: all var(--transition-slow);
}

.gallery-item::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.6) 0%, transparent 50%);
  opacity: 0;
  transition: opacity var(--transition-base);
  z-index: 1;
}

.gallery-item:hover {
  transform: scale(1.02);
  box-shadow: var(--shadow-lg);
}

.gallery-item:hover::before {
  opacity: 1;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-slow);
}

.gallery-item:hover img {
  transform: scale(1.05);
}

.gallery-caption {
  position: absolute;
  bottom: var(--space-md);
  left: var(--space-md);
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: white;
  z-index: 2;
  opacity: 0;
  transform: translateY(10px);
  transition: all var(--transition-base);
}

.gallery-item:hover .gallery-caption {
  opacity: 1;
  transform: translateY(0);
}

/* ==========================================================================
   Specs Section
   ========================================================================== */
.specs {
  background: var(--color-bg-elevated);
}

.specs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--space-lg);
  max-width: var(--max-width);
  margin: 0 auto var(--space-3xl);
}

.spec-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
}

.spec-card h3 {
  font-size: var(--font-size-lg);
  font-weight: 600;
  margin-bottom: var(--space-md);
  color: var(--color-text);
}

.spec-card ul {
  list-style: none;
}

.spec-card li {
  display: flex;
  justify-content: space-between;
  padding: var(--space-xs) 0;
  border-bottom: 1px solid var(--color-border);
  font-size: var(--font-size-sm);
}

.spec-card li:last-child {
  border-bottom: none;
}

.spec-card li span:first-child {
  color: var(--color-text-secondary);
}

.spec-card li span:last-child {
  font-weight: 500;
  color: var(--color-text);
}

.stats-row {
  display: flex;
  justify-content: center;
  gap: var(--space-3xl);
  flex-wrap: wrap;
  max-width: var(--max-width);
  margin: 0 auto;
}

.stat {
  text-align: center;
}

.stat-value {
  display: block;
  font-size: var(--font-size-4xl);
  font-weight: 800;
  background: linear-gradient(135deg, var(--color-accent-fallback), #8B5CF6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-label {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
}

/* ==========================================================================
   Download Section
   ========================================================================== */
.download {
  background: linear-gradient(180deg, var(--color-bg-elevated) 0%, var(--color-bg) 100%);
  text-align: center;
}

.download-content {
  max-width: 600px;
  margin: 0 auto;
}

.download-badge {
  display: inline-block;
  padding: 8px 16px;
  background: rgba(91, 127, 255, 0.1);
  border: 1px solid rgba(91, 127, 255, 0.3);
  border-radius: var(--radius-full);
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-accent-fallback);
  margin-bottom: var(--space-lg);
}

.download h2 {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-bottom: var(--space-md);
}

.download p {
  font-size: var(--font-size-lg);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-xl);
}

.signup-form {
  display: flex;
  gap: var(--space-sm);
  max-width: 480px;
  margin: 0 auto var(--space-xl);
}

.signup-form input {
  flex: 1;
  padding: 16px 20px;
  font-size: var(--font-size-base);
  font-family: inherit;
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  color: var(--color-text);
  outline: none;
  transition: border-color var(--transition-fast);
}

.signup-form input:focus {
  border-color: var(--color-accent-fallback);
}

.signup-form input::placeholder {
  color: var(--color-text-tertiary);
}

.download-features {
  display: flex;
  justify-content: center;
  gap: var(--space-lg);
  flex-wrap: wrap;
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
}

.download-features span {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.download-features svg {
  fill: #30d158;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.footer {
  padding: var(--space-2xl) var(--space-md);
  border-top: 1px solid var(--color-border);
}

.footer-content {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-weight: 600;
  color: var(--color-text);
}

.footer-links {
  display: flex;
  gap: var(--space-lg);
}

.footer-links a {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  transition: color var(--transition-fast);
}

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

.footer-copyright {
  font-size: var(--font-size-xs);
  color: var(--color-text-tertiary);
}

/* ==========================================================================
   Animations
   ========================================================================== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Scroll-triggered animations using Intersection Observer (JS) */
.animate-on-scroll {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.animate-on-scroll.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */
@media (max-width: 768px) {
  .nav-links {
    display: none;
  }

  .hero {
    padding-top: calc(56px + var(--space-2xl));
  }

  .hero-title {
    font-size: clamp(2.5rem, 10vw, 4rem);
  }

  .hero-subtitle {
    font-size: var(--font-size-base);
  }

  .hero-buttons {
    flex-direction: column;
    width: 100%;
  }

  .btn {
    width: 100%;
  }

  .features-grid,
  .gallery-grid {
    grid-template-columns: 1fr;
  }

  .signup-form {
    flex-direction: column;
  }

  .stats-row {
    gap: var(--space-xl);
  }

  .download-features {
    flex-direction: column;
    align-items: center;
  }
}

/* ==========================================================================
   PhotoSwipe Customization
   ========================================================================== */
.pswp {
  --pswp-bg: rgba(0, 0, 0, 0.95);
}

.pswp__button {
  color: white;
}

.pswp__counter {
  font-family: var(--font-family);
}

/* ==========================================================================
   Toast Notification
   ========================================================================== */
.toast {
  position: fixed;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #30d158;
  color: white;
  padding: 16px 32px;
  border-radius: var(--radius-full);
  font-size: var(--font-size-base);
  font-weight: 600;
  box-shadow: 0 8px 32px rgba(48, 209, 88, 0.3);
  opacity: 0;
  visibility: hidden;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 10000;
}

.toast.show {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.toast.error {
  background: #ff453a;
  box-shadow: 0 8px 32px rgba(255, 69, 58, 0.3);
}

/* ==========================================================================
   Legal Pages (Privacy, Terms, License)
   ========================================================================== */
.legal-page {
  padding: calc(56px + var(--space-3xl)) var(--space-md) var(--space-3xl);
  min-height: calc(100vh - 200px);
}

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

.legal-content h1 {
  font-size: clamp(2.5rem, 6vw, 3.5rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: var(--space-sm);
  background: linear-gradient(135deg, #fff 0%, rgba(255, 255, 255, 0.7) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.legal-updated {
  font-size: var(--font-size-sm);
  color: var(--color-text-tertiary);
  margin-bottom: var(--space-lg);
}

.legal-badge {
  display: inline-block;
  padding: 8px 16px;
  background: rgba(91, 127, 255, 0.1);
  border: 1px solid rgba(91, 127, 255, 0.3);
  border-radius: var(--radius-full);
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-accent-fallback);
  margin-bottom: var(--space-xl);
}

.legal-intro {
  font-size: var(--font-size-lg);
  color: var(--color-text-secondary);
  line-height: 1.7;
  margin-bottom: var(--space-2xl);
}

.legal-section {
  margin-bottom: var(--space-xl);
  padding-bottom: var(--space-xl);
  border-bottom: 1px solid var(--color-border);
}

.legal-section:last-of-type {
  border-bottom: none;
}

.legal-section h2 {
  font-size: var(--font-size-xl);
  font-weight: 600;
  margin-bottom: var(--space-md);
  color: var(--color-text);
}

.legal-section p {
  font-size: var(--font-size-base);
  color: var(--color-text-secondary);
  line-height: 1.7;
  margin-bottom: var(--space-md);
}

.legal-section p:last-child {
  margin-bottom: 0;
}

.legal-section ul,
.legal-section ol {
  margin: var(--space-md) 0;
  padding-left: var(--space-lg);
}

.legal-section li {
  font-size: var(--font-size-base);
  color: var(--color-text-secondary);
  line-height: 1.7;
  margin-bottom: var(--space-xs);
}

.legal-section a {
  color: var(--color-accent-fallback);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.legal-section a:hover {
  color: #8B5CF6;
  text-decoration: underline;
}

.legal-section strong {
  color: var(--color-text);
  font-weight: 600;
}

.legal-uppercase {
  text-transform: uppercase;
  font-size: var(--font-size-sm);
  letter-spacing: 0.02em;
}

.legal-acceptance {
  margin-top: var(--space-2xl);
  padding: var(--space-lg);
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  font-size: var(--font-size-base);
  color: var(--color-text);
  line-height: 1.7;
}

/* Responsive adjustments for legal pages */
@media (max-width: 768px) {
  .legal-page {
    padding: calc(56px + var(--space-xl)) var(--space-md) var(--space-xl);
  }

  .legal-content h1 {
    font-size: clamp(2rem, 8vw, 2.5rem);
  }
}
