/* ========================================
   ChrisOS Studio — Marketing Website Styles
   ======================================== */

/* --- Tokens (Dark — default) --- */
:root {
  --bg: #1A1816;
  --surface: #22201D;
  --surface-hover: #2D2A26;
  --border: #3D3630;
  --border-subtle: rgba(255, 255, 255, 0.06);
  --text-primary: #E8E2DA;
  --text-secondary: #A69985;
  --text-muted: #73676D;
  --accent: #C8A064;
  --accent-hover: #D4AE74;
  --success: #7EC896;
  --error: #D4756A;
  --info: #6BA3BE;
  --purple: #9B7DB8;
  --deep-teal: #2E4A4D;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
}

/* --- Light Mode Overrides --- */
[data-mode="light"] {
  --bg: #F5F2EE;
  --surface: #EBE7E1;
  --surface-hover: #E0DBD4;
  --border: #D0C8BE;
  --border-subtle: rgba(0, 0, 0, 0.07);
  --text-primary: #2A2420;
  --text-secondary: #6B5D50;
  --text-muted: #8A7E74;
  --accent: #8A6820;
  --accent-hover: #9A7830;
  --success: #2E7A48;
  --error: #B84A3E;
  --info: #3A7A94;
  --purple: #6A4A8E;
  --deep-teal: #1A3538;
}

[data-mode="light"] .glass {
  background: rgba(245, 242, 238, 0.85);
}

[data-mode="light"] .hero-bg {
  background:
    radial-gradient(ellipse 60% 50% at 50% 40%, rgba(138, 104, 32, 0.06) 0%, transparent 70%),
    radial-gradient(ellipse 80% 60% at 30% 60%, rgba(26, 53, 56, 0.04) 0%, transparent 60%);
}

[data-mode="light"] .hero-cta {
  color: #FFFAF3;
}

[data-mode="light"] .hero-cta:hover {
  box-shadow: 0 8px 32px rgba(138, 104, 32, 0.2);
}

[data-mode="light"] .feature-card:hover {
  border-color: rgba(138, 104, 32, 0.2);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
}

[data-mode="light"] .feature-icon {
  background: rgba(138, 104, 32, 0.08);
}

[data-mode="light"] .app-window {
  box-shadow:
    0 2px 4px rgba(0, 0, 0, 0.06),
    0 12px 40px rgba(0, 0, 0, 0.12),
    0 0 0 1px rgba(0, 0, 0, 0.08);
}

[data-mode="light"] .app-chrome {
  background: rgba(235, 231, 225, 0.95);
  border-bottom-color: rgba(0, 0, 0, 0.06);
}

[data-mode="light"] .app-chrome-title {
  color: var(--text-secondary);
}

[data-mode="light"] .app-canvas {
  background: var(--bg);
}

[data-mode="light"] .app-status-bar {
  background: rgba(235, 231, 225, 0.7);
  border-top-color: rgba(0, 0, 0, 0.06);
}

[data-mode="light"] .canvas-toolbar {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

[data-mode="light"] .how-it-works {
  background: linear-gradient(180deg, var(--bg) 0%, rgba(138, 104, 32, 0.06) 30%, rgba(138, 104, 32, 0.06) 70%, var(--bg) 100%);
}

[data-mode="light"] .step-number {
  background: rgba(138, 104, 32, 0.1);
  color: var(--accent);
}

[data-mode="light"] .mcp-group-title {
  color: var(--accent);
}

[data-mode="light"] .mcp-tool {
  background: rgba(0, 0, 0, 0.03);
}

/* --- Scrollbars --- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(61, 54, 48, 0.6); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(166, 153, 133, 0.5); }
::-webkit-scrollbar-thumb:active { background: rgba(200, 160, 100, 0.4); }
::-webkit-scrollbar-corner { background: transparent; }
* { scrollbar-width: thin; scrollbar-color: rgba(61, 54, 48, 0.6) transparent; }

[data-mode="light"] ::-webkit-scrollbar-thumb { background: rgba(209, 201, 190, 0.7); }
[data-mode="light"] ::-webkit-scrollbar-thumb:hover { background: rgba(160, 120, 48, 0.4); }
[data-mode="light"] ::-webkit-scrollbar-thumb:active { background: rgba(160, 120, 48, 0.5); }
[data-mode="light"] * { scrollbar-color: rgba(209, 201, 190, 0.7) transparent; }

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

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);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  transition: background 0.3s ease, color 0.3s ease;
}

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

/* --- Utilities --- */
.glass {
  background: rgba(26, 24, 22, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
}

.section-title {
  font-size: 32px;
  font-weight: 300;
  letter-spacing: -0.02em;
  margin-bottom: 48px;
  text-align: center;
}

/* --- Scroll Reveal --- */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s var(--ease-out), transform 0.6s var(--ease-out);
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger children */
.reveal-stagger .reveal:nth-child(1) { transition-delay: 0ms; }
.reveal-stagger .reveal:nth-child(2) { transition-delay: 60ms; }
.reveal-stagger .reveal:nth-child(3) { transition-delay: 120ms; }
.reveal-stagger .reveal:nth-child(4) { transition-delay: 180ms; }
.reveal-stagger .reveal:nth-child(5) { transition-delay: 240ms; }
.reveal-stagger .reveal:nth-child(6) { transition-delay: 300ms; }
.reveal-stagger .reveal:nth-child(7) { transition-delay: 360ms; }
.reveal-stagger .reveal:nth-child(8) { transition-delay: 420ms; }

/* --- Nav --- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  border-bottom: 1px solid var(--border-subtle);
  transition: background 0.3s ease;
}

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

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-icon {
  width: 24px;
  height: 24px;
  color: var(--accent);
  flex-shrink: 0;
}

.nav-icon svg {
  width: 100%;
  height: 100%;
}

.nav-wordmark {
  font-family: 'Playfair Display', Georgia, serif;
  font-style: italic;
  font-size: 16px;
  font-weight: 500;
  color: var(--accent);
}

/* --- Theme Toggle --- */
.theme-toggle {
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 3px;
}

.theme-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 24px;
  border: none;
  border-radius: 5px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease;
}

.theme-btn:hover {
  color: var(--text-secondary);
}

.theme-btn.active {
  background: var(--border-subtle);
  color: var(--accent);
}

.theme-btn svg {
  width: 14px;
  height: 14px;
}

/* --- Hero --- */
.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 80px 24px 60px;
  position: relative;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 50% 40%, rgba(200, 160, 100, 0.06) 0%, transparent 70%),
    radial-gradient(ellipse 80% 60% at 30% 60%, rgba(46, 74, 77, 0.05) 0%, transparent 60%);
  pointer-events: none;
}

.hero-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-style: italic;
  font-size: 56px;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.1;
  color: var(--accent);
  opacity: 0;
  transform: translateY(30px);
  animation: hero-enter 0.8s var(--ease-out) 0.1s forwards;
}

.hero-tagline {
  font-size: 18px;
  color: var(--text-secondary);
  margin-top: 16px;
  font-weight: 400;
  letter-spacing: -0.01em;
  opacity: 0;
  transform: translateY(30px);
  animation: hero-enter 0.8s var(--ease-out) 0.3s forwards;
}

@keyframes hero-enter {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --- App Window (iframe demo) --- */
.demo-container {
  margin-top: 48px;
  opacity: 0;
  transform: translateY(30px);
  animation: hero-enter 0.8s var(--ease-out) 0.5s forwards;
}

.app-window {
  width: 900px;
  max-width: calc(100vw - 48px);
  background: var(--surface);
  border-radius: 12px;
  box-shadow:
    0 2px 4px rgba(0, 0, 0, 0.2),
    0 12px 40px rgba(0, 0, 0, 0.35),
    0 0 0 1px rgba(255, 255, 255, 0.06);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.app-chrome {
  height: 36px;
  flex-shrink: 0;
  background: rgba(30, 28, 25, 0.95);
  display: flex;
  align-items: center;
  padding: 0 12px;
  position: relative;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.traffic-lights {
  display: flex;
  gap: 6px;
}

.tl-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.tl-close { background: #ED6A5E; }
.tl-minimize { background: #F5BF4F; }
.tl-maximize { background: #62C554; }

.app-chrome-title {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

/* --- Tab bar mockup --- */
.app-tabs {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0 8px;
  height: 36px;
  background: var(--bg);
  border-bottom: 1px solid var(--border-subtle);
  overflow-x: auto;
  flex-shrink: 0;
}

.app-tab {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0 12px;
  height: 100%;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
  letter-spacing: 0.01em;
  border-bottom: 2px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.app-tab svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}

.app-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* --- Canvas area --- */
.app-canvas {
  width: 100%;
  height: 420px;
  background: var(--bg);
  position: relative;
  overflow: hidden;
}

#sketch-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* Floating toolbar */
.canvas-toolbar {
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.toolbar-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 28px;
  border-radius: 6px;
  color: var(--text-muted);
  transition: color 0.15s ease, background 0.15s ease;
}

.toolbar-btn svg {
  width: 16px;
  height: 16px;
}

.toolbar-btn.active {
  color: var(--accent);
  background: rgba(200, 160, 100, 0.1);
}

/* --- Status bar --- */
.app-status-bar {
  height: 26px;
  flex-shrink: 0;
  padding: 0 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  border-top: 1px solid var(--border-subtle);
  background: rgba(30, 28, 25, 0.6);
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
}

.status-dot.connected {
  background: var(--success);
  box-shadow: 0 0 6px rgba(126, 200, 150, 0.4);
}

/* --- Download CTA (shared) --- */
.hero-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 40px;
  padding: 14px 32px;
  background: var(--accent);
  color: #1A1816;
  font-size: 15px;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: transform 0.25s var(--ease-out), box-shadow 0.25s var(--ease-out), background 0.2s ease;
}

.hero-cta:hover {
  transform: translateY(-2px);
  background: var(--accent-hover);
  box-shadow: 0 8px 32px rgba(200, 160, 100, 0.25);
}

.hero-cta:active {
  transform: translateY(0);
}

.hero-cta svg {
  width: 18px;
  height: 18px;
}

.hero-cta-enter {
  opacity: 0;
  transform: translateY(30px);
  animation: hero-enter 0.8s var(--ease-out) 0.9s forwards;
}

/* --- Download Section --- */
.download {
  padding: 100px 0 80px;
  text-align: center;
}

.download .hero-cta {
  font-size: 16px;
  padding: 16px 40px;
}

.download-meta {
  margin-top: 16px;
  font-size: 13px;
  color: var(--text-muted);
}

.download-instructions {
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  line-height: 1.7;
}

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

.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.feature-card {
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 28px 24px;
  transition: transform 0.3s var(--ease-out), border-color 0.3s ease, box-shadow 0.3s ease;
}

.feature-card:hover {
  transform: translateY(-2px);
  border-color: rgba(200, 160, 100, 0.15);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
}

.feature-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: rgba(200, 160, 100, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  color: var(--accent);
}

.feature-icon svg {
  width: 20px;
  height: 20px;
  stroke: var(--accent);
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.feature-card h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}

.feature-card p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* --- How It Works --- */
.how-it-works {
  padding: 100px 0;
  background: linear-gradient(180deg, var(--bg) 0%, rgba(200, 160, 100, 0.08) 30%, rgba(200, 160, 100, 0.08) 70%, var(--bg) 100%);
}

.steps-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
  max-width: 900px;
  margin: 0 auto;
}

.step {
  text-align: center;
}

.step-number {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(200, 160, 100, 0.12);
  color: var(--accent);
  font-family: 'Playfair Display', Georgia, serif;
  font-style: italic;
  font-size: 20px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
}

.step h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}

.step p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.step code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 2px 6px;
  color: var(--accent);
  word-break: break-all;
}

/* --- MCP Tools --- */
.mcp-tools {
  padding: 100px 0;
}

.mcp-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

.mcp-group {
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 24px;
}

.mcp-group-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.mcp-group-icon {
  width: 20px;
  height: 20px;
  color: var(--accent);
  flex-shrink: 0;
}

.mcp-group-icon svg {
  width: 100%;
  height: 100%;
  stroke: var(--accent);
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mcp-group-title {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--accent);
}

.mcp-tool-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mcp-tool {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius-sm);
}

.mcp-tool-name {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  color: var(--text-primary);
  white-space: nowrap;
  flex-shrink: 0;
}

.mcp-tool-desc {
  font-size: 12px;
  color: var(--text-muted);
}

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

.footer-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
}

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

  .app-iframe-wrap {
    height: 480px;
  }
}

@media (max-width: 768px) {
  .hero-title {
    font-size: 40px;
  }

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

  .section-title {
    font-size: 26px;
    margin-bottom: 32px;
  }

  .app-iframe-wrap {
    height: 400px;
  }

  .steps-grid {
    grid-template-columns: 1fr;
    gap: 40px;
  }

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

@media (max-width: 640px) {
  .hero-title {
    font-size: 34px;
  }

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

  .footer-inner {
    flex-direction: column;
    gap: 12px;
    text-align: center;
  }

  .app-iframe-wrap {
    height: 320px;
  }
}
