/* ============================================
   POIROT — poirot.fyi
   Design system derived from PoirotTheme.swift
   ============================================ */

/* --- Custom Properties --- */
:root {
  /* Backgrounds */
  --bg-app: #0D0D0F;
  --bg-sidebar: #141416;
  --bg-card: #1A1A1E;
  --bg-elevated: #222226;
  --bg-code: #161618;

  /* Accent */
  --accent: #E8A642;
  --accent-hover: #F0B85A;
  --accent-dim: rgba(232, 166, 66, 0.15);

  /* Text */
  --text-primary: #F5F5F7;
  --text-secondary: #8E8E93;
  --text-tertiary: #636366;

  /* Borders */
  --border: rgba(255, 255, 255, 0.06);
  --border-subtle: rgba(255, 255, 255, 0.03);

  /* Semantic */
  --purple: #AF52DE;

  /* Radii */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 20px;

  /* Spacing */
  --s-xs: 4px;
  --s-sm: 8px;
  --s-md: 12px;
  --s-lg: 16px;
  --s-xl: 20px;
  --s-2xl: 24px;
  --s-3xl: 32px;
  --s-4xl: 48px;
  --s-5xl: 64px;
  --s-6xl: 96px;

  /* Layout */
  --max-width: 1120px;
  --nav-height: 56px;
}

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

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-app);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
}

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

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

/* --- Utility --- */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--s-2xl);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* --- Nav --- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: var(--nav-height);
  display: flex;
  align-items: center;
  border-bottom: 1px solid transparent;
  transition: background 0.3s, border-color 0.3s, backdrop-filter 0.3s;
}

.nav.scrolled {
  background: rgba(13, 13, 15, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom-color: var(--border);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--s-2xl);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: var(--s-sm);
}

.nav-brand img {
  width: 28px;
  height: 28px;
  border-radius: var(--r-sm);
}

.nav-brand span {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--s-2xl);
  list-style: none;
}

.nav-links a {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: color 0.2s;
}

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

.nav-links .gh-link {
  display: flex;
  align-items: center;
  color: var(--text-secondary);
  transition: color 0.2s;
}

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

.nav-links .gh-link svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

/* --- Hero --- */
.hero {
  padding-top: calc(var(--nav-height) + var(--s-6xl));
  padding-bottom: var(--s-6xl);
  text-align: center;
}

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

.badge {
  font-size: 12px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 100px;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.hero-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-lg);
  margin-bottom: var(--s-lg);
}

.hero-logo {
  width: 64px;
  height: 64px;
  border-radius: var(--r-md);
}

.hero h1 {
  font-size: 56px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text-primary);
}

.hero-tagline {
  font-size: 20px;
  color: var(--text-secondary);
  max-width: 560px;
  margin: 0 auto var(--s-4xl);
  line-height: 1.5;
}

.hero-ctas {
  display: flex;
  justify-content: center;
  gap: var(--s-lg);
  margin-bottom: var(--s-5xl);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--s-sm);
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  padding: 12px 24px;
  border-radius: var(--r-md);
  border: none;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary {
  background: var(--accent);
  color: var(--bg-app);
}

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

.btn-outline {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.btn-outline:hover {
  background: var(--bg-elevated);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.hero-image {
  max-width: 960px;
  margin: 0 auto;
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.03),
    0 20px 60px rgba(0, 0, 0, 0.5),
    0 0 120px rgba(232, 166, 66, 0.06);
  overflow: hidden;
}

.hero-image img {
  width: 100%;
}

/* --- Story --- */
.story {
  padding: var(--s-6xl) 0;
}

.story-inner {
  max-width: 640px;
  margin: 0 auto;
  text-align: center;
}

.story p {
  font-size: 17px;
  color: var(--text-secondary);
  line-height: 1.75;
  margin-bottom: var(--s-2xl);
}

.story strong {
  color: var(--accent);
  font-weight: 600;
}

.story-divider {
  width: 48px;
  height: 2px;
  background: var(--accent);
  margin: var(--s-4xl) auto 0;
  border-radius: 1px;
}

/* --- Features --- */
.features {
  padding: var(--s-6xl) 0;
}

.features-header {
  text-align: center;
  margin-bottom: var(--s-5xl);
}

.features-header h2 {
  font-size: 36px;
  font-weight: 700;
  margin-bottom: var(--s-md);
}

.features-header p {
  font-size: 17px;
  color: var(--text-secondary);
}

.feature {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-5xl);
  align-items: center;
  margin-bottom: var(--s-6xl);
}

.feature:last-child {
  margin-bottom: 0;
}

.feature.reverse {
  direction: rtl;
}

.feature.reverse > * {
  direction: ltr;
}

.feature-text {
  display: flex;
  flex-direction: column;
  gap: var(--s-lg);
}

.feature-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}

.feature-text h3 {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.2;
}

.feature-text p {
  font-size: 16px;
  color: var(--text-secondary);
  line-height: 1.65;
}

.feature-image {
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.feature-image img {
  width: 100%;
}

/* --- Install --- */
.install {
  background: var(--bg-sidebar);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: var(--s-6xl) 0;
}

.install-inner {
  text-align: center;
  max-width: 560px;
  margin: 0 auto;
}

.install h2 {
  font-size: 36px;
  font-weight: 700;
  margin-bottom: var(--s-md);
}

.install-sub {
  font-size: 17px;
  color: var(--text-secondary);
  margin-bottom: var(--s-4xl);
}

.code-block {
  position: relative;
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--s-lg) var(--s-2xl);
  margin-bottom: var(--s-2xl);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-lg);
}

.code-block code {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 15px;
  color: var(--accent);
}

.copy-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 6px 8px;
  display: flex;
  align-items: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.copy-btn:hover {
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.15);
}

.copy-btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.install-alt {
  font-size: 14px;
  color: var(--text-tertiary);
  margin-bottom: var(--s-sm);
}

.install-alt a {
  color: var(--text-secondary);
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 0.2s;
}

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

.install-note {
  font-size: 13px;
  color: var(--text-tertiary);
}

/* --- Footer --- */
.footer {
  padding: var(--s-5xl) 0;
  text-align: center;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: var(--s-2xl);
  margin-bottom: var(--s-3xl);
  list-style: none;
}

.footer-links a {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: color 0.2s;
}

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

.footer-tagline {
  font-size: 14px;
  color: var(--text-tertiary);
  margin-bottom: var(--s-sm);
}

.footer-privacy {
  font-size: 13px;
  color: var(--text-tertiary);
  opacity: 0.7;
}

.footer-author {
  margin-top: var(--s-3xl);
  padding-top: var(--s-2xl);
  border-top: 1px solid var(--border);
}

.footer-author p {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: var(--s-xs);
}

.footer-author-links {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--s-sm);
}

.footer-author-links a {
  font-size: 13px;
  color: var(--text-tertiary);
  transition: color 0.2s;
}

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

.footer-dot {
  color: var(--text-tertiary);
  opacity: 0.5;
}

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

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

/* --- Responsive --- */

/* Tablet */
@media (max-width: 1024px) {
  .hero-logo {
    width: 52px;
    height: 52px;
  }

  .hero h1 {
    font-size: 44px;
  }

  .hero-tagline {
    font-size: 18px;
  }

  .hero-image {
    max-width: 100%;
  }

  .feature {
    grid-template-columns: 1fr;
    gap: var(--s-3xl);
  }

  .feature.reverse {
    direction: ltr;
  }

  .feature-text {
    text-align: center;
  }

  .feature-label {
    text-align: center;
  }

  .features-header h2,
  .install h2 {
    font-size: 30px;
  }
}

/* Mobile */
@media (max-width: 768px) {
  :root {
    --nav-height: 48px;
  }

  .container {
    padding: 0 var(--s-lg);
  }

  .nav-inner {
    padding: 0 var(--s-lg);
  }

  .nav-links .nav-text {
    display: none;
  }

  .hero {
    padding-top: calc(var(--nav-height) + var(--s-5xl));
    padding-bottom: var(--s-5xl);
  }

  .hero-logo {
    width: 40px;
    height: 40px;
  }

  .hero h1 {
    font-size: 36px;
  }

  .hero-tagline {
    font-size: 16px;
  }

  .hero-ctas {
    flex-direction: column;
    align-items: center;
    gap: var(--s-md);
  }

  .btn {
    width: 100%;
    max-width: 280px;
    justify-content: center;
  }

  .story p {
    font-size: 15px;
  }

  .feature-text h3 {
    font-size: 22px;
  }

  .feature-text p {
    font-size: 15px;
  }

  .hero, .story, .features, .install {
    padding-top: var(--s-5xl);
    padding-bottom: var(--s-5xl);
  }

  .feature {
    margin-bottom: var(--s-5xl);
  }

  .code-block {
    padding: var(--s-md) var(--s-lg);
  }

  .code-block code {
    font-size: 13px;
  }

  .footer-links {
    flex-wrap: wrap;
    gap: var(--s-lg);
  }
}

/* Small mobile */
@media (max-width: 480px) {
  .hero-logo {
    width: 32px;
    height: 32px;
  }

  .hero h1 {
    font-size: 28px;
  }

  .hero-badges {
    flex-wrap: wrap;
  }

  .features-header h2,
  .install h2 {
    font-size: 24px;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .fade-in {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .btn:hover {
    transform: none;
  }
}
