/* Core Variables & Theming */
:root {
  /* Light Mode Defaults */
  --bg-color: #f8fafc;
  --surface-color: #ffffff;
  --surface-hover: #f1f5f9;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-tertiary: #64748b;

  --accent-color: #0ea5e9;
  --accent-hover: #0284c7;
  --accent-text: #ffffff;

  --border-color: #e2e8f0;
  --border-hover: #cbd5e1;

  --focus-ring: #38bdf8;
  --header-height: 72px;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg:
    0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

/* System Dark Mode Support */
@media (prefers-color-scheme: dark) {
  :root {
    --bg-color: #0f172a;
    --surface-color: #1e293b;
    --surface-hover: #334155;

    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-tertiary: #94a3b8;

    --accent-color: #38bdf8;
    --accent-hover: #7dd3fc;
    --accent-text: #0f172a;

    --border-color: #334155;
    --border-hover: #475569;

    --focus-ring: #0ea5e9;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.4);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.5);
  }
}

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

html {
  scroll-behavior: smooth;
  /* Ensure anchors offset below the sticky header */
  scroll-padding-top: calc(var(--header-height) + 32px);
}

body {
  font-family:
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    Helvetica,
    Arial,
    sans-serif;
  background-color: var(--bg-color);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Accessibility Focus States */
*:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Layout */
.content-wrapper {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 24px;
}

section {
  margin-bottom: 80px;
}

/* Typography */
h1,
h2,
h3,
h4 {
  color: var(--text-primary);
  line-height: 1.2;
  margin-bottom: 16px;
  font-weight: 700;
  letter-spacing: -0.025em;
}

h1 {
  font-size: clamp(2.5rem, 5vw, 3.5rem);
  margin-top: calc(var(--header-height) + 60px);
  margin-bottom: 24px;
}

h2 {
  font-size: 2rem;
}
h3 {
  font-size: 1.5rem;
}
p {
  color: var(--text-secondary);
  font-size: 1.1rem;
  margin-bottom: 24px;
}
a {
  color: var(--accent-color);
  text-decoration: none;
  transition: color 0.2s;
}
a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

/* Sticky Header */
.site-header {
  position: sticky;
  top: 0;
  width: 100%;
  height: var(--header-height);
  background-color: rgba(var(--surface-color), 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  z-index: 1000;
}

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-logo {
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--text-primary);
  text-decoration: none;
  letter-spacing: -0.025em;
}

.site-logo:hover {
  text-decoration: none;
  color: var(--accent-color);
}

/* Desktop Nav */
.desktop-nav ul {
  list-style: none;
  display: flex;
  gap: 32px;
}

.desktop-nav a {
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 1rem;
}

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

/* Mobile Nav Button */
.mobile-menu-btn {
  display: none;
  background: transparent;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
}

.mobile-menu-btn:hover {
  background-color: var(--surface-hover);
}

.mobile-menu-btn svg {
  width: 28px;
  height: 28px;
}

/* Mobile Navigation Panel */
.mobile-nav {
  position: fixed;
  top: var(--header-height);
  right: -100%;
  width: 300px;
  max-width: 80vw;
  height: calc(100vh - var(--header-height));
  background-color: var(--surface-color);
  border-left: 1px solid var(--border-color);
  padding: 32px 24px;
  z-index: 999;
  transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
}

.mobile-nav.is-open {
  right: 0;
  box-shadow: -10px 0 20px rgba(0, 0, 0, 0.1);
}

.mobile-nav ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.mobile-nav a {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  display: block;
}

.nav-backdrop {
  position: fixed;
  top: var(--header-height);
  left: 0;
  width: 100vw;
  height: calc(100vh - var(--header-height));
  background-color: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  z-index: 998;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.nav-backdrop.is-active {
  opacity: 1;
  visibility: visible;
}

/* Hero Section */
.hero-section .subtitle {
  font-size: 1.25rem;
  max-width: 800px;
  color: var(--text-secondary);
}

/* Surface Panels */
.surface-panel {
  background-color: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 48px;
  box-shadow: var(--shadow-sm);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px 32px;
  font-size: 1.1rem;
  font-weight: 600;
  text-decoration: none;
  border-radius: 12px;
  transition: all 0.2s ease;
}

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

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

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

.btn-secondary {
  background-color: transparent;
  color: var(--text-primary);
  border: 2px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
  background-color: var(--surface-hover);
  border-color: var(--accent-color);
  color: var(--accent-color);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.button-group {
  margin-bottom: 48px;
}

/* Bento Grid */
.modular-heading {
  margin-bottom: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--border-color);
}

.bento-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.bento-card {
  background-color: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.2s ease;
  color: var(--text-primary);
}

.bento-card:hover {
  background-color: var(--surface-hover);
  border-color: var(--accent-color);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  text-decoration: none;
}

.bento-content h4 {
  margin: 0 0 8px 0;
  font-size: 1.1rem;
}

.file-size {
  display: inline-block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-tertiary);
  background-color: var(--border-color);
  padding: 4px 12px;
  border-radius: 20px;
}

.bento-icon {
  color: var(--text-tertiary);
  transition: color 0.2s ease;
}

.bento-card:hover .bento-icon {
  color: var(--accent-color);
}

/* Installation List */
.install-steps {
  list-style: none;
  counter-reset: step-counter;
}

.install-steps > li {
  position: relative;
  margin-bottom: 32px;
  padding-left: 56px;
}

.install-steps > li::before {
  counter-increment: step-counter;
  content: counter(step-counter);
  position: absolute;
  left: 0;
  top: 0;
  width: 40px;
  height: 40px;
  background-color: var(--bg-color);
  border: 2px solid var(--border-color);
  color: var(--text-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
}

.step-title {
  display: block;
  font-size: 1.25rem;
  margin-bottom: 8px;
  color: var(--text-primary);
  font-weight: 700;
}

.step-content p {
  margin-bottom: 12px;
}

/* Inline Code Elements */
.step-content code {
  background-color: var(--bg-color);
  border: 1px solid var(--border-color);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.9em;
  color: var(--accent-color);
  word-break: break-word;
}

/* Full Width Block Code Elements */
.code-block {
  background-color: var(--bg-color);
  border: 1px solid var(--border-color);
  padding: 12px;
  border-radius: 6px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.95rem;
  color: var(--text-primary);
  display: block;
  margin: 12px 0;
  overflow-x: auto;
}

.path-note {
  font-size: 0.95rem;
  color: var(--text-tertiary) !important;
}

/* Sliders */
.comparison-section {
  margin-bottom: 60px;
}

.comparison-section h3 {
  font-size: 1.25rem;
  margin-bottom: 16px;
}

.comparison-slider {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  cursor: ew-resize;
  background: var(--bg-color);
  --local-pos: 50%;
}

.comparison-slider img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}

.img-after {
  clip-path: inset(0 0 0 var(--local-pos));
  z-index: 2;
}

.slider-bar {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--local-pos);
  width: 2px;
  background: #ffffff;
  z-index: 10;
  transform: translateX(-50%);
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.3);
}

.slider-bar::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 40px;
  background-color: #ffffff;
  border-radius: 50%;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="%230f172a" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 8L22 12L18 16M6 8L2 12L6 16"/></svg>');
  background-repeat: no-repeat;
  background-position: center;
  box-shadow: var(--shadow-md);
}

.badge {
  position: absolute;
  top: 16px;
  padding: 6px 12px;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(4px);
  color: #ffffff;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  z-index: 5;
  border-radius: 6px;
  pointer-events: none;
}

.badge-before {
  left: 16px;
}
.badge-after {
  right: 16px;
  background: var(--accent-color);
  color: var(--accent-text);
}

/* Technical Grid */
.process-items {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 32px;
}

.process-item h3 {
  font-size: 1.25rem;
  margin-bottom: 8px;
  color: var(--accent-color);
}

.process-item p {
  margin-bottom: 0;
}

/* Roadmap List */
.status-box ul {
  list-style: none;
}

.status-box li {
  margin-bottom: 16px;
  padding-left: 24px;
  position: relative;
}

.status-box li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--accent-color);
  font-weight: 700;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border-color);
  padding: 48px 0;
  text-align: center;
}

.site-footer p {
  margin-bottom: 8px;
}

.footer-subtext {
  font-size: 0.9rem;
  color: var(--text-tertiary);
}

/* Back to Top */
.back-to-top {
  position: fixed;
  bottom: 32px;
  right: 32px;
  width: 48px;
  height: 48px;
  background-color: var(--surface-color);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 900;
  box-shadow: var(--shadow-md);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all 0.3s ease;
}

.back-to-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top:hover {
  background-color: var(--surface-hover);
  color: var(--accent-color);
}

.back-to-top svg {
  width: 24px;
  height: 24px;
}

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

  .mobile-menu-btn {
    display: block;
  }

  .surface-panel {
    padding: 32px 24px;
  }

  .install-steps > li {
    padding-left: 0;
    padding-top: 56px;
  }

  .btn {
    width: 100%;
  }

  .comparison-slider {
    aspect-ratio: 4 / 3;
  }
}
