/* ============================================
   Gatehouse Landing Page — Style
   ============================================ */

/* --- Design Tokens --- */
:root {
  --bg-base: #09090b;
  --bg-surface: #111114;
  --border: #222228;
  --border-subtle: #1a1a1f;
  --text-primary: #f0f0f4;
  --text-secondary: #8a8a9a;
  --text-muted: #5a5a6e;
  --accent: #6366f1;
  --accent-hover: #818cf8;

  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', ui-monospace, monospace;

  --max-width: 1120px;
  --max-text: 640px;
  --max-code: 680px;
  --max-multi: 1040px;

  --section-gap: 96px;
  --block-gap: 32px;
}

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

html {
  background: var(--bg-base);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  overflow-x: hidden;
}

/* --- Typography --- */
h1, h2, h3 {
  color: var(--text-primary);
  font-weight: 600;
}

h1 {
  font-size: 40px;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

h2 {
  font-size: 24px;
  line-height: 1.3;
}

h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

p {
  max-width: var(--max-text);
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 150ms ease;
}

a:hover {
  color: var(--accent-hover);
}

code {
  font-family: var(--font-mono);
  font-size: 13px;
  background: var(--bg-surface);
  padding: 2px 6px;
  border-radius: 4px;
}

/* --- Layout --- */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 48px;
}

section {
  padding: var(--section-gap) 0;
}

section + section {
  border-top: 1px solid var(--border-subtle);
}

/* --- Nav --- */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 48px;
  max-width: var(--max-width);
  margin: 0 auto;
}

.nav-logo {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  text-decoration: none;
}

.nav-links {
  display: flex;
  gap: 24px;
  list-style: none;
}

.nav-links a {
  color: var(--text-secondary);
  font-size: 14px;
  text-decoration: none;
  transition: color 150ms ease;
}

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

/* --- Hero --- */
.hero {
  text-align: center;
  padding: 96px 0 64px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hero h1 {
  max-width: 720px;
}

.hero .subhead {
  max-width: 560px;
  margin-top: 24px;
  font-size: 18px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.hero-code {
  display: inline;
  font-family: var(--font-mono);
  font-size: 18px;
  background: none;
  padding: 0;
  border: none;
  border-radius: 0;
  margin: 0;
}

.hero-code-before {
  color: rgba(239, 68, 68, 0.5);
}

.hero-code-after {
  color: rgba(134, 239, 172, 0.6);
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-top: 40px;
}

/* --- Install Block --- */
.install-block {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 20px;
  font-family: var(--font-mono);
  font-size: 15px;
  color: var(--text-primary);
  cursor: pointer;
  transition: border-color 200ms ease;
  position: relative;
  user-select: none;
}

.install-block:hover {
  border-color: rgba(99, 102, 241, 0.4);
}

.install-block .copy-icon {
  width: 16px;
  height: 16px;
  opacity: 0.5;
  transition: opacity 150ms ease;
  flex-shrink: 0;
}

.install-block:hover .copy-icon {
  opacity: 0.8;
}

.install-block.copied {
  border-color: rgba(134, 239, 172, 0.4);
}

.install-block .tooltip {
  position: absolute;
  top: -32px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 12px;
  color: #86efac;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 150ms ease;
}

.install-block.copied .tooltip {
  opacity: 1;
}

/* --- GitHub Link --- */
.github-link {
  color: var(--text-secondary);
  font-size: 15px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: color 150ms ease;
}

.github-link:hover {
  color: var(--text-primary);
}

.github-link .arrow {
  display: inline-block;
  transition: transform 150ms ease;
}

.github-link:hover .arrow {
  transform: translateX(4px);
}

/* --- Code Blocks --- */
.code-block {
  position: relative;
  margin: 16px 0;
  min-width: 0;
}

.code-block pre {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 24px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-primary);
  max-width: 100%;
}

.code-block pre code {
  background: none;
  padding: 0;
  font-size: inherit;
  border-radius: 0;
}

.code-label {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

/* --- Annotation --- */
.annotation {
  font-size: 14px;
  color: var(--text-muted);
  font-style: italic;
  max-width: 560px;
  margin-top: 12px;
  line-height: 1.6;
}

/* --- Section Centered --- */
.section-centered {
  max-width: var(--max-code);
  margin: 0 auto;
}

/* --- Comparison (Section 2) --- */
.comparison {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  max-width: var(--max-multi);
  margin: 0 auto;
  overflow: hidden;
}

.comparison-col {
  min-width: 0;
}

.comparison-col h3 {
  margin-bottom: 24px;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.comparison-col h3::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.comparison-col.before h3::before {
  background: #ef4444;
  opacity: 0.5;
}

.comparison-col.after h3::before {
  background: #86efac;
  opacity: 0.6;
}

.comparison-col.before .code-block pre {
  border-left: 3px solid rgba(239, 68, 68, 0.25);
  background: #1a1214;
  opacity: 0.85;
}

.comparison-col.after .code-block pre {
  border-left: 3px solid rgba(134, 239, 172, 0.25);
  background: #111416;
}

.comparison-note {
  margin-top: 16px;
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.6;
}

/* --- Steps (Section 3) --- */
.step {
  margin-top: var(--block-gap);
}

.step-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.step-number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  flex-shrink: 0;
}

.step-title {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-primary);
}

.step-end {
  margin-top: 40px;
  text-align: center;
  font-size: 16px;
  color: var(--text-muted);
  font-style: italic;
}

/* --- Adapters (Section 4) --- */
.adapters-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  max-width: var(--max-multi);
  margin: 0 auto;
  overflow: hidden;
}

.adapter-col {
  min-width: 0;
}

.adapter-col h3 {
  margin-bottom: 12px;
  text-transform: none;
  letter-spacing: normal;
}

.adapters-note {
  text-align: center;
  margin-top: var(--block-gap);
  max-width: var(--max-text);
  margin-left: auto;
  margin-right: auto;
}

/* --- Three Columns (Section 5) --- */
.three-cols {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  max-width: var(--max-multi);
  margin: 0 auto;
  overflow: hidden;
}

.three-cols > div {
  min-width: 0;
}

.three-cols h3 {
  margin-bottom: 16px;
  text-transform: none;
  letter-spacing: normal;
}

/* Make code blocks in columns smaller */
.three-cols .code-block pre,
.adapters-grid .code-block pre {
  font-size: 13px;
  padding: 16px;
}

/* --- TypeScript Section --- */
.ts-section {
  max-width: var(--max-code);
  margin: 0 auto;
}

.ts-note {
  margin-top: 24px;
  font-size: 15px;
  line-height: 1.7;
}

/* --- Comparisons (Section 7) --- */
.comparison-item {
  max-width: var(--max-code);
  margin: 0 auto;
  margin-top: 48px;
}

.comparison-item:first-child {
  margin-top: var(--block-gap);
}

.comparison-item h3 {
  text-transform: none;
  letter-spacing: normal;
  font-size: 18px;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.comparison-item p {
  line-height: 1.7;
  max-width: var(--max-code);
}

.comparison-item .choose {
  margin-top: 16px;
  font-weight: 500;
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.8;
}

/* --- API Reference (Section 8) --- */
.api-section {
  max-width: var(--max-code);
  margin: 0 auto;
}

.api-group {
  margin-top: 40px;
}

.api-group h3 {
  text-transform: none;
  letter-spacing: normal;
  font-size: 18px;
  color: var(--text-primary);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.api-group .code-block pre {
  font-size: 13px;
  line-height: 1.7;
}

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

.footer .install-block {
  display: inline-flex;
  margin-bottom: 24px;
}

.footer-links {
  font-size: 14px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.footer-links a {
  color: var(--text-muted);
}

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

.footer-sep {
  color: var(--border);
}

/* --- Section Header Utility --- */
.section-header {
  margin-bottom: var(--block-gap);
}

.section-header.centered {
  text-align: center;
}

.section-header p {
  margin-top: 12px;
}

/* --- Responsive --- */
@media (max-width: 1023px) {
  .comparison,
  .adapters-grid,
  .three-cols {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .container {
    padding: 0 24px;
  }

  .nav {
    padding: 16px 24px;
  }
}

@media (max-width: 639px) {
  :root {
    --section-gap: 64px;
  }

  h1 {
    font-size: 28px;
  }

  h2 {
    font-size: 20px;
  }

  .container {
    padding: 0 16px;
  }

  .nav {
    padding: 16px;
  }

  .hero {
    padding: 64px 0 48px;
  }

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

  .hero-actions {
    flex-direction: column;
    gap: 16px;
  }

  .install-block {
    font-size: 14px;
  }

  /* Code blocks bleed to edges on mobile */
  .code-block {
    margin-left: -16px;
    margin-right: -16px;
  }

  .code-block pre {
    border-radius: 0;
    border-left: none;
    border-right: none;
    padding: 20px 16px;
  }
}
