/* ============================================
   opencode-mcp Landing — Terminal-First Design
   ============================================ */

/* ---------- Design Tokens ---------- */
:root {
  --canvas: #0f0f0f;
  --surface-soft: #141414;
  --surface-card: #1c1a1a;
  --surface-elevated: #2a2727;
  --text-primary: #fdfcfc;
  --text-body: #d5d3d3;
  --text-mute: #9a9898;
  --text-stone: #6e6e73;
  --hairline: rgba(255, 255, 255, 0.10);
  --hairline-strong: rgba(255, 255, 255, 0.22);
  --accent: #007aff;
  --success: #30d158;
  --warning: #ff9f0a;
  --danger: #ff3b30;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --radius: 5px;
}

/* ---------- Base ---------- */
* {
  font-family: var(--font-mono);
}

body {
  background: var(--canvas);
  color: var(--text-body);
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: var(--canvas);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* ---------- Selection ---------- */
::selection {
  background: rgba(0, 122, 255, 0.3);
  color: #fff;
}

/* ---------- Progress Bar ---------- */
.progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
  transform-origin: left;
  transform: scaleX(0);
  z-index: 100;
  pointer-events: none;
}

/* ---------- Navigation ---------- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  transition: all 0.3s ease;
  background: transparent;
}

.nav.scrolled {
  background: rgba(15, 15, 15, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--hairline);
}

.nav-link {
  color: var(--text-mute);
  font-size: 0.8125rem;
  font-weight: 500;
  transition: color 0.2s ease;
  font-family: var(--font-mono);
}
.nav-link:hover {
  color: var(--text-primary);
}

.nav-github-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--hairline);
  background: transparent;
  color: var(--text-mute);
  font-size: 0.8125rem;
  font-weight: 500;
  font-family: var(--font-mono);
  transition: all 0.2s ease;
}
.nav-github-btn:hover {
  border-color: var(--hairline-strong);
  color: var(--text-primary);
  transform: translateY(-1px);
}

/* ---------- Hero Section ---------- */
.hero-section {
  position: relative;
  overflow: hidden;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--canvas);
}

/* Flex children default to min-width:auto, letting wide <pre> content
   (delegation terminal) stretch the hero past the viewport on mobile */
.hero-section > * {
  min-width: 0;
  max-width: 100%;
}

.terminal-body {
  overflow-x: auto;
}

/* ---------- Dither Field (ANSI background) ---------- */
.dither-field {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.dither-layer {
  position: absolute;
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.2;
  color: var(--text-primary);
  opacity: 0.06;
  white-space: pre;
  user-select: none;
  animation: dither-shimmer 8s ease-in-out infinite alternate;
}

.dither-layer:nth-child(2) {
  animation-delay: -3s;
  opacity: 0.04;
}

.dither-layer:nth-child(3) {
  animation-delay: -6s;
  opacity: 0.05;
}

@keyframes dither-shimmer {
  0% { opacity: 0.04; }
  50% { opacity: 0.08; }
  100% { opacity: 0.04; }
}

/* ---------- Hero Badge ---------- */
.hero-badge {
  animation: fadeInDown 0.6s ease-out;
  font-family: var(--font-mono);
}

/* ---------- Hero Title ---------- */
.hero-title {
  font-family: var(--font-mono);
  color: var(--text-primary);
}

.accent-word {
  color: var(--accent);
}

/* ---------- Install Command Block ---------- */
.install-command-block {
  background: var(--surface-card);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  transition: border-color 0.2s ease;
  position: relative;
  overflow: hidden;
}
.install-command-block:hover {
  border-color: var(--hairline-strong);
}

.install-command-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* ---------- Copy Button ---------- */
.copy-btn {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.625rem;
  border-radius: var(--radius);
  border: 1px solid var(--hairline);
  background: transparent;
  color: var(--text-mute);
  font-size: 0.75rem;
  font-weight: 500;
  font-family: var(--font-mono);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  flex-shrink: 0;
}
.copy-btn:hover {
  border-color: var(--hairline-strong);
  color: var(--text-primary);
}
.copy-btn.copied {
  border-color: rgba(48, 209, 88, 0.4);
  color: var(--success);
}

/* ---------- CTA Buttons ---------- */
.cta-primary {
  display: inline-flex;
  align-items: center;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 0.875rem;
  font-family: var(--font-mono);
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}
.cta-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 20px rgba(0, 122, 255, 0.25);
}

.cta-secondary {
  display: inline-flex;
  align-items: center;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  border: 1px solid var(--hairline);
  background: transparent;
  color: var(--text-body);
  font-weight: 600;
  font-size: 0.875rem;
  font-family: var(--font-mono);
  transition: all 0.2s ease;
}
.cta-secondary:hover {
  border-color: var(--hairline-strong);
  color: var(--text-primary);
  transform: translateY(-2px);
}

/* ---------- Flat Card (replaces glass-card) ---------- */
.glass-card {
  background: var(--surface-card);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  transition: all 0.25s ease;
}
.glass-card:hover {
  border-color: var(--hairline-strong);
  transform: translateY(-2px);
}

/* ---------- Feature Cards ---------- */
.feature-card {
  position: relative;
  overflow: hidden;
}
.feature-card:hover {
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
}

.feature-icon {
  transition: transform 0.25s ease;
  border-radius: var(--radius) !important;
}
.feature-card:hover .feature-icon {
  transform: scale(1.05);
}

/* ---------- Architecture ASCII Diagram ---------- */
.arch-flow {
  /* Fallback for small screens; the ASCII diagram replaces it on desktop */
  display: none;
  align-items: center;
  justify-content: center;
  gap: 0;
  flex-wrap: wrap;
  padding: 2rem 0;
}

.arch-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 1.25rem;
  border-radius: var(--radius);
  background: var(--surface-card);
  border: 1px solid var(--hairline);
  min-width: 140px;
  transition: all 0.25s ease;
}
.arch-node:hover {
  border-color: var(--hairline-strong);
  transform: translateY(-2px);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
}

.arch-node-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.75rem;
  border: 1px solid;
}

.arch-node-title {
  font-weight: 600;
  font-size: 0.8125rem;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
  font-family: var(--font-mono);
}

.arch-node-desc {
  font-size: 0.6875rem;
  color: var(--text-stone);
  font-family: var(--font-mono);
}

.arch-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 0.5rem;
  flex-shrink: 0;
}

.arch-arrow-svg {
  opacity: 0.5;
}

.arch-arrow-path {
  stroke-dasharray: 60;
  stroke-dashoffset: 60;
  transition: stroke-dashoffset 0.6s ease;
}

.arch-flow.animated .arch-arrow-path {
  stroke-dashoffset: 0;
}

/* ASCII architecture diagram */
.arch-ascii {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.6;
  color: var(--text-mute);
  text-align: center;
  white-space: pre;
  overflow-x: auto;
  padding: 2rem 1rem;
}

.arch-ascii .pulse-char {
  transition: color 0.15s ease;
}

.arch-ascii .pulse-char.active {
  color: var(--accent);
}

/* ---------- Tool Cards ---------- */
.tool-card {
  position: relative;
  transition: all 0.25s ease;
}
.tool-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
}

.tool-badge {
  flex-shrink: 0;
  font-family: var(--font-mono);
}

.badge-server {
  background: rgba(0, 122, 255, 0.12);
  color: var(--accent);
  border-color: rgba(0, 122, 255, 0.25);
}

.badge-task {
  background: rgba(48, 209, 88, 0.12);
  color: var(--success);
  border-color: rgba(48, 209, 88, 0.25);
}

.badge-wait {
  background: rgba(255, 159, 10, 0.12);
  color: var(--warning);
  border-color: rgba(255, 159, 10, 0.25);
}

.badge-danger {
  background: rgba(255, 59, 48, 0.12);
  color: var(--danger);
  border-color: rgba(255, 59, 48, 0.25);
}

.badge-prompt {
  background: rgba(0, 122, 255, 0.12);
  color: var(--accent);
  border-color: rgba(0, 122, 255, 0.25);
}

/* ---------- Install Tabs ---------- */
.install-tabs {
  display: flex;
  gap: 0.25rem;
  background: var(--surface-soft);
  border: 1px solid var(--hairline);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 0.25rem;
  width: fit-content;
}

.install-tab {
  padding: 0.5rem 1.25rem;
  border-radius: 4px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-mute);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--font-mono);
}
.install-tab:hover {
  color: var(--text-primary);
}
.install-tab.active {
  background: var(--surface-elevated);
  color: var(--text-primary);
}

/* ---------- Tab Content ---------- */
.tab-content {
  display: none;
}
.tab-content.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

/* ---------- Code Block ---------- */
.code-block {
  background: var(--surface-soft);
  border: 1px solid var(--hairline);
  border-radius: 0 var(--radius) var(--radius) var(--radius);
  overflow: hidden;
}

.code-block-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--surface-card);
  border-bottom: 1px solid var(--hairline);
}

.code-block-dots {
  display: flex;
  gap: 0.375rem;
}

.code-block-title {
  font-size: 0.75rem;
  color: var(--text-stone);
  font-family: var(--font-mono);
  flex: 1;
}

.code-copy-btn {
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0;
}

.code-block-body {
  padding: 1.25rem;
  margin: 0;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.7;
  color: var(--text-body);
  tab-size: 2;
}

.code-block-body code {
  font-family: inherit;
}

/* Syntax highlighting */
.code-key {
  color: #c084fc;
}
.code-string {
  color: #86efac;
}
.code-keyword {
  color: #93c5fd;
}
.code-fn {
  color: #67e8f9;
}
.code-prompt {
  color: var(--accent);
  user-select: none;
}
.code-flag {
  color: var(--warning);
}
.code-comment {
  color: var(--text-stone);
  font-style: italic;
}

/* ---------- Delegation Terminal ---------- */
.delegation-terminal {
  background: var(--surface-soft);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  overflow: hidden;
  max-width: 540px;
  margin: 0 auto;
  text-align: left;
}

.terminal-titlebar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 0.875rem;
  background: var(--surface-card);
  border-bottom: 1px solid var(--hairline);
}

.terminal-dots {
  display: flex;
  gap: 6px;
}

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

.terminal-dot-red { background: #ff5f57; }
.terminal-dot-yellow { background: #febc2e; }
.terminal-dot-green { background: #28c840; }

.terminal-title {
  font-size: 0.6875rem;
  color: var(--text-stone);
  font-family: var(--font-mono);
  flex: 1;
  text-align: center;
  margin-right: 36px;
}

.terminal-body {
  padding: 1rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1.8;
  color: var(--text-body);
  min-height: 180px;
}

.terminal-line {
  white-space: pre-wrap;
  word-break: break-all;
}

.terminal-prompt {
  color: var(--accent);
}

.terminal-cursor {
  display: inline-block;
  width: 7px;
  height: 14px;
  background: var(--accent);
  vertical-align: text-bottom;
  animation: blink-cursor 1s step-end infinite;
}

@keyframes blink-cursor {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.terminal-success {
  color: var(--success);
}

.terminal-spinner {
  display: inline-block;
  width: 1ch;
}

/* ---------- Footer ---------- */
.footer-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-stone);
  font-size: 0.8125rem;
  font-family: var(--font-mono);
  transition: color 0.2s ease;
  text-decoration: none;
}
.footer-link:hover {
  color: var(--text-mute);
}

/* ---------- Reveal Animation (initial state) ---------- */
.reveal-on-scroll {
  opacity: 0;
  transform: translateY(30px);
}

/* ---------- Keyframes ---------- */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---------- Typing Cursor ---------- */
.typing-cursor {
  color: var(--accent);
  animation: typing-blink 0.8s step-end infinite;
  font-weight: 400;
}

@keyframes typing-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* ---------- Status Chip ---------- */
.status-chip {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
  font-family: var(--font-mono);
  font-size: 0.5625rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  border: 1px solid;
  transition: all 0.25s ease;
  z-index: 1;
  line-height: 1.4;
}

.status-chip-pending {
  background: rgba(154, 152, 152, 0.08);
  color: var(--text-stone);
  border-color: rgba(154, 152, 152, 0.15);
}

.status-chip-running {
  background: rgba(255, 159, 10, 0.1);
  color: var(--warning);
  border-color: rgba(255, 159, 10, 0.25);
}

.status-chip-completed {
  background: rgba(48, 209, 88, 0.1);
  color: var(--success);
  border-color: rgba(48, 209, 88, 0.25);
}

.status-chip-indicator {
  display: inline-block;
  width: 1ch;
  text-align: center;
}

/* ---------- Tool Group Labels ---------- */
.tool-group-label {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--text-stone);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding: 0.75rem 0 0.25rem;
  opacity: 0;
  transform: translateY(20px);
}

/* ---------- Core Tool Cards ---------- */
.tool-card-core-success {
  border-color: rgba(48, 209, 88, 0.35);
}
.tool-card-core-success:hover {
  border-color: rgba(48, 209, 88, 0.5);
}

.tool-card-core-warning {
  border-color: rgba(255, 159, 10, 0.35);
}
.tool-card-core-warning:hover {
  border-color: rgba(255, 159, 10, 0.5);
}

.core-tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.5625rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.0625rem 0.375rem;
  border-radius: 3px;
  background: rgba(48, 209, 88, 0.12);
  color: var(--success);
  border: 1px solid rgba(48, 209, 88, 0.25);
  margin-left: 0.5rem;
  vertical-align: middle;
  line-height: 1.4;
}

.core-tag-warning {
  background: rgba(255, 159, 10, 0.12);
  color: var(--warning);
  border-color: rgba(255, 159, 10, 0.25);
}

/* ---------- Reduced Motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .dither-layer {
    animation: none;
    opacity: 0.05;
  }

  .terminal-cursor {
    animation: none;
    opacity: 1;
  }

  .reveal-on-scroll {
    opacity: 1;
    transform: none;
  }

  .arch-arrow-path {
    stroke-dashoffset: 0;
    transition: none;
  }

  .typing-cursor {
    animation: none;
    display: none;
  }

  .tool-group-label {
    opacity: 1;
    transform: none;
  }

  .status-chip {
    transition: none;
  }
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  .hero-section {
    min-height: auto;
    padding-top: 6rem;
    padding-bottom: 4rem;
  }

  .arch-flow {
    display: flex;
    flex-direction: column;
    gap: 0;
  }

  .arch-ascii {
    display: none;
  }

  .arch-arrow {
    transform: rotate(90deg);
    padding: 0.25rem 0;
  }

  .arch-node {
    min-width: 200px;
    width: 100%;
    max-width: 280px;
  }

  .install-tabs {
    width: 100%;
  }

  .install-tab {
    flex: 1;
    text-align: center;
  }

  .code-block {
    border-radius: 0 0 var(--radius) var(--radius);
  }

  .arch-ascii {
    font-size: 0.625rem;
  }

  .delegation-terminal {
    font-size: 0.6875rem;
  }
}

@media (max-width: 640px) {
  .hero-title {
    font-size: 1.75rem !important;
  }

  .install-command-block {
    padding: 0.625rem 0.75rem;
  }

  .install-command-row code {
    font-size: 0.6875rem;
  }

  .arch-ascii {
    font-size: 0.5rem;
    line-height: 1.4;
  }

  .terminal-body {
    font-size: 0.625rem;
    min-height: 140px;
  }
}
