/* ============================================
   PapySoft - Main Stylesheet
   Design: Clean, professional, dark/light theme
   ============================================ */

/* --- CSS Custom Properties (Theme) --- */
:root {
  /* Brand colors (from logo: cyan/teal + amber) */
  --brand-teal: #0d9488;
  --brand-teal-light: #14b8a6;
  --brand-teal-dark: #0f766e;
  --brand-amber: #d97706;
  --brand-amber-light: #f59e0b;

  /* Light theme (default) */
  --bg-primary: #f8fafc;
  --bg-secondary: #e2e8f0;
  --bg-card: #ffffff;
  --bg-hero: linear-gradient(135deg, #0f172a 0%, #134e4a 50%, #0d9488 100%);
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --text-on-hero: #f8fafc;
  --border: #e2e8f0;
  --accent: #0d9488;
  --accent-hover: #0f766e;
  --accent-text: #ffffff;
  --nav-bg: rgba(255, 255, 255, 0.85);
  --nav-border: rgba(0, 0, 0, 0.06);
  --nav-text: #0f172a;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-glow: 0 0 20px rgba(13, 148, 136, 0.15);
  --code-bg: #f1f5f9;
  --tag-bg: #e2e8f0;
  --tag-text: #475569;
  --card-border: #e2e8f0;
  --input-bg: #ffffff;
  --input-border: #cbd5e1;
  --placeholder: #94a3b8;
}

[data-theme="dark"] {
  --bg-primary: #0c1222;
  --bg-secondary: #1e293b;
  --bg-card: #1a2332;
  --bg-hero: linear-gradient(135deg, #020617 0%, #0f172a 50%, #134e4a 100%);
  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-on-hero: #e2e8f0;
  --border: #1e293b;
  --accent: #14b8a6;
  --accent-hover: #2dd4bf;
  --accent-text: #0c1222;
  --nav-bg: rgba(12, 18, 34, 0.85);
  --nav-border: rgba(255, 255, 255, 0.06);
  --nav-text: #e2e8f0;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.4), 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
  --shadow-glow: 0 0 20px rgba(20, 184, 166, 0.1);
  --code-bg: #1e293b;
  --tag-bg: #1e293b;
  --tag-text: #94a3b8;
  --card-border: #1e293b;
  --input-bg: #1a2332;
  --input-border: #334155;
  --placeholder: #64748b;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  transition: background-color 0.3s ease, color 0.3s ease;
  overflow-x: hidden;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s ease;
}

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

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

ul {
  list-style: none;
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* --- Navigation --- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: var(--nav-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--nav-border);
  transition: background 0.3s ease, border-color 0.3s ease;
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--nav-text);
  text-decoration: none;
}

.nav-logo img {
  height: 36px;
  width: auto;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 32px;
}

.nav-links a {
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  position: relative;
  padding: 4px 0;
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--accent);
  transition: width 0.3s ease;
  border-radius: 1px;
}

.nav-links a:hover::after,
.nav-links a.active::after {
  width: 100%;
}

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

.nav-links a.active {
  color: var(--accent);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Theme Toggle Button */
.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 1.1rem;
  transition: all 0.3s ease;
  position: relative;
}

.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--bg-secondary);
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
  position: absolute;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

[data-theme="dark"] .theme-toggle .icon-sun {
  opacity: 1;
  transform: rotate(0deg);
}

[data-theme="dark"] .theme-toggle .icon-moon {
  opacity: 0;
  transform: rotate(90deg);
}

.theme-toggle .icon-sun {
  opacity: 0;
  transform: rotate(-90deg);
}

.theme-toggle .icon-moon {
  opacity: 1;
  transform: rotate(0deg);
}

/* Mobile Menu Toggle */
.mobile-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
}

.mobile-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text-primary);
  margin: 4px 0;
  transition: all 0.3s ease;
  border-radius: 1px;
}

/* --- Hero Section --- */
.hero {
  min-height: 85vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-hero);
  color: var(--text-on-hero);
  padding: 120px 24px 80px;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 20% 50%, rgba(13, 148, 136, 0.15) 0%, transparent 50%),
              radial-gradient(ellipse at 80% 50%, rgba(217, 119, 6, 0.08) 0%, transparent 50%);
  pointer-events: none;
}

.hero-content {
  text-align: center;
  max-width: 720px;
  position: relative;
  z-index: 1;
}

.hero-logo {
  width: 280px;
  margin: 0 auto 32px;
}

.hero h1 {
  font-size: 3rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 16px;
  line-height: 1.15;
}

.hero h1 .highlight {
  background: linear-gradient(135deg, var(--brand-teal-light), var(--brand-amber-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  font-size: 1.2rem;
  color: rgba(255, 255, 255, 0.75);
  margin-bottom: 32px;
  line-height: 1.7;
}

.hero-badges {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 40px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.85);
}

.hero-badge .badge-icon {
  font-size: 1rem;
}

.hero-actions {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  border: none;
  text-decoration: none;
}

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

.btn-primary:hover {
  background: var(--accent-hover);
  color: var(--accent-text);
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-on-hero);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.18);
  color: var(--text-on-hero);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  color: var(--accent);
  border: 1.5px solid var(--accent);
}

.btn-outline:hover {
  background: var(--accent);
  color: var(--accent-text);
  transform: translateY(-1px);
}

/* --- Sections --- */
.section {
  padding: 80px 0;
}

.section-header {
  text-align: center;
  margin-bottom: 56px;
}

.section-header h2 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 12px;
  letter-spacing: -0.01em;
}

.section-header p {
  color: var(--text-secondary);
  font-size: 1.1rem;
  max-width: 600px;
  margin: 0 auto;
}

.section-alt {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

/* --- Software Cards --- */
.software-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
}

.software-card {
  background: var(--bg-card);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 32px;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.software-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--brand-teal), var(--brand-amber));
  opacity: 0;
  transition: opacity 0.3s ease;
}

.software-card:hover::before {
  opacity: 1;
}

.software-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: transparent;
}

.software-card-icon {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--brand-teal), var(--brand-teal-light));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: 20px;
  color: white;
}

.software-card h3 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.software-card .card-desc {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.6;
  margin-bottom: 16px;
}

.software-card .card-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.software-card .card-tag {
  background: var(--tag-bg);
  color: var(--tag-text);
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 500;
}

.software-card .card-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent);
}

.software-card .card-link:hover {
  gap: 10px;
}

/* Coming soon card variant */
.software-card.coming-soon {
  opacity: 0.6;
  cursor: default;
}

.software-card.coming-soon:hover {
  transform: none;
  box-shadow: none;
}

.software-card.coming-soon::before {
  display: none;
}

/* --- Features Grid (for MissionsTracker page) --- */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 28px;
  transition: all 0.3s ease;
}

.feature-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-glow);
}

.feature-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  margin-bottom: 16px;
}

.feature-icon.teal {
  background: rgba(13, 148, 136, 0.12);
  color: var(--brand-teal);
}

.feature-icon.amber {
  background: rgba(217, 119, 6, 0.12);
  color: var(--brand-amber);
}

.feature-icon.blue {
  background: rgba(59, 130, 246, 0.12);
  color: #3b82f6;
}

.feature-icon.purple {
  background: rgba(139, 92, 246, 0.12);
  color: #8b5cf6;
}

.feature-card h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 8px;
}

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

/* --- Software Detail Hero (missions-tracker etc.) --- */
.detail-hero {
  background: var(--bg-hero);
  color: var(--text-on-hero);
  padding: 120px 24px 60px;
  text-align: center;
}

.detail-hero h1 {
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: 12px;
}

.detail-hero .subtitle {
  color: rgba(255, 255, 255, 0.7);
  font-size: 1.1rem;
  margin-bottom: 24px;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.detail-hero .app-icon {
  width: 80px;
  height: 80px;
  border-radius: 18px;
  margin: 0 auto 24px;
  box-shadow: var(--shadow-lg);
}

/* --- About / Story --- */
.story-section {
  max-width: 760px;
  margin: 0 auto;
}

.story-section p {
  color: var(--text-secondary);
  font-size: 1.05rem;
  line-height: 1.8;
  margin-bottom: 20px;
}

.story-section .highlight-text {
  color: var(--accent);
  font-weight: 600;
}

/* Timeline */
.timeline {
  position: relative;
  padding: 20px 0;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 24px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, var(--brand-teal), var(--brand-amber));
}

.timeline-item {
  padding-left: 60px;
  position: relative;
  margin-bottom: 36px;
}

.timeline-item:last-child {
  margin-bottom: 0;
}

.timeline-dot {
  position: absolute;
  left: 16px;
  top: 4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--bg-primary);
  z-index: 1;
}

.timeline-year {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.timeline-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.timeline-desc {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.6;
}

/* --- Screenshots Section --- */
.screenshots-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 20px;
}

.screenshot {
  width: 100%;
  height: auto;
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--card-border);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.screenshot:hover {
  transform: translateY(-4px) scale(1.01);
  box-shadow: var(--shadow-lg), 0 0 0 2px var(--accent);
}

/* --- Contact Form --- */
.contact-form {
  max-width: none;
  width: 100%;
}

.form-group {
  margin-bottom: 24px;
}

.form-group label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--input-border);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--text-primary);
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.12);
}

.form-group textarea {
  min-height: 140px;
  resize: vertical;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--placeholder);
}

/* --- Stats --- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 24px;
  text-align: center;
}

.stat-item {
  padding: 24px;
}

.stat-number {
  font-size: 2.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--brand-teal), var(--brand-amber));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 0.88rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* --- CTA Section --- */
.cta-section {
  background: var(--bg-hero);
  color: var(--text-on-hero);
  text-align: center;
  padding: 80px 24px;
}

.cta-section h2 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.cta-section p {
  color: rgba(255, 255, 255, 0.75);
  margin-bottom: 32px;
  font-size: 1.1rem;
}

.cta-section .btn-primary {
  background: var(--brand-amber);
  color: #0c1222;
}

.cta-section .btn-primary:hover {
  background: var(--brand-amber-light);
}

/* --- Footer --- */
.footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  padding: 48px 0 24px;
}

.footer-inner {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 40px;
  margin-bottom: 32px;
}

.footer-brand p {
  color: var(--text-secondary);
  font-size: 0.88rem;
  margin-top: 12px;
  max-width: 360px;
  line-height: 1.6;
}

.footer-brand img {
  height: 32px;
  width: auto;
}

.footer h4 {
  font-size: 0.88rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.footer-links a {
  display: block;
  color: var(--text-secondary);
  font-size: 0.88rem;
  padding: 4px 0;
}

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

.footer-bottom {
  border-top: 1px solid var(--border);
  padding-top: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.footer-bottom p {
  color: var(--text-muted);
  font-size: 0.82rem;
}

/* --- Contact Page --- */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: start;
}

/* --- Page Header (non-hero pages) --- */
.page-header {
  padding: 100px 24px 40px;
  text-align: center;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
}

.page-header h1 {
  font-size: 2.2rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.page-header p {
  color: var(--text-secondary);
  font-size: 1.05rem;
}

/* --- Animations --- */
.fade-in {
  opacity: 0;
  transform: translateY(20px);
  animation: fadeInUp 0.6s ease forwards;
}

@keyframes fadeInUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in:nth-child(2) { animation-delay: 0.1s; }
.fade-in:nth-child(3) { animation-delay: 0.2s; }
.fade-in:nth-child(4) { animation-delay: 0.3s; }

/* --- Mobile Responsive --- */
@media (max-width: 768px) {
  .nav-links {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--nav-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--nav-border);
    flex-direction: column;
    padding: 16px 24px;
    gap: 4px;
  }

  .nav-links.open {
    display: flex;
  }

  .nav-links a {
    padding: 12px 0;
    width: 100%;
  }

  .nav-links a::after {
    display: none;
  }

  .mobile-toggle {
    display: flex;
  }

  .mobile-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(4px, 4px);
  }

  .mobile-toggle.active span:nth-child(2) {
    opacity: 0;
  }

  .mobile-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(4px, -4px);
  }

  .hero h1 {
    font-size: 2rem;
  }

  .hero p {
    font-size: 1rem;
  }

  .hero-logo {
    width: 200px;
  }

  .hero-badges {
    flex-direction: column;
    align-items: center;
  }

  .section {
    padding: 56px 0;
  }

  .section-header h2 {
    font-size: 1.6rem;
  }

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

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

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

  .footer-inner {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .footer-bottom {
    flex-direction: column;
    text-align: center;
  }

  .detail-hero h1 {
    font-size: 1.8rem;
  }

  .page-header h1 {
    font-size: 1.6rem;
  }

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

@media (max-width: 480px) {
  .hero h1 {
    font-size: 1.6rem;
  }

  .hero-logo {
    width: 160px;
  }

  .nav-logo span {
    display: none;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 16px;
  }

  .stat-number {
    font-size: 1.8rem;
  }
}
