/* ==========================================================================
   Blog — listing, post, author. Builds on the tokens in theme.css.
   ========================================================================== */

.text-accent { color: var(--accent) !important; }

/* The legacy styles.css forces every link to 13px; let blog links inherit their context's size.
   :where() keeps specificity at zero so explicit class sizes below still apply. */
:where(.blog-hero, .post-card, .post-lead, .post-body, .author-box, .cta-card, .post-share, .related-posts, .author-profile) a { font-size: inherit; }

/* Hero band ---------------------------------------------------------------- */
.blog-hero {
  background:
    radial-gradient(1200px 400px at 85% -10%, rgba(0,122,135,.09), transparent 60%),
    linear-gradient(180deg, var(--bg-soft), #fff);
  border-bottom: 1px solid var(--line);
  padding: clamp(28px, 4vw, 44px) 0 clamp(32px, 5vw, 56px);
}
.blog-hero-title { margin-bottom: .6rem; }

.blog-crumbs {
  list-style: none; padding: 0; margin: 0 0 1.5rem;
  display: flex; flex-wrap: wrap; gap: .25rem .5rem;
  font-size: .85rem; color: var(--muted);
}
.blog-crumbs li { display: inline-flex; align-items: center; gap: .5rem; min-width: 0; }
.blog-crumbs li + li::before { content: "/"; color: #c3c8d4; }
.blog-crumbs a { color: var(--muted); }
.blog-crumbs a:hover { color: var(--accent); }
.blog-crumbs span[aria-current] {
  color: var(--ink-2); font-weight: 500;
  max-width: 46ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Search */
.blog-search {
  position: relative; display: flex; gap: .5rem;
  background: #fff; border: 1px solid var(--line); border-radius: var(--r);
  padding: .4rem; box-shadow: var(--shadow-sm);
}
.blog-search i { position: absolute; left: 1.05rem; top: 50%; transform: translateY(-50%); color: var(--muted); }
.blog-search input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent;
  padding: .55rem .5rem .55rem 2.3rem; font-size: .95rem; color: var(--ink-2);
}
.blog-search .btn { padding: .6rem 1.2rem; }

/* Category chips */
.blog-cats { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1.75rem; }
.blog-cat-chip {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .45rem .95rem; border-radius: var(--r-pill);
  border: 1px solid var(--line); background: #fff;
  font-family: var(--font-head); font-weight: 600; font-size: .85rem; color: var(--ink-2);
  transition: all .2s var(--ease);
}
.blog-cat-chip span { font-size: .72rem; color: var(--muted); background: var(--bg-soft); border-radius: var(--r-pill); padding: .05rem .45rem; }
.blog-cat-chip:hover { border-color: var(--ink); color: var(--ink); }
.blog-cat-chip.is-active { background: var(--ink); border-color: var(--ink); color: #fff; }
.blog-cat-chip.is-active span { background: rgba(255,255,255,.15); color: #fff; }

/* Cards -------------------------------------------------------------------- */
.post-card {
  position: relative; height: 100%;
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  overflow: hidden; box-shadow: var(--shadow-sm);
  transition: transform .35s var(--ease), box-shadow .35s var(--ease);
}
.post-card:hover { transform: translateY(-6px); box-shadow: var(--shadow); }
.post-card-media { display: block; aspect-ratio: 16 / 9; overflow: hidden; background: var(--teal-soft); }
.post-card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--ease); }
.post-card:hover .post-card-media img { transform: scale(1.04); }
.post-card-placeholder {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #e9f0ff, var(--teal-soft)); color: var(--ink); font-size: 2.4rem; opacity: .85;
}
.post-card-body { display: flex; flex-direction: column; flex: 1; padding: 1.4rem 1.5rem 1.5rem; }
.post-card-title { font-size: 1.15rem; line-height: 1.35; margin: .5rem 0 .55rem; }
.post-card-title a { color: var(--ink); }
.post-card-title a::after { content: ""; position: absolute; inset: 0; z-index: 1; }   /* whole card clickable */
.post-card:hover .post-card-title a { color: var(--accent); }
.post-card-excerpt { color: var(--muted); font-size: .93rem; flex: 1; margin-bottom: 1rem; }
.post-card .card-link {
  font-family: var(--font-head); font-weight: 700; font-size: .88rem; color: var(--ink);
  display: inline-flex; align-items: center; gap: .4rem;
}
.post-card .card-link i { transition: transform .25s var(--ease); }
.post-card:hover .card-link { color: var(--accent); }
.post-card:hover .card-link i { transform: translateX(4px); }

.post-meta-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .55rem;
  font-size: .8rem; color: var(--muted);
}
.post-cat {
  position: relative; z-index: 2;
  display: inline-block; padding: .2rem .65rem; border-radius: var(--r-pill);
  background: #fdeef2; color: var(--accent);
  font-family: var(--font-head); font-weight: 700; font-size: .72rem; letter-spacing: .02em;
}
.post-cat:hover { background: var(--accent); color: #fff; }
.post-cat-lg { font-size: .78rem; padding: .3rem .85rem; margin-bottom: 1rem; }
.post-badge {
  display: inline-block; padding: .2rem .65rem; border-radius: var(--r-pill);
  background: var(--teal-soft); color: var(--teal);
  font-family: var(--font-head); font-weight: 700; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em;
}

/* Lead (featured) story */
.post-lead {
  display: grid; grid-template-columns: 1.15fr 1fr; gap: 0;
  background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg);
  overflow: hidden; box-shadow: var(--shadow); margin-bottom: 2.5rem;
}
.post-lead-media { display: block; min-height: 320px; background: var(--teal-soft); }
.post-lead-media img { width: 100%; height: 100%; object-fit: cover; }
.post-lead-body { padding: clamp(1.5rem, 3vw, 2.75rem); display: flex; flex-direction: column; justify-content: center; }
.post-lead-title { font-size: clamp(1.4rem, 2.4vw, 1.9rem); line-height: 1.25; margin: .85rem 0 .75rem; }
.post-lead-title a { color: var(--ink); }
.post-lead-title a:hover { color: var(--accent); }
.post-lead-body p { color: var(--body); margin-bottom: 1.4rem; }
@media (max-width: 991.98px) {
  .post-lead { grid-template-columns: 1fr; }
  .post-lead-media { min-height: 0; aspect-ratio: 16 / 9; }
}

/* Pagination / empty state */
.blog-pagination { display: flex; flex-wrap: wrap; justify-content: center; gap: .4rem; margin-top: 3rem; }
.blog-pagination a, .blog-pagination .page-gap {
  min-width: 42px; height: 42px; padding: 0 .9rem;
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  border-radius: var(--r-sm); border: 1px solid var(--line); background: #fff;
  font-family: var(--font-head); font-weight: 600; font-size: .9rem; color: var(--ink-2);
}
.blog-pagination .page-gap { border: 0; background: none; min-width: 20px; padding: 0; }
.blog-pagination a:hover { border-color: var(--ink); color: var(--ink); }
.blog-pagination a.is-current { background: var(--ink); border-color: var(--ink); color: #fff; }

.blog-empty { text-align: center; padding: 3rem 1rem; max-width: 520px; margin: 0 auto; }
.blog-empty > i { font-size: 2.6rem; color: var(--teal); display: block; margin-bottom: .75rem; }

/* Post page ---------------------------------------------------------------- */
.read-progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 1100; pointer-events: none; }
.read-progress span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--teal)); transition: width .1s linear; }

.preview-bar {
  background: #fff7e0; border-bottom: 1px solid #f1d98a; color: #6b5310;
  padding: .7rem 1rem; text-align: center; font-size: .9rem;
}
.preview-bar a { margin-left: .75rem; font-weight: 700; }

.post-hero { padding-bottom: clamp(28px, 4vw, 44px); }
.post-hero-inner { max-width: 860px; }
.post-title { font-size: clamp(1.85rem, 4vw, 2.75rem); line-height: 1.18; margin-bottom: 1.4rem; }
.post-byline { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.75rem; }
.post-byline-author { display: inline-flex; align-items: center; gap: .7rem; color: var(--ink); }
.post-byline-author img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; border: 2px solid #fff; box-shadow: var(--shadow-sm); }
.post-byline-author .by-label { display: block; font-size: .72rem; color: var(--muted); line-height: 1.2; }
.post-byline-author strong { font-family: var(--font-head); font-size: .95rem; }
.post-byline-author:hover strong { color: var(--accent); }
.post-byline-meta { display: flex; flex-wrap: wrap; gap: .4rem 1.1rem; font-size: .87rem; color: var(--muted); }
.post-byline-meta i { color: var(--teal); margin-right: .25rem; }

.post-section { padding: clamp(28px, 4vw, 48px) 0 var(--section-y); }
.post-cover { margin: 0 0 2rem; border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow); background: var(--teal-soft); }
.post-cover img { width: 100%; display: block; aspect-ratio: 16 / 9; object-fit: cover; }

/* Article typography */
.post-body { font-size: 1.06rem; line-height: 1.85; color: var(--body); overflow-wrap: anywhere; }
.post-body > *:first-child { margin-top: 0; }
.post-body p { margin: 0 0 1.25rem; color: var(--body); }
.post-body li, .author-box p:not(.author-role) { color: var(--body); }
.post-body h2, .post-body h3, .post-body h4 { scroll-margin-top: 110px; color: var(--ink); }
.post-body h2 { font-size: clamp(1.4rem, 2.6vw, 1.8rem); margin: 2.4rem 0 1rem; }
.post-body h3 { font-size: clamp(1.15rem, 2vw, 1.35rem); margin: 1.9rem 0 .75rem; color: var(--ink-2); }
.post-body h4 { font-size: 1.08rem; margin: 1.5rem 0 .6rem; color: var(--ink-2); }
.post-body a { color: var(--accent); font-weight: 600; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.post-body a:hover { color: var(--accent-600); }
.post-body strong { color: var(--ink-2); }
.post-body ul, .post-body ol { margin: 0 0 1.4rem; padding-left: 1.35rem; }
.post-body li { margin-bottom: .5rem; padding-left: .25rem; }
.post-body ul > li::marker { color: var(--accent); }
.post-body ol > li::marker { color: var(--accent); font-weight: 700; font-family: var(--font-head); }
.post-body blockquote {
  margin: 1.75rem 0; padding: 1.25rem 1.5rem;
  border-left: 4px solid var(--teal); background: var(--teal-soft); border-radius: 0 var(--r) var(--r) 0;
  color: var(--ink-2); font-size: 1.04rem;
}
.post-body blockquote p:last-child { margin-bottom: 0; }
.post-body img { border-radius: var(--r); height: auto; }
.post-body figure { margin: 1.75rem 0; }
.post-body figure.image { text-align: center; }
.post-body figure.image-style-side, .post-body figure.image-style-align-right { float: right; max-width: 45%; margin: .4rem 0 1rem 1.5rem; }
.post-body figure.image-style-align-left { float: left; max-width: 45%; margin: .4rem 1.5rem 1rem 0; }
.post-body figcaption { font-size: .85rem; color: var(--muted); text-align: center; margin-top: .6rem; }
.post-body hr { margin: 2.25rem 0; border-color: var(--line); opacity: 1; }
.post-body code { background: var(--bg-soft); padding: .1rem .35rem; border-radius: 6px; font-size: .9em; }
.post-body pre { background: var(--ink); color: #e6ebff; padding: 1rem 1.25rem; border-radius: var(--r); overflow-x: auto; }
.post-body .table-wrap { overflow-x: auto; margin: 1.75rem 0; border: 1px solid var(--line); border-radius: var(--r); }
.post-body figure.table { margin: 1.75rem 0; }
.post-body figure.table .table-wrap { margin: 0; }
.post-body table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.post-body th, .post-body td { padding: .8rem 1rem; border-bottom: 1px solid var(--line); vertical-align: top; text-align: left; }
.post-body tr:last-child td { border-bottom: 0; }
.post-body th, .post-body thead td { background: var(--bg-soft); color: var(--ink); font-family: var(--font-head); font-weight: 700; }
.post-body iframe { width: 100%; aspect-ratio: 16 / 9; height: auto; border: 0; border-radius: var(--r); }
.post-body::after { content: ""; display: table; clear: both; }
@media (max-width: 575.98px) {
  .post-body figure.image-style-side, .post-body figure.image-style-align-right,
  .post-body figure.image-style-align-left { float: none; max-width: 100%; margin: 1.5rem 0; }
}

/* Sticky sidebar */
.post-aside {
  position: sticky; top: 104px;
  display: flex; flex-direction: column; gap: 1.25rem;
  max-height: calc(100vh - 124px);
}
.toc-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm); padding: 1.25rem 1.1rem 1rem;
  display: flex; flex-direction: column; min-height: 0; flex: 0 1 auto;
}
.toc-head {
  display: flex; justify-content: space-between; align-items: center;
  font-family: var(--font-head); font-weight: 700; color: var(--ink); font-size: .95rem;
  padding: 0 .4rem .8rem; border-bottom: 1px solid var(--line); margin-bottom: .6rem;
}
.toc-head i { color: var(--teal); margin-right: .35rem; }
.toc-progress { font-size: .75rem; color: var(--teal); background: var(--teal-soft); border-radius: var(--r-pill); padding: .1rem .55rem; }
.toc-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; overscroll-behavior: contain; flex: 1 1 auto; min-height: 0; }
.post-aside .post-cta { flex: 0 0 auto; }
.toc-list li { margin: 0; }
.toc-list a {
  display: block; padding: .42rem .6rem .42rem .85rem; border-left: 2px solid transparent;
  color: var(--body); font-size: .88rem; line-height: 1.45; border-radius: 0 8px 8px 0;
  transition: color .2s var(--ease), background .2s var(--ease), border-color .2s var(--ease);
}
.toc-list .toc-l3 a { padding-left: 1.75rem; font-size: .84rem; color: var(--muted); }
.toc-list a:hover { color: var(--accent); background: var(--bg-soft); }
.toc-list a.is-active { color: var(--accent); border-left-color: var(--accent); background: #fdf3f6; font-weight: 600; }

.toc-mobile {
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--r);
  margin-bottom: 1.75rem; overflow: hidden;
}
.toc-mobile summary {
  list-style: none; cursor: pointer; padding: .95rem 1.1rem;
  display: flex; align-items: center; gap: .5rem;
  font-family: var(--font-head); font-weight: 700; color: var(--ink);
}
.toc-mobile summary::-webkit-details-marker { display: none; }
.toc-mobile summary i:first-child { color: var(--teal); }
.toc-mobile .toc-chev { margin-left: auto; transition: transform .2s var(--ease); }
.toc-mobile[open] .toc-chev { transform: rotate(180deg); }
.toc-mobile .toc-list { padding: 0 .6rem .8rem; max-height: 50vh; }

/* CTA card */
.cta-card {
  position: relative; overflow: hidden;
  background: linear-gradient(160deg, var(--ink) 0%, #14307e 100%);
  color: #cdd5ee; border-radius: var(--r-lg); padding: 1.4rem;
  box-shadow: var(--shadow);
}
.cta-card::before {
  content: ""; position: absolute; width: 180px; height: 180px; right: -60px; top: -60px;
  border-radius: 50%; background: radial-gradient(circle, rgba(0,122,135,.45), transparent 70%);
}
.cta-card-top { position: relative; display: flex; align-items: center; gap: .8rem; margin-bottom: .9rem; }
.cta-card-top img { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; border: 2px solid rgba(255,255,255,.35); }
.cta-card-top strong { display: block; color: #fff; font-family: var(--font-head); font-size: 1.02rem; line-height: 1.25; }
.cta-card-top span { font-size: .8rem; color: #aeb9da; }
.cta-card p { color: #cdd5ee; position: relative; font-size: .9rem; line-height: 1.6; margin-bottom: 1rem; }
.cta-card .btn { position: relative; box-shadow: none; }
.cta-card-call {
  position: relative; display: flex; justify-content: center; align-items: center; gap: .45rem;
  margin-top: .75rem; color: #fff; font-family: var(--font-head); font-weight: 600; font-size: .9rem;
}
.cta-card-call:hover { color: #fff; opacity: .85; }

/* Share */
.post-share {
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem;
  margin: 2.5rem 0 0; padding: 1.25rem 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.post-share > span { font-family: var(--font-head); font-weight: 700; color: var(--ink); margin-right: .5rem; font-size: .92rem; }
.post-share a, .post-share button {
  width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: #fff;
  display: inline-flex; align-items: center; justify-content: center; color: var(--ink-2); font-size: 1.05rem;
  transition: all .2s var(--ease); cursor: pointer;
}
.post-share a:hover, .post-share button:hover { color: #fff; transform: translateY(-2px); border-color: transparent; }
.post-share .share-wa:hover { background: #25d366; }
.post-share .share-fb:hover { background: #1877f2; }
.post-share .share-in:hover { background: #0a66c2; }
.post-share .share-x:hover { background: #111; }
.post-share .share-copy:hover, .post-share .share-copy.copied { background: var(--teal); color: #fff; }

/* Author box */
.author-box {
  display: flex; gap: 1.5rem; align-items: flex-start;
  margin-top: 2.5rem; padding: 1.75rem;
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--r-lg);
}
.author-box-photo { flex: 0 0 auto; }
.author-box-photo img { width: 110px; height: 110px; border-radius: 50%; object-fit: cover; border: 4px solid #fff; box-shadow: var(--shadow-sm); }
.author-box h2 a { color: var(--ink); }
.author-box h2 a:hover { color: var(--accent); }
.author-role { color: var(--accent); font-weight: 600; font-size: .88rem; margin-bottom: .75rem; }
.author-box-body p:not(.author-role) { font-size: .95rem; }
.author-box .btn-sm { padding: .55rem 1rem; font-size: .85rem; }
@media (max-width: 575.98px) {
  .author-box { flex-direction: column; align-items: center; text-align: center; padding: 1.5rem 1.25rem; }
  .author-box .d-flex { justify-content: center; }
}

/* Author page */
.author-profile { display: flex; gap: clamp(1.5rem, 4vw, 3rem); align-items: center; }
.author-profile-photo { flex: 0 0 auto; }
.author-profile-photo img {
  width: clamp(150px, 20vw, 240px); height: clamp(150px, 20vw, 240px);
  border-radius: var(--r-lg); object-fit: cover; box-shadow: var(--shadow-lg); border: 6px solid #fff;
}
.author-profile-body { max-width: 760px; }
.author-stats { display: flex; flex-wrap: wrap; gap: .75rem; margin: 0 0 1.5rem; }
.author-stats div { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: .7rem 1.1rem; min-width: 130px; }
.author-stats strong { display: block; font-family: var(--font-head); color: var(--ink); font-size: 1.2rem; }
.author-stats span { font-size: .8rem; color: var(--muted); }
.author-social { display: inline-flex; gap: .4rem; margin-left: .25rem; }
.author-social a {
  width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: #fff;
  display: inline-flex; align-items: center; justify-content: center; color: var(--ink-2);
}
.author-social a:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
@media (max-width: 767.98px) {
  .author-profile { flex-direction: column; align-items: flex-start; }
}

/* Homepage block reuses .post-card */
@media (max-width: 575.98px) {
  .blog-search .btn { padding: .6rem .9rem; }
  .post-card-body { padding: 1.2rem 1.25rem 1.3rem; }
}
