/* ==========================================================================
   Lumiere — blog: the index (/blog), the articles (/blog/<slug>) and the cards the
   home page borrows. Pages are generated by tools/build_blog.py.
   ========================================================================== */

/* ---- Cards (index, "Keep reading", home) --------------------------------- */
.pcards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.pcard {
  display: flex; flex-direction: column; overflow: hidden; border-radius: 20px;
  border: 1px solid var(--line); background: var(--bg-2);
  transition: transform .35s var(--ease), border-color .25s, box-shadow .35s;
}
.pcard[hidden] { display: none; }
.pcard:hover { transform: translateY(-4px); border-color: color-mix(in srgb, var(--accent) 45%, transparent); box-shadow: 0 26px 60px -34px var(--glow); }
.pcard img { width: 100%; height: auto; aspect-ratio: 3 / 2; object-fit: cover; background: var(--bg-3); }
.pcard-body { display: flex; flex-direction: column; gap: 10px; padding: 18px 20px 22px; }
.pcard .label { color: var(--accent); letter-spacing: .16em; font-size: 10.5px; }
.pcard h2, .pcard h3 { margin: 0; font: 600 19px/1.28 var(--font-display); letter-spacing: -.012em; color: var(--text); text-wrap: balance; }
.pcard-desc { color: var(--text-2); font-size: 14.5px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
:root[data-theme="deepspace"] .pcard h2, :root[data-theme="deepspace"] .pcard h3 { font-size: 16px; letter-spacing: 0; line-height: 1.4; }
@media (max-width: 1000px) { .pcards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .pcards { grid-template-columns: 1fr; gap: 14px; } }

/* ---- Index ---------------------------------------------------------------- */
.blog-index { padding-bottom: 120px; }
.blog-filter { margin: 0 0 28px; }
.blog-filter .chip { height: 38px; font-size: 14px; }

/* ---- Home: "From the blog" -------------------------------------------------- */
.journal .pcards { margin-top: 46px; }
.journal-all { margin: 34px 0 0; }

/* ---- Article ---------------------------------------------------------------- */
.post-hero { padding-bottom: 38px; }
.post-hero .crumbs { flex-wrap: wrap; row-gap: 6px; }
.post-title {
  margin: 0; max-width: 940px; text-wrap: balance;
  font: 650 clamp(33px, 4.9vw, 62px)/1.05 var(--font-display); letter-spacing: -.03em;
}
:root[data-theme="deepspace"] .post-title { font-size: clamp(26px, 3.6vw, 46px); letter-spacing: 0; line-height: 1.18; font-weight: 700; }
.post-hero .lede { max-width: 720px; }
.post-meta { margin: 24px 0 0; font: 600 11.5px/1.6 var(--font-mono); letter-spacing: .13em; text-transform: uppercase; color: var(--text-3); }

.post-cover { margin: 0 0 58px; }
.post-cover img { width: 100%; height: auto; max-height: 640px; object-fit: cover; border-radius: 26px; border: 1px solid var(--line); background: var(--bg-3); }
.post-cover figcaption { margin-top: 10px; font-size: 12.5px; color: var(--text-3); }
.post-cover figcaption a { text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; }

.post-grid { display: grid; grid-template-columns: 230px minmax(0, 740px); gap: 64px; justify-content: center; padding-bottom: 90px; }
.post-toc { position: sticky; top: 92px; align-self: start; max-height: calc(100vh - 120px); overflow-y: auto; scrollbar-width: none; }
.post-toc::-webkit-scrollbar { display: none; }
.post-toc ol { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 2px; border-left: 1px solid var(--line); }
.post-toc a { display: block; padding: 7px 0 7px 16px; margin-left: -1px; border-left: 1px solid transparent; font: 500 14px/1.35 var(--font-text); color: var(--text-2); transition: color .2s, border-color .2s; }
.post-toc a:hover { color: var(--accent); border-color: var(--accent); }
@media (max-width: 1000px) {
  .post-grid { grid-template-columns: minmax(0, 740px); gap: 0; }
  .post-toc { position: static; max-height: none; margin: 0 0 38px; padding: 18px 20px; border: 1px solid var(--line); border-radius: 18px; background: var(--bg-2); }
  .post-cover { margin-bottom: 34px; }
  .post-cover img { border-radius: 18px; }
}

/* ---- Prose ------------------------------------------------------------------ */
.prose { --prose: color-mix(in srgb, var(--text) 80%, transparent); min-width: 0; font-size: 17.5px; line-height: 1.72; color: var(--prose); }
.prose > :first-child { margin-top: 0; }
.prose p { margin: 0 0 22px; }
.prose h2 { margin: 58px 0 18px; font: 650 clamp(25px, 2.7vw, 32px)/1.16 var(--font-display); letter-spacing: -.022em; color: var(--text); scroll-margin-top: 92px; text-wrap: balance; }
.prose h3 { margin: 36px 0 12px; font: 600 20.5px/1.3 var(--font-display); letter-spacing: -.012em; color: var(--text); scroll-margin-top: 92px; }
:root[data-theme="deepspace"] .prose h2 { font-size: clamp(20px, 2.2vw, 25px); letter-spacing: 0; line-height: 1.3; }
:root[data-theme="deepspace"] .prose h3 { font-size: 17px; letter-spacing: 0; }
.prose strong { color: var(--text); font-weight: 600; }
.prose a:not(.appstore) { color: var(--accent); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent); text-underline-offset: 3px; transition: text-decoration-color .2s; }
.prose a:not(.appstore):hover { text-decoration-color: var(--accent); }
.prose ul, .prose ol { margin: 0 0 24px; padding-left: 24px; }
.prose li { margin: 8px 0; padding-left: 4px; }
.prose li::marker { color: var(--accent); font-weight: 600; }
.prose code { font: 600 .86em/1 var(--font-mono); padding: 3px 6px; border-radius: 6px; border: 1px solid var(--line-2); background: var(--surface); color: var(--text); white-space: nowrap; }
.prose blockquote { margin: 28px 0; padding: 4px 0 4px 22px; border-left: 2px solid var(--accent); font: 400 22px/1.45 var(--font-serif); font-style: italic; color: var(--text); }
.prose blockquote p { margin: 0; }

.table-wrap { margin: 26px 0 30px; overflow-x: auto; border: 1px solid var(--line); border-radius: 16px; background: var(--bg-2); -webkit-overflow-scrolling: touch; }
.prose table { width: 100%; border-collapse: collapse; font-size: 15px; line-height: 1.45; }
.prose th, .prose td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
.prose th { font: 600 11px/1.3 var(--font-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--text-3); white-space: nowrap; }
.prose tbody tr:last-child td { border-bottom: 0; }
.prose td:first-child { color: var(--text); font-weight: 600; }

/* Figures: engine renders side by side, look grids, app screenshots */
.fig { margin: 34px 0; }
.fig-row { display: grid; gap: 10px; }
.fig-compare .fig-row { grid-template-columns: 1fr 1fr; }
.fig-grid .fig-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.fig-grid[data-n="2"] .fig-row, .fig-grid[data-n="4"] .fig-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.fig-cell { position: relative; min-width: 0; }
.fig img { width: 100%; height: auto; border-radius: 14px; border: 1px solid var(--line); background: var(--bg-3); }
.fig-tag { position: absolute; left: 10px; top: 10px; padding: 6px 9px; border-radius: 8px; font: 700 10px/1 var(--font-mono); letter-spacing: .14em; text-transform: uppercase; color: #fff; background: rgba(0, 0, 0, .62); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.fig-cell small { display: block; margin: 7px 2px 4px; font-size: 13px; line-height: 1.35; color: var(--text-3); }
.fig figcaption { margin-top: 12px; font-size: 14px; line-height: 1.5; color: var(--text-3); }
/* Match Photo: the reference is 4:3, the others 3:2; one shape keeps the row even. */
.fig-match img { aspect-ratio: 3 / 2; object-fit: cover; }
.fig-screen .fig-row { display: flex; justify-content: center; gap: 18px; }
.fig-screen img { width: min(270px, 46%); border-radius: 30px; border-color: var(--line-2); box-shadow: 0 40px 80px -40px rgba(0, 0, 0, .8), 0 0 90px -40px var(--glow); }
.fig-screen figcaption { text-align: center; }
@media (max-width: 640px) {
  .prose { font-size: 17px; }
  .fig-grid .fig-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* three renders: two side by side, the third full width below, no orphan */
  .fig-grid[data-n="3"] .fig-cell:last-child { grid-column: 1 / -1; }
  .fig-tag { left: 7px; top: 7px; padding: 5px 7px; font-size: 9px; letter-spacing: .1em; }
  .fig img { border-radius: 11px; }
  .fig-screen img { border-radius: 22px; }
}

.callout { margin: 28px 0; padding: 18px 20px; border-radius: 16px; border: 1px solid color-mix(in srgb, var(--accent) 34%, transparent); background: color-mix(in srgb, var(--accent) 7%, transparent); }
.callout b { display: block; font: 700 10.5px/1 var(--font-mono); letter-spacing: .2em; text-transform: uppercase; color: var(--accent); }
.callout p { margin: 9px 0 0; font-size: 16px; line-height: 1.6; }
.callout-note { border-color: var(--line-2); background: var(--surface); }
.callout-note b { color: var(--text-3); }

.prose .faq { margin: 0 0 10px; }
.prose .faq summary { color: var(--text); }
.prose .faq details p { font-size: 16px; line-height: 1.65; padding-bottom: 14px; margin: 0; }
.prose .faq details p:last-child { padding-bottom: 20px; }

/* Download box */
.post-cta {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 20px 28px;
  margin: 46px 0 0; padding: 26px 28px; border-radius: 22px;
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  background: radial-gradient(120% 160% at 100% 0%, rgba(var(--accent-rgb), .16), transparent 62%), var(--bg-2);
}
.post-cta-inline { margin: 34px 0; }
.post-cta > div { flex: 1 1 280px; min-width: 0; }
.post-cta b { display: block; font: 650 23px/1.2 var(--font-display); letter-spacing: -.02em; color: var(--text); }
.post-cta p { margin: 8px 0 0; font-size: 15.5px; line-height: 1.55; color: var(--text-2); }
.post-cta small { display: block; margin-top: 10px; font-size: 13px; line-height: 1.5; color: var(--text-3); }
.post-cta .appstore { flex: none; }
:root[data-theme="deepspace"] .post-cta b { font-size: 18px; letter-spacing: 0; }

/* Keep reading */
.post-more { padding-bottom: 120px; }
.h-more { margin: 0 0 26px; font: 650 clamp(28px, 3.4vw, 40px)/1.1 var(--font-display); letter-spacing: -.025em; }
.post-all { margin: 34px 0 0; }
