/* Blog pages: same tokens, nav and theme as index.php */
:root {
  --bg: #000000;
  --ink: #f5f5f7;
  --muted: #8a8a93;
  --pink: #ff2d95;
  --cyan: #00e5ff;
  --card: #0f0c17;
  --edge: rgba(255, 255, 255, 0.08);
  --body-ink: #d5d5dc;
  --font-display: "Space Grotesk", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;
}
[data-theme="light"] {
  --bg: #f7f5f2;
  --ink: #141419;
  --muted: #5a5a66;
  --pink: #d6106f;
  --cyan: #0891b2;
  --card: #ffffff;
  --edge: rgba(0, 0, 0, 0.08);
  --body-ink: #2a2a33;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { background: var(--bg); color: var(--ink); font-family: var(--font-body); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
::selection { background: var(--pink); color: #000; }
a { color: inherit; }

/* ---------- nav (copied from index.php) ---------- */
.topnav { position: fixed; top: 0; left: 0; right: 0; z-index: 40; display: flex; align-items: center; justify-content: space-between; padding: 18px clamp(20px, 4vw, 48px); transition: background .35s ease, padding .35s ease, box-shadow .35s ease; }
.topnav.scrolled { background: rgba(0,0,0,0.72); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); padding-top: 12px; padding-bottom: 12px; box-shadow: 0 1px 0 rgba(255,255,255,0.06); }
.nav-brand { position: relative; z-index: 46; font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; color: var(--ink); text-decoration: none; letter-spacing: -0.02em; }
.nav-brand span { background: linear-gradient(100deg, var(--pink), var(--cyan)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.nav-right { display: flex; align-items: center; gap: clamp(14px, 2vw, 26px); }
.nav-links { display: flex; align-items: center; gap: clamp(14px, 2vw, 30px); }
.nav-links a { font-family: var(--font-display); font-size: .86rem; font-weight: 500; letter-spacing: .04em; color: #b9b9c2; text-decoration: none; transition: color .25s ease; }
.nav-links a:hover, .nav-links a.active { color: var(--ink); }
.nav-links a.active { text-shadow: 0 0 18px rgba(255,45,149,0.6); }
.nav-links a.nav-cta { color: #000; background: linear-gradient(100deg, var(--pink), var(--cyan)); padding: .55em 1.3em; border-radius: 999px; font-weight: 600; }
.nav-burger { display: none; position: relative; z-index: 46; width: 42px; height: 42px; border: 1px solid rgba(255,255,255,0.14); border-radius: 12px; background: rgba(0,0,0,0.4); cursor: pointer; flex-direction: column; align-items: center; justify-content: center; gap: 5px; }
.nav-burger span { display: block; width: 18px; height: 2px; background: var(--ink); border-radius: 2px; transition: transform .3s ease, opacity .3s ease; }
body.nav-open .nav-burger span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
body.nav-open .nav-burger span:nth-child(2) { opacity: 0; }
body.nav-open .nav-burger span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
.theme-toggle { position: relative; z-index: 46; width: 42px; height: 42px; padding: 10px; border-radius: 12px; border: 1px solid rgba(255,255,255,0.14); background: rgba(0,0,0,0.4); color: var(--ink); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; transition: border-color .25s ease, color .25s ease, transform .25s ease; }
.theme-toggle:hover { border-color: var(--pink); color: var(--pink); transform: rotate(-12deg); }
.theme-toggle:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }
.ic-svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.theme-toggle .ic-moon { display: none; }
[data-theme="light"] .theme-toggle .ic-sun { display: none; }
[data-theme="light"] .theme-toggle .ic-moon { display: block; }

@media (max-width: 860px) {
  .nav-burger { display: flex; }
  .nav-links { position: fixed; inset: 0; z-index: 45; flex-direction: column; justify-content: center; gap: 30px; background: rgba(0,0,0,0.94); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); transform: translateY(-100%); visibility: hidden; transition: transform .45s cubic-bezier(.7,0,.3,1), visibility 0s .45s; }
  body.nav-open .nav-links { transform: translateY(0); visibility: visible; transition: transform .45s cubic-bezier(.7,0,.3,1); }
  body.nav-open { overflow: hidden; }
  body.nav-open .topnav { backdrop-filter: none; -webkit-backdrop-filter: none; }
  .nav-links a { font-size: 1.25rem; }
  [data-theme="light"] .nav-links { background: rgba(247,245,242,0.97); }
}
[data-theme="light"] .topnav.scrolled { background: rgba(247,245,242,0.82); box-shadow: 0 1px 0 rgba(0,0,0,0.08); }
[data-theme="light"] .nav-links a:not(.nav-cta) { color: #55555f; }
[data-theme="light"] .nav-links a:not(.nav-cta):hover,
[data-theme="light"] .nav-links a.active:not(.nav-cta) { color: var(--ink); }
[data-theme="light"] .nav-links a.active { text-shadow: 0 0 18px rgba(214,16,111,0.3); }
[data-theme="light"] .nav-links a.nav-cta { color: #fff; }
[data-theme="light"] .theme-toggle,
[data-theme="light"] .nav-burger { border-color: rgba(0,0,0,0.14); background: rgba(255,255,255,0.7); }

/* ---------- blog layout ---------- */
.blog-wrap { max-width: 1160px; margin: 0 auto; padding: 130px clamp(16px, 4vw, 40px) 80px; }
.eyebrow { font: 600 .75rem var(--font-display); letter-spacing: .2em; text-transform: uppercase; color: var(--pink); }
.grad { background: linear-gradient(100deg, var(--pink), var(--cyan)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lede { color: var(--muted); font-size: clamp(1rem, 1.4vw, 1.15rem); line-height: 1.6; max-width: 60ch; }
.lede a { color: var(--cyan); }
.lede, .post-body p { overflow-wrap: anywhere; }
.empty { color: var(--muted); padding: 40px 0; }

.blog-hero { margin-bottom: clamp(40px, 6vw, 70px); display: grid; gap: 16px; }
.blog-hero h1 { font: 700 clamp(2.2rem, 6vw, 4.2rem)/1.04 var(--font-display); letter-spacing: -0.035em; max-width: 16ch; }

.post-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: clamp(18px, 2.4vw, 28px); }
.post-card { display: flex; flex-direction: column; text-decoration: none; background: var(--card); border: 1px solid var(--edge); border-radius: 20px; overflow: hidden; transition: transform .3s ease, border-color .3s ease, box-shadow .3s ease; }
.post-card:hover { transform: translateY(-4px); border-color: rgba(255,45,149,.35); box-shadow: 0 24px 50px -28px rgba(255,45,149,.55); }
.post-card:focus-visible { outline: 2px solid var(--cyan); outline-offset: 4px; }
.post-cover { aspect-ratio: 16 / 10; overflow: hidden; background: linear-gradient(135deg, rgba(255,45,149,.25), rgba(0,229,255,.18)); display: grid; place-items: center; }
/* show the whole image; the empty sides take a flat tone instead of cropping */
.post-cover:has(img) { background: #15121d; }
[data-theme="light"] .post-cover:has(img) { background: #ece8e3; }
.post-cover { position: relative; }
.post-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; transition: transform .6s ease; }
.post-card:hover .post-cover img { transform: scale(1.04); }
.cover-fallback { font: 700 5rem var(--font-display); color: rgba(255,255,255,.35); }
.post-body { padding: 20px 22px 24px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.post-body time, .card-meta { font-size: .8rem; color: var(--muted); }
.post-body h2 { font: 600 1.25rem/1.25 var(--font-display); letter-spacing: -0.015em; color: var(--ink); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.post-body p:not(.card-meta) { color: var(--muted); font-size: .95rem; line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.read-more { margin-top: auto; padding-top: 6px; font: 600 .85rem var(--font-display); color: var(--cyan); }
.post-card:hover .read-more { color: var(--pink); }

/* blog list: equal cards, 3 / 2 / 1 per row */
.blog-wrap > .post-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 980px) { .blog-wrap > .post-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px) { .blog-wrap > .post-grid { grid-template-columns: minmax(0, 1fr); } }

/* pagination: ← Newer  1 2 … 9  Older → */
.pagination { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; margin-top: clamp(44px, 6vw, 64px); }
.pagination ol { list-style: none; display: flex; align-items: center; gap: 6px; }
.pg-num, .pg-step, .pg-gap { display: inline-grid; place-items: center; min-width: 44px; height: 44px; padding: 0 14px; border-radius: 999px; font: 600 .92rem var(--font-display); font-variant-numeric: tabular-nums; text-decoration: none; }
.pg-num, .pg-step { color: var(--ink); border: 1px solid var(--edge); transition: border-color .2s, color .2s, background-color .2s; }
a.pg-num:hover, a.pg-step:hover { border-color: var(--pink); color: var(--pink); }
.pg-num.is-on { background: var(--pink); border-color: var(--pink); color: #000; }
[data-theme="light"] .pg-num.is-on { color: #fff; }
.pg-step.is-off { opacity: .35; }
.pg-gap { min-width: 24px; padding: 0; color: var(--muted); }
.pg-range { text-align: center; color: var(--muted); font-size: .85rem; margin-top: 14px; }
@media (max-width: 520px) {
  .pg-step { order: 1; }
  .pagination ol { width: 100%; justify-content: center; }
}

/* ---------- single post ---------- */
.post { width: 100%; }
.back { display: inline-block; color: var(--muted); text-decoration: none; font-size: .9rem; margin-bottom: 28px; }
.back:hover { color: var(--cyan); }
.crumbs { margin-bottom: 28px; font-size: .9rem; }
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; min-width: 0; }
.crumbs li { display: flex; align-items: center; gap: 10px; color: var(--muted); min-width: 0; }
.crumbs li + li::before { content: "/"; color: var(--edge); color: color-mix(in srgb, var(--muted) 50%, transparent); }
.crumbs a { color: var(--muted); text-decoration: none; transition: color .2s; }
.crumbs a:hover { color: var(--cyan); }
.crumbs [aria-current] { color: var(--ink); max-width: min(52ch, 70vw); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* reading progress: thin pink line under the nav */
.read-progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 60; pointer-events: none; }
.read-progress span { display: block; height: 100%; background: var(--pink); transform: scaleX(0); transform-origin: 0 50%; }

/* article head: one text column, title large, then the byline */
.post-head { max-width: 860px; margin-bottom: clamp(32px, 4vw, 48px); }
.post-head h1 { font: 700 clamp(2.2rem, 5.2vw, 4.2rem)/1.04 var(--font-display); letter-spacing: -0.035em; overflow-wrap: anywhere; text-wrap: balance; }
.post-lede { margin-top: 20px; color: var(--muted); font-size: clamp(1.08rem, 1.5vw, 1.3rem); line-height: 1.55; max-width: 62ch; overflow-wrap: anywhere; }
.byline { display: flex; align-items: center; gap: 12px; margin-top: 28px; }
.byline-text { display: grid; gap: 2px; font-size: .9rem; color: var(--muted); }
.byline-text strong { color: var(--ink); font-weight: 600; }
.avatar { flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--pink); color: #000; font: 700 1.1rem var(--font-display); }
.avatar-lg { width: 56px; height: 56px; font-size: 1.35rem; }

.post-cover-full { margin: 0 0 clamp(44px, 6vw, 72px); border-radius: 20px; overflow: hidden; background: var(--card); aspect-ratio: 16 / 9; max-height: 640px; width: 100%; }
.post-cover-full img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* body: sticky rail (contents + share) beside a 720px reading column */
.post-layout { display: grid; grid-template-columns: 220px minmax(0, 720px); gap: clamp(40px, 6vw, 96px); justify-content: start; }
.post-rail { position: sticky; top: 96px; align-self: start; display: grid; gap: 32px; max-height: calc(100vh - 120px); overflow-y: auto; scrollbar-width: none; }
.rail-title { font: 600 .9rem var(--font-display); color: var(--ink); margin-bottom: 12px; }
.toc ol { list-style: none; display: grid; gap: 2px; border-left: 2px solid var(--edge); }
.toc a { display: block; padding: 6px 0 6px 14px; margin-left: -2px; border-left: 2px solid transparent; color: var(--muted); font-size: .88rem; line-height: 1.4; text-decoration: none; transition: color .2s, border-color .2s; }
.toc .toc-h3 a { padding-left: 26px; font-size: .84rem; }
.toc a:hover { color: var(--ink); }
.toc a.is-on { color: var(--ink); border-left-color: var(--pink); }
.post-rail .share { flex-direction: column; align-items: stretch; }
.post-rail .share a, .post-rail .share button { text-align: left; }
.prose h2, .prose h3 { scroll-margin-top: 100px; }

.share { display: flex; flex-wrap: wrap; gap: 8px; }
.share a, .share button { font: 600 .82rem var(--font-display); color: var(--ink); background: transparent; border: 1px solid var(--edge); border-radius: 999px; padding: .55em 1.1em; text-decoration: none; cursor: pointer; transition: border-color .2s, color .2s, background-color .2s; }
.share a:hover, .share button:hover { border-color: var(--pink); color: var(--pink); }

/* end of article: author card, then back link and share */
.post-end { max-width: 720px; margin: clamp(56px, 7vw, 88px) 0 0 calc(220px + clamp(40px, 6vw, 96px)); display: grid; gap: 28px; }
.author-card { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 18px; padding: 24px; background: var(--card); border: 1px solid var(--edge); border-radius: 20px; }
.author-card p { color: var(--muted); font-size: .95rem; line-height: 1.55; }
.author-card .author-name { color: var(--ink); font: 600 1.05rem var(--font-display); margin-bottom: 4px; }
.btn-pill { font: 600 .88rem var(--font-display); color: #000; background: var(--pink); padding: .7em 1.3em; border-radius: 999px; text-decoration: none; white-space: nowrap; transition: transform .2s; }
.btn-pill:hover { transform: translateY(-1px); }
[data-theme="light"] .btn-pill, [data-theme="light"] .avatar { color: #fff; }
.end-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.back-link { color: var(--muted); text-decoration: none; font-size: .95rem; transition: color .2s; }
.back-link:hover { color: var(--pink); }

.post-layout.no-toc .toc { display: none; }
@media (max-width: 1000px) {
  .post-layout { grid-template-columns: minmax(0, 1fr); }
  .post-layout > .prose { max-width: 720px; }
  .post-rail { position: static; max-height: none; order: -1; }
  .post-rail .toc { padding: 18px 20px; background: var(--card); border: 1px solid var(--edge); border-radius: 16px; }
  .post-rail .rail-share { display: none; }
  .post-end { margin-left: 0; }
}
@media (max-width: 600px) {
  .post-cover-full { border-radius: 14px; aspect-ratio: 4 / 3; }
  .author-card { grid-template-columns: auto 1fr; }
  .author-card .btn-pill { grid-column: 1 / -1; text-align: center; }
}
@media (prefers-reduced-motion: reduce) { .read-progress { display: none; } }

.prose { color: var(--body-ink); font-size: 1.08rem; line-height: 1.8; overflow-wrap: anywhere; }
.prose > * + * { margin-top: 1.2em; }
.prose h2 { font: 600 1.6rem/1.25 var(--font-display); color: var(--ink); letter-spacing: -0.02em; margin-top: 1.8em; }
.prose h3 { font: 600 1.25rem/1.3 var(--font-display); color: var(--ink); margin-top: 1.5em; }
.prose a { color: var(--cyan); text-underline-offset: 3px; }
.prose strong { color: var(--ink); }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li + li { margin-top: .4em; }
.prose li::marker { color: var(--pink); }
.prose blockquote { border-left: 3px solid var(--pink); padding: .2em 0 .2em 1.2em; color: var(--ink); font-style: italic; }
.prose img { max-width: 100%; height: auto; border-radius: 14px; display: block; margin-inline: auto; border: 1px solid var(--edge); }
.prose p > img { margin-block: .4em; }
.prose u { text-decoration-color: var(--pink); text-underline-offset: 3px; }
.prose em { color: var(--ink); }
.prose code { font: .88em ui-monospace, Consolas, monospace; background: rgba(255,255,255,.07); color: var(--ink); padding: .15em .4em; border-radius: 6px; }
.prose pre { font: .9rem/1.6 ui-monospace, Consolas, monospace; background: var(--card); border: 1px solid var(--edge); color: var(--ink); padding: 18px 20px; border-radius: 14px; overflow-x: auto; white-space: pre-wrap; }
.prose pre code { background: none; padding: 0; }
.prose hr { border: 0; height: 1px; background: var(--edge); margin: 2.4em 0; }
.prose h2 + *, .prose h3 + * { margin-top: .6em; }
[data-theme="light"] .prose code { background: rgba(0,0,0,.06); }
/* older posts saved before the paste filter may still carry inline colours */
.prose [style] { color: inherit !important; background: none !important; font-family: inherit !important; font-size: inherit !important; }
.prose iframe { width: 100%; aspect-ratio: 16 / 9; height: auto; border: 0; border-radius: 14px; }
.prose p:empty { display: none; }

.more { margin-top: 90px; padding-top: 50px; border-top: 1px solid var(--edge); }
.more > h2 { font: 600 1.5rem var(--font-display); margin-bottom: 24px; }

.site-foot { border-top: 1px solid var(--edge); padding: 28px clamp(16px, 4vw, 40px); text-align: center; color: var(--muted); font-size: .88rem; }
.site-foot a { color: var(--muted); text-decoration: none; }
.site-foot a:hover { color: var(--cyan); }
