/* ============================================================
   Annota8 — Blog / long-form article styles
   Reuses tokens.css + base.css (the .a8-bg backdrop, bbox motif,
   reveals, badges, buttons). Register: day (paper) — the fixed
   brand backdrop shows through. Signature add: animated keypoint
   skeletons (the article annotates its own subject).
   ============================================================ */

/* ---------- reading progress (top) ---------- */
.kp-progress {
  position: fixed; top: 0; left: 0; height: 3px; width: 0%;
  z-index: 200; pointer-events: none;
  background: linear-gradient(90deg, var(--brand), var(--brand-alt));
  box-shadow: 0 0 14px rgba(63,111,200,0.5);
  transition: width 80ms linear;
}
[dir="rtl"] .kp-progress{left:auto;right:0;}

/* ---------- article shell ---------- */
.kp-main { padding-top: 0; }
.kp-wrap { max-width: 760px; margin-inline: auto; padding-inline: var(--gutter); }
.kp-wrap--wide { max-width: 1100px; }

/* Wide desktop: a centered content band offset to the right of the fixed TOC rail.
   Gives small balanced side margins (uses the screen), a wider reading + media
   column (less scrolling), and guarantees content never sits under the TOC. */
@media (min-width: 1180px) {
  .kp-main { max-width: 1340px; margin-inline: auto; box-sizing: border-box;
             padding-inline-start: 206px; padding-inline-end: clamp(1.5rem, 4vw, 3.5rem); }
  /* scoped to .kp-main so the article band never affects the index listing,
     which reuses .kp-wrap--wide for its card grid (no .kp-main there). */
  /* prose CENTERED in the content area (balanced L/R); media breaks out
     full-width, so the prose reads as a centered column inside wider media. */
  .kp-main .kp-wrap { margin-inline: auto; padding-inline: 0; max-width: 900px; }
  .kp-main .kp-wrap--wide { margin-inline: 0; padding-inline: 0; max-width: 100%; }
}
.kp-article { font-size: 1.075rem; line-height: 1.72; color: var(--day-fg2); }
.kp-article > section { margin-block: clamp(2.6rem, 6vw, 4.6rem); scroll-margin-top: 96px; }
.kp-article h2 {
  font-size: clamp(1.7rem, 3.2vw, 2.5rem); color: var(--day-fg);
  margin-bottom: var(--s3); line-height: 1.12; letter-spacing: -0.02em;
}
.kp-article h3 {
  font-family: var(--font-ui); font-size: 1.2rem; color: var(--day-fg);
  margin: var(--s4) 0 var(--s2);
}
.kp-article p { margin: 0 0 var(--s3); color: var(--day-fg2); }
.kp-article p > strong, .kp-article li > strong { color: var(--day-fg); font-weight: 600; }
.kp-article a.inline { color: var(--brand-ink); border-bottom: 1px solid rgba(63,111,200,0.35); }
.kp-article a.inline:hover { border-color: var(--brand); }
.kp-article ul, .kp-article ol { margin: 0 0 var(--s3); padding-left: 1.3em; }
.kp-article li { margin-bottom: 0.5em; }
.kp-article sup.ref { font-size: 0.7em; color: var(--brand); font-weight: 600; padding-left: 1px; }
.kp-article sup.ref a { color: inherit; }

/* ---------- hero ---------- */
.kp-hero { padding-top: clamp(7rem, 13vh, 9rem); padding-bottom: var(--s4); }
.kp-hero__kicker {
  display: inline-flex; align-items: center; gap: 0.6em; margin-bottom: var(--s3);
  font-family: var(--font-ui); font-size: 0.74rem; font-weight: 600;
  letter-spacing: 0.18em; text-transform: uppercase; color: var(--day-fg3);
}
.kp-hero h1 {
  font-size: clamp(2.4rem, 6vw, 4.1rem); line-height: 1.05; color: var(--day-fg);
  letter-spacing: -0.03em; margin-bottom: var(--s3); max-width: 16ch;
}
.kp-hero .dek { font-size: clamp(1.15rem, 2vw, 1.45rem); color: var(--day-fg2); max-width: 60ch; line-height: 1.5; }
.kp-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 1.1rem;
  margin-top: var(--s4); font-family: var(--font-ui); font-size: 0.85rem; color: var(--day-fg3);
}
.kp-meta .sep { opacity: 0.4; }
.kp-meta .author { color: var(--day-fg2); font-weight: 600; }

/* ---------- figures + video ---------- */
.kp-figure { margin: var(--s5) 0; }
.kp-figure figcaption { margin-top: 0.8rem; font-size: 0.86rem; color: var(--day-fg3); text-align: center; font-family: var(--font-ui); }
.kp-frame {
  position: relative; border-radius: var(--r-card); overflow: hidden;
  border: 1px solid var(--card-border); box-shadow: var(--shadow-card);
  background: #0b0b0f;
}
.kp-frame img, .kp-frame video { width: 100%; display: block; }

/* video player with EN/AR toggle */
.kp-video__head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 0.9rem; flex-wrap: wrap; }
.kp-video__label { font-family: var(--font-ui); font-weight: 600; font-size: 0.95rem; color: var(--day-fg); display: inline-flex; align-items: center; gap: 0.5em; }
.kp-langtoggle { display: inline-flex; border: 1px solid var(--card-border); border-radius: var(--r-pill); overflow: hidden; background: rgba(255,255,255,0.5); }
.kp-langtoggle button {
  border: none; background: transparent; padding: 0.42em 1.05em;
  min-height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-ui); font-weight: 600; font-size: 0.82rem; color: var(--day-fg3);
  transition: background var(--t-fast), color var(--t-fast);
}
.kp-langtoggle button.is-active { background: var(--day-fg); color: #fff; }

/* ---------- key takeaways (AEO TL;DR) ---------- */
.kp-takeaways {
  margin: var(--s5) 0; padding: var(--s4);
  border: 1px solid rgba(63,111,200,0.22); border-radius: var(--r-card);
  background: linear-gradient(180deg, rgba(63,111,200,0.05), rgba(91,184,232,0.04));
}
.kp-takeaways h2 { font-size: 1.05rem !important; font-family: var(--font-ui); text-transform: uppercase; letter-spacing: 0.14em; color: var(--day-fg3) !important; margin-bottom: var(--s2) !important; }
.kp-takeaways ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.8rem; }
.kp-takeaways li { position: relative; padding-left: 1.7rem; color: var(--day-fg); }
.kp-takeaways li::before {
  content: ""; position: absolute; left: 0; top: 0.5em; width: 10px; height: 10px; border-radius: 50%;
  background: var(--brand-alt); box-shadow: 0 0 0 3px rgba(91,184,232,0.18);
}

/* ---------- North-Star pull-quote ---------- */
.kp-northstar {
  margin: var(--s6) 0; text-align: center; padding: var(--s4) 0;
}
.kp-northstar blockquote {
  margin: 0 auto; max-width: 18ch;
  font-family: var(--font-display); font-style: italic; font-weight: 400;
  font-size: clamp(2rem, 5vw, 3.4rem); line-height: 1.12; letter-spacing: -0.01em; color: var(--day-fg);
}
.kp-northstar cite { display: block; margin-top: var(--s3); font-style: normal; font-family: var(--font-ui); font-size: 0.8rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--day-fg3); }

/* ============================================================
   SIGNATURE: animated keypoint skeleton (SVG overlay)
   Points snap on (scale+fade, staggered); edges draw
   (stroke-dashoffset); joint labels fade in. JS in blog.js.
   ============================================================ */
.kp-scene { position: relative; }
.kp-scene svg.kp-overlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.kp-edge {
  fill: none; stroke: #fff; stroke-width: 2.4; stroke-linecap: round;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,0.45));
  opacity: 0.92;
}
.kp-dot {
  stroke: #fff; stroke-width: 2.5;
  filter: drop-shadow(0 2px 5px rgba(0,0,0,0.4));
}
/* the four product joint colors (match labeling_config.xml) */
.kp-dot--shoulder { fill: #BD72BF; }
.kp-dot--elbow    { fill: #72BFBB; }
.kp-dot--wrist    { fill: #728FBF; }
.kp-dot--knee     { fill: #E8915C; }
.kp-dot--ankle    { fill: #E8915C; }
.kp-dot--hip      { fill: #BD72BF; }
.kp-dot--head     { fill: #72BFBB; }
.kp-jointlabel { font-family: var(--font-ui); font-size: 12px; font-weight: 600; fill: #fff; }
.kp-jointlabel rect { fill: rgba(11,11,15,0.72); }

/* standalone "anatomy of a keypoint" diagram card */
.kp-anatomy {
  position: relative; margin: var(--s5) 0; border-radius: var(--r-card);
  background: linear-gradient(165deg, #11152a 0%, #0b0f19 100%);
  border: 1px solid rgba(255,255,255,0.08); box-shadow: var(--shadow-card);
  padding: clamp(1.5rem, 4vw, 3rem); overflow: hidden;
}
.kp-anatomy__grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: clamp(1.5rem,4vw,3rem); align-items: center; }
@media (max-width: 720px) { .kp-anatomy__grid { grid-template-columns: 1fr; } }
.kp-anatomy svg { width: 100%; height: auto; }
.kp-anatomy .lede { color: #c9cce0; }
.kp-anatomy h3 { color: #fff; }
.kp-anatomy .kp-legend { display: grid; gap: 0.6rem; margin-top: var(--s3); }
.kp-anatomy .kp-legend div { display: flex; align-items: center; gap: 0.6em; font-family: var(--font-ui); font-size: 0.9rem; color: #c9cce0; }
.kp-anatomy .kp-legend i { width: 12px; height: 12px; border-radius: 50%; border: 2px solid #fff; }

/* ---------- use-case showcase ---------- */
.kp-uc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1.4rem; margin: var(--s4) 0; }
.kp-uc {
  border: 1px solid var(--card-border); border-radius: var(--r-card); overflow: hidden;
  background: rgba(255,255,255,0.55); backdrop-filter: blur(6px);
  transition: transform var(--t-med) var(--ease-out), box-shadow var(--t-med) var(--ease-out);
}
.kp-uc:hover { transform: translateY(-4px); box-shadow: var(--shadow-card); }
.kp-uc__media { position: relative; aspect-ratio: 16/10; overflow: hidden; background: #0b0b0f; }
.kp-uc__media img { width: 100%; height: 100%; object-fit: cover; }
.kp-uc__num { position: absolute; top: 0.7rem; left: 0.7rem; font-family: var(--font-ui); font-weight: 700; font-size: 0.72rem; letter-spacing: 0.1em; color: #fff; background: linear-gradient(92deg,var(--brand),var(--brand-alt)); padding: 0.25em 0.6em; border-radius: 5px; }
.kp-uc__body { padding: 1.1rem 1.2rem 1.3rem; }
.kp-uc__body h3 { margin: 0 0 0.4rem; font-size: 1.05rem; color: var(--day-fg); }
.kp-uc__body p { font-size: 0.92rem; margin: 0; color: var(--day-fg2); }
.kp-uc__tags { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.8rem; }
.kp-uc__tags span { font-family: var(--font-ui); font-size: 0.72rem; color: var(--day-fg3); border: 1px solid var(--card-border); border-radius: var(--r-pill); padding: 0.2em 0.7em; }

/* ---------- FAQ accordion (AEO) ---------- */
.kp-faq { display: grid; gap: 0.7rem; margin-top: var(--s3); }
.kp-faq__item { border: 1px solid var(--card-border); border-radius: 12px; background: rgba(255,255,255,0.5); overflow: hidden; }
.kp-faq__q {
  width: 100%; text-align: start; background: transparent; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1.05rem 1.2rem; font-family: var(--font-ui); font-weight: 600; font-size: 1.02rem; color: var(--day-fg);
}
.kp-faq__q .chev { transition: transform var(--t-med) var(--ease-out); flex: none; color: var(--day-fg3); }
.kp-faq__item[open] .kp-faq__q .chev, .kp-faq__item.is-open .kp-faq__q .chev { transform: rotate(45deg); }
.kp-faq__a { padding: 0 1.2rem; max-height: 0; overflow: hidden; visibility: hidden; transition: max-height var(--t-med) var(--ease-out), padding var(--t-med) var(--ease-out), visibility var(--t-med) var(--ease-out); }
.kp-faq__item.is-open .kp-faq__a { padding: 0 1.2rem 1.2rem; max-height: 600px; visibility: visible; }
.kp-faq__a p { margin: 0; color: var(--day-fg2); font-size: 0.98rem; }

/* ---------- references ---------- */
.kp-refs { margin-top: var(--s4); border-top: 1px solid var(--rule); padding-top: var(--s4); }
.kp-refs ol { font-size: 0.88rem; color: var(--day-fg3); line-height: 1.6; }
.kp-refs li { margin-bottom: 0.6em; }
.kp-refs a { color: var(--brand-ink); word-break: break-word; }

/* ---------- CTA band ---------- */
.kp-cta {
  margin: var(--s6) auto 0; max-width: 1100px; text-align: center;
  border-radius: 24px; padding: clamp(2.5rem, 6vw, 4.5rem) var(--gutter);
  background: linear-gradient(160deg, #11152a 0%, #0b0f19 100%);
  border: 1px solid rgba(255,255,255,0.08); position: relative; overflow: hidden;
}
.kp-cta h2 { color: #fff; font-size: clamp(1.8rem,4vw,2.8rem); margin-bottom: var(--s2); }
.kp-cta .teach b:nth-of-type(1){ color:#7FB0FF; } .kp-cta .teach b:nth-of-type(2){ color:var(--brand-alt); } .kp-cta .teach b:nth-of-type(3){ color:#B2C5E9; }
.kp-cta p { color: #c9cce0; max-width: 52ch; margin: 0 auto var(--s4); }
.kp-cta .btn--primary { background: #fff; color: #0b0f19; }

/* ---------- mini TOC (sticky, desktop) ---------- */
.kp-toc { position: fixed; top: 50%; transform: translateY(-50%); width: 170px;
  inset-inline-start: max(1.25rem, calc((100vw - 1340px)/2 + 18px)); inset-inline-end: auto; z-index: 40; display: none; }
@media (min-width: 1180px) { .kp-toc { display: block; } }
.kp-toc ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.55rem; }
.kp-toc a { display: flex; align-items: center; gap: 0.6em; font-family: var(--font-ui); font-size: 0.78rem; color: var(--day-fg3); opacity: 1; transition: opacity var(--t-fast), color var(--t-fast); }
.kp-toc a::before { content: ""; width: 18px; height: 2px; background: currentColor; opacity: 0.5; transition: width var(--t-fast); }
.kp-toc a.is-active { color: var(--brand); opacity: 1; }
.kp-toc a.is-active::before { width: 30px; opacity: 1; }

/* ---------- RTL / Arabic ---------- */
[dir="rtl"] .kp-article, [lang="ar"] .kp-article { font-family: var(--font-ar); }
[dir="rtl"] .kp-article ul, [dir="rtl"] .kp-article ol { padding-left: 0; padding-right: 1.3em; }
[dir="rtl"] .kp-takeaways li { padding-left: 0; padding-right: 1.7rem; }
[dir="rtl"] .kp-takeaways li::before { left: auto; right: 0; }

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .kp-progress { display: none; }
  .kp-faq__a { transition: none; }
}


/* ============================================================
   Enhanced animation primitives (hero word-mask, heading rule,
   magnetic + clip layers). Reduced-motion handled in blog.js.
   ============================================================ */
.kp-hero h1 .kp-w { display:inline-block; overflow:hidden; vertical-align:top; padding-bottom:.14em; margin-bottom:-.14em; }
.kp-hero h1 .kp-wi { display:inline-block; will-change:transform; }
/* Self-annotation tag on the hero headline: float it above the box instead of over
   the glyphs. main.js animates the label with a GSAP y-nudge, whose inline transform
   clobbers the base `transform: translateY(-115%)` float — so anchor the lift on
   `bottom`, which the transform can't override. Scoped to the headline; the laptop-stage
   tag (big box, label sits inside) keeps its base positioning. */
.kp-hero h1 .bbox-label { top:auto; bottom:100%; margin-bottom:-.9em; }
.kp-h2rule { display:block; width:64px; height:3px; margin-top:.7rem; border-radius:2px;
  background:linear-gradient(90deg, var(--brand), var(--brand-alt)); transform:scaleX(0); transform-origin:left center; }
[dir="rtl"] .kp-h2rule { transform-origin:right center; }
.kp-cta a { will-change:transform; }
.kp-figure .kp-frame img { will-change:clip-path, transform; }

/* --- Collapsible "Go deeper" deep-dive sections (keypoint 5-min pillar) --- */
.kp-deep{border:1px solid var(--rule,rgba(11,11,15,.1));border-radius:14px;margin:1.4rem 0;background:rgba(255,255,255,.45);overflow:hidden;transition:border-color .2s}
.kp-deep>summary{cursor:pointer;list-style:none;padding:1.05rem 1.3rem;display:flex;align-items:baseline;justify-content:space-between;gap:1rem}
.kp-deep>summary::-webkit-details-marker{display:none}
.kp-deep>summary>h2,.kp-deep>summary>h3{display:inline;margin:0;font-size:1.16rem;line-height:1.3}
.kp-deep>summary::after{content:"Go deeper ↓";font:600 .7rem/1 var(--label,var(--font-ui,system-ui));letter-spacing:.05em;text-transform:uppercase;color:var(--brand,#3F6FC8);white-space:nowrap;opacity:.85;flex:none;align-self:center}
.kp-deep[open]>summary::after{content:"Close ↑"}
.kp-deep:hover{border-color:var(--rule-strong,rgba(11,11,15,.18))}
.kp-deep[open]{border-color:var(--rule-strong,rgba(11,11,15,.18))}
.kp-deep[open]>summary{border-bottom:1px solid var(--rule,rgba(11,11,15,.08))}
.kp-deep__b{padding:.5rem 1.3rem 1.3rem}
.kp-deep__b>h3:first-child{margin-top:.6rem}
.kp-deep{scroll-margin-top:84px}
