/* ============================================================
   ChinaEntra - Blog & guides (warm editorial design)
   Extends /styles.css: ivory paper, navy ink, Newsreader display serif,
   IBM Plex Mono labels, brand blue #1a73e8 as the only accent.
   Shared header/footer/buttons come from the main stylesheet.
   ============================================================ */

/* Current section in the main navigation */
.nav > a.is-current { color: var(--brand); font-weight: 600; }
.nav > a.is-current::after {
  content: ""; display: block; height: 2px; margin-top: 4px;
  background: var(--brand);
}

/* ---------- Blog index hero ---------- */
.blog-hero {
  padding: 88px 0 68px;
  background: var(--paper-2);
  border-bottom: 1px solid var(--line-2);
}
.blog-hero .eyebrow { margin-bottom: 20px; }
.blog-hero h1 {
  max-width: 820px; font-size: clamp(2.6rem, 5vw, 4.1rem);
  line-height: 1.06; letter-spacing: -.034em; font-weight: 400;
}
.blog-hero h1 em { font-style: italic; color: var(--brand); }
.blog-hero .lede { max-width: 680px; margin-top: 24px; font-size: 17px; color: var(--muted); line-height: 1.8; }

/* ---------- Post cards (editorial) ----------
   The artwork bleeds to the card edges at the top. order:-1 puts the image
   first visually without touching the HTML the auto-publisher emits, so every
   future article card inherits this layout automatically. The 16:9 lock is
   asserted by both edge_qa.mjs and edge_qa_home.mjs - do not remove. */
.post-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; align-items: stretch; }
.post-card {
  --card-pad: 0px;
  display: flex; flex-direction: column;
  background: transparent; border: 0; border-top: 2px solid var(--line-2);
  padding: 0 0 26px; overflow: hidden;
  transition: border-color .22s ease;
}
.post-card:hover { border-top-color: var(--brand); }
.post-card-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 20px var(--card-pad) 16px; }
.post-tag {
  display: inline-block; padding: 4px 9px;
  border: 1px solid var(--line-2); background: transparent;
  font-family: var(--font-mono); font-size: 10px; font-weight: 500;
  letter-spacing: .09em; text-transform: uppercase; color: var(--brand);
}
.post-read { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .04em; color: var(--muted-2); white-space: nowrap; }
.post-card h2 { margin: 0 var(--card-pad); font-family: var(--font-display); font-size: 1.62rem; line-height: 1.22; letter-spacing: -.022em; font-weight: 500; color: var(--ink); }
.post-card p { margin: 12px var(--card-pad) 0; font-size: 14.5px; line-height: 1.75; color: var(--muted); flex: 1; }
.post-more {
  display: inline-flex; align-items: center; gap: 8px; margin: 22px var(--card-pad) 0;
  font-size: 13.5px; font-weight: 600; color: var(--brand);
  border-bottom: 1px solid rgba(26, 115, 232, .35); align-self: flex-start; padding-bottom: 2px;
}
.post-more .icon { width: 17px; height: 17px; transition: transform .2s; }
.post-card:hover .post-more .icon { transform: translateX(4px); }
.post-card:focus-within { border-top-color: var(--brand); }

/* ---------- Article layout ---------- */
.article-head {
  padding: 76px 0 52px;
  background: var(--paper-2);
  border-bottom: 1px solid var(--line-2);
}
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted-2); margin-bottom: 24px; }
.crumbs a { color: var(--brand); }
.crumbs a:hover { text-decoration: underline; }
.article-head h1 {
  max-width: 880px; font-size: clamp(2.3rem, 4.4vw, 3.6rem);
  line-height: 1.09; letter-spacing: -.032em; font-weight: 400;
}
.article-head .standfirst { max-width: 760px; margin-top: 22px; font-size: 18px; line-height: 1.75; color: var(--muted); }
.article-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 18px; margin-top: 28px; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .05em; text-transform: uppercase; color: var(--muted-2); }
.article-meta span { display: inline-flex; align-items: center; gap: 7px; }
.article-meta .icon { width: 15px; height: 15px; }

.article-body { padding: 68px 0 100px; }
/* Reading measure stays bounded on ultrawide monitors even though the page
   chrome is full-bleed; 1400px keeps prose + TOC together comfortably. */
.article-layout { display: grid; grid-template-columns: minmax(0, 1fr) 250px; gap: 64px; align-items: start; max-width: 1400px; margin-inline: auto; }
/* Grid items default to min-width:auto, so a wide table or image can force the
   whole column past the viewport on phones. Let every child shrink instead. */
.article-layout > * { min-width: 0; }
.toc {
  position: sticky; top: 106px; padding: 22px 0 0;
  background: transparent; border-top: 2px solid var(--line-2);
}
.toc h2 { font-family: var(--font-mono); font-size: 10.5px; font-weight: 500; letter-spacing: .12em; text-transform: uppercase; color: var(--muted-2); margin-bottom: 16px; }
.toc a { display: block; padding: 7px 0; font-size: 13.5px; line-height: 1.55; color: var(--ink-2); }
.toc a:hover { color: var(--brand); }

/* ---------- Prose ---------- */
.prose { max-width: 760px; font-size: 16.5px; line-height: 1.85; color: var(--ink-2); }
.prose > * + * { margin-top: 24px; }
.prose h2 {
  margin-top: 56px; padding-top: 24px; font-size: 2.05rem; line-height: 1.2;
  letter-spacing: -.024em; font-weight: 400; color: var(--ink);
  border-top: 1px solid var(--line); scroll-margin-top: 100px;
}
.prose h3 { margin-top: 36px; font-size: 1.45rem; line-height: 1.35; font-weight: 500; color: var(--ink); }
.prose p { margin: 0; }
.prose strong { color: var(--ink); font-weight: 600; }
.prose a { color: var(--brand); text-decoration: underline; text-underline-offset: 3px; }
.prose ul, .prose ol { margin: 0; padding-left: 24px; }
.prose ul { list-style: disc; }
.prose ol { list-style: decimal; }
.prose li { margin: 9px 0; padding-left: 4px; }
.prose li::marker { color: var(--brand); font-weight: 600; }
.prose li ul { margin-top: 8px; list-style: circle; }
.prose blockquote {
  margin-left: 0; padding: 4px 0 4px 24px;
  border-left: 3px solid var(--brand); color: var(--muted);
  font-family: var(--font-display); font-size: 20px; line-height: 1.5;
}
.prose table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.prose th, .prose td { padding: 13px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.prose th { background: var(--paper-2); color: var(--ink); font-size: 12.5px; font-weight: 600; letter-spacing: .02em; }
.prose .callout {
  padding: 22px 24px; border-left: 3px solid var(--brand);
  background: var(--paper-2); color: var(--ink-2);
}
.prose .callout p + p { margin-top: 10px; }
.prose .callout strong { color: var(--ink); }
.prose .check-list { list-style: none; padding-left: 0; }
.prose .check-list li { position: relative; padding-left: 30px; }
.prose .check-list li::before {
  content: ""; position: absolute; left: 2px; top: 11px;
  width: 14px; height: 8px; border-left: 2px solid var(--brand); border-bottom: 2px solid var(--brand);
  transform: rotate(-45deg);
}
.prose .lead { font-size: 19px; color: var(--ink); }

/* ---------- Stage navigation on the blog index ---------- */
.stage-nav {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px; margin: 0 0 48px;
  background: var(--line-2); border: 1px solid var(--line-2);
}
.stage-nav-item {
  display: flex; flex-direction: column; gap: 7px;
  padding: 22px 24px; background: var(--white); transition: background .2s;
}
.stage-nav-item:hover { background: var(--paper-2); }
.stage-nav-num { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--brand); }
.stage-nav-item strong { font-family: var(--font-display); font-size: 1.35rem; font-weight: 500; letter-spacing: -.02em; color: var(--ink); }
.stage-nav-item > span:last-child { font-size: 12.5px; line-height: 1.6; color: var(--muted); }

/* ---------- Article footer nav / CTA ---------- */
.blog-cta-stage { margin-bottom: 12px; font-family: var(--font-mono); font-size: 10.5px; font-weight: 500; letter-spacing: .12em; text-transform: uppercase; color: var(--brand); }
.blog-cta-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; flex: none; }
.post-nav { display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; margin-top: 64px; padding-top: 28px; border-top: 1px solid var(--line-2); }
.post-nav a { font-size: 14.5px; font-weight: 600; color: var(--brand); }
.post-nav a:hover { text-decoration: underline; }
.blog-cta {
  padding: 60px 0; background: var(--paper-2); border-top: 1px solid var(--line-2);
}
.blog-cta-inner { display: flex; align-items: center; justify-content: space-between; gap: 32px; flex-wrap: wrap; }
.blog-cta h2 { font-size: 2.1rem; letter-spacing: -.024em; font-weight: 400; }
.blog-cta p { margin-top: 12px; max-width: 560px; color: var(--muted); font-size: 15.5px; }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .post-grid { grid-template-columns: repeat(2, 1fr); }
  .article-layout { grid-template-columns: minmax(0, 1fr) 210px; gap: 38px; }
}
@media (max-width: 860px) {
  .article-layout { grid-template-columns: minmax(0, 1fr); }
  .toc { position: static; order: -1; }
  .toc a { display: inline-block; margin-right: 16px; }
  .blog-hero { padding: 60px 0 46px; }
  .article-head { padding: 52px 0 38px; }
  .article-body { padding: 48px 0 76px; }
}
@media (max-width: 620px) {
  .post-grid { grid-template-columns: 1fr; }
  .post-card { padding: 0 0 24px; }
  .prose { font-size: 16px; }
  .prose h2 { font-size: 1.75rem; margin-top: 46px; }
  .prose table { display: block; overflow-x: auto; white-space: nowrap; }
  .blog-cta-inner { flex-direction: column; align-items: flex-start; }
  .stage-nav { grid-template-columns: 1fr; margin-bottom: 36px; }
  .blog-cta-actions { width: 100%; }
  .blog-cta-actions .btn { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .post-card, .post-more .icon, .post-card-thumb { transition: none; }
  .post-card:hover .post-card-thumb { transform: none; }
}

/* ---------- Figures & illustrations (image + infographic rule) ---------- */
.prose .post-figure { margin: 36px 0 40px; }
.post-figure img {
  display: block; width: 100%; height: auto;
  border: 1px solid var(--line); background: var(--paper-2);
}
.post-figure figcaption {
  margin-top: 12px; font-family: var(--font-mono); font-size: 11px; line-height: 1.7;
  letter-spacing: .01em; color: var(--muted-2); text-align: left;
}
.prose .post-figure.is-hero { margin: 0 0 40px; }
.post-card-thumb {
  /* flex:none + height:auto are essential: as a flex child of an equal-height
     card, aspect-ratio alone lets the image stretch into a tall narrow strip
     and crop the artwork. Locking all three keeps a true 16:9 cover. */
  order: -1; flex: none; display: block;
  width: 100%; height: auto; aspect-ratio: 16 / 9;
  object-fit: cover; object-position: center;
  border: 0; border-radius: 0; background: var(--paper-2);
  margin: 0 0 20px; filter: saturate(.92);
  transition: transform .5s cubic-bezier(.2, .7, .2, 1);
}
.post-card:hover .post-card-thumb { transform: scale(1.035); }
@media (max-width: 620px) {
  .prose .post-figure { margin: 28px 0 32px; }
  .post-figure figcaption { font-size: 10.5px; }
}

/* ---------- Keep reading: three contextual links at the end of each guide ---------- */
.post-related { margin: 48px 0 0; padding-top: 26px; border-top: 1px solid var(--line-2); }
.post-related-label {
  margin: 0 0 6px;
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--muted-2);
}
.post-related a {
  display: grid; grid-template-columns: 118px minmax(0, 1fr); gap: 16px;
  align-items: baseline; padding: 13px 0;
  border-bottom: 1px solid var(--line);
  text-decoration: none; color: var(--ink-2);
  font-size: 14.5px; line-height: 1.55;
  transition: color .18s ease;
}
.post-related a span {
  font-family: var(--font-mono); font-size: 10px; font-weight: 500; letter-spacing: .12em;
  text-transform: uppercase; color: var(--brand);
}
.post-related a:hover { color: var(--brand); }

@media (max-width: 620px) {
  .post-related a { grid-template-columns: 1fr; gap: 5px; padding: 14px 0; }
}
