/* pg-web.dev — Postgres-native theme.
   Light airy pages, ink-navy type, #336791 accent, dark-navy code blocks. */

:root {
  --fg: #0b1e2d;            /* ink navy */
  --muted: #5b6b7a;
  --accent: #336791;        /* Postgres slate blue */
  --accent-hover: #24506f;
  --bg: #ffffff;
  --surface: #f4f7fa;
  --code-bg: #0e2233;       /* terminal window set into the page */
  --code-fg: #dce8f2;
  --border: #dbe4ec;
  --radius: 8px;
  --max: 720px;
  --max-wide: 980px;
  --font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 1.05rem;
  line-height: 1.65;
  color: var(--fg);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

/* —— chrome —— */
header {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 10;
}

nav {
  max-width: var(--max-wide);
  margin: 0 auto;
  padding: 0.85rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--fg);
  letter-spacing: -0.02em;
}
.brand:hover { text-decoration: none; color: var(--fg); }
.brand span { color: var(--accent); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
}
.nav-links a {
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 500;
}
.nav-links a:hover { color: var(--fg); text-decoration: none; }

/* Active section in the nav — keyed on the body class each page sets in its
   `body_class` block (no request path reaches Tera, so this is CSS-only).
   `page-post` maps to Blog: posts live under /blog. */
body.page-how  .nav-links a[href="/how"],
body.page-docs .nav-links a[href="/docs"],
body.page-blog .nav-links a[href="/blog"],
body.page-post .nav-links a[href="/blog"] {
  color: var(--accent);
  font-weight: 600;
}

.nav-cta,
.nav-links a.nav-cta {
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}
.nav-links a.nav-cta:hover { background: var(--accent-hover); color: #fff; }

main {
  flex: 1;
  max-width: var(--max);
  width: 100%;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 4rem;
}

body.page-home main,
body.page-docs main {
  max-width: var(--max-wide);
}

/* —— type —— */
h1 {
  font-size: clamp(2rem, 4vw, 2.75rem);
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin: 0 0 1rem;
}

h2 {
  font-size: 1.25rem;
  margin: 2.25rem 0 0.75rem;
  letter-spacing: -0.02em;
}

h3 { font-size: 1.05rem; margin: 1.5rem 0 0.5rem; }

p, ul, ol { margin: 0.75rem 0; }
ul, ol { padding-left: 1.25rem; }

table {
  border-collapse: collapse;
  width: 100%;
  margin: 1rem 0;
  font-size: 0.95rem;
}
th, td {
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
}
th { color: var(--muted); font-weight: 600; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.04em; }

.eyebrow {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin: 0 0 0.75rem;
}

.lede {
  font-size: 1.2rem;
  color: var(--muted);
  max-width: 38em;
  margin: 0 0 1.5rem;
}

.muted { color: var(--muted); }

/* —— hero —— */
.hero { margin-bottom: 3rem; }

.hero-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  align-items: center;
}
@media (min-width: 860px) {
  .hero-grid { grid-template-columns: 3fr 2fr; }
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin: 1.5rem 0;
}

.btn {
  display: inline-block;
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--fg);
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
}
.btn:hover {
  text-decoration: none;
  border-color: #b9cbd9;
  background: #e9eff5;
  color: var(--fg);
}
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn.primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #fff;
}
.btn.ghost { background: transparent; }

/* —— cards —— */
.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 0.85rem;
  margin: 1.25rem 0 2rem;
}

.card {
  display: block;
  padding: 1.15rem 1.2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: inherit;
  text-decoration: none;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.card:hover {
  text-decoration: none;
  border-color: #8fb3cf;
  box-shadow: 0 4px 16px rgba(51, 103, 145, 0.10);
  color: inherit;
}
.card h2, .card h3 {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
  color: var(--accent);
}
.card p {
  margin: 0;
  font-size: 0.95rem;
  color: var(--muted);
}

/* —— callouts —— */
.callout {
  background: #eaf1f7;
  border-left: 3px solid var(--accent);
  padding: 0.85rem 1rem;
  margin: 1.5rem 0;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 0.98rem;
}

/* —— honesty strip —— */
.honesty {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 1.15rem 1.35rem;
  margin: 2.5rem 0;
  font-size: 0.98rem;
}
.honesty p { margin: 0.35rem 0; }

/* —— quickstart strip —— */
.quickstart { margin: 2.5rem 0; }

/* —— code —— */
code, pre {
  font-family: var(--mono);
  font-size: 0.88em;
}

code {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

pre {
  background: var(--code-bg);
  color: var(--code-fg);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
  overflow-x: auto;
  margin: 1rem 0;
  line-height: 1.5;
}
pre code {
  background: none;
  border: none;
  padding: 0;
  color: inherit;
  font-size: 0.85rem;
}

/* hand-annotated syntax accents (hero code pair only) */
.tok-k { color: #8fd0ff; }   /* keywords */
.tok-s { color: #b5e0a8; }   /* strings */
.tok-c { color: #6c8ba3; }   /* comments */

pre.diagram {
  background: var(--surface);
  color: var(--fg);
  border: 1px solid var(--border);
}

.code-pair {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}
@media (min-width: 800px) {
  .code-pair { grid-template-columns: 1fr 1fr; }
}

/* —— docs shell —— */
.docs-shell {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}
@media (min-width: 860px) {
  .docs-shell { grid-template-columns: 190px minmax(0, 1fr); gap: 3rem; }
}

.docs-sidebar {
  font-size: 0.95rem;
}
@media (min-width: 860px) {
  .docs-sidebar {
    position: sticky;
    top: 4.5rem;
    align-self: start;
  }
}
.docs-sidebar .eyebrow { margin-bottom: 0.5rem; }
.docs-sidebar ul { list-style: none; padding: 0; margin: 0; }
.docs-sidebar li { margin: 0.3rem 0; }
.docs-sidebar a { color: var(--muted); display: block; padding: 0.15rem 0; }
.docs-sidebar a:hover { color: var(--accent); text-decoration: none; }

/* Current docs page in the sidebar — keyed on the `docs-<section>` body
   class each docs page adds alongside `page-docs`. */
body.docs-tutorial  .docs-sidebar a[href="/docs/tutorial"],
body.docs-guide     .docs-sidebar a[href="/docs/guide"],
body.docs-deploy    .docs-sidebar a[href="/docs/deploy"],
body.docs-reference .docs-sidebar a[href="/docs/reference"] {
  color: var(--accent);
  font-weight: 600;
}

.docs-content { min-width: 0; }
.docs-content > h1 { font-size: 2rem; }

/* —— blog —— */
.post-list { list-style: none; padding: 0; margin: 2rem 0; }
.post-list-item { margin: 0 0 2rem; }
.post-list-item h2 { margin: 0 0 0.25rem; font-size: 1.3rem; }
.post-list-item p { margin: 0.25rem 0 0; color: var(--muted); }

.post-meta {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0 0 2rem;
}

article.post h2 { font-size: 1.35rem; margin-top: 2.5rem; }
article.post blockquote {
  margin: 1.5rem 0;
  padding: 0.25rem 0 0.25rem 1.15rem;
  border-left: 3px solid var(--accent);
  color: var(--muted);
}

/* —— footer —— */
footer {
  border-top: 1px solid var(--border);
  margin-top: auto;
  background: var(--surface);
}
.footer-inner {
  max-width: var(--max-wide);
  margin: 0 auto;
  padding: 1.25rem 1.25rem 1.75rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
}
.footer-inner p { margin: 0.25rem 0; }
.footer-inner a { color: var(--muted); text-decoration: underline; }
.footer-inner a:hover { color: var(--fg); }

/* —— sections —— */
section + section { margin-top: 0.5rem; }

@media (max-width: 640px) {
  main { padding-top: 1.75rem; }
  .nav-links { gap: 0.85rem; }
}
