/* Ready — Site-specific styles */

/* ── Color aliases ── */
:root {
  --accent: var(--ds-accent-primary);
  --accent-light: var(--ds-accent-primary-light);
  --teal: var(--ds-accent-secondary);
  --teal-light: var(--ds-accent-secondary-light);
}

/* ── Navigation ── */
.nav { composes: ds-nav; }

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  gap: var(--ds-space-lg);
}

.nav-logo {
  font-family: var(--ds-font-mono);
  font-size: 15px;
  font-weight: 600;
  color: var(--ds-text);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.nav-logo span { color: var(--accent); }

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

.nav-links a {
  font-size: var(--ds-text-sm);
  font-weight: 500;
  color: var(--ds-text-secondary);
  transition: color 0.15s;
  text-decoration: none;
}

.nav-links a:hover { color: var(--ds-text); }

/* ── Hero ── */
.hero {
  padding: var(--ds-space-section) 0 var(--ds-space-2xl);
  text-align: center;
}

.hero-problem {
  font-family: var(--ds-font-mono);
  font-size: var(--ds-text-xs);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: var(--ds-space-md);
}

.hero h1 {
  max-width: 860px;
  margin: 0 auto var(--ds-space-md);
}

.hero h1 span { color: var(--accent); }

.hero-sub {
  font-size: var(--ds-text-lg);
  color: var(--ds-text-secondary);
  max-width: 640px;
  margin: 0 auto var(--ds-space-xl);
  line-height: 1.6;
}

.hero-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--ds-space-sm);
  flex-wrap: wrap;
}

.hero-install {
  margin-top: var(--ds-space-xl);
}

.hero-install .ds-code-block {
  display: inline-block;
  padding: 14px 28px;
  font-size: 14px;
  text-align: left;
}

/* ── Sections ── */
section {
  padding: var(--ds-space-section) 0;
}

.section-label {
  font-family: var(--ds-font-mono);
  font-size: var(--ds-text-xs);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: var(--ds-space-sm);
}

.section-title {
  font-size: var(--ds-text-2xl);
  font-weight: 700;
  line-height: var(--ds-line-height-tight);
  letter-spacing: -0.03em;
  margin-bottom: var(--ds-space-sm);
}

.section-desc {
  font-size: var(--ds-text-lg);
  color: var(--ds-text-secondary);
  max-width: 640px;
  line-height: 1.6;
  margin-bottom: var(--ds-space-xl);
}

/* ── Feature grid ── */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--ds-space-md);
}

.feature-card {
  background: var(--ds-surface);
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius-lg);
  padding: var(--ds-space-lg);
  transition: border-color 0.15s, transform 0.15s;
}

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

.feature-card h3 {
  font-size: var(--ds-text-base);
  font-weight: 600;
  margin-bottom: var(--ds-space-xs);
}

.feature-card p {
  font-size: var(--ds-text-sm);
  color: var(--ds-text-secondary);
  line-height: 1.6;
}

.feature-icon {
  font-size: 24px;
  margin-bottom: var(--ds-space-sm);
  display: block;
}

/* ── Terminal demo ── */
.demo-block {
  max-width: 720px;
}

.demo-block .ds-code-block {
  margin-bottom: var(--ds-space-md);
}

/* ── Install section ── */
.install-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--ds-space-md);
}

.install-option {
  background: var(--ds-surface);
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius-lg);
  padding: var(--ds-space-md);
}

.install-option h3 {
  font-family: var(--ds-font-mono);
  font-size: var(--ds-text-sm);
  font-weight: 600;
  color: var(--accent);
  margin-bottom: var(--ds-space-sm);
}

.install-option .ds-code-block {
  font-size: 12px;
  padding: 14px;
}

/* ── Who section ── */
.who-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--ds-space-md);
}

.who-card {
  text-align: center;
  padding: var(--ds-space-lg);
}

.who-icon {
  font-family: var(--ds-font-mono);
  font-size: 36px;
  margin-bottom: var(--ds-space-sm);
  color: var(--accent);
}

.who-card h3 {
  margin-bottom: var(--ds-space-xs);
}

.who-card p {
  font-size: var(--ds-text-sm);
  color: var(--ds-text-secondary);
  line-height: 1.6;
}

/* ── Two-column layout ── */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--ds-space-xl);
  align-items: start;
}

.two-col h3 {
  margin-bottom: var(--ds-space-xs);
}

.two-col p {
  font-size: var(--ds-text-sm);
  color: var(--ds-text-secondary);
  line-height: 1.6;
}

/* ── Command reference table ── */
.cmd-table {
  overflow-x: auto;
}

.cmd-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--ds-text-sm);
}

.cmd-table td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--ds-border);
  vertical-align: top;
}

.cmd-table td:first-child {
  white-space: nowrap;
  width: 1%;
}

.cmd-table td:last-child {
  color: var(--ds-text-secondary);
}

.cmd-table tr:hover td {
  background: var(--ds-surface);
}

/* ── Tier grid (SaaS pricing style) ── */
.tier-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--ds-space-md);
  align-items: start;
}

.tier-card {
  background: var(--ds-surface);
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius-lg);
  padding: 0;
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s, transform 0.15s;
}

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

.tier-card--featured {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.tier-card--featured:hover {
  border-color: var(--accent);
}

.tier-header {
  padding: var(--ds-space-lg) var(--ds-space-lg) var(--ds-space-md);
  border-bottom: 1px solid var(--ds-border);
}

.tier-card--featured .tier-header {
  border-bottom-color: color-mix(in srgb, var(--accent) 30%, transparent);
}

.tier-label {
  font-family: var(--ds-font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.tier-header h3 {
  font-size: var(--ds-text-xl);
  font-weight: 700;
  margin: var(--ds-space-xs) 0 4px;
}

.tier-price {
  font-size: var(--ds-text-sm);
  color: var(--ds-text-secondary);
}

.tier-features {
  list-style: none;
  padding: var(--ds-space-md) var(--ds-space-lg);
  margin: 0;
  flex-grow: 1;
}

.tier-features li {
  font-size: var(--ds-text-sm);
  color: var(--ds-text-secondary);
  padding: 6px 0;
  border-bottom: 1px solid var(--ds-border);
  line-height: 1.5;
}

.tier-features li:last-child {
  border-bottom: none;
}

.tier-features li::before {
  content: "\2713";
  color: var(--accent);
  font-weight: 600;
  margin-right: 8px;
}

.tier-code {
  margin: 0 var(--ds-space-md);
  font-size: 11px;
  padding: var(--ds-space-sm) var(--ds-space-md) !important;
  border-radius: var(--ds-radius-md);
  overflow-x: auto;
  max-width: 100%;
}

.tier-note {
  font-size: 12px;
  color: var(--ds-text-secondary);
  padding: var(--ds-space-sm) var(--ds-space-lg) var(--ds-space-lg);
  line-height: 1.5;
}

/* ── Legacy setup tiers (unused, kept for reference) ── */
.setup-tier {
  margin-bottom: var(--ds-space-xl);
  padding-bottom: var(--ds-space-xl);
  border-bottom: 1px solid var(--ds-border);
}

.setup-tier:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.setup-tier h3 {
  font-size: var(--ds-text-xl);
  margin-bottom: var(--ds-space-xs);
}

.setup-tier > p {
  font-size: var(--ds-text-base);
  color: var(--ds-text-secondary);
  margin-bottom: var(--ds-space-md);
  line-height: 1.6;
}

/* ── Ecosystem links ── */
.ecosystem-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--ds-space-md);
  margin-top: var(--ds-space-md);
}

.ecosystem-card {
  text-decoration: none;
  display: block;
}

.ecosystem-card h4 {
  font-family: var(--ds-font-mono);
  color: var(--accent);
  margin-bottom: var(--ds-space-xs);
}

.ecosystem-card p {
  font-size: var(--ds-text-sm);
  color: var(--ds-text-secondary);
  line-height: 1.5;
}

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

  .hero { padding: var(--ds-space-2xl) 0 var(--ds-space-xl); }
  .hero h1 { font-size: clamp(28px, 7vw, 44px); }
  .hero-sub { font-size: var(--ds-text-base); }

  section { padding: var(--ds-space-2xl) 0; }
  .section-title { font-size: var(--ds-text-xl); }

  .two-col { grid-template-columns: 1fr; }
  .tier-grid { grid-template-columns: 1fr; }
  .install-grid { grid-template-columns: 1fr; }
  .ecosystem-links { grid-template-columns: 1fr; }
  .term-accordion-subtitle { display: none; }
}

/* ── Terminal player ── */
.demo-terminals {
  display: flex;
  flex-direction: column;
  gap: var(--ds-space-sm);
  margin-top: var(--ds-space-xl);
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
}

/* Tab strip — hidden, using accordion instead */
.demo-tabs { display: none; }

/* Accordion header — clickable row to expand a terminal */
.term-accordion-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  background: var(--ds-surface);
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  user-select: none;
}
.term-accordion-header:hover {
  border-color: var(--ds-accent-primary);
  background: var(--ds-surface-hover);
}
[data-terminal-demo].active .term-accordion-header {
  border-radius: var(--ds-radius) var(--ds-radius) 0 0;
  border-bottom-color: transparent;
  border-color: var(--ds-accent-primary);
}

.term-accordion-arrow {
  color: var(--ds-text-muted);
  font-size: 12px;
  transition: transform 0.2s;
  flex-shrink: 0;
}
[data-terminal-demo].active .term-accordion-arrow {
  transform: rotate(90deg);
  color: var(--ds-accent-primary);
}

.term-accordion-title {
  font-family: var(--ds-font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--ds-text-secondary);
  flex: 1;
}
[data-terminal-demo].active .term-accordion-title {
  color: var(--ds-text);
}

.term-accordion-subtitle {
  font-family: var(--ds-font-mono);
  font-size: 11px;
  color: var(--ds-text-muted);
  flex-shrink: 0;
}

/* Terminal body — only visible when accordion is open */
.term-accordion-body {
  display: none;
  border: 1px solid var(--ds-accent-primary);
  border-top: none;
  border-radius: 0 0 var(--ds-radius) var(--ds-radius);
  background: var(--ds-code-bg);
  overflow: hidden;
}
[data-terminal-demo].active .term-accordion-body {
  display: flex;
  flex-direction: column;
}

[data-terminal-demo] {
  margin-bottom: 4px;
}

/* Window chrome — hidden, title is in tab strip now */
.term-chrome { display: none; }

/* Scrollable viewport — fixed height, content anchored to bottom */
.term-viewport {
  overflow-y: auto;
  overflow-x: hidden;
  height: clamp(280px, 40vh, 440px);
  scrollbar-width: thin;
  scrollbar-color: var(--ds-border) transparent;
  display: flex;
  flex-direction: column;
}

/* Spacer fills space above content, pushing it to the bottom.
   As content grows, spacer shrinks to zero and viewport scrolls. */
.term-spacer {
  flex: 1;
}
.term-viewport::-webkit-scrollbar { width: 8px; }
.term-viewport::-webkit-scrollbar-track { background: transparent; }
.term-viewport::-webkit-scrollbar-thumb {
  background: var(--ds-border);
  border-radius: 4px;
  border: 2px solid var(--ds-code-bg);
}
.term-viewport::-webkit-scrollbar-thumb:hover { background: var(--ds-text-muted); }

/* Content — matches ds-code-block internals */
.term-content {
  padding: 20px;
  font-family: var(--ds-font-mono);
  font-size: 13px;
  line-height: 1.8;
  color: var(--ds-text-secondary);
  flex-shrink: 0;
  flex-grow: 0;
}

.term-line {
  white-space: pre-wrap;
  word-break: break-all;
}
.term-line.term-blank { height: 14px; }
.term-line.t-cmd { color: var(--ds-accent-secondary-light); }
.term-line.t-comment { color: #4a4a4a; }
.term-line.t-out { color: var(--ds-text-secondary); }
.t-ps1 { color: var(--ds-accent-primary); font-weight: 600; }

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}
.t-cursor {
  display: inline-block;
  width: 8px;
  height: 15px;
  background: var(--ds-accent-primary);
  vertical-align: text-bottom;
  margin-left: 1px;
  animation: blink 1s step-end infinite;
  opacity: 0.9;
}

/* Control bar */
.term-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: var(--ds-surface);
  border-top: 1px solid var(--ds-border);
  user-select: none;
}

.term-btn {
  background: none;
  border: 1px solid var(--ds-border);
  color: var(--ds-text-secondary);
  font-size: 12px;
  width: 28px;
  height: 24px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s, color 0.15s;
  flex-shrink: 0;
}
.term-btn:hover { border-color: var(--ds-accent-primary); color: var(--ds-accent-primary); }

/* Progress bar */
.term-progress-wrap {
  flex: 1;
  height: 4px;
  background: var(--ds-border);
  border-radius: 2px;
  cursor: pointer;
  overflow: hidden;
}
.term-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--ds-accent-primary);
  border-radius: 2px;
  transition: width 0.15s ease;
}
.term-progress-wrap:hover .term-progress-fill {
  background: var(--ds-accent-primary-light);
}

.term-step {
  font-family: var(--ds-font-mono);
  font-size: 11px;
  color: var(--ds-text-muted);
  flex-shrink: 0;
  min-width: 40px;
  text-align: right;
}

.term-bar-source {
  font-family: var(--ds-font-mono);
  font-size: 11px;
  color: var(--ds-text-muted);
  text-decoration: none;
  transition: color 0.15s;
  flex-shrink: 0;
  margin-left: 4px;
}
.term-bar-source:hover { color: var(--ds-accent-secondary-light); }
