/* Blog — index listing + article view.
   Built entirely from the existing design system: .container, .eyebrow, the
   type scale (--fs-*), text ladder (--text-*), borders, accents and spacing
   tokens. No new colors, fonts or primitives. */

/* ── Index ── */
.blog {
  padding: var(--space-section-md) 0 var(--space-section-lg);
}
.blog-inner {
  max-width: 760px;
}
.blog .eyebrow {
  margin-bottom: 16px;
}
.blog-title {
  font-size: var(--fs-display);
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: var(--lh-tight);
  color: var(--text-strong);
  margin-bottom: 18px;
}
.blog-lede {
  font-size: var(--fs-lg);
  line-height: var(--lh-base);
  color: var(--text-muted);
  max-width: 58ch;
  margin-bottom: 52px;
}
.blog-list {
  display: flex;
  flex-direction: column;
}
.blog-card {
  display: flex;
  gap: 28px;
  align-items: center;
  padding: 28px 0;
  border-top: 1px solid var(--border-hairline);
  color: inherit;
}
.blog-card:last-child {
  border-bottom: 1px solid var(--border-hairline);
}
.blog-card-cover {
  flex: 0 0 200px;
  aspect-ratio: 16 / 10;
  background: var(--surface-1);
  border: 1px solid var(--border-hairline);
  overflow: hidden;
}
.blog-card-cover img {
  display: block;
  width: 100%;
  height: 100%;
}
.blog-card-text {
  flex: 1;
  min-width: 0;
}
.blog-card-meta {
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  letter-spacing: 0.02em;
  color: var(--text-tertiary);
  margin-bottom: 10px;
}
.blog-card-title {
  font-size: var(--fs-h3);
  font-weight: 700;
  line-height: var(--lh-tight);
  letter-spacing: -0.01em;
  color: var(--text-strong);
  margin-bottom: 10px;
  transition: color var(--t-base);
}
.blog-card:hover .blog-card-title,
.blog-card:focus-visible .blog-card-title {
  color: var(--accent-primary-3);
}
.blog-card-excerpt {
  font-size: var(--fs-md);
  line-height: var(--lh-base);
  color: var(--text-muted);
  max-width: 64ch;
}
.blog-card-more {
  display: inline-block;
  margin-top: 14px;
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--accent-primary);
}
.blog-empty {
  padding: 28px 0;
  border-top: 1px solid var(--border-hairline);
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  letter-spacing: 0.02em;
  color: var(--text-tertiary);
}

/* ── Article ── */
.blog-post {
  padding: var(--space-section-md) 0 var(--space-section-lg);
}
.blog-post-inner {
  max-width: 720px;
}
.blog-post-back {
  display: inline-block;
  margin-bottom: 28px;
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  color: var(--text-tertiary);
}
.blog-post-back:hover {
  color: var(--accent-primary-3);
}
.blog-post .eyebrow {
  margin-bottom: 16px;
}
.blog-post-title {
  font-size: var(--fs-display);
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: var(--lh-tight);
  color: var(--text-strong);
  margin-bottom: 18px;
}
.blog-post-meta {
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  letter-spacing: 0.02em;
  color: var(--text-tertiary);
  margin-bottom: 44px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--border-hairline);
}
.blog-post-cover {
  height: 260px;
  margin-bottom: 44px;
  background: var(--surface-1);
  border: 1px solid var(--border-hairline);
}
.blog-post-cover img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 28px;
}

/* Live 3D CSS cube — ported from the gea css-3d-cube example
   (examples/css-3d-cube/styles.css): the same faces, the same @keyframes
   cube-spin, the same grid stage. Scoped to the post hero and sized for the box. */
@font-face {
  font-family: 'Bebas Neue';
  font-style: normal;
  font-weight: 400;
  src: url('../fonts/bebas-neue-400.ttf') format('truetype');
  font-display: swap;
}
.cube-demo {
  position: relative;
  height: 340px;
  overflow: hidden;
  background-color: #12130f;
  background-image: linear-gradient(135deg, #12130f 0%, #171b14 45%, #251a15 100%);
}
.cube-demo .stage-scene {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  perspective: 520px;
  perspective-origin: 50% 30%;
  pointer-events: none;
}
.cube-demo .stage-wall {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 54%;
  background-image:
    linear-gradient(90deg, rgba(140, 232, 196, 0.11) 1px, transparent 1px),
    linear-gradient(to top, rgba(140, 232, 196, 0.08) 1px, transparent 1px),
    linear-gradient(180deg, #090a07 0%, #161c14 100%);
  background-size: 38px 38px, 38px 38px, 100% 100%;
  background-position: 0 0, 0 100%, 0 0;
}
.cube-demo .stage-floor {
  position: absolute;
  left: 0;
  right: 0;
  top: 54%;
  bottom: -45%;
  transform-origin: 50% 0%;
  transform: rotateX(73deg);
  background-image:
    linear-gradient(90deg, rgba(255, 241, 118, 0.16) 1px, transparent 1px),
    linear-gradient(rgba(255, 241, 118, 0.13) 1px, transparent 1px),
    linear-gradient(180deg, #241a12 0%, #090a07 100%);
  background-size: 38px 38px, 38px 38px, 100% 100%;
}
.cube-demo .stage-horizon {
  position: absolute;
  left: 0;
  right: 0;
  top: 54%;
  height: 2px;
  transform: translateY(-1px);
  background: linear-gradient(90deg, rgba(140, 232, 196, 0) 0%, rgba(140, 232, 196, 0.5) 50%, rgba(140, 232, 196, 0) 100%);
}
.cube-demo .cube-stage {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  transform: translateY(26px);
}
.cube-demo .cube-wrap {
  --cube-size: clamp(140px, 22vw, 196px);
  position: relative;
  width: var(--cube-size);
  height: var(--cube-size);
  perspective: 900px;
  perspective-origin: 48% 42%;
  animation: stage-float 5.8s ease-in-out infinite alternate;
}
.cube-demo .cube {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  animation: cube-spin 10s cubic-bezier(0.62, 0, 0.28, 1) infinite;
}
.cube-demo .cube-face {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 246, 232, 0.42);
  backface-visibility: visible;
}
.cube-demo .cube-face-label {
  color: #12130fbd;
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(24px, 4.4vw, 38px);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.cube-demo .cube-face--front {
  background: linear-gradient(145deg, rgba(255, 241, 118, 0.72), rgba(255, 128, 97, 0.7));
  transform: rotateY(0deg) translateZ(calc(var(--cube-size) / 2));
}
.cube-demo .cube-face--back {
  background: linear-gradient(145deg, rgba(49, 211, 196, 0.7), rgba(93, 196, 110, 0.7));
  transform: rotateY(180deg) translateZ(calc(var(--cube-size) / 2));
}
.cube-demo .cube-face--right {
  background: linear-gradient(145deg, rgba(255, 128, 97, 0.7), rgba(231, 86, 128, 0.7));
  transform: rotateY(90deg) translateZ(calc(var(--cube-size) / 2));
}
.cube-demo .cube-face--left {
  background: linear-gradient(145deg, rgba(140, 232, 196, 0.7), rgba(255, 241, 118, 0.68));
  transform: rotateY(-90deg) translateZ(calc(var(--cube-size) / 2));
}
.cube-demo .cube-face--top {
  background: linear-gradient(145deg, rgba(255, 246, 232, 0.72), rgba(140, 232, 196, 0.7));
  transform: rotateX(90deg) translateZ(calc(var(--cube-size) / 2));
}
.cube-demo .cube-face--bottom {
  background: linear-gradient(145deg, rgba(36, 35, 28, 0.76), rgba(255, 128, 97, 0.56));
  transform: rotateX(-90deg) translateZ(calc(var(--cube-size) / 2));
}
@keyframes cube-spin {
  0% {
    transform: rotateX(-18deg) rotateY(24deg) rotateZ(0deg);
  }
  45% {
    transform: rotateX(44deg) rotateY(188deg) rotateZ(5deg);
  }
  100% {
    transform: rotateX(342deg) rotateY(384deg) rotateZ(0deg);
  }
}
@keyframes stage-float {
  from {
    transform: translateY(-18px) scale(0.94);
  }
  to {
    transform: translateY(-6px) scale(0.98);
  }
}
@media (prefers-reduced-motion: reduce) {
  .cube-demo .cube,
  .cube-demo .cube-wrap {
    animation-play-state: paused;
  }
}

/* Inline figures. Diagrams ship as standalone, self-contained SVGs (the site
   fonts are embedded in the file) so they stay portable if the post is moved —
   referenced as <img>, never inlined. They bake the dark scheme, matching the
   site's always-dark code surfaces. */
.blog-fig {
  margin: 36px 0;
}
.blog-fig img {
  display: block;
  width: 100%;
  height: auto;
  margin: 0 auto;
  border: 1px solid var(--border-hairline);
}
.blog-fig figcaption {
  margin-top: 12px;
  font-size: var(--fs-sm);
  line-height: var(--lh-base);
  color: var(--text-tertiary);
}
/* Device renders sit centered on the page (transparent PNG/WebP), grounded by a
   soft shadow — narrower than the column, no frame. */
.blog-fig.is-device {
  text-align: center;
}
.blog-fig.is-device img {
  width: auto;
  max-width: 260px;
  margin: 0 auto;
  border: 0;
  filter: drop-shadow(0 18px 40px rgba(0, 0, 0, 0.45));
}

/* Embedded demo video — the same click-to-load YouTube facade as the home page
   (js/video.js + .demo-frame). Kept under its own wrapper so the .blog-fig img
   rule above doesn't clobber the absolutely-positioned poster. */
.blog-video {
  margin: 36px 0;
}
.blog-video figcaption {
  margin-top: 12px;
  font-size: var(--fs-sm);
  line-height: var(--lh-base);
  color: var(--text-tertiary);
}
.blog-video .demo-frame {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius);
  background: #08080c;
  cursor: pointer;
}
.blog-video .demo-poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.5;
  transition: opacity var(--t-base), transform var(--t-slow);
}
.blog-video .demo-frame:hover .demo-poster {
  opacity: 0.62;
  transform: scale(1.02);
}
.blog-video .demo-play {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 76px;
  height: 76px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding-left: 4px;
  color: #fff;
  background: var(--accent-primary);
  border-radius: 50%;
  box-shadow: 0 10px 30px -8px rgba(0, 0, 0, 0.6);
  transition: background var(--t-base), transform var(--t-base);
}
.blog-video .demo-frame:hover .demo-play {
  background: var(--accent-primary-hover);
  transform: scale(1.06);
}
.blog-video .demo-tag {
  position: absolute;
  left: 16px;
  bottom: 14px;
  font-size: var(--fs-2xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.85);
}
.blog-video .demo-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
@media (max-width: 720px) {
  .blog-video .demo-play {
    width: 60px;
    height: 60px;
  }
}
.blog-post-body {
  font-size: var(--fs-lg);
  line-height: var(--lh-base);
  color: var(--text-muted);
}
.blog-post-body > p {
  margin-bottom: 24px;
}
.blog-post-body > p:first-of-type {
  font-size: var(--fs-xl);
  color: var(--text-secondary);
}
.blog-post-body h2 {
  font-size: var(--fs-h2);
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: var(--lh-tight);
  color: var(--text-strong);
  margin: 48px 0 18px;
}
.blog-post-body h3 {
  font-size: var(--fs-h3);
  font-weight: 700;
  color: var(--text-strong);
  margin: 32px 0 14px;
}
.blog-post-body ul,
.blog-post-body ol {
  padding-left: 24px;
  margin-bottom: 24px;
}
.blog-post-body ul {
  list-style: disc;
}
.blog-post-body ol {
  list-style: decimal;
}
.blog-post-body li {
  margin-bottom: 10px;
}
.blog-post-body li::marker {
  color: var(--text-faint);
}
.blog-post-body strong {
  color: var(--text-strong);
  font-weight: 600;
}
.blog-post-body a {
  color: var(--accent-primary);
}
.blog-post-body a:hover {
  color: var(--accent-primary-3);
}
.blog-post-body code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  padding: 2px 6px;
  background: var(--surface-2);
  border: 1px solid var(--border-hairline);
  color: var(--text-secondary);
}
.blog-post-body blockquote {
  margin: 28px 0;
  padding: 4px 0 4px 22px;
  border-left: 2px solid var(--border-strong);
  color: var(--text-secondary);
  font-size: var(--fs-xl);
}
/* Code blocks reuse the hero code-window surface — same always-dark code
   aesthetic as the rest of the site, no new design language. */
.blog-post-body pre {
  margin: 28px 0;
  padding: 18px 20px;
  background: #12141d;
  border: 1px solid #20232e;
  overflow-x: auto;
  line-height: var(--lh-mono);
}
.blog-post-body pre code {
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  color: #e8eaf2;
  background: none;
  border: 0;
  padding: 0;
}
/* Build-time syntax highlighting (see build.mjs highlightCode). The code surface
   is always dark, so these are fixed dark values, not themed tokens. */
.blog-post-body pre .tok-com {
  color: #6a6a74;
  font-style: italic;
}
.blog-post-body pre .tok-kw,
.blog-post-body pre .tok-sel {
  color: #8c97ff;
}
.blog-post-body pre .tok-typ,
.blog-post-body pre .tok-fn,
.blog-post-body pre .tok-prop {
  color: #6bd3c4;
}
.blog-post-body pre .tok-str {
  color: #c9e29a;
}
.blog-post-body pre .tok-num {
  color: #e0a93d;
}
.blog-post-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 28px 0;
  font-size: var(--fs-md);
}
.blog-post-body th,
.blog-post-body td {
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-hairline);
}
.blog-post-body th {
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-strong);
}
.blog-post-body thead th {
  border-bottom-color: var(--border-strong);
}
.blog-post-body td {
  color: var(--text-muted);
}
.blog-post-author {
  margin-top: 56px;
  padding-top: 28px;
  border-top: 1px solid var(--border-hairline);
}
.blog-post-byline {
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  letter-spacing: 0.02em;
  color: var(--text-tertiary);
  margin-bottom: 12px;
}
.blog-post-byline strong {
  color: var(--text-secondary);
  font-weight: 600;
}
.blog-post-cta {
  font-size: var(--fs-lg);
  line-height: var(--lh-base);
  color: var(--text-secondary);
  max-width: 58ch;
}
.blog-post-author a {
  color: var(--accent-primary);
}
.blog-post-author a:hover {
  color: var(--accent-primary-3);
}

@media (max-width: 640px) {
  .blog,
  .blog-post {
    padding: var(--space-section-sm) 0 var(--space-section-md);
  }
  .blog-card {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
  }
  .blog-card-cover {
    flex-basis: auto;
  }
}
