/* ==========================================================================
   Sabi Resources: article and hub styles.
   Loads after /assets/sabi.css and only uses its tokens, through the
   semantic aliases below. No colour values are hard-coded in components,
   so light mode, dark mode and each product accent work automatically.
   ========================================================================== */

/* ---------- semantic aliases (map design-system tokens to roles) */
:root{
  --color-background:var(--paper);
  --color-background-alt:var(--paper-2);
  --color-surface:var(--surface);
  --color-surface-elevated:var(--surface-2);
  --color-border:var(--line);
  --color-border-strong:var(--line-2);
  --color-text-primary:var(--ink);
  --color-text-secondary:var(--ink-2);
  --color-text-muted:var(--muted);
  --color-accent:var(--accent);
  --color-accent-strong:var(--accent-strong);
  --color-accent-soft:var(--accent-soft);
  --color-on-accent:var(--on-accent);
  --color-success:var(--leaf-700);
  --color-success-soft:var(--leaf-100);
  --color-warning:#7a4a05;
  --color-warning-soft:var(--ochre-100);
  --color-danger:var(--clay-600);
  --color-danger-soft:var(--clay-100);

  /* spacing (4-point scale) */
  --space-1:4px; --space-2:8px; --space-3:12px; --space-4:16px;
  --space-5:24px; --space-6:32px; --space-7:48px; --space-8:64px;

  /* type roles */
  --font-size-xs:.78rem; --font-size-sm:var(--step--1); --font-size-md:var(--step-0);
  --font-size-lg:var(--step-1); --font-size-xl:var(--step-2);
  --line-height-tight:1.25; --line-height-body:1.7;
  --font-weight-regular:400; --font-weight-medium:500; --font-weight-semibold:600; --font-weight-bold:650;

  /* radius & elevation aliases */
  --radius-sm:var(--r-sm); --radius-md:var(--r); --radius-lg:var(--r-lg);
  --shadow-1:var(--shadow-sm); --shadow-2:var(--shadow); --shadow-3:var(--shadow-lg);
}
@media (prefers-color-scheme:dark){
  :root{--color-success:#6fe0b5;--color-warning:#f5c56b;--color-danger:#ff9f7a}
}
/* PromptVeil has no product accent in sabi.css yet; it borrows the hub indigo. */
[data-product="veil"]{--accent:var(--indigo-700);--accent-strong:var(--indigo-800);--accent-soft:var(--indigo-100)}
@media (prefers-color-scheme:dark){[data-product="veil"]{--accent:#8a98ff;--accent-strong:#a9b4ff;--accent-soft:#1d2240;--on-accent:#0d1230}}

/* ---------- breadcrumb */
.crumbs{font-size:var(--font-size-sm);color:var(--color-text-muted);margin-bottom:var(--space-5)}
.crumbs ol{list-style:none;margin:0;padding:0;display:flex;flex-wrap:wrap;gap:var(--space-2)}
.crumbs li+li::before{content:"/";margin-right:var(--space-2);color:var(--color-border-strong)}
.crumbs a{color:var(--color-text-muted);text-decoration:none}
.crumbs a:hover{color:var(--color-text-primary);text-decoration:underline}

/* ---------- article header */
.article-head{padding-block:clamp(40px,6vw,80px) clamp(24px,4vw,40px);border-bottom:1px solid var(--color-border)}
.article-head h1{font-size:var(--step-4);max-width:22ch}
.article-head .lede{margin-top:var(--space-4)}
.article-meta{display:flex;flex-wrap:wrap;gap:var(--space-2) var(--space-5);margin-top:var(--space-5);font-size:var(--font-size-sm);color:var(--color-text-muted)}
.article-meta span{display:inline-flex;align-items:center;gap:.4em}

/* ---------- layout: prose + sticky table of contents */
.article-layout{display:grid;grid-template-columns:minmax(0,1fr);gap:clamp(24px,5vw,64px);padding-block:clamp(32px,5vw,64px)}
@media (min-width:1040px){.article-layout{grid-template-columns:minmax(0,1fr) 260px}.article-layout .toc{order:2}}
.toc{font-size:var(--font-size-sm)}
.toc details{background:var(--color-surface);border:1px solid var(--color-border);border-radius:var(--radius-md);padding:var(--space-3) var(--space-4)}
.toc summary{cursor:pointer;font-weight:var(--font-weight-semibold);color:var(--color-text-primary)}
.toc ol{list-style:none;margin:var(--space-3) 0 0;padding:0;display:grid;gap:var(--space-2)}
.toc a{color:var(--color-text-secondary);text-decoration:none;display:block;padding:2px 0 2px var(--space-3);border-left:2px solid var(--color-border)}
.toc a:hover{color:var(--color-accent);border-left-color:var(--color-accent)}
@media (min-width:1040px){
  .toc{position:sticky;top:88px;align-self:start;max-height:calc(100vh - 110px);overflow:auto}
  .toc details{background:transparent;border:0;padding:0}
  .toc summary{pointer-events:none;list-style:none;font:600 var(--font-size-xs)/1 var(--font-body);letter-spacing:.08em;text-transform:uppercase;color:var(--color-text-muted)}
  .toc summary::-webkit-details-marker{display:none}
}

/* ---------- article prose */
.article-body{max-width:70ch;font-size:var(--font-size-md);line-height:var(--line-height-body)}
.article-body h2{font-size:var(--step-2);margin-top:2.2em;scroll-margin-top:88px}
.article-body h3{font-size:var(--step-1);margin-top:1.8em;scroll-margin-top:88px}
.article-body ul,.article-body ol{padding-left:1.3em;margin:0 0 1.2em}
.article-body li{margin-bottom:.45em}
.article-body li>ul,.article-body li>ol{margin-top:.45em}
.article-body blockquote{margin:1.5em 0;padding:var(--space-1) 0 var(--space-1) var(--space-5);border-left:3px solid var(--color-accent);color:var(--color-text-secondary)}
.article-body code{background:var(--color-background-alt);padding:.1em .35em;border-radius:6px}
.article-body hr{margin:2.5rem 0}
.article-body :is(h2,h3) a.anchor{opacity:0;margin-left:.3em;color:var(--color-text-muted);text-decoration:none;font-weight:400}
.article-body :is(h2,h3):hover a.anchor,.article-body a.anchor:focus-visible{opacity:1}
/* language examples */
.article-body .ex-term,.article-body i.lang{font-style:italic;color:var(--color-text-primary)}
.article-body [lang="ig"]{font-feature-settings:normal}

/* ---------- tables */
.table-wrap{overflow-x:auto;margin:1.5em 0;border:1px solid var(--color-border);border-radius:var(--radius-md);background:var(--color-surface)}
.table-wrap:focus-visible{box-shadow:var(--focus)}
.article-body table{width:100%;border-collapse:collapse;font-size:.95em;line-height:1.5}
.article-body th,.article-body td{text-align:left;vertical-align:top;padding:var(--space-3) var(--space-4);border-bottom:1px solid var(--color-border)}
.article-body thead th{background:var(--color-surface-elevated);font-weight:var(--font-weight-semibold);color:var(--color-text-primary);white-space:nowrap}
.article-body tbody tr:last-child td{border-bottom:0}
.article-body caption{caption-side:bottom;text-align:left;padding:var(--space-3) var(--space-4);font-size:var(--font-size-sm);color:var(--color-text-muted)}

/* ---------- callouts */
.callout{margin:1.6em 0;padding:var(--space-4) var(--space-5);border-radius:var(--radius-md);border:1px solid var(--color-border);border-left:4px solid var(--color-accent);background:var(--color-surface)}
.callout>:last-child{margin-bottom:0}
.callout .callout-title{display:block;font-weight:var(--font-weight-semibold);margin-bottom:var(--space-2);color:var(--color-text-primary)}
.callout--warn{border-left-color:var(--ochre-500);background:var(--color-warning-soft)}
.callout--tip{border-left-color:var(--leaf-600);background:var(--color-success-soft)}
.callout--key{border-left-color:var(--color-accent);background:var(--color-accent-soft)}

/* ---------- checklists (interactive only if JS; plain list otherwise) */
.article-body ul.checklist{list-style:none;padding-left:0}
.article-body ul.checklist li{position:relative;padding-left:2rem}
.article-body ul.checklist li::before{content:"";position:absolute;left:0;top:.3em;width:1.15rem;height:1.15rem;border:2px solid var(--color-border-strong);border-radius:5px;background:var(--color-surface)}

/* ---------- product CTA */
.cta-card{margin:clamp(40px,6vw,64px) 0 0;padding:clamp(24px,3vw,36px);border-radius:var(--radius-lg);background:var(--color-accent-soft);border:1px solid color-mix(in srgb,var(--color-accent) 30%,transparent)}
.cta-card .eyebrow{margin-bottom:var(--space-3)}
.cta-card h2{font-size:var(--step-2);margin:0 0 var(--space-3)}
.cta-card p{color:var(--color-text-secondary);max-width:60ch}
.cta-card .btn-row{margin-top:var(--space-5)}

/* ---------- FAQ, sources, related */
.article-section{margin-top:clamp(40px,6vw,64px)}
.article-section>h2{font-size:var(--step-2);margin-bottom:var(--space-5)}
.sources{font-size:var(--font-size-sm);color:var(--color-text-secondary);padding-left:1.2em}
.sources li{margin-bottom:var(--space-2);overflow-wrap:anywhere}
.related{display:grid;gap:var(--space-4);grid-template-columns:repeat(auto-fit,minmax(min(100%,240px),1fr))}
.related .card h3{font-size:1.05rem;line-height:1.3}
.related .card p{font-size:var(--font-size-sm);color:var(--color-text-muted)}
.reviewed{font-size:var(--font-size-sm);color:var(--color-text-muted);border-top:1px solid var(--color-border);margin-top:var(--space-7);padding-top:var(--space-4)}

/* ---------- author */
.article-meta a{color:inherit}
.author-box{margin-top:var(--space-7);padding:var(--space-4) var(--space-5);border:1px solid var(--color-border);border-radius:var(--radius-md);background:var(--color-surface);font-size:var(--font-size-sm);color:var(--color-text-secondary)}
.author-box p{margin:0 0 var(--space-1)}
.author-box strong{color:var(--color-text-primary)}

/* ---------- resources hub */
.hub-head{padding-block:clamp(48px,7vw,104px) clamp(28px,4vw,48px)}
.filter{display:flex;flex-wrap:wrap;gap:var(--space-2);margin-top:var(--space-6)}
.filter a{display:inline-flex;align-items:center;padding:.5em 1em;border-radius:999px;border:1px solid var(--color-border-strong);color:var(--color-text-secondary);text-decoration:none;font-weight:var(--font-weight-medium);font-size:.93rem}
.filter a:hover{background:var(--color-background-alt);color:var(--color-text-primary)}
.topic{padding-block:clamp(32px,5vw,56px);scroll-margin-top:72px}
.topic+.topic{border-top:1px solid var(--color-border)}
.topic-head{display:flex;flex-wrap:wrap;align-items:baseline;justify-content:space-between;gap:var(--space-3);margin-bottom:var(--space-5)}
.topic-head h2{font-size:var(--step-3);margin:0}
.topic-head p{margin:0;color:var(--color-text-muted);max-width:52ch}
.article-card{display:flex;flex-direction:column;height:100%}
.article-card .chip{align-self:flex-start;margin-bottom:var(--space-4)}
.article-card h3{font-size:1.15rem;line-height:1.3;margin-bottom:var(--space-2)}
.article-card p{color:var(--color-text-muted);font-size:.95rem}
.article-card .read{margin-top:auto;padding-top:var(--space-4);font-size:var(--font-size-sm);color:var(--color-text-muted)}
.article-card[data-product]{--card-accent:var(--accent)}

/* ---------- print */
@media print{
  .site-header,.site-footer,.stripe,.toc,.cta-card .btn-row,.related{display:none!important}
  .article-layout{display:block}
  .article-body{max-width:none}
  a{color:inherit} .article-body a[href^="http"]::after{content:" (" attr(href) ")";font-size:.85em;color:#555}
}
