/* ============================================================
   Design tokens
   ============================================================ */
:root {
  --brand-yellow: #FFB500;
  --brand-pink: #FF61BD;
  --brand-gradient: linear-gradient(135deg, #FFB500, #FF61BD);

  --bg: #F5F0E8;
  --bg-elevated: #EDE8DF;
  --surface-glass: rgba(255, 255, 255, 0.45);
  --surface-glass-border: rgba(255, 255, 255, 0.6);
  --surface-glass-highlight: rgba(255, 255, 255, 0.75);

  --text-primary: #111010;
  --text-secondary: #3D3A35;
  --text-tertiary: #7A756C;

  --border-subtle: rgba(0, 0, 0, 0.08);
  --shadow-glass: 0 8px 32px rgba(0, 0, 0, 0.08), 0 2px 8px rgba(0, 0, 0, 0.05);

  --radius-card: 22px;
  --radius-btn: 12px;
  --radius-kbd: 6px;

  --ambient-yellow: rgba(255, 181, 0, 0.18);
  --ambient-pink: rgba(255, 97, 189, 0.15);
}

[data-theme="dark"] {
  --bg: #0E0D0C;
  --bg-elevated: #161513;
  --surface-glass: rgba(255, 255, 255, 0.055);
  --surface-glass-border: rgba(255, 255, 255, 0.1);
  --surface-glass-highlight: rgba(255, 255, 255, 0.14);

  --text-primary: #F2EDE6;
  --text-secondary: #A89F94;
  --text-tertiary: #5E5750;

  --border-subtle: rgba(255, 255, 255, 0.07);
  --shadow-glass: 0 8px 40px rgba(0, 0, 0, 0.4), 0 2px 10px rgba(0, 0, 0, 0.3);

  --ambient-yellow: rgba(255, 181, 0, 0.14);
  --ambient-pink: rgba(255, 97, 189, 0.12);
}

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

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

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* Noise texture overlay */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
  background-size: 200px 200px;
}

/* Ambient radial blobs */
.ambient {
  position: fixed;
  z-index: 0;
  pointer-events: none;
  border-radius: 50%;
  filter: blur(80px);
  will-change: transform;
}

.ambient-yellow {
  width: 600px;
  height: 600px;
  background: var(--ambient-yellow);
  top: -150px;
  left: -150px;
}

.ambient-pink {
  width: 700px;
  height: 700px;
  background: var(--ambient-pink);
  bottom: -200px;
  right: -200px;
}

/* Scroll-drift for ambient blobs */
.ambient-yellow { transition: transform 0.1s linear; }
.ambient-pink   { transition: transform 0.1s linear; }

/* ============================================================
   Layout
   ============================================================ */
.container {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
  position: relative;
  z-index: 1;
}

/* ============================================================
   Typography
   ============================================================ */
.display {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", system-ui, sans-serif;
  font-size: clamp(56px, 8vw, 88px);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.05;
}

.section-title {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", system-ui, sans-serif;
  font-size: clamp(36px, 5vw, 52px);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--text-primary);
}

.eyebrow {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand-yellow);
}

kbd {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.85em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 7px;
  border-radius: var(--radius-kbd);
  background: var(--surface-glass);
  border: 1px solid var(--surface-glass-border);
  box-shadow: 0 1px 2px rgba(0,0,0,0.12), inset 0 1px 0 var(--surface-glass-highlight);
  color: var(--text-primary);
  white-space: nowrap;
  vertical-align: baseline;
}

code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.88em;
  color: var(--brand-yellow);
}

/* ============================================================
   Focus styles
   ============================================================ */
:focus-visible {
  outline: 2px solid var(--brand-yellow);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ============================================================
   Header
   ============================================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 0;
  transition: background 0.25s ease, border-color 0.25s ease, backdrop-filter 0.25s ease;
}

.site-header.scrolled {
  background: var(--surface-glass);
  backdrop-filter: blur(40px) saturate(1.4);
  -webkit-backdrop-filter: blur(40px) saturate(1.4);
  border-bottom: 1px solid var(--border-subtle);
}

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

.header-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  color: var(--text-primary);
}

.header-brand img {
  width: 24px;
  height: 24px;
  border-radius: 6px;
}

.header-wordmark {
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.01em;
}

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

.header-nav a {
  font-size: 14px;
  font-weight: 450;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.15s ease;
}

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

/* ============================================================
   Glass surface mixin (utility class)
   ============================================================ */
.glass {
  background: var(--surface-glass);
  backdrop-filter: blur(40px) saturate(1.4);
  -webkit-backdrop-filter: blur(40px) saturate(1.4);
  border: 1px solid var(--surface-glass-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-glass);
  position: relative;
  overflow: hidden;
}

.glass::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--surface-glass-highlight);
  border-radius: var(--radius-card) var(--radius-card) 0 0;
}

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 24px;
  border-radius: var(--radius-btn);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: opacity 0.15s ease, transform 0.12s ease;
  white-space: nowrap;
}

.btn:hover  { opacity: 0.88; transform: translateY(-1px); }
.btn:active { opacity: 0.95; transform: translateY(0); }

.btn-primary {
  background: var(--brand-gradient);
  color: #111;
}

.btn-ghost {
  background: var(--surface-glass);
  backdrop-filter: blur(20px) saturate(1.2);
  -webkit-backdrop-filter: blur(20px) saturate(1.2);
  border: 1px solid var(--surface-glass-border);
  color: var(--brand-yellow);
  box-shadow: var(--shadow-glass);
}

.btn-small {
  padding: 8px 16px;
  font-size: 13px;
  border-radius: 10px;
}

/* ============================================================
   Hero
   ============================================================ */
.hero {
  padding: 120px 0 80px;
  text-align: center;
}

.hero .eyebrow {
  margin-bottom: 20px;
  display: block;
}

.hero .display {
  margin-bottom: 28px;
}

.hero-subtitle {
  font-size: 19px;
  color: var(--text-secondary);
  max-width: 560px;
  margin: 0 auto 40px;
  line-height: 1.6;
}

.hero-subtitle kbd {
  font-size: 0.82em;
}

.cta-row {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 12px;
}

.cta-meta {
  font-size: 13px;
  color: var(--text-tertiary);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  margin-bottom: 64px;
}

/* ============================================================
   Interactive demo
   ============================================================ */
.demo-wrapper {
  max-width: 720px;
  margin: 0 auto;
}

.demo-screen {
  aspect-ratio: 16 / 10;
  border-radius: 16px;
  overflow: hidden;
  position: relative;
  border: 1px solid var(--border-subtle);
  box-shadow: 0 24px 80px rgba(0,0,0,0.18), 0 4px 16px rgba(0,0,0,0.1);
}

/* Wallpaper layer */
.demo-wallpaper {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #1a1060 0%, #2d0a3e 50%, #1a0a28 100%);
}

[data-theme="dark"] .demo-wallpaper,
@media (prefers-color-scheme: dark) {
  .demo-wallpaper { background: linear-gradient(135deg, #0d0820 0%, #1a0530 50%, #0d0515 100%); }
}

.demo-wallpaper-light {
  background: linear-gradient(135deg, #fdf0e0 0%, #f5d6e8 50%, #eedde6 100%);
}

/* Center the overlay */
.demo-content {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

/* kbd glyph indicators */
.demo-kbd-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.demo-kbd-indicator kbd {
  font-size: 18px;
  padding: 4px 10px;
  transition: box-shadow 0.2s ease;
}

.demo-kbd-indicator kbd.glow {
  box-shadow: 0 0 12px rgba(255, 181, 0, 0.6), 0 0 4px rgba(255, 181, 0, 0.4);
  border-color: rgba(255, 181, 0, 0.5);
}

/* The switcher overlay */
.demo-overlay {
  width: 440px;
  max-width: calc(100% - 32px);
  background: rgba(30, 28, 26, 0.72);
  backdrop-filter: blur(40px) saturate(1.4);
  -webkit-backdrop-filter: blur(40px) saturate(1.4);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius-card);
  box-shadow: 0 32px 80px rgba(0,0,0,0.5), 0 8px 24px rgba(0,0,0,0.3);
  overflow: hidden;
  position: relative;
}

.demo-overlay::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: rgba(255,255,255,0.2);
}

.demo-overlay-header {
  padding: 14px 16px 10px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.35);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.demo-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  cursor: pointer;
  position: relative;
  transition: background 0.15s ease;
}

.demo-row + .demo-row {
  border-top: 1px solid rgba(255,255,255,0.04);
}

.demo-row.selected {
  background: rgba(255, 181, 0, 0.06);
  box-shadow: inset 0 0 0 1px rgba(255, 181, 0, 0.25), inset 0 0 0 1px rgba(255, 97, 189, 0.1);
}

.demo-row-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: rgba(255,255,255,0.6);
}

.demo-row.selected .demo-row-icon {
  color: rgba(255, 181, 0, 0.9);
}

.demo-row-title {
  flex: 1;
  font-size: 14px;
  color: rgba(255,255,255,0.75);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.demo-row.selected .demo-row-title {
  color: rgba(255,255,255,0.95);
}

.demo-badge {
  font-size: 10px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  letter-spacing: 0.03em;
  color: rgba(255,255,255,0.3);
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 20px;
  padding: 2px 8px;
  white-space: nowrap;
}

/* Raise animation */
.demo-overlay.raising {
  animation: raise-flash 0.6s ease forwards;
}

@keyframes raise-flash {
  0%   { opacity: 1; }
  25%  { opacity: 0.4; box-shadow: 0 0 40px rgba(255,181,0,0.3), 0 32px 80px rgba(0,0,0,0.5); }
  60%  { opacity: 0; }
  100% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .demo-overlay.raising { animation: none; }
  .demo-kbd-indicator kbd.glow { transition: none; }
}

/* Demo controls */
.demo-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.demo-caption {
  margin-top: 14px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12px;
  color: var(--text-tertiary);
  text-align: center;
}

/* Keyboard mode focus ring on demo container */
.demo-wrapper:focus {
  outline: 2px solid var(--brand-yellow);
  outline-offset: 4px;
  border-radius: 20px;
}

.demo-keyboard-mode-tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 12px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color: var(--text-secondary);
  white-space: nowrap;
  pointer-events: none;
  z-index: 10;
  box-shadow: var(--shadow-glass);
}

.demo-keyboard-mode-tooltip.hidden {
  display: none;
}

/* ============================================================
   Section base
   ============================================================ */
section {
  padding: 100px 0;
}

/* ============================================================
   Why section
   ============================================================ */
.why {
  padding: 100px 0;
}

.why-inner {
  max-width: 720px;
  margin: 0 auto;
}

.why-inner .section-title {
  margin-bottom: 32px;
}

.why-inner p {
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.why-inner p:last-child {
  margin-bottom: 0;
}

/* ============================================================
   Features
   ============================================================ */
.features {
  padding: 100px 0;
}

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

.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  list-style: none;
  padding: 0;
}

.feature-tile {
  padding: 28px 26px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.feature-icon {
  width: 36px;
  height: 36px;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.feature-heading {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.feature-desc {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.55;
}

/* ============================================================
   Install section
   ============================================================ */
.install {
  padding: 100px 0;
}

.install .section-title {
  margin-bottom: 40px;
}

.install-card {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  overflow: hidden;
}

.install-col {
  padding: 40px;
}

.install-col + .install-col {
  border-left: 1px solid var(--border-subtle);
}

.install-col-heading {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.install-col p {
  font-size: 15px;
  color: var(--text-secondary);
  margin-bottom: 24px;
  line-height: 1.6;
}

.install-sub {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 10px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

/* Code block — dark terminal look in both themes */
.code-block {
  background: #1a1816;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 16px 18px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 13px;
  color: rgba(242, 237, 230, 0.85);
  line-height: 1.7;
  overflow-x: auto;
  margin-bottom: 12px;
}

.code-block span.cmd {
  color: var(--brand-yellow);
}

/* ============================================================
   Permissions section
   ============================================================ */
.permissions {
  padding: 100px 0;
  border-top: 1px solid var(--border-subtle);
}

.permissions-inner {
  max-width: 720px;
}

.permissions-inner .section-title {
  margin-bottom: 28px;
}

.permissions-inner p {
  color: var(--text-secondary);
  font-size: 17px;
  line-height: 1.7;
}

/* ============================================================
   Footer
   ============================================================ */
.site-footer {
  border-top: 1px solid var(--border-subtle);
  padding: 32px 0;
}

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

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

.footer-left a {
  color: var(--text-tertiary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

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

/* Theme segmented control */
.theme-control {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color: var(--text-tertiary);
}

.theme-control span {
  opacity: 0.5;
}

.theme-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 12px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color: var(--text-tertiary);
  padding: 2px 6px;
  border-radius: 4px;
  transition: color 0.15s ease, background 0.15s ease;
}

.theme-btn:hover {
  color: var(--text-primary);
  background: var(--border-subtle);
}

.theme-btn.active {
  color: var(--brand-yellow);
}

.footer-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.footer-right a {
  font-size: 13px;
  color: var(--text-tertiary);
  text-decoration: none;
  transition: color 0.15s ease;
}

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

/* ============================================================
   Scroll entrance animation
   ============================================================ */
.fade-in {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}

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

@media (prefers-reduced-motion: reduce) {
  .fade-in {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 900px) {
  .features-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .install-card {
    grid-template-columns: 1fr;
  }

  .install-col + .install-col {
    border-left: none;
    border-top: 1px solid var(--border-subtle);
  }

  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
}

@media (max-width: 600px) {
  .features-grid {
    grid-template-columns: 1fr;
  }

  .hero {
    padding: 80px 0 60px;
  }

  .demo-overlay {
    width: calc(100% - 32px);
  }

  .header-nav {
    gap: 16px;
  }
}
