/* Blog post layout (added by apply_blog_layout.py). Loaded only on blog posts.
   One white article card beside a sticky sidebar, on a soft grey page. Uses main.css tokens. */

.post { background: var(--bg-alt-2); padding-bottom: var(--sp-2); }
.post-shell {
  display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: var(--sp-6);
  align-items: start; padding-top: var(--sp-6); padding-bottom: var(--sp-7);
}
.post-main {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm); padding: var(--sp-7) clamp(1.25rem, 4.5vw, 4rem) var(--sp-6);
  min-width: 0;
}

/* ---------- header ---------- */
.post-head { padding-bottom: var(--sp-5); margin-bottom: var(--sp-6); border-bottom: 1px solid var(--border); }
.post-crumbs { padding: 0; margin-bottom: var(--sp-5); font-size: var(--fs-tiny); font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase; }
.post-crumbs a { color: var(--ink); }
.post-crumbs li[aria-current] { color: var(--muted-2); max-width: 38ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.post-head .kicker {
  display: inline-block; margin: 0 0 var(--sp-4); padding: 0.32rem 0.8rem; border-radius: var(--radius-pill);
  background: var(--orange-tint); color: #B84A00; font-size: var(--fs-tiny); letter-spacing: 0.08em;
}
.post-head h1 {
  font-size: clamp(2rem, 4.2vw, 3.05rem); line-height: 1.1; letter-spacing: -0.025em;
  margin: 0 0 var(--sp-4); color: var(--ink-strong); text-wrap: balance;
}
.post-dek { font-size: clamp(1.08rem, 1.6vw, 1.28rem); line-height: 1.6; color: var(--muted-2); margin: 0 0 var(--sp-5); max-width: 62ch; }
.post-byline { display: flex; align-items: center; gap: var(--sp-3); }
.post-byline-avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex: none; border: 2px solid var(--orange-tint-2); }
.post-byline .post-meta { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.75rem; }

/* ---------- hero image ---------- */
.post-main .post-hero-image {
  margin: 0 0 var(--sp-6); border-radius: var(--radius-lg); overflow: hidden;
  aspect-ratio: auto; box-shadow: var(--shadow);
}
.post-main .post-hero-image img { height: auto; }

/* ---------- body typography ---------- */
.post-main .post-body { max-width: 72ch; }
.post-main .post-body > p, .post-main .post-body li { font-size: 1.09rem; line-height: 1.78; color: #2A2A2E; }
.post-main .post-body > p { margin: 0 0 1.15em; }
.post-main .post-body h2 {
  font-size: clamp(1.45rem, 2.4vw, 1.85rem); line-height: 1.25; letter-spacing: -0.015em;
  margin: 2.4em 0 0.7em; padding-top: 0; border-top: 0; scroll-margin-top: 140px;
}
.post-main .post-body h3 { font-size: 1.22rem; margin: 1.8em 0 0.5em; scroll-margin-top: 140px; }
.post-main .post-body ul, .post-main .post-body ol { padding-left: 1.3rem; margin: 0 0 1.3em; }
.post-main .post-body li { margin-bottom: 0.45em; }
.post-main .post-body li::marker { color: var(--orange); font-weight: 700; }
.post-main .post-body a:not(.btn):not(.share-btn) { color: #C25100; text-decoration: underline; text-decoration-color: rgba(255,107,0,0.35); text-underline-offset: 3px; }
.post-main .post-body a:not(.btn):not(.share-btn):hover { text-decoration-color: var(--orange); }
.post-main .post-body strong { color: var(--ink); }

/* Quick-answer and quote blocks read as a highlighted summary card */
.post-main .post-body blockquote {
  margin: var(--sp-6) 0; padding: var(--sp-5) var(--sp-5) var(--sp-4); border: 1px solid var(--orange-tint-2);
  border-left: 4px solid var(--orange); border-radius: var(--radius); background: linear-gradient(180deg, #FFF8F2 0%, #fff 100%);
}
.post-main .post-body blockquote p:first-child { margin-top: 0; }
.post-main .post-body blockquote li, .post-main .post-body blockquote p { font-size: 1.02rem; }
.post-main .answer-box { border-radius: var(--radius); }

/* In-body "Contents" list becomes a tidy card */
.post-main .post-body h2#contents { font-size: var(--fs-tiny); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted-2); margin: var(--sp-6) 0 var(--sp-3); }
.post-main .post-body h2#contents + ol { background: var(--bg-alt-2); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--sp-4) var(--sp-5) var(--sp-4) 2.4rem; }
.post-main .post-body h2#contents + ol li { font-size: 0.98rem; margin-bottom: 0.3em; }
.post-main .post-body h2#contents + ol a { color: var(--ink); text-decoration: none; }
.post-main .post-body h2#contents + ol a:hover { color: var(--orange); }

/* Tables */
.post-main .post-body table { width: 100%; border-collapse: separate; border-spacing: 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; font-size: 0.95rem; }
.post-main .post-body th { background: var(--bg-alt-2); font-family: var(--font-head); font-weight: 700; text-align: left; }
.post-main .post-body th, .post-main .post-body td { padding: 0.7rem 0.9rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.post-main .post-body tr:last-child td { border-bottom: 0; }
.post-main .post-body tbody tr:nth-child(even) td { background: #FCFCFD; }

/* Scrollable tables: the .table-wrap / overflow-x wrappers posts already use, and bare tables.
   On narrow screens columns keep a readable width and the table scrolls sideways, with soft edge
   shadows showing there is more to see. */
.post-main .post-body .table-wrap,
.post-main .post-body div[style*="overflow-x"] {
  overflow-x: auto; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain;
  margin: 0 0 var(--sp-5); border: 1px solid var(--border); border-radius: var(--radius);
  background:
    linear-gradient(90deg, #fff 30%, rgba(255,255,255,0)) 0 0 / 40px 100% no-repeat local,
    linear-gradient(270deg, #fff 30%, rgba(255,255,255,0)) 100% 0 / 40px 100% no-repeat local,
    radial-gradient(farthest-side at 0 50%, rgba(17,17,17,0.16), transparent) 0 0 / 14px 100% no-repeat scroll,
    radial-gradient(farthest-side at 100% 50%, rgba(17,17,17,0.16), transparent) 100% 0 / 14px 100% no-repeat scroll;
}
.post-main .post-body .table-wrap > table,
.post-main .post-body div[style*="overflow-x"] > table { border: 0; border-radius: 0; margin: 0; overflow: visible; min-width: 100%; }
.post-main .post-body .table-wrap td,
.post-main .post-body div[style*="overflow-x"] td { background: transparent; }
.post-main .post-body .table-wrap tbody tr:nth-child(even) td,
.post-main .post-body div[style*="overflow-x"] tbody tr:nth-child(even) td { background: rgba(247,247,248,0.6); }
@media (max-width: 760px) {
  .post-main .post-body table { font-size: 0.9rem; }
  .post-main .post-body > table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .post-main .post-body .table-wrap > table,
  .post-main .post-body div[style*="overflow-x"] > table,
  .post-main .post-body > table { width: max-content; max-width: none; }
  .post-main .post-body th, .post-main .post-body td { min-width: 8.5rem; max-width: 15rem; padding: 0.6rem 0.75rem; }
  .post-main .post-body th:first-child, .post-main .post-body td:first-child { min-width: 9.5rem; }
  .post-main .post-body .table-wrap::after { content: none; }
}

.post-main .post-body figure { margin: var(--sp-6) 0; }
.post-main .post-body figcaption { font-size: var(--fs-small); color: var(--muted-2); margin-top: var(--sp-2); }

/* ---------- sidebar ---------- */
.post-aside { align-self: stretch; display: flex; flex-direction: column; gap: var(--sp-4); }
.pa-sticky { position: sticky; top: calc(var(--header-h, 72px) + 44px + var(--sp-4)); display: grid; gap: var(--sp-4); }
.pa-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--sp-5); box-shadow: var(--shadow-sm); }
.pa-title { margin: 0 0 var(--sp-2); font-size: 0.72rem; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted-2); }
.pa-h { font-size: 1.2rem; line-height: 1.3; letter-spacing: -0.01em; margin: 0 0 var(--sp-3); }
.pa-h a { color: var(--ink); }
.pa-h a:hover { color: var(--orange); text-decoration: none; }
.pa-btn { display: flex; width: 100%; justify-content: center; }

/* follow card */
.pa-brand { text-align: center; padding: var(--sp-6) var(--sp-5); }
.pa-brand-h { margin: 0 0 var(--sp-2); font-family: var(--font-head); font-size: 1.22rem; line-height: 1.35; color: var(--ink); }
.pa-brand-h b { font-weight: 800; }
.pa-brand > p:not(.pa-brand-h) { margin: 0 0 var(--sp-5); color: var(--muted-2); font-size: 0.92rem; line-height: 1.55; }
.pa-social { display: flex; justify-content: center; gap: var(--sp-3); }
.pa-social a { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; background: var(--orange-tint); color: #C25100; transition: background .15s ease, color .15s ease, transform .15s ease; }
.pa-social a:hover { background: var(--orange); color: #fff; transform: translateY(-2px); }
.pa-social svg { width: 19px; height: 19px; }

/* app download */
.pa-app { position: relative; overflow: hidden; background: linear-gradient(160deg, #FFF6EF 0%, #fff 60%); border-color: var(--orange-tint-2); }
.pa-app::after { content: ""; position: absolute; width: 160px; height: 160px; right: -60px; bottom: -70px; border-radius: 50%; background: radial-gradient(circle, rgba(123,97,255,0.16), rgba(123,97,255,0) 70%); pointer-events: none; }
.pa-app .pa-title { color: #B84A00; }
.pa-app p:not(.pa-title) { margin: 0 0 var(--sp-4); font-size: 0.9rem; line-height: 1.55; color: var(--muted-2); }
.pa-play { position: relative; z-index: 1; display: inline-flex; align-items: center; gap: 0.6rem; padding: 0.55rem 1.1rem 0.55rem 0.85rem; border-radius: 12px; background: #000; color: #fff; font-family: var(--font-head); font-weight: 700; font-size: 1.02rem; line-height: 1.05; transition: transform .15s ease, box-shadow .15s ease; }
.pa-play svg { width: 24px; height: 24px; flex: none; }
.pa-play small { display: block; font-family: var(--font-body); font-weight: 500; font-size: 0.66rem; letter-spacing: 0.04em; text-transform: uppercase; opacity: 0.85; }
.pa-play:hover { color: #fff; text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow); }

/* programs */
.pa-links ul { list-style: none; margin: 0; padding: 0; }
.pa-links li { margin: 0; }
.pa-links a { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-3); padding: 0.62rem 0; border-bottom: 1px solid var(--border); font-size: 0.94rem; font-weight: 600; color: var(--ink); }
.pa-links li:last-child a { border-bottom: 0; padding-bottom: 0; }
.pa-links a::after { content: "\2192"; color: var(--orange); transition: transform .15s ease; }
.pa-links a:hover { color: var(--orange); text-decoration: none; }
.pa-links a:hover::after { transform: translateX(3px); }

/* contents */
.pa-toc { padding: var(--sp-4) var(--sp-3) var(--sp-3); }
.pa-toc .pa-title { padding: 0 var(--sp-2); display: flex; justify-content: space-between; align-items: center; }
.pa-toc-count { font-weight: 700; letter-spacing: 0; color: var(--orange); }
.pa-toc-bar { height: 3px; margin: 0 var(--sp-2) var(--sp-2); border-radius: 3px; background: var(--border); overflow: hidden; }
.pa-toc-bar i { display: block; height: 100%; width: 0; background: var(--orange); transition: width .2s ease; }
.pa-toc ol { list-style: none; margin: 0; padding: 0; counter-reset: pa; max-height: 34vh; overflow-y: auto; scrollbar-width: thin; }
.pa-toc li { margin: 0; counter-increment: pa; }
.pa-toc a { display: flex; gap: 0.6rem; padding: 0.4rem 0.5rem; border-radius: var(--radius-sm); font-size: 0.86rem; line-height: 1.4; color: var(--body); border-left: 2px solid transparent; }
.pa-toc a::before { content: counter(pa, decimal-leading-zero); font-family: var(--font-head); font-weight: 800; font-size: 0.72rem; color: var(--muted); padding-top: 0.1rem; }
.pa-toc a:hover { background: var(--bg-alt-2); text-decoration: none; }
.pa-toc a.is-active { background: var(--orange-tint); color: #B84A00; font-weight: 600; border-left-color: var(--orange); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.pa-toc a.is-active::before { color: var(--orange); }

/* counselling */
.pa-cta { background: var(--ink-strong); border-color: var(--ink-strong); color: #fff; position: relative; overflow: hidden; }
.pa-cta::after { content: ""; position: absolute; width: 180px; height: 180px; right: -70px; top: -80px; border-radius: 50%; background: radial-gradient(circle, rgba(255,107,0,0.55), rgba(255,107,0,0) 70%); pointer-events: none; }
.pa-cta .pa-h { color: #fff; font-size: 1.15rem; position: relative; }
.pa-cta p { margin: 0 0 var(--sp-4); font-size: 0.88rem; line-height: 1.55; color: rgba(255,255,255,0.75); position: relative; }
.pa-cta .btn { position: relative; }
.pa-wa { display: flex; justify-content: center; align-items: center; gap: 0.45rem; margin-top: var(--sp-3); font-size: var(--fs-small); font-weight: 600; color: #4ADE80; position: relative; }
.pa-wa svg { width: 16px; height: 16px; }
.pa-wa:hover { color: #86EFAC; }

/* the sidebar carries the contents on wide screens */
@media (min-width: 1101px) { .post-shell .post-toc { display: none; } }

/* reading progress */
.post-progress { position: fixed; left: 0; top: 0; height: 3px; width: 100%; transform-origin: 0 50%; transform: scaleX(0); background: linear-gradient(90deg, var(--orange), var(--orange-light)); z-index: 10000; pointer-events: none; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .post-shell { grid-template-columns: minmax(0, 1fr); }
  .post-aside { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .pa-sticky { display: contents; }
  .pa-toc { display: none; }
}
@media (max-width: 640px) {
  .post-shell { padding-top: var(--sp-4); gap: var(--sp-4); padding-left: 10px; padding-right: 10px; }
  .post-main { padding: var(--sp-5) 1.05rem var(--sp-5); border-radius: var(--radius); }
  .post-aside { grid-template-columns: 1fr; }
  .pa-cta { display: none; } /* the mobile CTA bar covers this */
  .post-crumbs li[aria-current] { max-width: 22ch; }
  .post-byline { align-items: flex-start; }
  .post-byline .post-meta span + span::before { display: none; }
  .post-byline .post-meta span:first-child { flex-basis: 100%; }
  .post-head h1 { font-size: 1.85rem; }
  .post-main .post-body > p, .post-main .post-body li { font-size: 1.03rem; line-height: 1.72; }
}
@media (prefers-reduced-motion: reduce) { .pa-social a, .pa-play, .pa-links a::after, .pa-toc-bar i { transition: none; } }
