/* ============================================================
   IFinTechy — Article page (post_detail)
   Loaded after theme.css; consumes its design tokens, so light
   and dark mode both work automatically.
   ============================================================ */

/* ---------- Reading progress ---------- */
.reading-progress {
  position: fixed; inset: 0 0 auto 0; height: 3px; z-index: 60;
  background: transparent; pointer-events: none;
}
.reading-progress-bar {
  height: 100%; width: 0;
  background: linear-gradient(90deg, var(--blue-500), var(--emerald-500));
  transition: width .08s linear;
}

/* ---------- Header block ---------- */
.article-hero { padding: 2.75rem 0 1.25rem; }
.article-hero .inner { max-width: 780px; margin-inline: auto; }

.article-hero .breadcrumbs { margin-bottom: 1rem; }

.article-cat {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .38rem .85rem; border-radius: var(--radius-full);
  font-size: var(--text-xs); font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; text-decoration: none;
  background: color-mix(in srgb, var(--cat-color, var(--blue-600)) 12%, transparent);
  color: var(--cat-color, var(--blue-600));
  border: 1px solid color-mix(in srgb, var(--cat-color, var(--blue-600)) 25%, transparent);
  transition: transform var(--speed) var(--ease);
}
.article-cat:hover { transform: translateY(-1px); }

.article-hero h1 {
  margin: .9rem 0 .6rem;
  font-size: clamp(1.9rem, 1.2rem + 2.6vw, 2.9rem);
  line-height: 1.15; letter-spacing: -0.022em; font-weight: 800;
  text-wrap: balance;
}
.article-dek {
  font-size: clamp(1.05rem, 1rem + .3vw, 1.2rem);
  line-height: 1.65; color: var(--text-2); max-width: 62ch;
}

/* Byline row */
.article-byline {
  display: flex; flex-wrap: wrap; align-items: center; gap: .9rem 1.1rem;
  margin-top: 1.35rem; padding-top: 1.15rem;
  border-top: 1px solid var(--border);
}
.byline-author { display: flex; align-items: center; gap: .7rem; }
.avatar {
  width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 800; font-size: 1.05rem; color: #fff;
  background: linear-gradient(135deg, var(--blue-500), var(--emerald-500));
  box-shadow: 0 0 0 3px var(--surface), 0 0 0 4px var(--border);
  user-select: none; flex: 0 0 auto;
}
.byline-author b { display: block; line-height: 1.2; }
.byline-author small { color: var(--text-3); font-size: var(--text-xs); }

.byline-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .9rem;
  color: var(--text-3); font-size: var(--text-sm);
}
.byline-meta i { margin-right: .35rem; color: var(--text-3); }
.updated-pill {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .18rem .6rem; border-radius: var(--radius-full);
  font-size: var(--text-xs); font-weight: 600;
  background: color-mix(in srgb, var(--emerald-500) 12%, transparent);
  color: var(--emerald-600, var(--emerald-500));
}

.byline-share { margin-left: auto; display: flex; gap: .45rem; }
.share-btn {
  width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-2); cursor: pointer;
  text-decoration: none; font-size: .95rem;
  transition: transform var(--speed) var(--ease), color var(--speed), border-color var(--speed), background var(--speed);
}
.share-btn:hover { transform: translateY(-2px); color: #fff; }
.share-btn.tw:hover { background: #0f1419; border-color: #0f1419; }
.share-btn.li:hover { background: #0a66c2; border-color: #0a66c2; }
.share-btn.fb:hover { background: #1877f2; border-color: #1877f2; }
.share-btn.cp:hover { background: var(--blue-600); border-color: var(--blue-600); }

@media print { .article-rail, .byline-share, .share-bar { display: none !important; } }

/* ---------- Two-column shell ---------- */
.article-shell {
  max-width: 1160px; margin-inline: auto;
  padding: 1.5rem 1rem 3rem;
  display: grid; grid-template-columns: minmax(0, 720px) 320px;
  gap: 3rem; justify-content: center;
}
.article-rail { display: block; }
.rail-sticky { position: sticky; top: 92px; display: grid; gap: 1.1rem; }

@media (max-width: 1023px) {
  .article-shell { grid-template-columns: minmax(0, 1fr); }
  .article-rail { display: none; }
}

/* ---------- TOC ---------- */
.toc-card {
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--surface); padding: 1.1rem 1.15rem;
}
.toc-card h2 {
  font-size: var(--text-xs); font-weight: 800; letter-spacing: .09em;
  text-transform: uppercase; color: var(--text-3); margin: 0 0 .7rem;
  display: flex; align-items: center; gap: .5rem;
}
.toc-list { list-style: none; margin: 0; padding: 0; max-height: 52vh; overflow: auto; }
.toc-list li { margin: 0; }
.toc-list a {
  display: block; padding: .42rem .65rem; border-radius: var(--radius);
  font-size: var(--text-sm); color: var(--text-2); text-decoration: none;
  border-left: 2px solid transparent; line-height: 1.4;
  transition: color var(--speed), background var(--speed), border-color var(--speed);
}
.toc-list a:hover { color: var(--text-1); background: var(--surface-2); }
.toc-list a.active {
  color: var(--blue-600); font-weight: 600;
  border-left-color: var(--blue-500);
  background: color-mix(in srgb, var(--blue-500) 8%, transparent);
}
.toc-list a.lvl-3 { padding-left: 1.45rem; font-size: var(--text-xs); }

/* Rail promo */
.rail-promo {
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 1.15rem; background:
    linear-gradient(160deg, color-mix(in srgb, var(--blue-500) 9%, var(--surface)), var(--surface));
}
.rail-promo h3 { font-size: var(--text-base); margin: 0 0 .35rem; }
.rail-promo p { font-size: var(--text-sm); color: var(--text-2); margin: 0 0 .8rem; }

/* ---------- Article body typography ---------- */
.article-body {
  font-size: 1.075rem; line-height: 1.85; color: var(--text-1);
  overflow-wrap: break-word;
}
.article-body > * + * { margin-top: 1.15rem; }
.article-body .content-block { margin-top: 1.15rem; }

.article-body h2, .article-body h3, .article-body h4 {
  scroll-margin-top: 96px; line-height: 1.3; letter-spacing: -0.015em;
  font-weight: 750;
}
.article-body h2 {
  font-size: clamp(1.35rem, 1.15rem + .8vw, 1.7rem);
  margin-top: 2.6rem; padding-bottom: .55rem; position: relative;
}
.article-body h2::after {
  content: ""; position: absolute; left: 0; bottom: 0;
  width: 52px; height: 3px; border-radius: 3px;
  background: linear-gradient(90deg, var(--blue-500), var(--emerald-500));
}
.article-body h3 { font-size: 1.2rem; margin-top: 2rem; }

.article-body a {
  color: var(--blue-600); text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--blue-500) 40%, transparent);
  text-underline-offset: 3px; font-weight: 500;
}
.article-body a:hover { text-decoration-color: var(--blue-500); }

.article-body ul, .article-body ol { padding-left: 1.35rem; }
.article-body li { margin-top: .45rem; }
.article-body li::marker { color: var(--blue-500); font-weight: 700; }

.article-body strong { font-weight: 700; }
.article-body hr, .article-body .divider-block hr {
  border: 0; height: 1px; background: var(--border); margin: 2.4rem auto; width: 60%;
}

/* Quotes / callouts */
.article-body blockquote {
  margin: 1.6rem 0; padding: 1.1rem 1.35rem;
  border-left: 4px solid var(--blue-500);
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
  background: color-mix(in srgb, var(--blue-500) 7%, var(--surface));
  font-size: 1.06rem; color: var(--text-1);
}
.article-body blockquote p { margin: 0; }
.article-body .blockquote-footer {
  margin-top: .55rem; font-size: var(--text-sm); color: var(--text-3);
}
.article-body .blockquote-footer::before { content: "— "; }

/* Images inside content */
.article-body figure { margin: 1.8rem 0; }
.article-body img {
  max-width: 100%; height: auto; border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.article-body .image-caption {
  margin-top: .55rem; text-align: center;
  font-size: var(--text-xs); color: var(--text-3);
}

/* Code */
.article-body pre {
  margin: 1.6rem 0; padding: 1.1rem 1.25rem; overflow: auto;
  border-radius: var(--radius-lg);
  background: #0d1526; color: #e6edf7;
  border: 1px solid color-mix(in srgb, var(--blue-500) 25%, transparent);
  font-size: .92rem; line-height: 1.65;
}
.article-body :not(pre) > code {
  padding: .15rem .45rem; border-radius: 6px; font-size: .9em;
  background: color-mix(in srgb, var(--blue-500) 10%, var(--surface-2));
  color: var(--blue-600);
}

/* Tables */
.article-body table {
  width: 100%; margin: 1.6rem 0; border-collapse: separate; border-spacing: 0;
  font-size: var(--text-sm); display: block; overflow-x: auto;
  border: 1px solid var(--border); border-radius: var(--radius-lg);
}
.article-body th, .article-body td {
  padding: .75rem .9rem; text-align: left; vertical-align: top;
  border-bottom: 1px solid var(--border); min-width: 120px;
}
.article-body thead th {
  background: var(--surface-2); font-weight: 700; white-space: nowrap;
  position: sticky; top: 0;
}
.article-body tbody tr:last-child td { border-bottom: 0; }
.article-body tbody tr:nth-child(even) td {
  background: color-mix(in srgb, var(--surface-2) 55%, transparent);
}

::selection { background: color-mix(in srgb, var(--blue-500) 25%, transparent); }

/* ---------- Tags ---------- */
.tags-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem;
  margin-top: 2.4rem; padding-top: 1.4rem; border-top: 1px solid var(--border);
}
.tag-chip {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .34rem .8rem; border-radius: var(--radius-full);
  border: 1px solid var(--border); background: var(--surface);
  font-size: var(--text-xs); font-weight: 600; color: var(--text-2);
  text-decoration: none; transition: all var(--speed) var(--ease);
}
.tag-chip:hover {
  color: var(--blue-600); border-color: var(--blue-500);
  background: color-mix(in srgb, var(--blue-500) 7%, var(--surface));
  transform: translateY(-1px);
}
.tag-chip i { font-size: .68rem; opacity: .7; }

/* ---------- End-of-article share ---------- */
.share-bar {
  margin-top: 1.6rem; padding: 1.15rem 1.3rem;
  display: flex; flex-wrap: wrap; align-items: center; gap: .8rem 1.2rem;
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--surface);
}
.share-bar b { font-size: var(--text-sm); }
.share-bar .btns { display: flex; flex-wrap: wrap; gap: .5rem; margin-left: auto; }
.share-pill {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .5rem .95rem; border-radius: var(--radius-full);
  font-size: var(--text-sm); font-weight: 600; text-decoration: none;
  border: 1px solid var(--border); color: var(--text-2); background: var(--surface);
  cursor: pointer; transition: all var(--speed) var(--ease);
}
.share-pill:hover { color: #fff; transform: translateY(-1px); }
.share-pill.tw:hover { background: #0f1419; border-color: #0f1419; }
.share-pill.li:hover { background: #0a66c2; border-color: #0a66c2; }
.share-pill.fb:hover { background: #1877f2; border-color: #1877f2; }
.share-pill.cp:hover { background: var(--blue-600); border-color: var(--blue-600); }

/* ---------- Author card ---------- */
.author-card {
  margin-top: 1.6rem; padding: 1.4rem;
  display: flex; gap: 1.1rem; align-items: flex-start;
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: linear-gradient(160deg, color-mix(in srgb, var(--blue-500) 5%, var(--surface)), var(--surface));
}
.author-card .avatar { width: 60px; height: 60px; font-size: 1.4rem; }
.author-card h2 { font-size: 1.05rem; margin: 0; }
.author-card .role {
  font-size: var(--text-xs); font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--blue-600); margin: .15rem 0 .5rem;
}
.author-card p { margin: 0; font-size: var(--text-sm); color: var(--text-2); line-height: 1.65; }

/* ---------- Admin toolbar ---------- */
.admin-toolbar {
  margin-top: 1.6rem; padding: 1rem 1.2rem;
  display: flex; flex-wrap: wrap; align-items: center; gap: .6rem;
  border: 1px dashed color-mix(in srgb, var(--coral-500) 45%, var(--border));
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--coral-500) 4%, var(--surface));
}
.admin-toolbar > span {
  font-size: var(--text-xs); font-weight: 800; letter-spacing: .08em;
  text-transform: uppercase; color: var(--text-3); margin-right: .4rem;
}

/* ---------- Prev / next ---------- */
.prevnext {
  margin-top: 2rem; display: grid; grid-template-columns: 1fr 1fr; gap: 1rem;
}
@media (max-width: 640px) { .prevnext { grid-template-columns: 1fr; } }
.pn-card {
  display: block; padding: 1.05rem 1.2rem; text-decoration: none;
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--surface); transition: all var(--speed) var(--ease);
}
.pn-card:hover { border-color: var(--blue-500); transform: translateY(-2px); box-shadow: var(--shadow); }
.pn-card .dir {
  display: flex; align-items: center; gap: .4rem;
  font-size: var(--text-xs); font-weight: 700; letter-spacing: .07em;
  text-transform: uppercase; color: var(--text-3); margin-bottom: .35rem;
}
.pn-card.next { text-align: right; }
.pn-card.next .dir { justify-content: flex-end; }
.pn-card .ttl { font-weight: 650; color: var(--text-1); font-size: var(--text-sm); line-height: 1.45; }
.pn-card:hover .ttl { color: var(--blue-600); }

/* ---------- Related + CTA ---------- */
.related-section { padding: 3rem 0 1rem; }

.article-cta {
  max-width: 1160px; margin: 1.5rem auto 3.5rem; padding: 0 1rem;
}
.article-cta .inner {
  border-radius: var(--radius-xl); padding: 2rem 1.75rem;
  display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 2rem;
  color: #fff;
  background:
    radial-gradient(600px 200px at 90% -20%, rgb(56 189 248 / .35), transparent 60%),
    linear-gradient(135deg, #0f1b2d, #14263f);
}
.article-cta h2 { color: #fff; font-size: var(--text-xl); margin: 0 0 .3rem; }
.article-cta p { color: rgb(255 255 255 / .75); margin: 0; font-size: var(--text-sm); max-width: 52ch; }
.article-cta .btn { margin-left: auto; }
@media (max-width: 640px) { .article-cta .btn { margin-left: 0; } }

/* Copy-link toast */
.copy-toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(8px);
  padding: .6rem 1.1rem; border-radius: var(--radius-full);
  background: var(--text-1); color: var(--bg); font-size: var(--text-sm); font-weight: 600;
  opacity: 0; pointer-events: none; z-index: 80;
  transition: opacity .2s var(--ease), transform .2s var(--ease);
}
.copy-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }