/* SPDX-License-Identifier: Apache-2.0 OR MIT */
/* WCAG 2.2 AAA Design System */

:root {
  --bg: #090a0f;
  --bg-subtle: #11141f;
  --bg-card: #151928;
  --bg-card-hover: #1c2236;
  --border: #374151;
  --border-strong: #4b5563;
  --fg: #ffffff;
  --fg-muted: #e5e7eb;
  --fg-subtle: #9ca3af;
  --primary: #60a5fa;
  --primary-hover: #93c5fd;
  --primary-glow: rgba(96, 165, 250, 0.25);
  --accent: #c084fc;
  --success: #34d399;
  --focus: #60a5fa;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

[data-theme="light"] {
  --bg: #ffffff;
  --bg-subtle: #f9fafb;
  --bg-card: #f3f4f6;
  --bg-card-hover: #e5e7eb;
  --border: #9ca3af;
  --border-strong: #6b7280;
  --fg: #090a0f;
  --fg-muted: #1f2937;
  --fg-subtle: #374151;
  --primary: #1d4ed8;
  --primary-hover: #1e40af;
  --primary-glow: rgba(29, 78, 216, 0.15);
  --accent: #6b21a8;
  --success: #065f46;
  --focus: #1d4ed8;
}

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

html, body {
  max-width: 100%;
  overflow-x: clip;
}

html {
  font-family: var(--font-sans);
  background-color: var(--bg);
  color: var(--fg);
  scroll-behavior: smooth;
  line-height: 1.6;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.skip-link {
  position: absolute;
  top: -999px;
  left: 1rem;
  background: var(--primary);
  color: #090a0f;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-sm);
  z-index: 100;
  font-weight: 800;
  min-height: 44px;
  min-width: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}
[data-theme="light"] .skip-link {
  color: #ffffff;
}
.skip-link:focus {
  top: 1rem;
}

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

.container {
  width: 100%;
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 1rem;
}

@media (min-width: 640px) {
  .container {
    padding: 0 1.5rem;
  }
}

.narrow {
  max-width: 760px;
}

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

.font-mono {
  font-family: var(--font-mono);
}

/* --- Header & Navigation --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 4.5rem;
  padding: 0.5rem 0;
  gap: 1rem;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--fg);
  font-weight: 700;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.nav-menu {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.nav-link {
  color: var(--fg-muted);
  text-decoration: none;
  font-size: 0.9375rem;
  font-weight: 600;
  padding: 0.5rem 0.5rem;
  min-height: 44px;
  min-width: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
}

.nav-link:hover,
.nav-link.active {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.nav-toggle {
  display: none;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--fg);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 1.25rem;
  min-height: 44px;
  min-width: 44px;
}

@media (max-width: 768px) {
  .nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .nav-menu {
    display: none;
    position: absolute;
    top: 4.5rem;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border-bottom: 2px solid var(--border-strong);
    flex-direction: column;
    padding: 1.5rem;
    gap: 1rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
  }

  .nav-menu.is-open {
    display: flex;
  }
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

@media (max-width: 640px) {
  .header-actions .btn {
    display: none;
  }
}

.theme-toggle {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--fg);
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  min-height: 44px;
  min-width: 44px;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  text-decoration: none;
  border-radius: 2rem;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
  border: 1px solid transparent;
  min-height: 44px;
  min-width: 44px;
}

.btn-sm {
  padding: 0.4rem 1.1rem;
  font-size: 0.875rem;
}

.btn-lg {
  padding: 0.8rem 1.85rem;
  font-size: 1rem;
}

.btn-primary {
  background: var(--primary);
  color: #090a0f;
  box-shadow: 0 4px 14px var(--primary-glow);
}

[data-theme="light"] .btn-primary {
  background: var(--primary);
  color: #ffffff;
}

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

.btn-secondary {
  background: var(--bg-card);
  color: var(--fg);
  border-color: var(--border-strong);
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  color: var(--fg);
  border-color: var(--border);
}

.btn-outline:hover {
  background: var(--bg-card);
}

:focus,
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

.hero-section {
  padding: 4rem 0 2.5rem;
  position: relative;
  overflow: hidden;
}

.pill-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.3rem 0.8rem 0.3rem 0.4rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 2rem;
  margin-bottom: 1.5rem;
  max-width: 100%;
}

.pill-tag {
  background: var(--primary);
  color: #090a0f;
  font-size: 0.75rem;
  font-weight: 800;
  padding: 0.15rem 0.5rem;
  border-radius: 1rem;
  text-transform: uppercase;
  flex-shrink: 0;
}

[data-theme="light"] .pill-tag {
  color: #ffffff;
}

.pill-text {
  font-size: 0.875rem;
  color: var(--fg-muted);
  font-weight: 600;
  overflow-wrap: break-word;
}

.hero-title {
  font-size: clamp(2.2rem, 4.5vw, 3.8rem);
  font-weight: 800;
  line-height: 1.18;
  letter-spacing: -0.03em;
  margin-bottom: 1.25rem;
  color: var(--fg);
  overflow-wrap: break-word;
  word-break: break-word;
}

.hero-lead {
  font-size: 1.15rem;
  color: var(--fg-muted);
  max-width: 65ch;
  margin: 0 auto 2rem;
  line-height: 1.7;
  overflow-wrap: break-word;
  word-break: break-word;
}

.hero-cta-group {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 3rem;
  flex-wrap: wrap;
}

/* --- Authentic 4-Pane TMUX IDE Terminal Grid --- */
.terminal-preview-card {
  max-width: 1080px;
  width: 100%;
  margin: 0 auto;
  background: #090d13;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.6);
  overflow: hidden;
  text-align: left;
  box-sizing: border-box;
}

.terminal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 1.25rem;
  background: #111620;
  border-bottom: 1px solid var(--border);
  gap: 0.75rem;
  flex-wrap: wrap;
}

.window-dots {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
}
.dot-red { background: #ef4444; }
.dot-yellow { background: #eab308; }
.dot-green { background: #22c55e; }

.terminal-tab-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.tmux-win-badge {
  color: #58a6ff;
  font-weight: 700;
  font-size: 0.8125rem;
}

.tab-item {
  font-size: 0.8125rem;
  color: #8b949e;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
}

.tab-item.active-tab {
  background: #090d13;
  color: #58a6ff;
  font-weight: 700;
  border: 1px solid var(--border);
}

.badge-status {
  font-size: 0.8125rem;
  color: #34d399;
  font-weight: 700;
}

/* 4-Pane Grid Layout */
.tmux-grid {
  display: grid;
  grid-template-columns: 210px 1fr 270px;
  min-height: 440px;
  background: #090d13;
}

@media (max-width: 900px) {
  .tmux-grid {
    grid-template-columns: 1fr;
    min-height: auto;
  }
}

.tmux-pane {
  background: #090d13;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.tmux-pane:last-child {
  border-right: 0;
}

.tmux-center-col {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  background: #090d13;
}

@media (max-width: 900px) {
  .tmux-pane, .tmux-center-col {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
}

.pane-editor {
  border-right: 0;
  border-bottom: 1px solid var(--border);
  flex: 1.4;
}

.pane-terminal {
  border-right: 0;
  border-bottom: 0;
  flex: 1;
}

.pane-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.35rem 0.85rem;
  background: #121822;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.72rem;
  color: #8b949e;
  font-weight: 600;
}

.pane-title {
  color: #c9d1d9;
}

.pane-file, .pane-badge {
  font-size: 0.7rem;
  color: #58a6ff;
}

.ai-badge {
  background: rgba(192, 132, 252, 0.2);
  color: #d2a8ff;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
}

.pane-content {
  padding: 0.85rem 1rem;
  font-size: clamp(0.78rem, 1vw, 0.86rem);
  line-height: 1.65;
  overflow-x: auto;
  max-width: 100%;
}

.explorer-content {
  color: #8b949e;
  font-size: 0.78rem;
  line-height: 1.7;
}

.tree-node {
  padding: 0.1rem 0;
  white-space: pre;
}

.tree-node.dir {
  color: #79c0ff;
  font-weight: 600;
}

.tree-node.file {
  color: #c9d1d9;
}

.tree-node.active {
  color: #58a6ff;
  font-weight: 700;
  background: rgba(88, 166, 255, 0.15);
  border-radius: 3px;
}

.editor-code {
  font-size: clamp(0.78rem, 1vw, 0.86rem);
  line-height: 1.65;
  color: #f0f6fc;
  margin: 0;
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  display: block;
}

.terminal-content {
  background: #090d13;
  color: #8b949e;
  font-size: 0.78rem;
  line-height: 1.65;
}

.ai-content {
  background: #0d111a;
  color: #c9d1d9;
  font-size: 0.76rem;
  line-height: 1.6;
}

.ai-prompt {
  color: #d2a8ff;
  font-weight: 700;
  margin-bottom: 0.4rem;
}

.ai-sym {
  color: #ff7b72;
}

.ai-tool {
  color: #79c0ff;
  margin-bottom: 0.35rem;
}

.ai-res {
  color: #7ee787;
  margin-bottom: 0.6rem;
}

.cli-line {
  color: #f0f6fc;
  margin-bottom: 0.2rem;
}

.cli-out {
  color: #8b949e;
  margin-bottom: 0.4rem;
}

.cli-ok {
  color: #7ee787;
  font-weight: 700;
  margin-bottom: 0;
}

.code-kw { color: #ff7b72; font-weight: 700; }
.code-fn { color: #d2a8ff; font-weight: 600; }
.code-type { color: #79c0ff; }
.code-str { color: #a5d6ff; }
.code-comment { color: #8b949e; font-style: italic; }
.code-num { color: #79c0ff; }

/* TMUX Status Bar at Bottom */
.tmux-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.35rem 1rem;
  background: #0366d6;
  color: #ffffff;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.status-center {
  color: rgba(255, 255, 255, 0.9);
  font-weight: 500;
}

/* --- Section Structure --- */
.section {
  padding: 4.5rem 0;
  border-top: 1px solid var(--border);
}

.section-title {
  font-size: 2.25rem;
  font-weight: 800;
  margin-bottom: 1rem;
  letter-spacing: -0.02em;
  color: var(--fg);
  overflow-wrap: break-word;
  word-break: break-word;
}

.section-desc {
  font-size: 1.125rem;
  color: var(--fg-muted);
  max-width: 60ch;
  margin: 0 auto 3rem;
  line-height: 1.7;
  overflow-wrap: break-word;
  word-break: break-word;
}

.grid-2x2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 1.25rem;
  width: 100%;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.75rem;
  transition: transform 0.2s, border-color 0.2s;
  overflow: hidden;
  max-width: 100%;
}

.card:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
}

.card h3 {
  font-size: 1.25rem;
  font-weight: 800;
  margin-bottom: 0.75rem;
  color: var(--fg);
  overflow-wrap: break-word;
}

.card p {
  color: var(--fg-muted);
  font-size: 1rem;
  line-height: 1.65;
  overflow-wrap: break-word;
}

pre {
  background: #0d0f18;
  border: 1px solid var(--border-strong);
  padding: 1.5rem;
  border-radius: var(--radius-md);
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 1rem;
  line-height: 1.7;
  margin: 1.5rem 0;
  color: #f9fafb;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  max-width: 100%;
}

pre code {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  display: block;
  max-width: 100%;
  overflow-x: auto;
}

.table-responsive {
  overflow-x: auto;
  margin: 2rem 0;
  max-width: 100%;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

th, td {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  font-size: 1rem;
}

th {
  background: var(--bg-card);
  color: var(--fg);
  font-weight: 700;
}

td {
  color: var(--fg-muted);
}

.suite-link {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 3px;
  font-weight: 700;
}
.suite-link:hover {
  color: var(--primary-hover);
}

.faq-stack {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-top: 2rem;
}

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-subtle);
  padding: 4rem 0 2rem;
  margin-top: auto;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 2.5rem;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.version-tag {
  background: var(--bg-card);
  border: 1px solid var(--border);
  font-size: 0.8125rem;
  font-family: var(--font-mono);
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: 1rem;
  color: var(--primary);
}

.footer-desc {
  color: var(--fg-muted);
  font-size: 0.9375rem;
  max-width: 35ch;
  margin-bottom: 0.5rem;
  overflow-wrap: break-word;
}

.footer-copy {
  color: var(--fg-subtle);
  font-size: 0.875rem;
}

.footer-links {
  display: flex;
  gap: 3rem;
  flex-wrap: wrap;
}

.footer-col h4 {
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--fg-subtle);
  font-weight: 800;
  margin-bottom: 0.75rem;
}

.footer-col a {
  display: block;
  color: var(--fg-muted);
  text-decoration: none;
  font-size: 0.9375rem;
  margin-bottom: 0.5rem;
  transition: color 0.2s;
}

.footer-col a:hover {
  color: var(--primary);
  text-decoration: underline;
}

/* --- Degraded (No-JS) & Print Support --- */
.no-js .nav-toggle {
  display: none !important;
}

.no-js .nav-menu {
  display: flex !important;
  position: static !important;
  flex-direction: row !important;
  gap: 1.5rem !important;
  padding: 0 !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

@media print {
  header.site-header, .site-header, .skip-link, button, .nav-toggle, .theme-toggle, .btn {
    position: static !important;
  }
  .nav-toggle, .theme-toggle, .skip-link {
    display: none !important;
  }
}
