/* Nari Labs blog — same design language as the production landing page:
   Iowan Old Style display, DM Sans body. */

@import url("/brand.css");

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* announcement banner styles come from brand.css */

/* --- nav (identical to landing) --- */
nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2rem 3rem;
  z-index: 10;
}
.logo {
  font-family: var(--serif);
  font-size: 1.35rem;
  letter-spacing: -0.01em;
  color: var(--text);
  text-decoration: none;
  transition: opacity 0.3s;
}
.logo:hover { opacity: 0.7; }
nav .logo { flex: 1; }
.nav-links { display: flex; align-items: center; gap: 1.5rem; margin-right: 1.5rem; }
.nav-links a,
.nav-icons a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.3s;
  display: flex;
  align-items: center;
}
.nav-links a:hover, .nav-icons a:hover { color: var(--text); }
.nav-links .section-link { font-family: var(--serif); font-size: 1.1rem; }
.nav-links a[aria-current="page"] { color: var(--text); }
.nav-icons { display: flex; align-items: center; gap: 1.5rem; }
.nav-icons svg { width: 20px; height: 20px; fill: currentColor; }
.github-link { gap: 0.4rem; }
.star-count { font-size: 0.8rem; font-weight: 500; letter-spacing: -0.01em; }

main { flex: 1; }
/* 46px = (banner + nav) - footer: equalizes the centering area top/bottom */
main.centered { display: flex; flex-direction: column; justify-content: center; padding-bottom: 46px; }

/* --- centered sub page (Vision / Team) --- */
.subpage {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
}
.subpage .hero { text-align: center; max-width: 880px; }
.subpage h1 {
  font-family: var(--serif);
  font-size: clamp(2.5rem, 5.5vw, 4.25rem);
  font-weight: 400;
  letter-spacing: -0.045em;
  line-height: 1.05;
  margin-bottom: 1.75rem;
}
.section-body {
  font-family: var(--sans);
  font-size: 1.25rem;
  color: var(--text-muted);
  font-weight: 400;
  line-height: 1.65;
  max-width: 560px;
  margin: 0 auto;
}
.section-body + .section-body { margin-top: 1.6rem; }
.section-body strong { color: var(--text); font-weight: 500; }
.credentials {
  list-style: none;
  max-width: 520px;
  margin: 2rem auto 0;
  font-family: var(--sans);
  font-size: 1.15rem;
  color: var(--text-muted);
  line-height: 1.9;
}
.credentials em {
  font-family: var(--serif);
  font-style: normal;
  font-weight: 400;
  font-size: 1.3em;
  color: var(--text);
  margin-right: 0.15em;
}
.credentials a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--underline);
  text-underline-offset: 2px;
  transition: color 0.2s, text-decoration-color 0.2s;
}
.credentials a:hover { color: var(--text); text-decoration-color: var(--text); }

/* --- blog index --- */
main.blog-index {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-bottom: 46px; /* (banner + nav) - footer */
}
.blog-head {
  text-align: center;
  padding: 0 3rem 4.5rem;
}
.blog-head h1 {
  font-family: var(--serif);
  font-size: clamp(2.5rem, 5.5vw, 4.25rem);
  font-weight: 400;
  letter-spacing: -0.045em;
  line-height: 1.05;
}
.blog-head .blog-lede {
  font-size: 1.1rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-top: 1.25rem;
}

.post-list {
  list-style: none;
  max-width: 640px;
  margin: 0 auto;
  padding: 0 3rem;
}
.post-list li + li { border-top: 1px solid var(--border); }
.post-list a {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 2rem 0;
  text-decoration: none;
  color: inherit;
}
.post-list .post-text { flex: 1; min-width: 0; }
.post-list .post-thumb {
  flex-shrink: 0;
  width: 132px;
  height: 88px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
}

/* featured layout — big card while the blog has few posts */
.post-list.featured {
  max-width: 960px;
  padding: 0 3rem;
}
.post-list.featured li + li { border-top: 0; margin-top: 2rem; }
.post-list.featured a {
  display: grid;
  /* right column = card height, so the thumbnail is a perfect square */
  grid-template-columns: 1fr clamp(240px, calc(100vh - 520px), 400px);
  align-items: stretch;
  gap: 0;
  padding: 0;
  background: var(--surface-fill-soft);
  border: 1px solid var(--border-faint);
  border-radius: 18px;
  overflow: hidden;
  transition: transform 0.3s;
}
.post-list.featured a:hover {
  transform: translateY(-2px);
}
.post-list.featured .post-text {
  padding: 2.75rem 3rem;
  align-self: start;
}
.post-list.featured .post-title { font-size: 2.4rem; }
.post-list.featured .post-meta { margin-top: 0.9rem; }
.post-list.featured .post-thumb {
  width: 100%;
  height: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  padding: 1.75rem;
  border: 0;
  border-radius: 0;
  background: #fbfbf8; /* matches the chart image's own background exactly */
}
.post-list .post-title {
  font-family: var(--serif);
  font-size: 1.65rem;
  font-weight: 400;
  letter-spacing: -0.03em;
  line-height: 1.2;
  color: var(--text);
  transition: opacity 0.3s;
}
.post-list .post-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

/* --- table of contents — a simple inline card under the article title --- */
.toc {
  display: block; /* override the global top-nav flex styles on <nav> */
  margin: 2.75rem 0 0;
  padding: 1.4rem 1.6rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-tint);
}
.toc-title {
  margin-bottom: 0.85rem;
  font-family: var(--sans);
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.4;
}
.toc ul {
  list-style: none;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.6rem;
}
.toc a {
  display: block;
  font-size: 0.85rem;
  line-height: 1.4;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s;
}
.toc a:hover { color: var(--text); }

/* --- article --- */
.article-shell {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 0 1.5rem;
}
.article-head {
  text-align: center;
  padding: 4.5rem 0 3rem;
}
.article-head .article-kicker {
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}
.article-head h1 {
  font-family: var(--serif);
  font-size: clamp(2.6rem, 5.5vw, 3.8rem);
  font-weight: 400;
  letter-spacing: -0.035em;
  line-height: 1.1;
  text-wrap: balance;
}
.article-head .byline {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 1.25rem;
}

.article { padding-bottom: 3rem; line-height: 1.7; }
.article > * + * { margin-top: 1.2em; }
.article p { font-size: 1.05rem; }
.article p.aside { font-size: 0.9rem; color: var(--text-muted); }
.article .article-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1.75rem 2rem;
  border-radius: 14px;
  background: var(--surface-fill);
}
.article .article-cta p {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(1.3rem, 2vw, 1.45rem);
  font-weight: 400;
  letter-spacing: -0.025em;
  line-height: 1.2;
}
.article .article-cta-button {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.7rem 1.15rem;
  border: 1px solid var(--text);
  border-radius: 999px;
  background: var(--text);
  color: var(--bg);
  font-family: var(--sans);
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1;
  text-decoration: none;
  transition: background-color 0.2s, color 0.2s;
}
.article .article-cta-button:hover {
  background: transparent;
  color: var(--text);
  text-decoration: none;
}
.article strong { font-weight: 500; }
.article em { font-style: normal; }
.article a { color: var(--text); text-decoration: underline; text-decoration-color: var(--underline); text-underline-offset: 2px; transition: text-decoration-color 0.2s; }
.article a:hover { text-decoration-color: var(--text); }
.footnote-ref {
  font-size: 0.72em;
  line-height: 0;
  vertical-align: super;
  scroll-margin-top: 2rem;
}
.article .footnote-ref a,
.article .footnote-backref {
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.footnotes {
  margin-top: 3rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--border);
}
.footnotes > * + * { margin-top: 0.65rem; }
.footnotes .aside { scroll-margin-top: 2rem; }
.article h2 {
  font-family: var(--serif);
  font-size: 1.8rem;
  font-weight: 400;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-top: 2.6em;
}
.article h3 {
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 400;
  letter-spacing: -0.025em;
  line-height: 1.25;
  margin-top: 2.2em;
}
.article ol, .article ul { padding-left: 1.4em; }
.article li { font-size: 1.05rem; margin-top: 0.4em; }
.article code {
  font-family: var(--mono);
  font-size: 0.85em;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 6px;
  white-space: nowrap;
}
.article hr { border: 0; border-top: 1px solid var(--border); margin: 2.4em 0; }
.article figure { margin: 2.2em auto; }
/* soft gray panels instead of hairline borders; diagram documents share the
   same --surface-fill background so iframe edges disappear */
.article figure img {
  width: 100%;
  height: auto;
  border-radius: 14px;
}
.article .image-zoom-trigger {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 14px;
  background: transparent;
  cursor: zoom-in;
}
.article .image-zoom-trigger:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 4px;
}
.image-lightbox {
  position: fixed;
  top: 50%;
  left: 50%;
  right: auto;
  bottom: auto;
  width: min(96vw, 1600px);
  max-width: none;
  max-height: 94vh;
  margin: 0;
  padding: 1.25rem;
  border: 0;
  border-radius: 16px;
  background: var(--bg);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
  transform: translate(-50%, -50%);
  overflow: auto;
}
.image-lightbox::backdrop {
  background: rgba(16, 16, 14, 0.72);
  backdrop-filter: blur(6px);
}
.image-lightbox img {
  display: block;
  width: 100%;
  height: auto;
  max-height: calc(94vh - 2.5rem);
  border-radius: 10px;
  object-fit: contain;
}
.image-lightbox-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 1;
  width: 2.25rem;
  height: 2.25rem;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: #1a1a1a;
  font: 1.5rem/1 var(--sans);
  cursor: pointer;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.18);
}
.image-lightbox-close:focus-visible {
  outline: 2px solid #1a1a1a;
  outline-offset: 2px;
}
/* figures that opt into the diagram panel look (e.g. the latency SVG) */
.article figure.panel img {
  background: #f8f8f6;
  padding: 1.25rem;
}
.article figure.diagram iframe {
  width: 100%;
  border: 0;
  border-radius: 14px;
  background: #f8f8f6;
  display: block;
}
/* Let wide diagrams use the open space around the centered article. */
@media (min-width: 840px) {
  .article figure.diagram {
    width: min(1100px, calc(100vw - 3rem));
    margin-left: 50%;
    transform: translateX(-50%);
  }
}
.article figcaption {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.7rem;
  text-align: center;
}
.article .table-scroll {
  overflow-x: auto;
  margin: 2.2em auto;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
}
.article table { width: 100%; border-collapse: collapse; font-size: 0.95rem; min-width: 560px; }
.article .tuned-table th:nth-child(2),
.article .tuned-table th:nth-child(3),
.article .tuned-table td:nth-child(2),
.article .tuned-table td:nth-child(3) {
  white-space: nowrap;
}
.article th {
  font-family: var(--sans);
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-weight: 500;
  color: var(--text-muted);
  text-align: left;
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface-tint);
}
.article td { padding: 0.8rem 1rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.article tbody tr:last-child td { border-bottom: 0; }
.article td:first-child { font-weight: 500; white-space: nowrap; }

/* audio player slot — wire real audio in when files land */
.article .listen {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  margin: 2.2em 0;
}
.article .listen audio { flex: 1; height: 40px; }
.article .listen .listen-label {
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
}

.article-footer {
  margin: 3rem 0 5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}
.article-footer .backlink {
  font-family: var(--serif);
  font-size: 1.2rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.3s;
}
.article-footer .backlink:hover { color: var(--text); }

/* --- footer (identical to landing, non-fixed) --- */
footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2rem 3rem;
  color: var(--text-muted);
  font-size: 0.8rem;
}
footer a { color: var(--text-muted); text-decoration: none; transition: color 0.3s; }
footer a:hover { color: var(--text); }
.heart { color: var(--heart); }

@media (max-width: 640px) {
  nav { padding: 1.5rem 1.25rem; }
  .blog-head { padding: 3.5rem 1.25rem 2.5rem; }
  .post-list { padding: 0 1.25rem 4rem; }
  .post-list .post-title { font-size: 1.5rem; }
  .post-list .post-thumb { width: 96px; height: 68px; }
  .post-list.featured { padding: 0 1.25rem 4rem; }
  .post-list.featured a { grid-template-columns: 1fr; }
  .post-list.featured .post-text { padding: 1.75rem 1.5rem; }
  .post-list.featured .post-title { font-size: 1.7rem; }
  .post-list.featured .post-thumb {
    width: 100%;
    height: auto;
    min-height: 0;
    aspect-ratio: 16 / 10;
    border-left: 0;
    border-top: 1px solid var(--border);
    order: 2;
  }
  .article .article-cta {
    align-items: flex-start;
    flex-direction: column;
    padding: 1.5rem;
  }
  footer { padding: 1.5rem 1.25rem; }
}

/* yellow NEW POST badge above a featured post title */
.badge-new {
  display: inline-block;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  background: var(--bloom);
  color: var(--on-key);
  padding: 5px 11px;
  border-radius: 999px;
  margin-bottom: 0.7rem;
}
