:root {
  --bg: #f5f4f0;
  --text: #222;
  --text-sub: #555;
  --text-muted: #999;
  --accent: #bfab90;
  --white: #fdfcf9;
  --border: rgba(0,0,0,0.07);
  --nav-blur: rgba(245,244,240,0.75);
  --max-w: 720px;
}

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

@keyframes shimmer-sweep {
  0% {
    background-position: 80% center;
    animation-timing-function: cubic-bezier(0.75, 0, 0.15, 1);
  }
  55%          { background-position: 20% center; }
  55.01%, 100% { background-position: 80% center; }
}
html { scroll-behavior: smooth; font-size: 16px; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
/* main content area always grows to push footer down */
.blog-page,
.blog-post { flex: 1; }

/* ── NAV ── */
.blog-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 200;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 4.4rem; padding: 0 3rem;
  background: var(--nav-blur);
  backdrop-filter: blur(20px) saturate(1.5);
  -webkit-backdrop-filter: blur(20px) saturate(1.5);
  border-bottom: 1px solid transparent;
  transition: border-color .4s;
}
.blog-nav.scrolled { border-bottom-color: var(--border); }

.blog-nav-logo {
  font-size: .78rem;
  font-weight: 500;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-sub);
  text-decoration: none;
  line-height: 1;
  transition: color .25s;
}
.blog-nav-logo:hover { color: var(--text-sub); }

.blog-nav-links {
  display: flex;
  align-items: center;
  gap: 2.5rem;
  list-style: none;
}
.blog-nav-links a {
  font-size: .72rem;
  font-weight: 400;
  letter-spacing: .1em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--text-sub);
  position: relative;
  transition: color .25s;
}
.blog-nav-links a::after {
  content: '';
  position: absolute;
  bottom: -2px; left: 0;
  width: 0; height: 1px;
  background: var(--text);
  transition: width .4s cubic-bezier(.16,1,.3,1);
}
.blog-nav-links a:hover,
.blog-nav-links a.active { color: var(--text); }
.blog-nav-links a.active::after,
.blog-nav-links a:hover::after { width: 100%; }
.blog-nav-links li.active {
  font-size: .72rem;
  font-weight: 400;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text);
}
.nav-current {
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text);
}

/* Hamburger button */
.blog-hamburger {
  display: none;
  background: none; border: none; cursor: pointer; padding: 0;
  width: 24px; height: 16px;
  position: relative; flex-shrink: 0;
  color: currentColor;
}
.blog-hamburger span {
  display: block;
  width: 100%; height: 1.5px;
  background: currentColor;
  border-radius: 2px;
  position: absolute; left: 0;
  transition: all .35s cubic-bezier(.16,1,.3,1);
}
.blog-hamburger span:nth-child(1) { top: 0; }
.blog-hamburger span:nth-child(2) { top: 50%; transform: translateY(-50%); }
.blog-hamburger span:nth-child(3) { bottom: 0; }
.blog-hamburger.open span:nth-child(1) { top: 50%; transform: translateY(-50%) rotate(45deg); }
.blog-hamburger.open span:nth-child(2) { opacity: 0; transform: translateY(-50%) scaleX(0); }
.blog-hamburger.open span:nth-child(3) { bottom: 50%; transform: translateY(50%) rotate(-45deg); }

/* Mobile nav overlay — same dark full-screen style as portfolio.html */
.blog-nav-mobile {
  position: fixed; inset: 0;
  background: rgba(10,7,5,0.97);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 2.8rem;
  z-index: 300;
  opacity: 0; pointer-events: none;
  transition: opacity .4s cubic-bezier(.16,1,.3,1);
}
.blog-nav-mobile.open { opacity: 1; pointer-events: all; }
.blog-nav-mobile a {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Roboto, Helvetica, Arial, sans-serif;
  font-size: clamp(2rem, 8vw, 3rem);
  font-weight: 400;
  letter-spacing: -.01em;
  text-decoration: none;
  color: rgba(240,237,232,0.55);
  transition: color .3s;
}
.blog-nav-mobile a:hover,
.blog-nav-mobile a.active { color: #d4a843; }
.nav-current-mobile {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Roboto, Helvetica, Arial, sans-serif;
  font-size: clamp(2rem, 8vw, 3rem);
  font-weight: 600;
  letter-spacing: -.01em;
  color: rgba(240,237,232,0.92);
}

/* ── PAGE WRAPPER ── */
.blog-page {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 5rem 2rem 3rem;
}

/* ── LIST PAGE HEADER ── */
.blog-header {
  margin-bottom: 3.5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
  transition: opacity .28s ease, transform .32s cubic-bezier(.16,1,.3,1);
}
.blog-header h1 {
  font-size: 2rem;
  font-weight: 500;
  letter-spacing: -.02em;
  color: var(--text);
  margin-bottom: .5rem;
}
.blog-header p {
  font-size: .9rem;
  color: var(--text-muted);
}

/* ── CARD LIST ── */
.blog-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.blog-card {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto auto;
  column-gap: 1.5rem;
  padding: 2rem 0;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
  transition: opacity .2s;
}
.blog-card { opacity: .82; transition: opacity .2s; }
.blog-card:hover { opacity: 1; }
.blog-card:first-child { padding-top: 0; }

.blog-card-tags {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  margin-bottom: .75rem;
}
.blog-card-tag {
  font-size: .65rem;
  font-weight: 500;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--accent);
}
.blog-card-tag::before { content: '#'; }

.blog-card-title {
  grid-column: 1;
  grid-row: 2;
  font-size: 1.15rem;
  font-weight: 500;
  letter-spacing: -.01em;
  color: #333;
  line-height: 1.45;
  margin-bottom: .6rem;
  transition: color .2s;
}
.blog-card:hover .blog-card-title { color: var(--text); }

.blog-card-excerpt {
  grid-column: 1;
  grid-row: 3;
  font-size: .875rem;
  color: var(--text-muted);
  line-height: 1.7;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.blog-card-date {
  grid-column: 2;
  grid-row: 1;
  text-align: right;
  font-size: .72rem;
  color: var(--text-muted);
  letter-spacing: .04em;
  white-space: nowrap;
}

.shimmer-wrap {
  position: relative;
  overflow: hidden;
  border-radius: 6px;
  background: #e8e5df;
  display: block;
}
.shimmer-wrap::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, rgba(255,255,255,0) 41%, rgba(255,255,255,0.5) 50%, rgba(255,255,255,0) 59%);
  background-size: 400% 100%;
  background-repeat: no-repeat;
  animation: shimmer-sweep 4s infinite;
  pointer-events: none;
}
.shimmer-wrap.img-loaded::after {
  opacity: 0;
  animation: none;
}

.blog-card-cover-wrap {
  grid-column: 2;
  grid-row: 2 / 4;
  width: 120px;
  height: 100%;
}
.blog-card-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 6px;
  display: block;
  background: transparent;
}

/* ── POST PAGE ── */
.blog-post { width: 100%; max-width: var(--max-w); margin: 0 auto; padding: 5rem 2rem 3rem; }

.blog-breadcrumb {
  font-size: .72rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 2.5rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.blog-breadcrumb a { color: var(--text-muted); text-decoration: none; transition: color .2s; }
.blog-breadcrumb a:hover { color: var(--text); }
.blog-breadcrumb svg { width: 12px; height: 12px; opacity: .5; }

.post-tags {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.post-tag {
  font-size: .65rem;
  font-weight: 500;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--accent);
}
.post-tag::before { content: '#'; }

.post-title {
  font-size: 2rem;
  font-weight: 500;
  letter-spacing: -.025em;
  line-height: 1.3;
  color: var(--text);
  margin-bottom: .75rem;
}

.post-date {
  font-size: .78rem;
  color: var(--text-muted);
  margin-bottom: 3rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

/* ── PROSE ── */
.post-content {
  font-size: .975rem;
  line-height: 1.85;
  color: var(--text-sub);
  user-select: text;
  -webkit-user-select: text;
}
.post-content h2 {
  font-size: 1.2rem;
  font-weight: 500;
  color: var(--text);
  letter-spacing: -.01em;
  margin: 2.5rem 0 .9rem;
}
.post-content h3 {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text);
  margin: 2rem 0 .6rem;
}
.post-content p { margin-bottom: 1.35rem; }
.post-content a { color: var(--text); border-bottom: 1px solid var(--accent); text-decoration: none; }
.post-content a:hover { opacity: .7; }
.post-content ul, .post-content ol {
  margin: 0 0 1.35rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: .4rem;
}
.post-content .shimmer-wrap {
  border-radius: 8px;
  margin: 1.5rem 0;
  min-height: 80px;
}
.post-content img {
  width: 100%;
  border-radius: 8px;
  display: block;
}
.post-content code {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: .82rem;
  background: rgba(0,0,0,.05);
  padding: .15em .4em;
  border-radius: 3px;
  color: var(--text);
}
.post-content pre {
  background: #f0ede8;
  border-radius: 8px;
  padding: 1.2rem 1.5rem;
  overflow-x: auto;
  margin: 1.5rem 0;
}
.post-content pre code {
  background: none;
  padding: 0;
  font-size: .82rem;
  line-height: 1.7;
}
.post-content blockquote {
  border-left: 2px solid var(--accent);
  padding-left: 1.2rem;
  color: var(--text-muted);
  margin: 1.5rem 0;
  font-style: italic;
}

/* ── TABLES ── */
.post-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: .875rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.post-content th {
  background: #f0ede8;
  padding: 12px 16px;
  text-align: left;
  font-weight: 500;
  color: var(--text);
  border-bottom: 1px solid var(--border);
}
.post-content td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.post-content tr:last-child td { border-bottom: none; }
.post-content tbody tr:hover { background: rgba(240, 237, 232, 0.5); }

/* ── CALLOUT BOXES ── */
.callout {
  background: #f0ede8;
  border-left: 3px solid var(--accent);
  padding: 1rem 1.2rem;
  margin: 1.8rem 0;
  border-radius: 0 6px 6px 0;
}
.callout.highlight {
  background: #e8f0ed;
  border-left-color: #8faeae;
}

/* ── CHECKLIST ── */
.checklist {
  list-style: none;
  margin-left: 0;
}
.checklist li {
  position: relative;
  padding-left: 1.5rem;
  margin-bottom: .5rem;
}
.checklist li::before {
  content: '☐';
  position: absolute;
  left: 0;
  color: var(--accent);
}

/* ── PHASE ── */
.phase {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.2rem 1.5rem;
  margin: 1.5rem 0;
}
.phase-title {
  font-size: .85rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: .8rem;
  letter-spacing: .02em;
}
.phase-title span {
  font-weight: 400;
  color: var(--text-muted);
  font-size: .78rem;
}

/* ── POST SHARE ── */
.post-share {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}
.post-share-eyebrow {
  font-size: .65rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 1rem;
}
.post-share-links {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  justify-content: flex-start;
}
.post-share-link {
  display: flex;
  text-decoration: none;
  color: var(--text-sub);
  transition: color .3s;
}
.post-share-link:hover { color: var(--text); }
.post-share-icon {
  width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--white);
  display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden;
  transition: border-color .35s, transform .35s cubic-bezier(.16,1,.3,1);
}
.post-share-icon::before {
  content: '';
  position: absolute; top: 50%; left: 50%;
  width: 100%; height: 100%; border-radius: 50%;
  background: var(--brand, #000);
  transform: translate(-50%, -50%) scale(0);
  transition: transform .45s cubic-bezier(.16,1,.3,1);
}
.post-share-link:hover .post-share-icon { border-color: var(--brand, rgba(0,0,0,.12)); }
.post-share-link:hover .post-share-icon::before { transform: translate(-50%, -50%) scale(1); }
.post-share-icon img {
  width: 15px; height: 15px;
  position: relative; z-index: 1;
  filter: grayscale(1) opacity(.45);
  transition: filter .35s;
}
.post-share-link:hover .post-share-icon img { filter: brightness(0) invert(1); }

/* ── FOOTER ── */
.blog-footer {
  padding: 1.8rem 3rem;
  font-size: .65rem;
  letter-spacing: .1em;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  text-align: center;
}

/* ── LOADING / EMPTY ── */
.blog-loading, .blog-empty {
  text-align: center;
  color: var(--text-muted);
  font-size: .875rem;
  padding: 5rem 0;
}
/* infinite scroll trigger */
.blog-sentinel { height: 1px; }

/* ── RESPONSIVE ── */
@media (max-width: 640px) {
  .blog-nav { height: 3.8rem; padding: 0 1.5rem; }
  .blog-nav-links { display: none; }
  .blog-hamburger { display: flex; }
  .blog-page, .blog-post { padding: 4.8rem 1.5rem 2.5rem; }
  .blog-header h1 { font-size: 1.5rem; }
  .post-title { font-size: 1.5rem; }
  .blog-card { grid-template-columns: 1fr; }
  .blog-card-date { text-align: left; }
  .blog-card-cover-wrap { display: none; }
  .post-cta { flex-direction: column; align-items: flex-start; }
  .blog-footer { padding: 1.5rem; }}

/* ── CUSTOM CURSOR ── */
body { cursor: none; }
#cursor {
  position: fixed; width: 8px; height: 8px; border-radius: 50%;
  background: rgba(0,0,0,.55); pointer-events: none; z-index: 10100;
  transform: translate(-50%,-50%);
  will-change: transform;
  transition: width .35s cubic-bezier(.16,1,.3,1), height .35s cubic-bezier(.16,1,.3,1), background .35s, opacity .2s;
}
#cursor.on-dark { background: #4A90FF; }
#cursor-ring {
  position: fixed; width: 32px; height: 32px; border-radius: 50%;
  border: 1px solid rgba(34,34,34,.22); pointer-events: none; z-index: 10099;
  transform: translate(-50%,-50%);
  will-change: transform;
  transition: all .2s cubic-bezier(.16,1,.3,1);
}
body.cursor-hover #cursor-ring { opacity: 0; }
/* Restore default cursor on touch devices */
@media (pointer: coarse) {
  body { cursor: auto; }
  #cursor, #cursor-ring { display: none; }
}
