/* ============================================================
   Article pages (includes/article.php).
   Content first: a readable column, a sticky table of contents
   and buy card beside it, and one style for every component the
   articles use — steps with phone shots, callouts, tables, FAQ.
   ============================================================ */

/* ------------------------------------------------------------ hero */
.post-hero {
  color: #fff; position: relative; overflow: hidden;
  padding-block: clamp(2rem, 1.2rem + 3vw, 3.75rem);
  /* the topic colour glows over the brand gradient; white text stays readable on every topic */
  background:
    radial-gradient(520px 320px at 12% 10%, rgb(var(--c1) / .55), transparent 65%),
    radial-gradient(460px 300px at 95% 120%, rgb(var(--c2) / .45), transparent 65%),
    linear-gradient(135deg, rgb(var(--brand-700)), rgb(var(--brand)) 60%, rgb(var(--brand-2)));
}
.post-hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(rgb(255 255 255 / .16) 1px, transparent 1px);
  background-size: 22px 22px; opacity: .3;
  mask-image: linear-gradient(to bottom, #000, transparent 80%);
}
.post-hero-in { position: relative; z-index: 1; display: flex; align-items: center; gap: 2rem; }
.post-hero-text { flex: 1; min-width: 0; }
.post-hero h1 { color: #fff; margin: .6rem 0 .9rem; max-width: 24ch; text-wrap: balance; }
.post-hero .crumbs, .post-hero .crumbs a { color: rgb(255 255 255 / .78); }
.post-hero .crumbs a:hover { color: #fff; }
.post-chip {
  display: inline-flex; align-items: center; gap: .4rem;
  background: rgb(255 255 255 / .16); border: 1px solid rgb(255 255 255 / .26);
  border-radius: 999px; padding: .25rem .8rem .25rem .65rem; font-size: .8rem; font-weight: 700;
  backdrop-filter: blur(6px);
}
.post-chip svg { width: 15px; height: 15px; }
.post-meta { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; color: rgb(255 255 255 / .82); font-size: .88rem; }
.post-meta span { display: inline-flex; align-items: center; gap: .4rem; }
.post-meta svg { width: 16px; height: 16px; flex: none; }
.post-hero-art {
  display: none; flex: none; width: 150px; height: 150px; border-radius: 40px;
  place-items: center; color: #fff; transform: rotate(-6deg);
  background: linear-gradient(135deg, rgb(var(--c1)), rgb(var(--c2)));
  border: 1px solid rgb(255 255 255 / .3);
  box-shadow: 0 24px 50px rgb(0 0 0 / .25), inset 0 1px 0 rgb(255 255 255 / .35);
}
.post-hero-art svg { width: 68px; height: 68px; }
@media (min-width: 860px) { .post-hero-art { display: grid; } }

/* ------------------------------------------------------------ layout */
.post-wrap { padding-block: clamp(1.75rem, 1rem + 3vw, 3.25rem); }
.post-grid { display: grid; gap: 2rem; }
.post-side { order: 2; display: grid; gap: 1rem; align-content: start; }
@media (min-width: 980px) {
  .post-grid { grid-template-columns: minmax(0, 1fr) 290px; gap: 3rem; }
  .post-side { order: 0; grid-column: 2; grid-row: 1; align-self: start; position: sticky; top: 84px; }
  .post { grid-column: 1; grid-row: 1; }
}

.toc-box, .buy-box {
  background: rgb(var(--card)); border: 1px solid rgb(var(--line));
  border-radius: var(--r-lg); padding: 1.1rem 1.15rem; box-shadow: var(--shadow-card);
}
.toc-box { display: none; }
@media (min-width: 980px) { .toc-box { display: block; } }
.toc-box-title { font-weight: 800; font-size: .92rem; margin: 0 0 .6rem; }
.toc-box ol { list-style: none; margin: 0; padding: 0; display: grid; gap: .1rem; }
.toc-box a {
  display: block; padding: .38rem .7rem; border-radius: 10px; font-size: .86rem; line-height: 1.7;
  color: rgb(var(--muted)); border-inline-start: 2px solid transparent;
  transition: background-color .2s, color .2s, border-color .2s;
}
.toc-box a:hover { background: rgb(var(--soft)); color: rgb(var(--ink)); text-decoration: none; }
.toc-box a.on { color: rgb(var(--brand)); background: rgb(var(--brand-soft)); border-color: rgb(var(--brand)); font-weight: 700; }

.buy-box {
  position: relative; overflow: hidden; display: grid; gap: .45rem;
  background:
    radial-gradient(300px 160px at 100% 0%, rgb(var(--accent) / .14), transparent 70%),
    rgb(var(--card));
}
.buy-box-ic {
  width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, rgb(var(--brand)), rgb(var(--brand-2)));
  box-shadow: 0 8px 18px rgb(var(--brand) / .3);
}
.buy-box-ic svg { width: 22px; height: 22px; }
.buy-box b { font-size: 1rem; }
.buy-box p { margin: 0; font-size: .86rem; color: rgb(var(--muted)); line-height: 1.8; }
.buy-box .buy-box-price { color: rgb(var(--ink)); font-size: .9rem; }
.buy-box-price b { color: rgb(var(--brand)); font-size: 1.05rem; }
.buy-box .btn { margin-top: .35rem; }
.buy-box-link { text-align: center; font-size: .84rem; font-weight: 700; }

/* ------------------------------------------------------------ text */
.post.prose { max-width: none; font-size: 1rem; line-height: 2.05; overflow-wrap: anywhere; min-width: 0; }
.post.prose > * { max-width: 46rem; }
.post.prose > p:first-of-type {
  font-size: 1.1rem; line-height: 2; color: rgb(var(--ink));
  padding-bottom: 1.25rem; border-bottom: 1px solid rgb(var(--line)); margin-bottom: 1.5rem;
}
.post h2 { scroll-margin-top: 88px; margin-top: 2.6rem; margin-bottom: .9rem; }
.post h3 { margin-top: 1.6rem; color: rgb(var(--ink)); }
.post b, .post strong { color: rgb(var(--ink)); }
.post a:not(.btn) { text-decoration: underline; text-decoration-color: rgb(var(--brand) / .35); text-underline-offset: 4px; }
.post a:not(.btn):hover { text-decoration-color: rgb(var(--brand)); }
.post [dir="ltr"] { unicode-bidi: isolate; }

/* lists */
.post ul.dotted li::before { background: linear-gradient(135deg, rgb(var(--brand)), rgb(var(--accent))); }
.post ol.steps-list li::before {
  background: linear-gradient(135deg, rgb(var(--brand)), rgb(var(--brand-2))); color: #fff;
  box-shadow: 0 4px 10px rgb(var(--brand) / .25);
}

/* callouts: one shape, colour says what kind */
.post .note {
  position: relative; display: block; border: 1px solid rgb(var(--brand) / .25);
  border-inline-start: 4px solid rgb(var(--brand));
  background: rgb(var(--brand-soft)); color: rgb(var(--ink));
  border-radius: var(--r-md); padding: 1rem 1.15rem; margin: 1.5rem 0; line-height: 1.95;
}
.post .note.bad  { border-color: rgb(var(--bad) / .3);  border-inline-start-color: rgb(var(--bad));  background: rgb(var(--bad-soft)); }
.post .note.ok   { border-color: rgb(var(--ok) / .3);   border-inline-start-color: rgb(var(--ok));   background: rgb(var(--ok-soft)); }
.post .note.warn { border-color: rgb(var(--warn) / .3); border-inline-start-color: rgb(var(--warn)); background: rgb(var(--warn-soft)); }
.post .note.bad > b:first-child { color: rgb(var(--bad)); }
.post .note.ok > b:first-child  { color: rgb(var(--ok)); }

/* tables */
.post .tbl-wrap {
  border: 1px solid rgb(var(--line)); border-radius: var(--r-lg); overflow-x: auto;
  background: rgb(var(--card)); box-shadow: var(--shadow-card);
}
.post .cmp-table { margin: 0; min-width: 520px; }
.post .cmp-table thead th { background: linear-gradient(135deg, rgb(var(--brand-700)), rgb(var(--brand))); }
.post .cmp-table td, .post .cmp-table th { border-bottom-color: rgb(var(--line)); vertical-align: top; }
.post .cmp-table tbody tr:last-child td { border-bottom: 0; }
.post .cmp-table td[dir="ltr"] { text-align: left; font-size: .86rem; }

/* figures */
.post .article-fig { box-shadow: var(--shadow-card); }

/* step-by-step with a phone screen beside each step */
.post .step-shot {
  display: grid; gap: 1.25rem; align-items: center;
  background: rgb(var(--card)); border: 1px solid rgb(var(--line));
  border-radius: var(--r-xl); padding: 1.25rem; margin: 1.25rem 0; box-shadow: var(--shadow-card);
}
@media (min-width: 640px) { .post .step-shot { grid-template-columns: minmax(0, 1fr) 210px; padding: 1.5rem; } }
.post .step-shot .txt p { margin-bottom: .6rem; }
.post .step-shot .txt p:last-child { margin-bottom: 0; }
.post .step-shot h3 { display: flex; align-items: center; gap: .65rem; margin: 0 0 .7rem; font-size: 1.08rem; }
.post .step-num {
  flex: none; width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center;
  background: linear-gradient(135deg, rgb(var(--brand)), rgb(var(--brand-2))); color: #fff;
  font-size: .92rem; font-weight: 800; box-shadow: 0 6px 14px rgb(var(--brand) / .3);
}
.post .step-shot .shot {
  justify-self: center; width: 100%; max-width: 210px; padding: .9rem;
  border-radius: var(--r-lg);
  background:
    radial-gradient(200px 160px at 50% 0%, rgb(var(--accent) / .16), transparent 70%),
    rgb(var(--soft));
}
/* the phone screens are English UI drawn left-to-right; the page's RTL would anchor their text from the wrong end */
.post .step-shot .shot svg { direction: ltr; width: 100%; height: auto; filter: drop-shadow(0 12px 18px rgb(20 16 90 / .18)); }
.post .hint {
  display: inline-block; font-size: .85rem; color: rgb(var(--muted));
  background: rgb(var(--soft)); border-radius: 8px; padding: .15rem .6rem;
}

/* FAQ: native accordion */
.post .qa-list { display: grid; gap: .65rem; margin: 1rem 0 1.5rem; }
.post details.qa {
  background: rgb(var(--card)); border: 1px solid rgb(var(--line));
  border-radius: var(--r-md); transition: border-color .2s, box-shadow .2s;
}
.post details.qa[open] { border-color: rgb(var(--brand) / .4); box-shadow: var(--shadow-card); }
.post details.qa summary {
  cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: .95rem 1.1rem; font-weight: 700; line-height: 1.8;
}
.post details.qa summary::-webkit-details-marker { display: none; }
.post details.qa summary::after {
  content: ""; flex: none; width: 26px; height: 26px; border-radius: 8px;
  background: rgb(var(--brand-soft)) center / 14px no-repeat;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%233d2fd6' stroke-width='2.6' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  transition: transform .25s ease;
}
.post details.qa[open] summary::after { transform: rotate(180deg); }
@media (prefers-color-scheme: dark) {
  .post details.qa summary::after {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23b4adff' stroke-width='2.6' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  }
}
@media (prefers-reduced-motion: reduce) { .post details.qa summary::after { transition: none; } }
.post details.qa summary:hover { color: rgb(var(--brand)); }
.post .qa-a { padding: 0 1.1rem 1rem; color: rgb(var(--muted)); }
.post .qa-a p { margin: 0; }

/* the in-text call to action */
.post .article-cta {
  margin: 2.25rem 0; padding: clamp(1.25rem, 1rem + 1.5vw, 2rem); border-radius: var(--r-xl);
  color: #fff; position: relative; overflow: hidden; box-shadow: var(--shadow-pop);
  background:
    radial-gradient(420px 220px at 90% -20%, rgb(var(--accent) / .45), transparent 65%),
    linear-gradient(135deg, rgb(var(--brand-700)), rgb(var(--brand)) 60%, rgb(var(--brand-2)));
}
.post .article-cta h3 { color: #fff; margin: 0 0 .4rem; font-size: 1.2rem; }
.post .article-cta p { color: rgb(255 255 255 / .86); margin-bottom: 1rem; }
.post .article-cta .cta-row { display: flex; flex-wrap: wrap; gap: .6rem; margin-bottom: .85rem; }
.post .article-cta a.btn { text-decoration: none; }
.post .article-cta small { color: rgb(255 255 255 / .75); font-size: .8rem; }

/* ------------------------------------------------------------ tail */
.post-tail { padding-bottom: 1rem; }
.cta-band-actions { display: flex; flex-wrap: wrap; gap: .75rem; justify-content: center; margin-top: 1.25rem; }
.post-tail .related { margin-top: 2.5rem; }
