/* ClawBank — blog index + posts (tokens.css + IBM Plex + local display fonts) */

@font-face {
  font-family: 'PP Nikkei Pacific';
  src: url('fonts/PPNikkeiPacific-Regular.otf') format('opentype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Tiempos Headline';
  src: url('fonts/TiemposHeadline-Medium.otf') format('opentype');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Tiempos Headline';
  src: url('fonts/TiemposHeadline-MediumItalic.otf') format('opentype');
  font-weight: 500;
  font-style: italic;
  font-display: swap;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body.blog-body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-mono);
  font-weight: 300;
  font-size: 14px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* Grain overlay */
body.blog-body::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='256' height='256'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: 0.032;
  pointer-events: none;
  z-index: 9000;
}

a { color: inherit; text-decoration: none; }

/* ── Reading progress bar (post pages only) ───────────────────── */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 0%;
  background: var(--accent);
  z-index: 9999;
  transition: width 0.08s linear;
  pointer-events: none;
}

/* Top bar styles live in nav.css (shared component) */

/* ── Main column ──────────────────────────────────────────────── */
.blog-main {
  max-width: 720px;
  margin: 0 auto;
  padding: 72px 32px 120px;
  position: relative;
  z-index: 1;
}

/* Blog index gets a wider canvas for the tile grid */
.blog-main--index {
  max-width: 1160px;
}

/* ── Blog index masthead ──────────────────────────────────────── */
.blog-masthead {
  margin-bottom: 56px;
  padding-bottom: 40px;
  border-bottom: 1px solid var(--border);
}

.blog-kicker {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}
.blog-kicker::before {
  content: '';
  display: inline-block;
  width: 20px;
  height: 1px;
  background: var(--accent);
  flex-shrink: 0;
}

.blog-page-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 2.75rem);
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: -0.025em;
  margin-bottom: 16px;
}

.blog-lede {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.75;
  max-width: 52ch;
}

/* ── Post list — tiled grid (~6 visible at a time on desktop) ── */
.blog-list {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
@media (max-width: 960px) {
  .blog-list { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .blog-list { grid-template-columns: 1fr; }
}

/* Tile card — cover on top, text below */
.blog-card--tile {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 0;
}
.blog-card--tile .blog-card-cover {
  width: 100%;
  /* Match the 21:9 frame used by the featured card and post hero,
     so covers render uncropped everywhere. */
  aspect-ratio: 21 / 9;
  overflow: hidden;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.blog-card--tile .blog-card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.5s ease;
}
.blog-card--tile:hover .blog-card-cover img {
  transform: scale(1.04);
}
/* Fallback cover for posts without an image */
.blog-card--tile .blog-card-cover--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  font-family: var(--font-display);
  font-size: 2rem;
  opacity: 0.45;
}
.blog-card--tile .blog-card-inner {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 20px 22px 22px;
}
.blog-card--tile .blog-card-title {
  font-size: 1.02rem;
  line-height: 1.3;
  margin-bottom: 8px;
}
.blog-card--tile .blog-card-desc {
  font-size: 11.5px;
  margin-top: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Base card */
.blog-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 2px solid transparent;
  border-radius: 2px;
  padding: 24px 28px;
  transition: border-color 0.18s, border-left-color 0.18s, background 0.18s;
  position: relative;
  overflow: hidden;
}
.blog-card:hover {
  border-color: var(--border-hi);
  border-left-color: var(--accent);
  background: var(--surface-2);
}

/* Featured card — first post gets elevated treatment */
.blog-card--featured {
  padding: 32px 32px 28px;
  border-left: 2px solid var(--accent);
}
.blog-card--featured:hover {
  background: #161412;
}
.blog-card--featured .blog-card-title {
  font-size: clamp(1.2rem, 2.5vw, 1.5rem);
  margin-bottom: 10px;
}
.blog-card--featured .blog-card-desc {
  font-size: 13px;
  max-width: 58ch;
  margin-top: 10px;
  line-height: 1.65;
}

.blog-card-inner {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.blog-card-pip {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  margin-top: 7px;
  opacity: 0.7;
}

.blog-card-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 400;
  color: var(--text);
  margin-bottom: 6px;
  letter-spacing: -0.015em;
  transition: color 0.18s;
}
.blog-card:hover .blog-card-title { color: #fff; }

.blog-card-meta {
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.blog-card-read {
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  opacity: 0.6;
}

.blog-card-meta-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 0;
}
.blog-card-meta-row .sep {
  color: var(--border-hi);
  font-size: 10px;
}

.blog-card-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-top: 8px;
  max-width: 54ch;
}

/* ── Cover image on featured card ────────────────────────────── */
.blog-card--featured .blog-card-cover {
  /* Bleed out of the card padding */
  width:  calc(100% + 64px);
  margin: -32px -32px 28px;
  aspect-ratio: 21 / 9;
  overflow: hidden;
  border-radius: 1px 1px 0 0;
  background: var(--surface-2);
}
.blog-card--featured .blog-card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.5s ease;
}
.blog-card--featured:hover .blog-card-cover img {
  transform: scale(1.03);
}

/* ── Thumbnail on regular cards ───────────────────────────────── */
.blog-card-inner--with-thumb {
  justify-content: space-between;
  align-items: flex-start;
}
.blog-card-thumb {
  flex-shrink: 0;
  width: 220px;
  height: 148px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: var(--surface-2);
  margin-left: 28px;
}
.blog-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}
.blog-card:hover .blog-card-thumb img {
  transform: scale(1.05);
}

/* ── Post cover image hero ────────────────────────────────────── */
.post-cover {
  width: 100%;
  aspect-ratio: 21 / 9;
  overflow: hidden;
  margin-bottom: 48px;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: var(--surface-2);
}
.post-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ── Inline images & figures in prose ────────────────────────── */
.post-prose img {
  max-width: 100%;
  height: auto;
  display: block;
  border: 1px solid var(--border);
  border-radius: 2px;
  margin: 2em auto;
}

.post-prose figure {
  margin: 2.5em 0;
}
.post-prose figure img {
  width: 100%;
  margin: 0; /* figure provides spacing */
}
.post-prose figcaption {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  line-height: 1.5;
  margin-top: 8px;
  padding-left: 2px;
  opacity: 0.8;
}

/* ── Scroll entrance animations ──────────────────────────────── */

/* Cards start invisible — class added by JS so no-JS users see content */
.blog-card.anim-ready {
  opacity: 0;
  transform: translateY(28px);
}
.blog-card.anim-ready.is-visible {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.45s ease, transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Typewriter cursor */
.typer-cursor {
  display: inline-block;
  color: var(--accent);
  font-weight: 300;
  margin-left: 1px;
  animation: cursor-blink 0.6s step-end infinite;
}
@keyframes cursor-blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}


/* ── Loading / empty states ───────────────────────────────────── */
.blog-loading,
.blog-empty {
  list-style: none;
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  padding: 40px 0;
}

/* ── Article layout ───────────────────────────────────────────── */
.post-crumbs {
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 32px;
  display: flex;
  align-items: center;
  gap: 0;
}
.post-crumbs a {
  color: var(--text-muted);
  transition: color 0.18s;
}
.post-crumbs a:hover { color: var(--accent); }
.post-crumbs .sep {
  opacity: 0.3;
  padding: 0 0.5em;
  font-size: 10px;
}

/* Post header */
.post-header {
  margin-bottom: 48px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--border);
}

.post-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 400;
  line-height: 1.08;
  letter-spacing: -0.025em;
  margin-bottom: 20px;
}

.post-meta-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.post-date {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.post-read-time {
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  opacity: 0.7;
}

.post-meta-sep {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--border-hi);
  flex-shrink: 0;
}

/* Prose body */
.post-prose {
  font-size: 14px;
  line-height: 1.85;
  color: var(--text);
}
.post-prose > * + * { margin-top: 1.25em; }

.post-prose h2 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 400;
  margin-top: 2.5em;
  margin-bottom: 0.6em;
  letter-spacing: -0.02em;
  padding-left: 14px;
  border-left: 2px solid var(--accent);
  color: var(--text);
}

.post-prose h3 {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-top: 2em;
  margin-bottom: 0.4em;
}

.post-prose p { color: rgba(240, 237, 230, 0.88); }

.post-prose a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  transition: opacity 0.18s;
}
.post-prose a:hover { opacity: 0.8; }

.post-prose ul,
.post-prose ol {
  padding-left: 1.4em;
  margin-top: 0.75em;
}
.post-prose li { margin-top: 0.4em; color: rgba(240, 237, 230, 0.88); }
.post-prose ul { list-style: disc; }

.post-prose code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  padding: 0.14em 0.4em;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 2px;
  color: var(--text);
}

.post-prose pre {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 20px 24px;
  overflow-x: auto;
  margin-top: 1.5em;
}
.post-prose pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 13px;
  line-height: 1.6;
}

.post-prose table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1.5em;
  font-size: 13px;
  line-height: 1.6;
}
.post-prose th {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-align: left;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
}
.post-prose td {
  padding: 10px 14px;
  border: 1px solid var(--border);
  color: rgba(240, 237, 230, 0.88);
  vertical-align: top;
}

/* Pull quote */
.post-prose blockquote {
  border-left: 2px solid var(--accent);
  padding: 4px 0 4px 20px;
  margin: 2em 0;
}
.post-prose blockquote p {
  font-family: var(--font-italic);
  font-style: italic;
  font-size: 1.1em;
  line-height: 1.6;
  color: var(--text);
  opacity: 0.9;
}

/* ── Post page entrance animation ────────────────────────────── */
.post-body-reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.55s ease, transform 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}
.post-body-reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ── Post footer ──────────────────────────────────────────────── */
.post-footer-nav {
  margin-top: 64px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
}

.post-back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  transition: color 0.18s, gap 0.18s;
  padding: 10px 0;
}
.post-back-link:hover {
  color: var(--text);
  gap: 12px;
}
.post-back-link::before {
  content: '←';
  font-size: 13px;
  transition: transform 0.18s;
}
.post-back-link:hover::before {
  transform: translateX(-3px);
}

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 540px) {
  .blog-top  { padding: 0 20px; }
  .blog-main { padding: 48px 20px 80px; }
  .blog-masthead { margin-bottom: 40px; padding-bottom: 32px; }
  .post-title { font-size: 1.75rem; }
}
