/* ==========================================================================
   yettagam — yettagam.net
   Dark theme adapted from metarium.ai design language
   ========================================================================== */

:root {
  --bg: #1a1a2e;
  --bg-card: #16213e;
  --bg-code: #0f3460;
  --border: #1a3a5c;
  --accent: #7ec8e3;
  --accent-hover: #5fb8d9;
  --text: #e0e0e0;
  --text-muted: #a0a0c0;
  --text-dim: #606080;
  --white: #ffffff;
  --green: #28a745;
  --blue: #007bff;
  --max-w: 960px;
  --radius: 8px;
  --radius-sm: 4px;
}

/* ==========================================================================
   Reset
   ========================================================================== */

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s;
}

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

img {
  max-width: 100%;
  height: auto;
}

/* ==========================================================================
   Navigation
   ========================================================================== */

.nav {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(8px);
}

.nav-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--white);
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 0.01em;
}

.nav-brand:hover {
  text-decoration: none;
  color: var(--white);
}

.nav-logo {
  width: 32px;
  height: 32px;
  border-radius: 4px;
  flex-shrink: 0;
}

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

.nav-links a {
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  transition: color 0.15s, background 0.15s;
  white-space: nowrap;
}

.nav-links a:hover {
  color: var(--accent);
  background: rgba(126, 200, 227, 0.08);
  text-decoration: none;
}

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  line-height: 1;
}

/* ==========================================================================
   Hero
   ========================================================================== */

.hero {
  text-align: center;
  padding: 4rem 1.5rem 3rem;
  max-width: var(--max-w);
  margin: 0 auto;
}

.hero-title {
  font-size: 2.75rem;
  font-weight: 800;
  color: var(--white);
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin-bottom: 1rem;
}

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

.hero-subtitle {
  color: var(--text-muted);
  font-size: 1.125rem;
  max-width: 560px;
  margin: 0 auto 0.5rem;
}

.hero-cta {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 2rem;
  flex-wrap: wrap;
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 22px;
  border-radius: 6px;
  font-size: 0.9375rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.15s;
  cursor: pointer;
  border: none;
  line-height: 1.4;
}

.btn:hover {
  text-decoration: none;
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--accent);
  color: var(--bg);
}

.btn-primary:hover {
  background: var(--accent-hover);
  color: var(--bg);
}

.btn-secondary {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: rgba(126, 200, 227, 0.08);
  border-color: var(--accent);
  color: var(--accent);
}

/* ==========================================================================
   Sections
   ========================================================================== */

.section {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 3rem 1.5rem;
}

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

.section-title {
  color: var(--accent);
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.section-subtitle {
  color: var(--text-muted);
  font-size: 1rem;
  max-width: 640px;
  margin-bottom: 1.5rem;
}

.section-intro {
  margin-bottom: 2rem;
}

.section p {
  margin-bottom: 0.75rem;
}

/* ==========================================================================
   Feature Cards
   ========================================================================== */

.card-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin: 1.5rem 0;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  transition: border-color 0.15s;
}

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

.card-icon {
  font-size: 1.75rem;
  margin-bottom: 0.75rem;
  line-height: 1;
}

.card h3 {
  color: var(--white);
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.card p {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.65;
  margin-bottom: 0.5rem;
}

.card ul {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 0;
}

.card ul li {
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 2px 0;
  line-height: 1.5;
}

.card ul li::before {
  content: "·";
  color: var(--accent);
  margin-right: 6px;
  font-weight: 700;
}

.card ul li em {
  color: var(--text-dim);
  font-size: 0.8rem;
}

/* ==========================================================================
   Code & Pre
   ========================================================================== */

code {
  background: var(--bg-code);
  color: var(--text);
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 0.875em;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', 'Monaco', monospace;
}

pre {
  background: var(--bg-code);
  color: var(--text);
  padding: 1rem 1.25rem;
  border-radius: 6px;
  overflow-x: auto;
  margin: 0.75rem 0 1.25rem;
  font-size: 0.85rem;
  line-height: 1.6;
  border: 1px solid var(--border);
}

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

/* ==========================================================================
   Steps
   ========================================================================== */

.steps {
  counter-reset: step;
  list-style: none;
  padding: 0;
  margin: 1.5rem 0;
}

.steps > li {
  counter-increment: step;
  position: relative;
  padding: 1rem 1.25rem 1rem 3.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.75rem;
}

.steps > li::before {
  content: counter(step);
  position: absolute;
  left: 1rem;
  top: 1rem;
  width: 1.75rem;
  height: 1.75rem;
  background: var(--bg-code);
  color: var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
}

.steps > li strong {
  color: var(--white);
  display: block;
  margin-bottom: 0.25rem;
}

.steps > li p {
  color: var(--text-muted);
  margin: 0;
  font-size: 0.9rem;
}

/* ==========================================================================
   Content (prose styling for integration page)
   ========================================================================== */

.content h3 {
  color: #a0d2db;
  font-size: 1.1rem;
  font-weight: 600;
  margin: 1.5rem 0 0.5rem;
}

.content h4 {
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 600;
  margin: 1rem 0 0.4rem;
}

.content ul, .content ol {
  padding-left: 1.5rem;
  margin-bottom: 1rem;
}

.content li {
  margin-bottom: 0.35rem;
}

/* ==========================================================================
   Note / Callout
   ========================================================================== */

.note {
  background: rgba(126, 200, 227, 0.06);
  border-left: 3px solid var(--accent);
  padding: 0.75rem 1rem;
  margin: 0.75rem 0;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.note p {
  margin-bottom: 0;
}

/* ==========================================================================
   Diagram
   ========================================================================== */

.diagram {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin: 1rem 0;
  overflow-x: auto;
}

.diagram pre {
  background: none;
  padding: 0;
  margin: 0;
  border: none;
  font-size: 0.8rem;
  color: #a0d2db;
  line-height: 1.5;
}

/* ==========================================================================
   Tables
   ========================================================================== */

table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.75rem 0 1.25rem;
  font-size: 0.875rem;
}

th, td {
  text-align: left;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
}

th {
  background: var(--bg-code);
  color: var(--accent);
  font-weight: 600;
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

td {
  background: var(--bg-card);
}

/* ==========================================================================
   Footer
   ========================================================================== */

.footer {
  max-width: var(--max-w);
  margin: 3rem auto 0;
  padding: 1.5rem;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--text-dim);
  font-size: 0.85rem;
}

.footer p {
  margin-bottom: 0.4rem;
}

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

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

/* ==========================================================================
   Error Page
   ========================================================================== */

.error-page {
  text-align: center;
  padding: 6rem 1.5rem;
  max-width: var(--max-w);
  margin: 0 auto;
}

.error-code {
  font-size: 6rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 0.5rem;
}

.error-message {
  font-size: 1.125rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
}

/* ==========================================================================
   Schema Browser — Layout
   ========================================================================== */

.schema-layout {
  display: flex;
  gap: 1.5rem;
}

.type-tree {
  width: 280px;
  flex-shrink: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  position: sticky;
  top: 80px;
}

.type-node {
  padding: 6px 8px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 4px;
}

.type-node:hover {
  background: rgba(126, 200, 227, 0.08);
}

.type-node.active {
  background: rgba(126, 200, 227, 0.12);
  color: var(--accent);
}

.type-node.abstract {
  font-style: italic;
}

.type-children {
  padding-left: 1.25rem;
}

.kind-badge {
  display: inline-block;
  font-size: 0.7rem;
  padding: 1px 6px;
  border-radius: 3px;
  margin-left: 6px;
}

.kind-badge.abstract {
  background: rgba(160, 160, 192, 0.15);
  color: var(--text-muted);
}

.kind-badge.concrete {
  background: rgba(126, 200, 227, 0.15);
  color: var(--accent);
}

/* ==========================================================================
   Schema Browser — Detail
   ========================================================================== */

.schema-detail {
  flex: 1;
  min-width: 0;
}

/* ==========================================================================
   Schema Browser — Predicate Groups
   ========================================================================== */

.predicate-group {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.75rem;
}

.predicate-group-header {
  padding: 0.75rem 1rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.predicate-group-header::after {
  content: "▸";
  transition: transform 0.2s;
}

.predicate-group.open .predicate-group-header::after {
  transform: rotate(90deg);
}

.predicate-group-body {
  display: none;
  padding: 0 1rem 0.75rem;
}

.predicate-group.open .predicate-group-body {
  display: block;
}

/* ==========================================================================
   Schema Browser — Badges
   ========================================================================== */

.badge {
  display: inline-block;
  font-size: 0.7rem;
  padding: 1px 6px;
  border-radius: 3px;
  background: var(--bg-code);
  color: var(--text-muted);
  margin-left: 4px;
}

/* ==========================================================================
   Schema Browser — Copy & Permalink
   ========================================================================== */

.copy-btn {
  background: var(--bg-code);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.8rem;
}

.copy-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.permalink-box {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', 'Monaco', monospace;
  font-size: 0.85rem;
  word-break: break-all;
}

/* ==========================================================================
   Schema Browser — Tabs
   ========================================================================== */

.tab-bar {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
}

.tab-bar button {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  padding: 8px 16px;
  cursor: pointer;
  font-size: 0.9rem;
}

.tab-bar button:hover {
  color: var(--text);
}

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

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* ==========================================================================
   Schema Browser — Inheritance Chain
   ========================================================================== */

.inheritance-chain {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.inheritance-chain a {
  color: var(--accent);
}

.inheritance-chain .arrow {
  color: var(--text-dim);
}

/* ==========================================================================
   Schema Browser — Tree Toggle (mobile only)
   ========================================================================== */

.tree-toggle {
  display: none;
}

/* ==========================================================================
   Responsive — Desktop (>=1024px)
   ========================================================================== */

@media (min-width: 1024px) {
  .card-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ==========================================================================
   Responsive — Mobile (<=768px)
   ========================================================================== */

@media (max-width: 768px) {
  .nav-links {
    display: none;
    position: absolute;
    top: 56px;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    padding: 0.5rem;
  }

  .nav-links.open {
    display: flex;
  }

  .nav-links a {
    padding: 10px 16px;
    font-size: 0.95rem;
  }

  .nav-toggle {
    display: block;
  }

  .hero {
    padding: 2.5rem 1rem 2rem;
  }

  .hero-title {
    font-size: 2rem;
  }

  .section {
    padding: 2rem 1rem;
  }

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

  .schema-layout {
    flex-direction: column;
  }

  .type-tree {
    width: 100%;
    max-height: 200px;
    position: static;
  }

  .tree-toggle {
    display: block;
    width: 100%;
    padding: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.9rem;
    margin-bottom: 1rem;
  }
}
