/* ============================================================
   FluentLake design system (Hybrid brand)
   Display: Space Grotesk | Body: Newsreader | Chrome: JetBrains Mono
   One teal does all the work.
   ============================================================ */

/* ---------- Tokens ---------- */
:root {
  --paper: #F4F6F5;
  --ink: #0E1A22;
  --teal: #0FB6C2;
  --teal-bright: #2DD4DE;
  --navy: #0B2A35;
  --slate: #5C7079;

  /* Semantic (light is default) */
  --bg: var(--paper);
  --surface: #ffffff;
  --surface-2: #eef1f0;
  --text: var(--ink);
  --text-muted: var(--slate);
  --accent: var(--teal);
  --accent-ink: #07343a;
  --hairline: #dde3e2;
  --code-bg: var(--navy);
  --code-text: #D6E2E2;
  --logo-word: var(--ink);
  --selection-bg: rgba(15, 182, 194, 0.22);
  --scanline-opacity: 0.025;
  --shadow: 0 1px 2px rgba(14, 26, 34, 0.04), 0 8px 24px rgba(14, 26, 34, 0.06);

  --font-display: "Space Grotesk", "Segoe UI", system-ui, sans-serif;
  --font-body: "Newsreader", Georgia, "Times New Roman", serif;
  --font-mono: "JetBrains Mono", "Cascadia Code", Consolas, monospace;

  --maxw: 1120px;
  --maxw-narrow: 68ch;
  --radius: 14px;
  --radius-sm: 8px;
}

:root[data-theme="dark"] {
  --bg: #0A1117;
  --surface: #0F1A22;
  --surface-2: #11212b;
  --text: #D6E2E2;
  --text-muted: #8aa0a8;
  --accent: var(--teal-bright);
  --accent-ink: #bff2f6;
  --hairline: #1E2E38;
  --code-bg: #08161c;
  --code-text: #D6E2E2;
  --logo-word: #D6E2E2;
  --selection-bg: rgba(45, 212, 222, 0.24);
  --scanline-opacity: 0.04;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 30px rgba(0, 0, 0, 0.35);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1.125rem;
  line-height: 1.7;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color 0.25s ease, color 0.25s ease;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
::selection { background: var(--selection-bg); }
img, svg { max-width: 100%; height: auto; }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; line-height: 1.15; color: var(--text); letter-spacing: -0.02em; }

a { color: var(--accent); text-decoration: none; text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration: underline; }

/* ---------- Focus + skip link ---------- */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: var(--navy);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  padding: 0.6rem 1rem;
  z-index: 100;
  border-radius: 0 0 var(--radius-sm) 0;
}
.skip-link:focus { left: 0; }

/* ---------- Scanline texture (very faint CRT nod) ---------- */
.scanlines {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 1;
  background-image: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, 1) 0px,
    rgba(0, 0, 0, 1) 1px,
    transparent 1px,
    transparent 3px
  );
  opacity: var(--scanline-opacity);
  mix-blend-mode: multiply;
}
:root[data-theme="dark"] .scanlines { mix-blend-mode: screen; }

/* ---------- Layout ---------- */
.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: clamp(1.1rem, 4vw, 2.5rem); }
.wrap--narrow { max-width: calc(var(--maxw-narrow) + 5rem); }
.site-main { flex: 1 0 auto; position: relative; z-index: 2; }

/* ---------- Mono utility ---------- */
.prompt, .tilde, .read-time, .draft-flag { font-family: var(--font-mono); }
.prompt { color: var(--accent); font-weight: 700; }
.tilde { color: var(--accent); }
.muted { color: var(--text-muted); }
.dot { color: var(--text-muted); }

/* Blinking cursor */
.cursor {
  display: inline-block;
  width: 0.6ch;
  height: 1.05em;
  margin-left: 0.15ch;
  background: var(--accent);
  vertical-align: -0.12em;
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 0%, 50% { opacity: 1; } 50.01%, 100% { opacity: 0; } }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.1) blur(8px);
  border-bottom: 1px solid var(--hairline);
}
.site-header__inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 64px; }
.brand { display: inline-flex; align-items: center; line-height: 1; }
.brand:hover { text-decoration: none; }
/* Live-text wordmark lockup (outlined-path versions live in /assets/img for images). */
.logo {
  display: inline-block;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.5rem;
  line-height: 1;
  letter-spacing: -0.035em;
  color: var(--logo-word);
  white-space: nowrap;
  -webkit-font-smoothing: antialiased;
}
.logo__lake { color: var(--accent); }

/* Combination lockup: Prompt Droplet mark + wordmark, horizontal, centered. */
.lockup { display: inline-flex; align-items: center; gap: 0.5rem; line-height: 1; }
.lockup__mark {
  /* Tuned to ~the wordmark cap height so the pair feels balanced. */
  width: 1.75rem;
  height: 1.75rem;
  flex: none;
  display: block;
}

.site-nav ul { display: flex; align-items: center; gap: clamp(0.5rem, 2vw, 1.4rem); list-style: none; margin: 0; padding: 0; }
.site-nav a {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  color: var(--text-muted);
  padding: 0.3rem 0;
  position: relative;
}
.site-nav a:hover { color: var(--text); text-decoration: none; }
.site-nav a[aria-current="page"] { color: var(--accent); }
.site-nav a[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -2px;
  height: 2px;
  background: var(--accent);
}

/* Theme toggle */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 0.3rem 0.7rem;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease;
}
.theme-toggle:hover { color: var(--text); border-color: var(--accent); }
.theme-toggle__icon {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 30%, transparent);
}
:root[data-theme="dark"] .theme-toggle__icon {
  background: transparent;
  box-shadow: inset 3px -3px 0 0 var(--accent);
}

/* ---------- Hero ---------- */
.hero { border-bottom: 1px solid var(--hairline); position: relative; overflow: hidden; }
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(60% 80% at 85% -10%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 60%);
  pointer-events: none;
}
.hero__inner { padding-block: clamp(3.5rem, 9vw, 6.5rem) clamp(2.5rem, 6vw, 4rem); position: relative; }
.hero__kicker {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  color: var(--text-muted);
  margin: 0 0 1.1rem;
  letter-spacing: 0.01em;
}
.hero__title {
  font-size: clamp(2.5rem, 7vw, 4.5rem);
  font-weight: 700;
  margin: 0 0 1.2rem;
  letter-spacing: -0.035em;
}
.hero__accent { color: var(--accent); }
.hero__lede {
  max-width: 56ch;
  font-size: clamp(1.15rem, 2.2vw, 1.4rem);
  color: var(--text);
  margin: 0 0 2rem;
}
.hero__cta { display: flex; flex-wrap: wrap; gap: 0.8rem; margin: 0; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  padding: 0.7rem 1.2rem;
  border-radius: 999px;
  background: var(--accent);
  color: var(--navy);
  border: 1px solid var(--accent);
  transition: transform 0.12s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 35%, transparent); }
.btn--ghost { background: transparent; color: var(--accent); border-color: var(--hairline); }
.btn--ghost:hover { border-color: var(--accent); box-shadow: none; }

/* ---------- Section heads ---------- */
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin: clamp(2.5rem, 6vw, 4rem) 0 1.6rem; }
.section-head__title { font-size: 1.25rem; margin: 0; font-family: var(--font-mono); font-weight: 500; letter-spacing: 0; }
.section-head__more { font-family: var(--font-mono); font-size: 0.82rem; color: var(--text-muted); white-space: nowrap; }
.section-head__more:hover { color: var(--accent); }

/* ---------- Post grid + cards ---------- */
.latest { padding-bottom: clamp(3rem, 8vw, 5rem); }
.page { padding-block: clamp(2.5rem, 6vw, 4rem) clamp(3rem, 8vw, 5rem); }
.post-grid {
  display: grid;
  gap: 1.1rem;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
}
.post-card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 1.5rem 1.6rem 1.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  transition: border-color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
}
.post-card:hover { border-color: color-mix(in srgb, var(--accent) 55%, var(--hairline)); transform: translateY(-2px); box-shadow: var(--shadow); }
.post-card__meta, .post__meta {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}
.post-card__title { font-size: 1.4rem; margin: 0; line-height: 1.2; }
.post-card__title a { color: var(--text); }
.post-card__title a:hover { color: var(--accent); text-decoration: none; }
.post-card__summary { margin: 0; color: var(--text); font-size: 1.02rem; line-height: 1.55; }

/* ---------- Tag chips ---------- */
.tag-list { display: flex; flex-wrap: wrap; gap: 0.45rem; list-style: none; margin: 0.3rem 0 0; padding: 0; }
.tag-chip {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.01em;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
  padding: 0.18rem 0.6rem;
  border-radius: 999px;
}
.tag-chip::before { content: "#"; opacity: 0.6; }
.tag-chip:hover { text-decoration: none; background: color-mix(in srgb, var(--accent) 18%, transparent); border-color: var(--accent); }
.tag-chip--lg { font-size: 0.85rem; padding: 0.4rem 0.85rem; }
.tag-chip__count { color: var(--text-muted); margin-left: 0.3rem; }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 0.6rem; list-style: none; padding: 0; margin: 0; }

.draft-flag {
  color: #b06a00;
  border: 1px solid color-mix(in srgb, #d98a17 45%, transparent);
  background: color-mix(in srgb, #d98a17 14%, transparent);
  border-radius: 999px;
  padding: 0.05rem 0.5rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
:root[data-theme="dark"] .draft-flag { color: #f0b860; }

/* ---------- Page headers ---------- */
.page__header { margin-bottom: 2rem; }
.page__title { font-size: clamp(2rem, 5vw, 3rem); margin: 0 0 0.5rem; }
.page__lede { color: var(--text-muted); font-size: 1.15rem; margin: 0; }

/* ---------- Breadcrumb ---------- */
.breadcrumb ol { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; list-style: none; margin: 0 0 1.6rem; padding: 0; font-family: var(--font-mono); font-size: 0.8rem; color: var(--text-muted); }
.breadcrumb li:not(:last-child)::after { content: "/"; margin-left: 0.4rem; color: var(--hairline); }
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb [aria-current="page"] { color: var(--text); }

/* ---------- Draft banner ---------- */
.draft-banner {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text);
  background: color-mix(in srgb, #d98a17 12%, var(--surface));
  border: 1px dashed color-mix(in srgb, #d98a17 55%, transparent);
  border-radius: var(--radius-sm);
  padding: 0.8rem 1rem;
  margin-bottom: 2rem;
}
.draft-banner__tag { background: #d98a17; color: #1a0f00; padding: 0.1rem 0.55rem; border-radius: 4px; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700; font-size: 0.72rem; }

/* ---------- Article ---------- */
.post { padding-block: clamp(2rem, 5vw, 3.5rem) clamp(3rem, 8vw, 5rem); }
.post__header { margin-bottom: 2.5rem; padding-bottom: 1.5rem; border-bottom: 1px solid var(--hairline); }
.post__title { font-size: clamp(2rem, 5.5vw, 3.2rem); margin: 0 0 1rem; letter-spacing: -0.03em; }
.post__meta { margin-bottom: 0.8rem; }
.byline a { color: var(--text-muted); text-decoration: none; }
.byline a:hover { color: var(--accent); }

/* Prose column */
.prose { max-width: var(--maxw-narrow); font-size: 1.18rem; }
.post__body.prose { margin-inline: auto; }
.prose > * + * { margin-top: 1.35em; }
.prose h2 { font-size: 1.7rem; margin-top: 2.4em; margin-bottom: 0.2em; }
.prose h3 { font-size: 1.32rem; margin-top: 1.9em; margin-bottom: 0.2em; }
.prose h2 .prompt, .prose h3 .prompt { margin-right: 0.3ch; }
.prose p { margin: 0; }
.prose > p + p { margin-top: 1.35em; }
.prose a { text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.prose a:hover { text-decoration-color: var(--accent); }
.prose strong { font-weight: 600; color: var(--text); }
.prose em { font-style: italic; }
.prose img { display: block; margin-inline: auto; border: 1px solid var(--hairline); border-radius: var(--radius-sm); box-shadow: var(--shadow); }
.prose ul, .prose ol { padding-left: 1.4em; margin-block: 1.2em; }
.prose li { margin-block: 0.4em; }
.prose li::marker { color: var(--accent); }
.prose img { border-radius: var(--radius-sm); border: 1px solid var(--hairline); display: block; }
.prose hr { border: none; border-top: 1px solid var(--hairline); margin-block: 2.5em; }

/* Blockquote */
.prose blockquote {
  margin: 1.6em 0;
  padding: 0.6em 1.2em;
  border-left: 3px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 7%, transparent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-style: italic;
  color: var(--text);
}
.prose blockquote p { margin: 0.3em 0; }

/* Inline code */
.prose :not(pre) > code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  background: color-mix(in srgb, var(--accent) 12%, var(--surface-2));
  color: var(--accent-ink);
  padding: 0.12em 0.4em;
  border-radius: 5px;
  border: 1px solid var(--hairline);
}

/* Tables */
.prose table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 0.86rem;
  margin-block: 1.6em;
  display: block;
  overflow-x: auto;
}
.prose th, .prose td { text-align: left; padding: 0.6rem 0.85rem; border-bottom: 1px solid var(--hairline); }
.prose thead th { color: var(--accent); border-bottom: 2px solid var(--hairline); white-space: nowrap; }
.prose tbody tr:hover { background: var(--surface-2); }

/* ---------- Code blocks (Prism on deep navy) ---------- */
.prose pre[class*="language-"],
.prose pre {
  font-family: var(--font-mono);
  font-size: 0.86rem;
  line-height: 1.6;
  background: var(--code-bg);
  color: var(--code-text);
  padding: 1.1rem 1.25rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--hairline);
  overflow-x: auto;
  margin-block: 1.6em;
  tab-size: 2;
}
.prose pre code { background: none; border: none; padding: 0; font-size: inherit; color: inherit; }

/* Prism token theme tuned to the FluentLake palette */
.token.comment, .token.prolog, .token.doctype, .token.cdata { color: #5f7a86; font-style: italic; }
.token.punctuation { color: #9fb3bb; }
.token.property, .token.tag, .token.boolean, .token.number, .token.constant, .token.symbol, .token.deleted { color: #6fd2da; }
.token.selector, .token.attr-name, .token.string, .token.char, .token.builtin, .token.inserted { color: #aee9bf; }
.token.operator, .token.entity, .token.url, .language-css .token.string, .style .token.string { color: #cdd9dd; }
.token.atrule, .token.attr-value, .token.keyword { color: #2DD4DE; }
.token.function, .token.class-name { color: #84e3ec; }
.token.regex, .token.important, .token.variable { color: #f0b860; }
.token.important, .token.bold { font-weight: 700; }
.token.italic { font-style: italic; }

/* ---------- Post footer nav ---------- */
.post__footer { max-width: var(--maxw-narrow); margin: 3rem auto 0; }
.post-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  padding-top: 2rem;
  border-top: 1px solid var(--hairline);
}
.post-nav__link {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  transition: border-color 0.2s ease;
}
.post-nav__link:hover { border-color: var(--accent); text-decoration: none; }
.post-nav__link--next { text-align: right; }
.post-nav__dir { font-family: var(--font-mono); font-size: 0.72rem; color: var(--text-muted); }
.post-nav__title { font-family: var(--font-display); font-weight: 600; font-size: 0.98rem; color: var(--text); }
.post__back { font-family: var(--font-mono); font-size: 0.85rem; margin-top: 2rem; }

.post__share {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding-bottom: 1.6rem;
  margin-bottom: 0.5rem;
  border-bottom: 1px solid var(--hairline);
}
.post__share-label {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
}
.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-sm);
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
}
.share-btn:hover {
  text-decoration: none;
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  border-color: var(--accent);
}
.share-btn__icon { flex-shrink: 0; }

/* ---------- Footer ---------- */
.site-footer {
  flex-shrink: 0;
  border-top: 1px solid var(--hairline);
  background: var(--surface);
  position: relative;
  z-index: 2;
  margin-top: auto;
}
.site-footer__inner { display: grid; gap: 1.4rem; padding-block: 2.5rem 3rem; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 700px) { .site-footer__inner { grid-template-columns: 1.4fr 1fr; } }
.site-footer__brand .logo { font-size: 1.35rem; }
.site-footer__brand .lockup { gap: 0.45rem; }
.site-footer__brand .lockup__mark { width: 1.55rem; height: 1.55rem; }
.site-footer__tagline { font-family: var(--font-mono); font-size: 0.82rem; color: var(--text-muted); margin: 0.7rem 0 0; }
.site-footer__nav ul { display: flex; flex-wrap: wrap; gap: 0.4rem 1.2rem; list-style: none; margin: 0; padding: 0; }
.site-footer__nav a { font-family: var(--font-mono); font-size: 0.82rem; color: var(--text-muted); }
.site-footer__nav a:hover { color: var(--accent); }
.site-footer__meta { font-family: var(--font-mono); font-size: 0.78rem; color: var(--text-muted); grid-column: 1 / -1; margin: 0; padding-top: 1.2rem; border-top: 1px solid var(--hairline); }

/* ---------- Responsive ---------- */
@media (max-width: 560px) {
  body { font-size: 1.06rem; }
  .post-nav { grid-template-columns: 1fr; }
  .post-nav__link--next { text-align: left; }
  .logo { font-size: 1.35rem; }
  .site-nav ul { gap: 0.7rem; }
  .theme-toggle__label { display: none; }
}

/* ---------- Diagram ---------- */
/* Inline-SVG figures (e.g. the medallion lakehouse). The SVG references the
   site's CSS custom properties directly, so it adapts to light/dark with the
   rest of the page. Static by design: no animation, nothing to gate behind
   prefers-reduced-motion. */
.diagram {
  margin: 2.4rem auto;
  max-width: var(--maxw-narrow);
}
.diagram svg {
  width: 100%;
  height: auto;
  display: block;
}
.diagram figcaption {
  margin-top: 0.9rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--text-muted);
  text-align: center;
}
