/* Papyrus AI — Landing Page Styles
   Design system tokens extracted from app/styles/theme.css
   Self-contained: no imports from Streamlit theme
*/

/* ===== SELF-HOSTED FONTS ===== */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('assets/fonts/inter-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('assets/fonts/inter-latin-500.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('assets/fonts/inter-latin-600.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('assets/fonts/inter-latin-700.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Merriweather';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('assets/fonts/merriweather-latin-400.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Merriweather';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('assets/fonts/merriweather-latin-700.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('assets/fonts/jetbrains-mono-latin-400.woff2') format('woff2');
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('assets/fonts/jetbrains-mono-latin-500.woff2') format('woff2');
}

/* ===== DESIGN TOKENS ===== */
:root {
  /* Backgrounds */
  --bg-page: #0a0a0a;
  --bg-glass: rgba(23, 23, 23, 0.6);
  --bg-elevated: #171717;

  /* Accent */
  --accent: #f59e0b;
  --accent-hover: #d97706;
  --accent-glow: rgba(245, 158, 11, 0.2);
  --accent-border: rgba(245, 158, 11, 0.5);
  --accent-subtle: rgba(245, 158, 11, 0.05);

  /* Text */
  --text-heading: #f3f4f6;
  --text-primary: #d1d5db;
  --text-secondary: #6b7280;
  --text-muted: #4b5563;

  /* Borders */
  --border-glass: rgba(255, 255, 255, 0.08);
  --border-subtle: rgba(255, 255, 255, 0.15);

  /* Glass */
  --glass-blur: blur(12px);

  /* Typography Scale (Golden Ratio: base 16 × 1.618) */
  --text-xs: 10px;
  --text-sm: 14px;
  --text-base: 16px;
  --text-lg: 26px;
  --text-xl: 42px;
  --text-2xl: 68px;

  /* Fibonacci Spacing */
  --space-xs: 10px;
  --space-sm: 16px;
  --space-md: 26px;
  --space-lg: 42px;
  --space-xl: 68px;

  /* Radii */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-pill: 9999px;

  /* Transitions */
  --transition-fast: 0.2s ease;
  --transition-normal: 0.3s ease;

  /* Font Stacks */
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-heading: 'Merriweather', Georgia, serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

/* ===== RESET & BASE ===== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* Use `hidden` (not `clip`) — `clip` is unsupported on iOS Safari < 16,
     where it silently falls back to `visible` and allows horizontal scroll.
     `hidden` has universal support and prevents horizontal overflow reliably. */
  overflow-x: hidden;
}

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

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

/* ===== SCROLLBAR (matches theme.css:448-464) ===== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #0a0a0a; }
::-webkit-scrollbar-thumb { background: #333; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #555; }

/* ===== CONTAINER ===== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-md);
}

/* ===== NAVIGATION ===== */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--space-xl);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-lg);
  z-index: 100;
  transition: background var(--transition-normal), backdrop-filter var(--transition-normal);
}

.nav.scrolled {
  background: rgba(10, 10, 10, 0.9);
  backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--border-glass);
}

.nav-logo {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 700;
  color: var(--text-heading);
  letter-spacing: -0.02em;
}

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

.nav-links {
  display: flex;
  gap: var(--space-sm);
}

.nav-link {
  padding: 8px 20px;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-primary);
  border: 1px solid transparent;
  transition: all var(--transition-fast);
}

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

/* ===== HERO ===== */
.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  position: relative;
  padding: var(--space-xl) var(--space-md);
  /* Contain the 800x800 amber glow (::before) so it can't inflate
     body.scrollWidth on narrow viewports. */
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 800px;
  height: 800px;
  background: radial-gradient(circle, rgba(245, 158, 11, 0.04) 0%, transparent 70%);
  border-radius: 50%;
  animation: hero-glow 6s ease-in-out infinite;
  pointer-events: none;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 14px;
  margin-bottom: var(--space-sm);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--radius-pill);
  background: rgba(120, 53, 15, 0.1);
  backdrop-filter: blur(4px);
}

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

.badge-text {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.05em;
}

.hero h1 {
  font-family: var(--font-heading);
  font-size: clamp(2.25rem, 5vw, 4.25rem);
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin-bottom: var(--space-xs);
  position: relative;
}

.hero-subtitle {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 300;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto var(--space-lg);
  line-height: 1.6;
}

.hero-ctas {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
  justify-content: center;
}

/* ===== BUTTONS ===== */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 32px;
  background: var(--accent);
  color: var(--bg-page);
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 600;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
}

.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 0 24px var(--accent-glow);
  transform: translateY(-1px);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 32px;
  background: transparent;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 500;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
}

.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ===== SECTIONS ===== */
section {
  padding: var(--space-xl) 0;
}

.section-heading {
  font-family: var(--font-heading);
  font-size: clamp(1.5rem, 3vw, var(--text-xl));
  font-weight: 700;
  color: var(--text-heading);
  text-align: center;
  margin-bottom: var(--space-lg);
  letter-spacing: -0.01em;
}

/* ===== GLASS CARDS (matches theme.css:360-372) ===== */
.glass-card {
  background: var(--bg-glass);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  transition: all var(--transition-normal);
}

.glass-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent-border);
  box-shadow: 0 0 20px var(--accent-glow);
}

/* ===== FEATURE CARDS ===== */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-md);
}

.feature-card {
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.feature-icon {
  width: 48px;
  height: 48px;
  margin-bottom: var(--space-sm);
  border-radius: var(--radius-pill);
  background: #262626;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #9ca3af;
  transition: all var(--transition-normal);
}

.glass-card:hover .feature-icon {
  color: #fbbf24;
  background: var(--bg-elevated);
}

.feature-card h3 {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 600;
  color: #e5e7eb;
  margin-bottom: 4px;
}

.feature-card p {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.4;
}

/* ===== PIPELINE ("How It Works") ===== */
.pipeline {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 0;
  padding: 0 var(--space-sm);
  flex-wrap: nowrap;
}

.pipeline-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  flex: 1;
  max-width: 180px;
  position: relative;
}

.pipeline-step:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 20px;
  right: -50%;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), rgba(245, 158, 11, 0.2));
  z-index: 0;
}

.pipeline-number {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(245, 158, 11, 0.1);
  border: 2px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--accent);
  margin-bottom: var(--space-xs);
  position: relative;
  z-index: 1;
}

.pipeline-label {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 600;
  color: #e5e7eb;
  margin-bottom: 4px;
}

.pipeline-detail {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.3;
}

/* ===== STATS BAR ===== */
.stats {
  background: var(--bg-glass);
  backdrop-filter: var(--glass-blur);
  border-top: 1px solid var(--border-glass);
  border-bottom: 1px solid var(--border-glass);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-md);
  padding: var(--space-lg) 0;
}

.stat {
  text-align: center;
}

.stat-number {
  font-family: var(--font-mono);
  font-size: clamp(1.25rem, 2.5vw, 1.75rem);
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 4px;
}

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

/* ===== FINAL CTA ===== */
.final-cta {
  text-align: center;
  position: relative;
  padding: var(--space-xl) 0;
  /* Contain the 600x400 amber glow (::before) for the same reason as .hero. */
  overflow: hidden;
}

.final-cta::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 600px;
  height: 400px;
  background: radial-gradient(circle, rgba(245, 158, 11, 0.03) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.final-cta h2 {
  font-family: var(--font-heading);
  font-size: clamp(1.5rem, 3vw, 2.25rem);
  font-weight: 700;
  color: var(--text-heading);
  margin-bottom: var(--space-md);
}

/* ===== FOOTER ===== */
.footer {
  border-top: 1px solid var(--border-glass);
  padding: var(--space-md) 0;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.footer-brand {
  font-family: var(--font-heading);
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

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

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

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

/* ===== ANIMATIONS (matches theme.css keyframes) ===== */
@keyframes hero-glow {
  0%, 100% { opacity: 0.5; transform: translate(-50%, -50%) scale(1); }
  50% { opacity: 1; transform: translate(-50%, -50%) scale(1.05); }
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

@keyframes fade-in-up {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Scroll-triggered fade-in */
.fade-section {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-section.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
  .pipeline-step:not(:last-child)::after {
    right: -45%;
    width: 90%;
  }
}

@media (max-width: 768px) {
  .nav {
    padding: 0 var(--space-sm);
  }

  .pipeline {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding-left: var(--space-lg);
  }

  .pipeline-step {
    flex-direction: row;
    align-items: center;
    text-align: left;
    max-width: none;
    gap: var(--space-sm);
    padding-bottom: var(--space-md);
    position: relative;
  }

  .pipeline-step:not(:last-child)::after {
    top: 40px;
    left: 19px;
    right: auto;
    width: 2px;
    height: calc(100% - 20px);
    background: linear-gradient(180deg, var(--accent), rgba(245, 158, 11, 0.2));
  }

  .pipeline-text {
    display: flex;
    flex-direction: column;
  }

  .pipeline-number {
    flex-shrink: 0;
    margin-bottom: 0;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .hero-ctas {
    flex-direction: column;
    width: 100%;
    padding: 0 var(--space-sm);
  }

  .btn-primary, .btn-secondary {
    width: 100%;
    justify-content: center;
  }

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

  .nav-logo {
    font-size: 16px;
  }

  .nav-link {
    padding: 6px 12px;
    font-size: 13px;
  }
}

/* ===== LOADING OVERLAY ===== */
#papyrus-loading {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 10, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: papyrus-fade-in 0.15s ease-out;
}
#papyrus-loading[hidden] { display: none; }
.papyrus-loading__card {
  text-align: center;
  color: #e5e7eb;
}
.papyrus-loading__spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(245, 158, 11, 0.15);
  border-top-color: #f59e0b;
  border-radius: 50%;
  margin: 0 auto 16px;
  animation: papyrus-spin 0.8s linear infinite;
}
.papyrus-loading__text {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  color: #9ca3af;
  letter-spacing: 0.02em;
}
@keyframes papyrus-spin { to { transform: rotate(360deg); } }
@keyframes papyrus-fade-in { from { opacity: 0; } to { opacity: 1; } }

/* ===== USER MENU (top-right nav slot) ===== */
.nav-user-slot {
  display: flex;
  align-items: center;
  position: relative;
  margin-left: 8px;
}
.nav-signin {
  background: #f59e0b;
  color: #0a0a0a;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 8px;
  transition: background 0.15s, box-shadow 0.15s;
}
.nav-signin:hover {
  background: #fbbf24;
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.3);
}
.nav-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: #f59e0b;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.nav-avatar:hover { background: rgba(245, 158, 11, 0.25); }
.nav-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 200px;
  background: rgba(23, 23, 23, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 8px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  z-index: 100;
}
.nav-dropdown[hidden] { display: none; }
.nav-dropdown-user {
  padding: 8px 12px 10px;
  font-size: 12px;
  color: #9ca3af;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav-dropdown a, .nav-dropdown button {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  color: #e5e7eb;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.12s, color 0.12s;
}
.nav-dropdown a:hover, .nav-dropdown button:hover {
  background: rgba(245, 158, 11, 0.1);
  color: #f59e0b;
}
.nav-dropdown hr {
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  margin: 6px 0;
}
