/* ─── Design tokens ─── */
:root {
  --bg: #FAFAF8;
  --surface: #FFFFFF;
  --text: #1C1C1E;
  --text-muted: #6B6B76;
  --border: #E8E8E4;

  --html: #E8735A;
  --html-light: #FDF0ED;
  --css: #5B73D7;
  --css-light: #EEF1FD;
  --js: #C4960A;
  --js-light: #FDF8E4;
  --json: #4A9B7A;
  --json-light: #EBF7F2;
  --backend: #8B5CF6;
  --backend-light: #F5F0FF;

  --radius: 12px;
  --radius-sm: 6px;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.12);
}

/* ─── Reset & base ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 16px;
}

/* ─── Nav ─── */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 40px;
  background: rgba(250,250,248,0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav-logo {
  font-family: 'DM Serif Display', serif;
  font-size: 20px;
  color: var(--text);
  letter-spacing: -0.02em;
}
.nav-links { display: flex; gap: 28px; }
.nav-links a {
  text-decoration: none;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  transition: color 0.2s;
}
.nav-links a:hover { color: var(--text); }

/* ─── Layout ─── */
.container { max-width: 960px; margin: 0 auto; padding: 0 40px; }
.section {
  padding: 88px 0;
  border-bottom: 1px solid var(--border);
}
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  align-items: start;
  margin-top: 32px;
}

/* ─── Hero ─── */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding: 120px 40px 80px;
  background: linear-gradient(160deg, #FAFAF8 0%, #F0EDF8 60%, #EBF7F2 100%);
}
.hero-content { max-width: 640px; margin: 0 auto; text-align: center; }
.hero-eyebrow {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 20px;
}
.hero h1 {
  font-family: 'DM Serif Display', serif;
  font-size: clamp(38px, 6vw, 62px);
  line-height: 1.12;
  color: var(--text);
  margin-bottom: 22px;
  letter-spacing: -0.02em;
}
.hero h1 em { font-style: italic; color: var(--backend); }
.hero-sub {
  font-size: 17px;
  color: var(--text-muted);
  max-width: 480px;
  margin: 0 auto 36px;
  line-height: 1.75;
}

/* ─── Buttons ─── */
.btn {
  display: inline-block;
  padding: 12px 28px;
  background: var(--text);
  color: white;
  border-radius: 50px;
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
  transition: transform 0.2s, box-shadow 0.2s;
  border: none;
  cursor: pointer;
  font-family: inherit;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 6px 24px rgba(0,0,0,0.18); }
.btn--outline {
  background: transparent;
  border: 1.5px solid var(--text);
  color: var(--text);
  font-size: 14px;
  padding: 10px 24px;
}
.btn--outline:hover { background: var(--text); color: white; }

/* ─── Section labels & headings ─── */
.section-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.html-label    { color: var(--html); }
.css-label     { color: var(--css); }
.js-label      { color: var(--js); }
.json-label    { color: var(--json); }
.backend-label { color: var(--backend); }

h2 {
  font-family: 'DM Serif Display', serif;
  font-size: clamp(28px, 4vw, 40px);
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin-bottom: 14px;
}
h3 {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 10px;
  line-height: 1.4;
}
.section-intro {
  font-size: 17px;
  color: var(--text-muted);
  max-width: 600px;
  line-height: 1.75;
  margin-bottom: 40px;
}

/* ─── House overview cards ─── */
.house-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
  margin-top: 40px;
}
.house-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 16px 20px;
  text-align: center;
  transition: transform 0.25s, box-shadow 0.25s;
}
.house-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.house-card[data-color="html"]    { border-top: 3px solid var(--html); }
.house-card[data-color="css"]     { border-top: 3px solid var(--css); }
.house-card[data-color="js"]      { border-top: 3px solid var(--js); }
.house-card[data-color="json"]    { border-top: 3px solid var(--json); }
.house-card[data-color="backend"] { border-top: 3px solid var(--backend); }
.house-icon { font-size: 30px; margin-bottom: 12px; }
.house-tag {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.house-name { font-weight: 600; font-size: 13px; margin-bottom: 8px; }
.house-desc { font-size: 12px; color: var(--text-muted); line-height: 1.55; }

/* ─── Code blocks ─── */
.code-demo {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.code-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 9px 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.code-block {
  font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.75;
  padding: 20px;
  background: #1E1E2E;
  color: #CDD6F4;
  overflow-x: auto;
  white-space: pre;
  margin: 0;
}
/* syntax colors — Catppuccin-ish */
.code-block .xt { color: #89DCEB; }   /* tag */
.code-block .xa { color: #89B4FA; }   /* attribute */
.code-block .xv { color: #A6E3A1; }   /* value / string */
.code-block .xs { color: #CBA6F7; }   /* selector */
.code-block .xp { color: #89B4FA; }   /* property */
.code-block .xc { color: #585B70; font-style: italic; }  /* comment */
.code-block .xk { color: #F38BA8; font-weight: 600; }    /* keyword (SQL) */

.code-preview-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 8px 16px 0;
}
.code-preview {
  padding: 16px 20px 20px;
  border-top: 1px solid var(--border);
}

/* ─── Analogy / callout boxes ─── */
.analogy-box {
  background: #F8F7FF;
  border: 1px solid #E0DEFF;
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 14px;
  line-height: 1.65;
}
.analogy-icon { margin-right: 6px; }

code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85em;
  background: rgba(0,0,0,0.07);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--text);
}
/* reset inline-code styles inside dark code blocks */
.code-block code {
  color: inherit;
  background: none;
  padding: 0;
  border-radius: 0;
  font-size: inherit;
}

.callout {
  border-radius: var(--radius);
  padding: 16px 20px;
  font-size: 15px;
  margin-top: 36px;
  border-left: 4px solid;
  line-height: 1.65;
}
.callout--html    { background: var(--html-light);    border-color: var(--html); }
.callout--js      { background: var(--js-light);      border-color: var(--js); }
.callout--json    { background: var(--json-light);    border-color: var(--json); }
.callout--backend { background: var(--backend-light); border-color: var(--backend); }

/* ─── CSS section ─── */
.section--css { background: #F8F9FF; }

.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0;
}
.tab {
  padding: 10px 20px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.2s, border-color 0.2s;
  font-family: inherit;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--css); border-bottom-color: var(--css); }
.tab--best.active { color: var(--json); border-bottom-color: var(--json); }

.tab-content { display: none; padding: 28px 0 8px; }
.tab-content.active { display: block; }

.problem-box, .success-box {
  border-radius: var(--radius);
  padding: 22px;
  font-size: 14px;
  line-height: 1.7;
}
.problem-box { background: #FFF8F7; border: 1px solid #FFD5CC; }
.success-box { background: var(--json-light); border: 1px solid #B8E8D4; }
.problem-title, .success-title {
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 12px;
}
.problem-box p, .success-box p { margin-bottom: 10px; }
.problem-box p:last-child, .success-box p:last-child { margin-bottom: 0; }

/* ─── Color demo (CSS linked file demo) ─── */
.color-demo {
  margin-top: 18px;
  padding: 16px;
  background: white;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.color-demo-buttons { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.color-demo-buttons button {
  padding: 5px 14px;
  border: 1px solid var(--border);
  border-radius: 50px;
  background: var(--bg);
  cursor: pointer;
  font-size: 12px;
  font-family: inherit;
  font-weight: 500;
  transition: background 0.15s, border-color 0.15s;
}
.color-demo-buttons button:hover { background: var(--border); }
.color-demo-result { display: flex; flex-direction: column; gap: 2px; }
.demo-h1 {
  font-family: 'DM Serif Display', serif;
  font-size: 22px;
  color: coral;
  transition: color 0.35s ease;
}
.color-demo-caption {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 10px;
  font-style: italic;
}

/* ─── JS section ─── */
.section--js { background: #FFFDF4; }

.feature-list { padding-left: 18px; }
.feature-list li {
  margin-bottom: 10px;
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1.55;
}

.js-demo-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.js-demo-header {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 10px 20px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.js-demo-text {
  font-size: 14px;
  color: var(--text-muted);
  padding: 20px 20px 16px;
}
.js-demo-btn {
  display: block;
  margin: 0 20px 16px;
  padding: 10px 20px;
  background: #F0B429;
  color: #1C1C1E;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  transition: transform 0.15s, box-shadow 0.15s;
}
.js-demo-btn:hover { transform: scale(1.03); box-shadow: 0 4px 16px rgba(240,180,41,0.45); }
.js-demo-output {
  min-height: 24px;
  padding: 0 20px 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--json);
}
.js-demo-code { border-top: 1px solid var(--border); }
.js-demo-code .code-block { font-size: 12px; border-radius: 0; }

/* ─── JSON section ─── */
.json-flow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 40px 0;
  flex-wrap: wrap;
}
.flow-step {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  text-align: center;
  min-width: 110px;
}
.flow-step--highlight {
  border-color: var(--json);
  background: var(--json-light);
}
.flow-icon { font-size: 26px; margin-bottom: 8px; }
.flow-label { font-weight: 600; font-size: 13px; }
.flow-sub { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.flow-arrow { font-size: 20px; color: var(--text-muted); }

/* ─── Product card demo ─── */
.product-card-demo {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  gap: 16px;
  align-items: flex-start;
}
.product-card-img {
  width: 80px;
  height: 80px;
  background: #F0EEE8;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  flex-shrink: 0;
}
.product-card-name { font-weight: 600; font-size: 15px; margin-bottom: 4px; }
.product-card-price { font-size: 20px; font-weight: 700; margin-bottom: 10px; }
.product-card-colors { display: flex; gap: 7px; margin-bottom: 10px; }
.product-card-colors span {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: block;
  border: 1.5px solid rgba(0,0,0,0.08);
}
.product-card-stock { font-size: 12px; color: var(--json); font-weight: 600; }

/* ─── Backend / Restaurant ─── */
.section--backend { background: #FAF8FF; }

.restaurant-split {
  display: grid;
  grid-template-columns: 1fr 56px 1fr;
  margin: 40px 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.restaurant-front { padding: 36px 32px; background: #F8FFFC; }
.restaurant-back  { padding: 36px 32px; background: #FAF8FF; }
.restaurant-divider {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--bg);
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
}
.divider-line { width: 1px; flex: 1; background: var(--border); }
.divider-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  writing-mode: vertical-rl;
  padding: 10px 0;
}
.restaurant-icon { font-size: 36px; margin-bottom: 12px; }
.restaurant-tagline { font-size: 12px; color: var(--text-muted); margin-bottom: 16px; }
.restaurant-front ul, .restaurant-back ul { padding-left: 18px; }
.restaurant-front li, .restaurant-back li {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 8px;
  line-height: 1.5;
}

/* ─── Request/response demo ─── */
.request-demo { margin-top: 52px; }
.request-flow {
  display: flex;
  align-items: center;
  gap: 0;
  margin: 32px 0;
}
.rf-step {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
}
.rf-icon { font-size: 22px; margin-bottom: 6px; }
.rf-label { font-weight: 600; font-size: 13px; }
.rf-sub { font-size: 11px; font-weight: 400; color: var(--text-muted); margin-top: 3px; }
.rf-connector {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 0 8px;
  min-width: 100px;
}
.rf-line { width: 100%; height: 2px; background: var(--border); }
.rf-msg {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--text-muted);
  text-align: center;
  white-space: nowrap;
}
.rf-arrow-head { font-size: 16px; color: var(--text-muted); }

.request-output {
  background: #1E1E2E;
  border-radius: var(--radius);
  padding: 20px 24px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12.5px;
  color: #CDD6F4;
  min-height: 64px;
  display: none;
  line-height: 1.85;
  margin-top: 20px;
}

/* ─── SQL section ─── */
.db-table {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-top: 16px;
}
.db-table table { width: 100%; border-collapse: collapse; font-size: 13px; }
.db-table th {
  background: var(--bg);
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.db-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.db-table tr:last-child td { border-bottom: none; }
.db-table tr:nth-child(even) td { background: #FAFAF8; }

/* ─── Cheat sheet ─── */
.section--recap { background: var(--bg); }

.cheat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-top: 40px;
}
.cheat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.cheat-term {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--backend);
  margin-bottom: 8px;
  line-height: 1.4;
}
.cheat-means { font-size: 13.5px; color: var(--text-muted); line-height: 1.65; }

/* ─── Footer ─── */
.footer {
  padding: 48px 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}
.footer-meta {
  margin-top: 8px;
  font-size: 12.5px;
  opacity: 0.55;
  font-style: italic;
}

/* ─── Responsive ─── */
@media (max-width: 768px) {
  /* Prevent any overflowing element from creating horizontal scroll */
  body { overflow-x: hidden; }

  .nav { padding: 14px 20px; }
  .nav-links { display: none; }
  .hero { padding: 100px 20px 60px; }
  .container { padding: 0 20px; }
  .section { padding: 56px 0; }

  /* Two-col: stack vertically, and let grid items shrink below min-content
     so long code lines don't blow out the layout */
  .two-col { grid-template-columns: 1fr; gap: 24px; }
  .two-col > * { min-width: 0; }

  /* Slightly smaller monospace font so code lines fit better */
  .code-block { font-size: 11.5px; }

  /* House overview: 2×2 + 1 centred */
  .house-grid { grid-template-columns: repeat(2, 1fr); }
  .house-card:last-child { grid-column: span 2; }

  /* CSS tabs: wrap onto two lines */
  .tabs { flex-wrap: wrap; }

  /* JSON flow: vertical, arrow becomes ↓ via rotation */
  .json-flow {
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
  }
  .json-flow .flow-step { min-width: 0; }
  .json-flow .flow-arrow {
    text-align: center;
    transform: rotate(90deg);
    line-height: 1;
  }

  /* Restaurant split: stack panels, hide decorative divider */
  .restaurant-split { grid-template-columns: 1fr; }
  .restaurant-divider { display: none; }
  .restaurant-front,
  .restaurant-back { padding: 28px 20px; }

  /* Request flow: vertical stack with clean down-arrows,
     no rotation hacks */
  .request-flow {
    flex-direction: column;
    align-items: center;
    gap: 0;
  }
  .rf-connector {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: auto;
    padding: 4px 0;
    transform: none;
  }
  .rf-line {
    width: 2px;
    height: 20px;
    margin-bottom: 2px;
  }
  .rf-arrow-head { transform: rotate(90deg); }
  .rf-msg { white-space: normal; text-align: center; font-size: 9px; }

  /* Cheat sheet: single column */
  .cheat-grid { grid-template-columns: 1fr; }
}
