/* ============================================================
   DATABASE EXECUTION PLAN — main.css
   ============================================================ */

/* ── 1. Design Tokens ───────────────────────────────────────── */
:root {
  --sky:        #38bdf8;
  --sky-light:  #bae6fd;
  --sky-dark:   #0ea5e9;
  --ocean:      #0284c7;
  --ocean-dark: #0369a1;
  --navy:       #0f172a;
  --navy-mid:   #1e293b;
  --mango:      #fb923c;
  --tangerine:  #f97316;
  --surface:    #f0f9ff;
  --surface-2:  #e0f2fe;
  --surface-3:  #cffafe;
  --text:       #1e293b;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --white:      #ffffff;
  --border:     #cbd5e1;
  --border-light: #e2e8f0;
  --success:    #22c55e;
  --radius-sm:  0.375rem;
  --radius:     0.625rem;
  --radius-lg:  1rem;
  --shadow-sm:  0 1px 3px rgba(15, 23, 42, 0.08);
  --shadow:     0 4px 16px rgba(15, 23, 42, 0.10);
  --shadow-lg:  0 8px 32px rgba(15, 23, 42, 0.12);
  --header-h:   64px;
  --container:  clamp(720px, 90vw, 1400px);
  --prose-w:    72ch;
  --transition: 0.18s ease;
}

/* ── 2. Reset & Base ────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 1.5rem);
  font-size: 16px;
}

body {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--surface);
  color: var(--text);
  line-height: 1.7;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

img, svg { display: block; max-width: 100%; }
a { color: var(--ocean); text-decoration: underline; text-underline-offset: 3px; transition: color var(--transition); }
a:hover { color: var(--tangerine); }
ul, ol { padding-left: 1.5rem; }
li { margin-bottom: 0.35rem; }
p { margin-bottom: 1.1rem; }
p:last-child { margin-bottom: 0; }

/* ── 3. Typography ──────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  line-height: 1.25;
  font-weight: 700;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  scroll-margin-top: calc(var(--header-h) + 1.5rem);
}

h1 { font-size: clamp(1.9rem, 4vw, 2.75rem); color: var(--navy); }
h2 { font-size: clamp(1.35rem, 2.5vw, 1.75rem); color: var(--ocean-dark); border-left: 4px solid var(--sky); padding-left: 0.9rem; }
h3 { font-size: clamp(1.1rem, 2vw, 1.35rem); color: var(--navy-mid); }
h4 { font-size: 1.05rem; color: var(--navy-mid); }

/* Anchor links on headings — only the # symbol is in .header-anchor (linkInsideHeader style) */
.header-anchor { opacity: 0; margin-left: 0.4em; font-weight: 400; text-decoration: none; color: var(--sky); font-size: 0.75em; }
h1:hover .header-anchor, h2:hover .header-anchor, h3:hover .header-anchor,
h4:hover .header-anchor { opacity: 1; }

strong { font-weight: 700; color: var(--navy-mid); }
em { font-style: italic; }
hr { border: none; border-top: 2px solid var(--border-light); margin: 2rem 0; }

/* ── 4. Layout ──────────────────────────────────────────────── */
.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: clamp(1rem, 4vw, 3rem); }

/* ── 5. Skip link ───────────────────────────────────────────── */
.skip-link {
  position: absolute; top: -9999px; left: 1rem; z-index: 9999;
  background: var(--navy); color: var(--white); padding: 0.5rem 1rem;
  border-radius: 0 0 var(--radius) var(--radius); text-decoration: none;
}
.skip-link:focus { top: 0; }

/* ── 6. Header ──────────────────────────────────────────────── */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(240, 249, 255, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-light);
  height: var(--header-h);
}
.header-inner {
  max-width: var(--container); margin-inline: auto;
  padding-inline: clamp(1rem, 4vw, 3rem);
  height: 100%; display: flex; align-items: center; gap: 1.5rem;
}

/* Logo */
.logo-link { display: flex; align-items: center; gap: 0.65rem; text-decoration: none; flex-shrink: 0; }
.logo-svg { width: 38px; height: 38px; }
.logo-text { font-size: 1.15rem; font-weight: 800; color: var(--navy); letter-spacing: -0.02em; white-space: nowrap; }
.logo-accent { color: var(--tangerine); }
.logo-link:hover .logo-text { color: var(--ocean); }

/* Desktop nav */
.site-nav { display: flex; align-items: center; gap: 0.25rem; margin-left: auto; }
.nav-link {
  display: flex; align-items: center; gap: 0.4rem;
  padding: 0.45rem 0.85rem; border-radius: var(--radius-sm);
  text-decoration: none; color: var(--text-muted); font-size: 0.9rem; font-weight: 600;
  transition: background var(--transition), color var(--transition);
  white-space: nowrap;
}
.nav-link:hover { background: var(--surface-2); color: var(--ocean); }
.nav-link--active { background: var(--surface-2); color: var(--ocean); }
.nav-icon { width: 16px; height: 16px; flex-shrink: 0; }

/* Hamburger */
.nav-toggle {
  display: none; flex-direction: column; justify-content: center; align-items: center; gap: 5px;
  width: 40px; height: 40px; border: none; background: none; cursor: pointer;
  margin-left: auto; border-radius: var(--radius-sm);
}
.nav-toggle:hover { background: var(--surface-2); }
.hamburger-bar { width: 22px; height: 2px; background: var(--navy-mid); border-radius: 2px; transition: var(--transition); }

/* Mobile nav */
.mobile-nav {
  background: var(--white); border-top: 1px solid var(--border-light);
  padding: 1rem; display: flex; flex-direction: column; gap: 0.25rem;
  position: absolute; top: var(--header-h); left: 0; right: 0;
  box-shadow: var(--shadow);
}
.mobile-nav[hidden] { display: none; }
.mobile-nav-link {
  font-weight: 700; font-size: 0.95rem; color: var(--navy-mid);
  padding: 0.6rem 0.75rem; border-radius: var(--radius-sm); text-decoration: none;
  transition: background var(--transition);
}
.mobile-nav-link:hover, .mobile-nav-link--active { background: var(--surface-2); color: var(--ocean); }
.mobile-nav-child {
  font-size: 0.875rem; color: var(--text-muted); padding: 0.4rem 0.75rem 0.4rem 1.75rem;
  border-radius: var(--radius-sm); text-decoration: none; transition: background var(--transition);
}
.mobile-nav-child:hover, .mobile-nav-child--active { background: var(--surface-2); color: var(--ocean); }

/* ── 7. Hero ────────────────────────────────────────────────── */
.hero {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-mid) 40%, var(--ocean-dark) 100%);
  color: var(--white); padding: clamp(3rem, 8vw, 6rem) 0;
}
.hero-inner {
  max-width: var(--container); margin-inline: auto;
  padding-inline: clamp(1rem, 4vw, 3rem);
  display: grid; grid-template-columns: 1fr 1fr; gap: 3rem; align-items: center;
}
.hero-title {
  font-size: clamp(2rem, 5vw, 3.25rem); color: var(--white); margin-top: 0; margin-bottom: 1.25rem;
  letter-spacing: -0.03em; line-height: 1.15;
}
.hero-title-accent {
  background: linear-gradient(90deg, var(--sky), var(--mango));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.hero-subtitle { font-size: clamp(1rem, 2vw, 1.15rem); color: var(--sky-light); line-height: 1.7; margin-bottom: 2rem; }
.hero-ctas { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.hero-cta {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.7rem 1.4rem; border-radius: var(--radius); font-weight: 700; font-size: 0.9rem;
  text-decoration: none; transition: transform var(--transition), box-shadow var(--transition);
}
.hero-cta svg { width: 18px; height: 18px; }
.hero-cta--database { background: var(--sky); color: var(--navy); }
.hero-cta--index { background: var(--mango); color: var(--white); }
.hero-cta--plan { background: var(--tangerine); color: var(--white); }
.hero-cta:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,0.25); color: inherit; }

/* Hero plan card visual */
.hero-visual { display: flex; justify-content: center; }
.hero-plan-card {
  background: rgba(15, 23, 42, 0.7); border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: var(--radius-lg); padding: 1.5rem; font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
  font-size: 0.8rem; line-height: 1.8; width: 100%; max-width: 420px;
  backdrop-filter: blur(8px);
}
.plan-line { padding: 0.15rem 0; }
.plan-line--keyword { color: var(--sky); font-weight: 700; }
.plan-line--node { color: #e2e8f0; }
.plan-line--child { color: #94a3b8; padding-left: 0.5rem; }
.plan-line--meta { color: var(--sky); margin-top: 0.5rem; font-size: 0.75rem; }
.plan-cost { color: var(--mango); }
.plan-actual { color: var(--sky-light); }
.plan-good { color: var(--success); }

/* ── 8. About section ───────────────────────────────────────── */
.about-section { padding: clamp(2.5rem, 6vw, 4rem) 0; background: var(--white); }
.about-section .container { max-width: min(var(--container), 900px); }
.about-lead { font-size: clamp(1.05rem, 2vw, 1.2rem); color: var(--navy-mid); font-weight: 500; line-height: 1.75; margin-bottom: 1.25rem; }
.about-section code { background: var(--surface-2); color: var(--ocean); padding: 0.15em 0.4em; border-radius: var(--radius-sm); font-family: 'Cascadia Code', 'Fira Code', monospace; font-size: 0.9em; }

/* ── 9. Section cards ───────────────────────────────────────── */
.sections-grid-section { padding: clamp(2.5rem, 6vw, 5rem) 0; }
.sections-heading {
  font-size: clamp(1.5rem, 3vw, 2rem); color: var(--navy); text-align: center;
  margin-bottom: 2.5rem; border-left: none; padding-left: 0;
}
.sections-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }

.section-card {
  background: var(--white); border: 1px solid var(--border-light); border-radius: var(--radius-lg);
  padding: 1.75rem; display: flex; flex-direction: column; gap: 1rem;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}
.section-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.section-card--database:hover { border-color: var(--sky); }
.section-card--index:hover { border-color: var(--mango); }
.section-card--plan:hover { border-color: var(--tangerine); }

.section-card-header { display: flex; align-items: center; gap: 1rem; }
.section-card-icon svg { width: 44px; height: 44px; }
.section-card-title { font-size: 1.1rem; margin: 0; color: var(--navy); font-weight: 700; }
.section-card-title a { text-decoration: none; color: inherit; }
.section-card-title a:hover { color: var(--ocean); }
.section-card-desc { color: var(--text-muted); font-size: 0.9rem; line-height: 1.65; margin: 0; }
.section-card-links { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.3rem; }
.section-card-links li { margin: 0; }
.section-card-links a { font-size: 0.875rem; color: var(--ocean); text-decoration: none; display: flex; align-items: center; gap: 0.4rem; }
.section-card-links a::before { content: "→"; color: var(--text-light); font-size: 0.8rem; }
.section-card-links a:hover { color: var(--tangerine); }
.section-card-cta {
  margin-top: auto; font-weight: 700; font-size: 0.875rem; color: var(--ocean); text-decoration: none;
  border-top: 1px solid var(--border-light); padding-top: 1rem;
}
.section-card-cta:hover { color: var(--tangerine); }

/* ── 10. Content page layout ────────────────────────────────── */
.page-main {
  flex: 1; width: 100%; max-width: var(--container); margin-inline: auto;
  padding: clamp(1.5rem, 4vw, 3rem) clamp(1rem, 4vw, 3rem);
}
.content-article { max-width: 100%; }
.content-article > h1:first-child {
  background: linear-gradient(120deg, var(--ocean), var(--tangerine));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
  margin-top: 0;
}

/* ── 11. Breadcrumbs ────────────────────────────────────────── */
.breadcrumbs { margin-bottom: 1.75rem; }
.breadcrumb-list { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; }
.breadcrumb-item { display: flex; align-items: center; gap: 0.35rem; font-size: 0.825rem; }
.breadcrumb-item a { color: var(--ocean); text-decoration: none; }
.breadcrumb-item a:hover { color: var(--tangerine); text-decoration: underline; }
.breadcrumb-item--current span { color: var(--text-muted); }
.breadcrumb-sep { color: var(--text-light); }

/* ── 12. Inline code ────────────────────────────────────────── */
:not(pre) > code {
  background: rgba(15, 23, 42, 0.05);
  color: inherit;
  padding: 0.1em 0.35em;
  border-radius: 0.25rem;
  font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
  font-size: 0.875em;
}

/* ── 13. Code blocks (light Prism theme) ────────────────────── */
pre[class*="language-"] {
  position: relative;
  background: #f0f9ff;
  border-radius: var(--radius);
  padding: 1.75rem 1.25rem 1.25rem;
  overflow-x: auto;
  margin: 1.5rem 0;
  box-shadow: var(--shadow-sm);
  border: 1px solid #bae6fd;
  font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
  font-size: 0.875rem; line-height: 1.65; tab-size: 2;
}
code[class*="language-"] { font-family: inherit; font-size: inherit; background: none; color: #1e293b; padding: 0; border: none; }

/* Language label */
pre[class*="language-"]::before {
  content: attr(class);
  display: block; position: absolute; top: 0.5rem; left: 1rem;
  font-size: 0.65rem; color: var(--ocean); text-transform: uppercase; letter-spacing: 0.1em; font-weight: 700;
  opacity: 0.55;
}
pre.language-sql::before  { content: "SQL"; }
pre.language-text::before { content: "PLAN OUTPUT"; }
pre.language-json::before { content: "JSON"; }
pre.language-bash::before { content: "BASH"; }
pre.language-mermaid::before { content: none; }

/* Prism tokens — tuned for light background */
.token.comment    { color: #94a3b8; font-style: italic; }
.token.keyword    { color: #0369a1; font-weight: 600; }
.token.string     { color: #c2410c; }
.token.number     { color: #0d9488; }
.token.operator   { color: #0369a1; }
.token.function   { color: #7c3aed; }
.token.punctuation{ color: #64748b; }
.token.class-name { color: #0369a1; }
.token.boolean    { color: #dc2626; }
.token.null.token { color: #dc2626; }
.token.property   { color: #0369a1; }
.token.tag        { color: #0369a1; }
.token.attr-name  { color: #c2410c; }

/* Copy button */
.code-copy-btn {
  position: absolute; top: 0.5rem; right: 0.5rem;
  background: rgba(2, 132, 199, 0.08); border: 1px solid rgba(2, 132, 199, 0.2);
  color: var(--ocean); border-radius: var(--radius-sm);
  padding: 0.25rem 0.6rem; font-size: 0.75rem; font-weight: 600; cursor: pointer;
  transition: background var(--transition), color var(--transition);
  opacity: 0; font-family: system-ui, sans-serif;
}
pre[class*="language-"]:hover .code-copy-btn { opacity: 1; }
.code-copy-btn:hover { background: var(--ocean); color: var(--white); }
.code-copy-btn.copied { background: var(--success); border-color: var(--success); color: var(--white); opacity: 1; }

/* ── 14. Tables ─────────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; margin: 1.5rem 0; border-radius: var(--radius); box-shadow: var(--shadow-sm); }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; background: var(--white); }
thead { background: var(--navy); color: var(--white); }
th { padding: 0.75rem 1rem; font-weight: 700; text-align: left; white-space: nowrap; }
td { padding: 0.65rem 1rem; border-bottom: 1px solid var(--border-light); }
tr:last-child td { border-bottom: none; }
tr:nth-child(even) td { background: var(--surface); }
tr:hover td { background: var(--surface-2); }

/* Auto-wrap tables */
.content-article table { display: block; overflow-x: auto; }

/* ── 15. FAQ Accordions ─────────────────────────────────────── */
.faq-section details {
  border: 1px solid var(--border-light); border-radius: var(--radius);
  margin-bottom: 0.75rem; overflow: hidden;
  transition: box-shadow var(--transition);
}
.faq-section details:hover { box-shadow: var(--shadow-sm); }
.faq-section details[open] { border-color: var(--sky); box-shadow: 0 0 0 2px rgba(56,189,248,0.15); }
.faq-section summary {
  padding: 1rem 1.25rem; font-weight: 600; color: var(--navy-mid); cursor: pointer;
  list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  user-select: none; background: var(--white); font-size: 0.95rem;
}
.faq-section summary::-webkit-details-marker { display: none; }
.faq-section summary::after { content: "▾"; color: var(--sky); flex-shrink: 0; transition: transform var(--transition); font-size: 1.1rem; }
.faq-section details[open] summary::after { transform: rotate(180deg); }
.faq-section summary:hover { background: var(--surface); }
.faq-section .faq-answer { padding: 0 1.25rem 1.25rem; color: var(--text); line-height: 1.7; }
.faq-section .faq-answer p { margin-bottom: 0.75rem; }
.faq-section .faq-answer p:last-child { margin: 0; }

/* ── 16. Task list checkboxes ───────────────────────────────── */
.task-list-item { list-style: none; display: flex; align-items: flex-start; gap: 0.5rem; padding: 0.2rem 0; }
.task-list-item input[type="checkbox"] {
  appearance: none; -webkit-appearance: none;
  width: 1.1rem; height: 1.1rem; flex-shrink: 0; margin-top: 0.2rem;
  border: 2px solid var(--border); border-radius: 0.25rem; background: var(--white);
  cursor: pointer; transition: background var(--transition), border-color var(--transition);
}
.task-list-item input[type="checkbox"]:checked { background: var(--mango); border-color: var(--mango); }
.task-list-item input[type="checkbox"]:checked::after {
  content: "✓"; display: block; text-align: center; color: white;
  font-size: 0.75rem; line-height: 1.1rem; font-weight: 700;
}
.task-list-item.checked > label { text-decoration: line-through; color: var(--text-muted); }
.task-list-item label { cursor: pointer; }

/* ── 17. Mermaid ────────────────────────────────────────────── */
.mermaid { background: var(--surface-2); border-radius: var(--radius); padding: 1.5rem; margin: 1.5rem 0; overflow-x: auto; text-align: center; border: 1px solid var(--border-light); }
pre.language-mermaid { background: transparent; border: none; padding: 0; box-shadow: none; }

/* ── 18. Blockquotes ────────────────────────────────────────── */
blockquote {
  border-left: 4px solid var(--sky); background: var(--surface-2);
  padding: 1rem 1.25rem; border-radius: 0 var(--radius) var(--radius) 0;
  margin: 1.5rem 0; color: var(--navy-mid);
}
blockquote p:last-child { margin: 0; }

/* ── 19. Content lists ──────────────────────────────────────── */
.content-article ul:not(.task-list):not(.section-card-links):not(.breadcrumb-list):not(.footer-nav-list) { list-style: none; padding-left: 0; }
.content-article ul:not(.task-list) > li { position: relative; padding-left: 1.4rem; margin-bottom: 0.5rem; }
.content-article ul:not(.task-list) > li::before { content: "▸"; position: absolute; left: 0; color: var(--sky); font-size: 0.85rem; top: 0.1rem; }

/* ── 20. Footer ─────────────────────────────────────────────── */
.site-footer { background: var(--navy); color: var(--sky-light); margin-top: auto; padding: clamp(2rem, 5vw, 4rem) 0 0; }
.footer-inner {
  max-width: var(--container); margin-inline: auto;
  padding-inline: clamp(1rem, 4vw, 3rem);
  display: grid; grid-template-columns: 1fr 2fr; gap: 3rem; padding-bottom: 2.5rem;
}
.footer-logo-link { display: flex; align-items: center; gap: 0.6rem; text-decoration: none; margin-bottom: 1rem; }
.footer-logo-svg { width: 32px; height: 32px; }
.footer-site-name { color: var(--white); font-weight: 800; font-size: 0.95rem; }
.footer-tagline { color: var(--text-light); font-size: 0.875rem; line-height: 1.6; }
.footer-nav-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2rem; }
.footer-section-title { color: var(--white); font-weight: 700; font-size: 0.875rem; text-decoration: none; display: block; margin-bottom: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; }
.footer-section-title:hover { color: var(--sky); }
.footer-nav-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 0.4rem; }
.footer-nav-link { color: var(--text-light); font-size: 0.825rem; text-decoration: none; transition: color var(--transition); }
.footer-nav-link:hover { color: var(--sky); }
.footer-bottom { border-top: 1px solid rgba(255,255,255,0.08); padding: 1.25rem clamp(1rem, 4vw, 3rem); text-align: center; }
.footer-bottom p { color: var(--text-light); font-size: 0.8rem; margin: 0; }

/* ── 21. Responsive ─────────────────────────────────────────── */
@media (max-width: 1100px) {
  .sections-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 800px) {
  .site-nav { display: none; }
  .nav-toggle { display: flex; }
  .hero-inner { grid-template-columns: 1fr; }
  .hero-visual { display: none; }
  .sections-grid { grid-template-columns: 1fr; }
  .footer-inner { grid-template-columns: 1fr; gap: 2rem; }
  .footer-nav-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .footer-nav-grid { grid-template-columns: 1fr; }
  .hero-ctas { flex-direction: column; }
  .hero-cta { justify-content: center; }
}

/* ── 22. Utility ────────────────────────────────────────────── */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

