/* ════════════════════════════════════════════════════════════
   cho Bơ 🥑 — shared theme
   Edit this file to restyle the whole blog. Content lives in
   posts/*.md and posts.json; this file never needs to touch it.
   ════════════════════════════════════════════════════════════ */

:root {
  --bg:       #faf8f2;
  --card:     rgba(255,254,249,.94);
  --paper:    rgba(255,254,249,.94);
  --border:   rgba(101,120,72,.22);
  --border-2: rgba(101,120,72,.34);
  --ink:      #3F4E2E;
  --ink-2:    #4c5d37;
  --ink-3:    #76845B;
  --ink-4:    #9aa680;
  --accent:   #516D38;
  --sage-deep:#516D38;
  --r:        14px;
  --maxw:     760px;
  --serif:    'Crimson Pro', Georgia, serif;
  --sans:     'Quicksand', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --hand:     'Crimson Pro', Georgia, serif;
}

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

html { background: var(--bg); }
body { background: transparent; }
html, body {
  color: var(--ink);
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
/* fixed background layer — subtle dotted grid, shared across every page */
.bg-layer {
  position: fixed; inset: 0; z-index: -1;
  background: var(--bg);
}
.bg-layer::after {
  content: "";
  position: absolute; inset: 0;
  background-image: radial-gradient(var(--border-2) 1px, transparent 1px);
  background-size: 24px 24px;
  opacity: .55;
}

a { color: inherit; }

/* ── Masthead ───────────────────────────────────────────────── */
.masthead {
  border-bottom: 1px solid var(--border);
  background: var(--card);
}
.masthead-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 26px 28px 0;
  text-align: center;
}
.masthead-brand {
  font-family: var(--serif);
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -.01em;
  color: var(--ink);
  text-decoration: none;
  display: inline-block;
}
.masthead-tag {
  font-size: 12.5px;
  color: var(--ink-3);
  margin-top: 4px;
}
.masthead-nav {
  display: flex;
  justify-content: center;
  gap: 26px;
  list-style: none;
  margin-top: 18px;
  border-top: 1px solid var(--border);
  padding: 11px 0 12px;
}
.masthead-nav a {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .02em;
  color: var(--ink-3);
  text-decoration: none;
  transition: color .12s;
}
.masthead-nav a:hover { color: var(--accent); }

/* ── Wrapper ────────────────────────────────────────────────── */
.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 36px 28px 64px;
}

/* ── Section divider label ──────────────────────────────────── */
.divider-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink-4);
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 44px 0 22px;
}
.divider-label::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}
.divider-label:first-child { margin-top: 0; }

/* ════════════════════════════════════════════════════════════
   HERO  —  editorial 3-column (Ref 2):  side · featured · side
   ════════════════════════════════════════════════════════════ */
.hero {
  display: grid;
  grid-template-columns: 1fr 1.5fr 1fr;
  gap: 32px;
  align-items: start;
}
.hero-col { display: flex; flex-direction: column; gap: 28px; }

/* featured (center) */
.feat {
  display: block;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}
.feat-img {
  aspect-ratio: 4/3;
  overflow: hidden;
  border-radius: var(--r);
  background: #f0efed;
}
.feat-img img {
  width: 100%; height: 100%;
  object-fit: cover; display: block;
  transition: transform .5s ease;
}
.feat:hover .feat-img img { transform: scale(1.03); }
.feat-body { text-align: center; padding: 18px 8px 0; }
.feat-title {
  font-family: var(--serif);
  font-size: 1.7rem;
  font-weight: 700;
  line-height: 1.18;
  letter-spacing: -.02em;
}
.feat-sub {
  font-size: 14px;
  color: var(--ink-3);
  margin-top: 9px;
  line-height: 1.55;
}

/* side post (compact, no image or small image) */
.side {
  display: block;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}
.side-img {
  aspect-ratio: 16/10;
  overflow: hidden;
  border-radius: 9px;
  background: #f0efed;
  margin-bottom: 11px;
}
.side-img img {
  width: 100%; height: 100%;
  object-fit: cover; display: block;
  transition: transform .4s ease;
}
.side:hover .side-img img { transform: scale(1.04); }
.side-img.ph { display: flex; align-items: center; justify-content: center; font-size: 1.5rem; }

.eyebrow {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent);
}
.side-title {
  font-family: var(--serif);
  font-size: 1.02rem;
  font-weight: 600;
  line-height: 1.28;
  margin-top: 5px;
}
.side:hover .side-title { color: var(--accent); }
.side-sub {
  font-size: 12.5px;
  color: var(--ink-3);
  margin-top: 6px;
  line-height: 1.5;
}
.meta {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; color: var(--ink-4);
  margin-top: 9px;
}
.meta img { width: 16px; height: 16px; border-radius: 50%; object-fit: cover; }

/* ════════════════════════════════════════════════════════════
   POST GRID  —  remaining posts, uniform cards
   ════════════════════════════════════════════════════════════ */
.grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 22px 24px;
}
.card {
  display: block;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}
.card.soon { cursor: default; }
.card-img {
  aspect-ratio: 3/2;
  overflow: hidden;
  border-radius: 10px;
  background: #f0efed;
  position: relative;
}
.card-img img {
  width: 100%; height: 100%;
  object-fit: cover; display: block;
  transition: transform .4s ease;
}
.card:not(.soon):hover .card-img img { transform: scale(1.04); }
.card-img.ph { display: flex; align-items: center; justify-content: center; font-size: 1.7rem; }
.ph-1 { background:#f2ece7 } .ph-2 { background:#e8f2ec } .ph-3 { background:#e7ecf2 }
.ph-4 { background:#f2e8ee } .ph-5 { background:#f5f0e6 } .ph-6 { background:#ece8f5 }
.ph-7 { background:#e8f2ef } .ph-8 { background:#f5ede8 } .ph-9 { background:#ede8f5 }

.soon-tag {
  position: absolute; bottom: 8px; right: 8px;
  background: rgba(255,255,255,.85);
  backdrop-filter: blur(6px);
  border-radius: 5px;
  padding: 2px 8px;
  font-size: 9.5px; font-weight: 600;
  letter-spacing: .07em; text-transform: uppercase;
  color: var(--ink-3);
}
.card-title {
  font-family: var(--serif);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.28;
  margin-top: 11px;
}
.card:not(.soon):hover .card-title { color: var(--accent); }
.card.soon .card-title { color: var(--ink-4); font-weight: 400; font-style: italic; }
.card-sub {
  font-size: 12.5px; color: var(--ink-3);
  margin-top: 6px; line-height: 1.5;
}

/* ── Footer ─────────────────────────────────────────────────── */
.foot {
  border-top: 1px solid var(--border);
  text-align: center;
  padding: 22px 16px;
  font-size: 12.5px;
  color: var(--ink-4);
  background: var(--card);
}
.foot a { color: var(--ink-3); text-decoration: none; }
.foot a:hover { color: var(--accent); }

/* ════════════════════════════════════════════════════════════
   POST READING VIEW  (post.html)
   ════════════════════════════════════════════════════════════ */
/* ── Table of contents (left, sticky) ──────────────────────── */
.toc {
  position: fixed;
  top: 50%; left: clamp(14px, 3.5vw, 46px);
  transform: translateY(-50%);
  width: min(208px, 22vw);
  max-height: 82vh; overflow: auto;
  z-index: 40;
  padding: 18px 20px;
  background: rgba(255,254,249,.94);
  border: 1px solid var(--border-2);
  border-radius: 14px;
  box-shadow: 0 8px 28px rgba(50,66,38,.1);
}
.toc-title {
  font-family: var(--hand);
  font-size: 1.3rem;
  color: var(--ink);
  margin-bottom: 12px;
}
.toc-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; }
.toc-list a {
  display: block;
  font-size: 14px; line-height: 1.35;
  color: var(--ink-3); text-decoration: none;
  border-left: 2px solid transparent;
  padding: 3px 0 3px 11px;
  transition: color .15s, border-color .15s;
}
.toc-list a:hover, .toc-list a.active {
  color: var(--sage-deep);
  border-left-color: var(--sage-deep);
}
.toc-list .lvl-3 a { padding-left: 22px; font-size: 13px; color: var(--ink-4); }
.toc-back {
  display: inline-block;
  margin-top: 14px;
  font-size: 13px; font-weight: 600;
  color: var(--ink-3); text-decoration: none;
}
.toc-back:hover { color: var(--sage-deep); }

@media (max-width: 1160px) { .toc { display: none; } }

.post {
  max-width: 760px;
  margin: clamp(34px,5vw,60px) auto clamp(40px,6vw,72px);
  padding: clamp(28px,5vw,58px) clamp(24px,6vw,68px);
}
.post-header { padding: 0 0 24px; text-align: center; }
.post-emoji { font-size: 2rem; line-height: 1; }
.post-title {
  font-family: var(--hand);
  font-size: clamp(2.35rem,5vw,3.25rem);
  font-weight: 600;
  line-height: 1.02;
  letter-spacing: -.02em;
  color: var(--ink);
  margin-top: 14px;
}
.post-meta {
  font-family: var(--sans);font-size: 12px; color: var(--ink-3);
  margin-top: 14px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.post-meta img { width: 22px; height: 22px; border-radius: 50%; object-fit: cover; border: 1px solid var(--border); }
.post-header hr,
.post-divider {
  border: none; border-top: 2px solid var(--border-2);
  margin: 28px auto 0; max-width: 70px;
}

/* rendered markdown body */
.post-content { font-family: var(--serif);font-size: 19px; line-height: 1.72; color: var(--ink-2); }
.post-content > *:first-child { margin-top: 0; }
.post-content p { margin: 1.05em 0; }
.post-content h1, .post-content h2, .post-content h3, .post-content h4 {
  font-family: var(--hand);
  color: var(--ink);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -.02em;
  scroll-margin-top: 22px;
}
.post-content h2 { font-size: 2rem; margin: 1.4em 0 .5em; }
.post-content h3 { font-size: 1.45rem; margin: 1.35em 0 .4em; }

/* each big-title section wrapped in a readable card */
.post-section {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
  margin: 34px 0;
  text-shadow: none;
}
.post-section + .post-section {border-top:1px solid var(--border);padding-top:34px}
.post-section > *:first-child { margin-top: 0; }
.post-section > *:last-child { margin-bottom: 0; }
.post-content h4 { font-size: 1.25rem; margin: 1.3em 0 .3em; }
.post-content a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; text-decoration-thickness: 1px; }
.post-content a:hover { text-decoration-thickness: 2px; }
.post-content strong { color: var(--ink); font-weight: 600; }
.post-content ul, .post-content ol { margin: 1em 0; padding-left: 1.5em; }
.post-content li { margin: .4em 0; }
.post-content hr { border: none; border-top: 1px solid var(--border); margin: 2.4em 0; }

/* runs of consecutive images → compact responsive row (2–3 across) */
.post-content .img-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin: 1.6em 0;
  align-items: start;
}
.post-content .img-row figure { margin: 0; }
.post-content .img-row img { width: auto; height: auto; max-height: 256px; margin: 0 auto; }

/* images → figures with caption */
.post-content figure { margin: 2em 0; text-align: center; }
.post-content img {
  max-width: 100%; max-height: 256px; width: auto; height: auto;
  border-radius: 10px; display: block; margin: 0 auto;
}
.post-content figcaption {
  font-size: 15px; color: var(--ink-4);
  margin-top: 10px; line-height: 1.5; font-style: italic;
}
.post-content p > img { border-radius: 10px; }

/* callouts (Notion callouts became blockquotes) */
.post-content blockquote {
  background: rgba(168,206,123,.16);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  padding: 16px 20px;
  margin: 1.6em 0;
  color: var(--ink-2);
  font-size: 18px;
}
.post-content blockquote p { margin: .5em 0; }
.post-content blockquote p:first-child { margin-top: 0; }
.post-content blockquote p:last-child { margin-bottom: 0; }
.post-content blockquote h4 { margin-top: .6em; }

/* tables */
.post-content table { border-collapse: collapse; width: 100%; margin: 1.6em 0; font-size: 16px; }
.post-content th, .post-content td { border: 1px solid var(--border); padding: 8px 12px; text-align: left; }
.post-content th { background: rgba(168,206,123,.18); font-weight: 600; color: var(--ink); }

.post-content code {
  background: rgba(101,120,72,.14);
  border-radius: 4px; padding: .15em .4em;
  font-size: 88%; font-family: ui-monospace, Menlo, monospace;
}

.post-foot {
  border-top: 1px solid var(--border);
  margin-top: 48px; padding-top: 24px;
  text-align: center;
}
.post-foot a {
  font-family: var(--hand);
  font-size: 18px; font-weight: 500;
  color: var(--accent); text-decoration: none;
}
.post-foot a:hover { color: var(--ink); }

/* loading / error states */
.post-status { text-align: center; padding: 90px 24px; color: var(--ink-3); }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 980px) {
  .hero { grid-template-columns: 1fr; gap: 0; }
  .hero-col { flex-direction: row; flex-wrap: wrap; gap: 24px; margin-top: 28px; }
  .hero-col .side { flex: 1 1 240px; }
  .grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 640px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
  .wrap { padding: 28px 16px 48px; }
  .hero-col { flex-direction: column; }
  .post {margin:0;padding:30px 20px 42px;border-radius:0;border-left:0;border-right:0}
  .post-title { font-size: 2.25rem; }
  .post-content { font-size: 18px; line-height:1.68; }
  .post-section {margin:28px 0}
  .post-section + .post-section {padding-top:28px}
  .feat-title { font-size: 1.45rem; }
}
