/* Base & Theme Variables */
:root {
  --bg: #ffffff;
  --bg-subtle: #f6f8fa;
  --bg-elevated: #ffffff;
  --bg-dark: #0f172a;
  --text: #0f172a;
  --text-muted: #475569;
  --border: #e2e8f0;
  --header-bg: rgba(255, 255, 255, 0.9);
  --accent: #059669;
  --accent-hover: #047857;
  --accent-soft: #ecfdf5;
  --accent-text: #065f46;
  --radius: 12px;
  --radius-sm: 8px;
  --max-width: 1120px;
  --shadow: 0 4px 20px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 16px 40px rgba(15, 23, 42, 0.12);
}

/* Pure-CSS Dark Mode Toggle via :has() */
body:has(#theme-toggle:checked) {
  --bg: #0b1120;
  --bg-subtle: #111827;
  --bg-elevated: #1e293b;
  --bg-dark: #020617;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --border: #1e293b;
  --header-bg: rgba(11, 17, 32, 0.9);
  --accent: #10b981;
  --accent-hover: #059669;
  --accent-soft: rgba(16, 185, 129, 0.14);
  --accent-text: #6ee7b7;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.5);
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
    Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  color: var(--text);
  background-color: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.2s ease, color 0.2s ease;
}

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

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

code,
pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", "Courier New", monospace;
}

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

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--header-bg);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text);
}

.brand:hover {
  text-decoration: none;
}

.brand img {
  width: 34px;
  height: 34px;
  border-radius: 8px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 24px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 20px;
  list-style: none;
}

.nav-links a {
  color: var(--text-muted);
  font-size: 0.93rem;
  font-weight: 500;
  transition: color 0.15s ease;
}

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

/* Pure-CSS Theme Switch */
.theme-toggle-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.theme-toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.theme-toggle-label:hover {
  border-color: var(--accent);
}

.theme-label-light {
  display: none;
}

body:has(#theme-toggle:checked) .theme-label-dark {
  display: none;
}

body:has(#theme-toggle:checked) .theme-label-light {
  display: inline;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.95rem;
  transition: background-color 0.15s ease, border-color 0.15s ease,
    transform 0.15s ease;
  cursor: pointer;
  border: 1px solid transparent;
}

.btn:hover {
  text-decoration: none;
  transform: translateY(-1px);
}

.btn-primary {
  background-color: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

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

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

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

.btn-sm {
  padding: 6px 12px;
  font-size: 0.82rem;
  border-radius: 6px;
}

/* Hero */
.hero {
  padding: 64px 0 72px;
  background: linear-gradient(180deg, var(--bg-subtle) 0%, var(--bg) 100%);
  border-bottom: 1px solid var(--border);
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  align-items: center;
  gap: 48px;
}

.badge {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 999px;
  background-color: var(--accent-soft);
  color: var(--accent-text);
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 18px;
}

.hero h1 {
  font-size: clamp(2.1rem, 4vw, 3.05rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 18px;
}

.hero p {
  font-size: 1.1rem;
  color: var(--text-muted);
  margin-bottom: 28px;
  max-width: 560px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* Pure-CSS Interactive Hero Phone Switcher */
.hero-visual {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.phone-radio {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.hero-phone {
  width: 270px;
  border-radius: 28px;
  border: 8px solid var(--bg-dark);
  box-shadow: var(--shadow-lg);
  background: var(--bg-dark);
  overflow: hidden;
  position: relative;
}

.phone-slide {
  display: none;
}

#slide-1:checked ~ .hero-phone .slide-1,
#slide-2:checked ~ .hero-phone .slide-2,
#slide-3:checked ~ .hero-phone .slide-3,
#slide-4:checked ~ .hero-phone .slide-4,
#slide-5:checked ~ .hero-phone .slide-5,
#slide-6:checked ~ .hero-phone .slide-6 {
  display: block;
  animation: fadeIn 0.22s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0.35;
  }
  to {
    opacity: 1;
  }
}

.phone-dots {
  display: flex;
  gap: 8px;
  align-items: center;
}

.phone-dot {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.phone-dot:hover {
  border-color: var(--accent);
  color: var(--text);
}

#slide-1:checked ~ .phone-dots label[for="slide-1"],
#slide-2:checked ~ .phone-dots label[for="slide-2"],
#slide-3:checked ~ .phone-dots label[for="slide-3"],
#slide-4:checked ~ .phone-dots label[for="slide-4"],
#slide-5:checked ~ .phone-dots label[for="slide-5"],
#slide-6:checked ~ .phone-dots label[for="slide-6"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

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

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

.section-header {
  max-width: 660px;
  margin-bottom: 36px;
}

.section-header h2 {
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  letter-spacing: -0.015em;
  margin-bottom: 10px;
}

.section-header p {
  color: var(--text-muted);
  font-size: 1.02rem;
}

/* Feature Grid */
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

.card h3 {
  font-size: 1.08rem;
  margin-bottom: 8px;
}

.card p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* Screenshots */
.screenshots-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 18px;
}

.screenshot-item {
  border-radius: 18px;
  border: 4px solid var(--bg-dark);
  overflow: hidden;
  box-shadow: var(--shadow);
  background: var(--bg-dark);
}

/* Install */
.install-card ol {
  padding-left: 20px;
  color: var(--text-muted);
  font-size: 0.94rem;
  margin-top: 10px;
}

.install-card li + li {
  margin-top: 6px;
}

.install-card .card-action {
  margin-top: 18px;
}

.inline-code {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 0.85em;
  word-break: break-all;
}

/* Architecture & Animated Flow */
.arch-diagram-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

.arch-diagram {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  height: auto;
  display: block;
}

.flow-line {
  stroke-dasharray: 6 5;
  animation: flowDash 1.4s linear infinite;
}

@keyframes flowDash {
  to {
    stroke-dashoffset: -22;
  }
}

/* Footer */
.site-footer {
  padding: 40px 0;
  border-top: 1px solid var(--border);
  background: var(--bg-subtle);
  color: var(--text-muted);
  font-size: 0.9rem;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
}

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

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

/* Responsive */
@media (max-width: 960px) {
  .hero-grid {
    grid-template-columns: 1fr;
  }

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

  .screenshots-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 640px) {
  .nav-links {
    display: none;
  }

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

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

  .hero {
    padding: 48px 0 56px;
  }

  .section {
    padding: 52px 0;
  }
}
