/* ========================================================================
   phbeks.com/blog — shared stylesheet.
   Token block mirrors design-tokens/tokens.css verbatim (canonical source).
   Hand-written posts and the index both link this file; keep the :root block
   in sync if the canonical tokens change.
   ======================================================================== */

:root {
  color-scheme: dark;

  /* Surfaces */
  --bg:              #0c0f16;
  --bg-card:         #141820;
  --bg-card-2:       #1a1f2b;
  --bg-card-hover:   #1f2530;

  /* Borders */
  --border:          #1e2530;
  --border-strong:   #2a3140;

  /* Accent (teal) */
  --accent:          #00d4aa;
  --accent-dim:      rgba(0, 212, 170, 0.12);
  --accent-soft:     rgba(0, 212, 170, 0.18);

  /* Secondary hues */
  --blue:            #3b82f6;
  --purple:          #a855f7;
  --orange:          #f59e0b;

  /* Semantic */
  --good:            #10b981;
  --warn:            #f59e0b;
  --bad:             #ef4444;

  /* Text */
  --text:            #e2e8f0;
  --text-dim:        #8492a6;
  --text-muted:      #4a5568;

  /* Type */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Consolas, monospace;

  /* Shape */
  --radius:          12px;
  --radius-lg:       16px;
  --shadow:          0 4px 14px rgba(0, 0, 0, 0.35);

  /* Backdrop — calm, static page gradient (Option B). */
  --backdrop: linear-gradient(180deg, rgba(0,212,170,0.05) 0%, transparent 42%),
              radial-gradient(90% 60% at 100% 0%, rgba(59,130,246,0.05) 0%, transparent 55%),
              var(--bg);
}

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

html { scroll-behavior: smooth; }
@media (pointer: coarse) { html { scroll-behavior: auto; } }

body {
  background: var(--backdrop);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font);
  line-height: 1.6;
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-overflow-scrolling: touch;
}

a { color: var(--accent); text-decoration: none; transition: opacity 0.2s; }
a:hover { opacity: 0.8; }

/* ── Layout ── */
/* Flex column so the footer sticks to the bottom of the viewport on short
   pages (matches phbeks.com). The last divider before the footer carries
   margin-top:auto, so the divider + footer travel down together. */
.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}
.container > .divider:last-of-type { margin-top: auto; }

/* ── Top bar / back-link ── */
.topbar {
  padding: 32px 0 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.topbar a.back {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--accent);
  letter-spacing: 0.04em;
  opacity: 0.85;
}
.topbar a.back::before { content: '\2190 '; }
.topbar .feed-link {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  letter-spacing: 0.06em;
}

/* ── Divider ── */
.divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
  margin: 20px 0;
}

/* ── Blog header (index) ── */
.blog-head { padding: 48px 0 24px; }
.blog-head .label {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--accent);
  letter-spacing: 0.08em;
  margin-bottom: 16px;
  opacity: 0.8;
}
.blog-head h1 {
  font-size: clamp(2.2rem, 5.5vw, 3.2rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin-bottom: 16px;
}
.blog-head p {
  font-size: 1.05rem;
  color: var(--text-dim);
  max-width: 540px;
  line-height: 1.7;
}

/* ── Post list (index) ── */
.post-list { padding: 16px 0 40px; display: flex; flex-direction: column; gap: 8px; }
.post-item {
  display: block;
  padding: 22px 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: background 0.2s, border-color 0.2s, transform 0.2s;
  color: inherit;
}
.post-item:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent);
  transform: translateY(-2px);
  opacity: 1;
}
.post-item .post-date {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}
.post-item h2 {
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 8px;
}
.post-item p {
  font-size: 0.92rem;
  color: var(--text-dim);
  line-height: 1.6;
}
.post-item .tags { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 8px; }

/* ── Tags ── */
.tag {
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--accent);
  background: var(--accent-dim);
  border-radius: 6px;
  padding: 3px 8px;
  letter-spacing: 0.03em;
}

.empty-note {
  color: var(--text-muted);
  font-size: 0.92rem;
  padding: 24px 0;
}

/* ── Article (post page) ── */
.article-head { padding: 40px 0 8px; }
.article-head .post-date {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  margin-bottom: 16px;
}
.article-head h1 {
  font-size: clamp(2rem, 5vw, 2.8rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.03em;
  margin-bottom: 16px;
}
/* Accent highlight on titles — mirrors the homepage hero (`.hero h1 span`).
   Wrap the payoff word/phrase of the title in <span>; applies to the blog
   landing headline, each post's <h1>, and the index post-card <h2>. */
.blog-head h1 span,
.article-head h1 span,
.post-item h2 span { color: var(--accent); }
.article-head .summary {
  font-size: 1.1rem;
  color: var(--text-dim);
  line-height: 1.7;
}
.article-head .tags { margin-top: 18px; display: flex; flex-wrap: wrap; gap: 8px; }

.prose { padding: 16px 0 32px; font-size: 1.02rem; line-height: 1.8; color: var(--text); }
.prose > * + * { margin-top: 1.2em; }
.prose h2 {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-top: 1.8em;
  line-height: 1.3;
}
.prose h3 {
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-top: 1.6em;
}
.prose p { color: var(--text); }
.prose a { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--accent-soft); }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li + li { margin-top: 0.4em; }
.prose li { color: var(--text); }
.prose blockquote {
  border-left: 3px solid var(--accent);
  background: var(--accent-dim);
  padding: 14px 20px;
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--text-dim);
  font-style: italic;
}
.prose code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: var(--bg-card-2);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 6px;
  color: var(--accent);
}
.prose pre {
  font-family: var(--mono);
  font-size: 0.86rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  overflow-x: auto;
  line-height: 1.6;
}
.prose pre code { background: none; border: none; padding: 0; color: var(--text); font-size: 1em; }
.prose img,
.prose video {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  display: block;
}
.prose hr { border: none; height: 1px; background: var(--border); margin: 2em 0; }

/* ── Media: figures, video, embeds ── */
.prose figure { margin: 1.6em 0; }
.prose figure > img,
.prose figure > video { width: 100%; }
.prose figcaption {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.5;
  margin-top: 10px;
}
/* Responsive iframe embeds (YouTube, etc.) — wrap the <iframe> in
   <div class="embed"> so it keeps a 16:9 box on every width. */
.prose .embed {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-card);
}
.prose .embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* ── Discuss / Phase 2 hook ── */
.discuss {
  margin: 8px 0 32px;
  padding: 18px 22px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.92rem;
  color: var(--text-dim);
}
.discuss a { font-weight: 500; }

/* ── Footer ── */
.footer {
  padding: 40px 0;
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-muted);
}
.footer-stamp {
  margin-bottom: 10px;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--text-muted);
}
.footer-build { color: var(--text-dim); }
.footer-tagline { margin-bottom: 8px; }
.footer-disclaimer {
  font-size: 0.7rem;
  color: var(--text-muted);
  max-width: 540px;
  margin: 0 auto;
  line-height: 1.6;
}
.footer-nav { margin-top: 12px; }
.footer a { color: var(--text-dim); }

/* ── Mobile ── */
@media (max-width: 559px) {
  .blog-head { padding: 32px 0 16px; }
  .article-head { padding: 28px 0 8px; }
  .topbar { padding-top: 24px; }
}
