/* Chart.js (fenced ```chart``` blocks, _markup/render-codeblock.html) - a bare canvas with
   no background reads as a stray, unfocused element floating on the page background; boxed
   here the same way every other embedded shortcode on this page is (border+card fill),
   so it reads as one deliberate unit instead. */
.chart-container{ position:relative; width:100%; max-width:600px; height:320px; margin:16px auto; padding:16px; border:1px solid var(--border); background:var(--card); }
/* Own overflow-x:auto, same idiom as .article-content table's (base/responsive.css) - a
   chart dropped into a table cell (e.g. helix's own "Rated" row, or a platform-styled info
   table) can end up wider than the column it actually settles into on a narrow screen:
   Chart.js v2 measures its container's width once via a resize-detection trick, and inside
   a table cell that hasn't finished laying out yet at that point, that first measurement can
   land stale/too wide. The table's own overflow-x:auto only scrolls the table itself, not a
   single cell's contents, so without this the chart just clips with no way to reveal the
   rest. A no-op whenever the chart already fits its box. */
.chart-container{
     overflow-x:auto;
     -webkit-overflow-scrolling:touch;
     scrollbar-width:thin;
     scrollbar-color:color-mix(in oklab, var(--border) 60%, transparent) transparent;
}
.chart-container::-webkit-scrollbar{ height:4px; }
.chart-container::-webkit-scrollbar-thumb{ background:color-mix(in oklab, var(--border) 60%, transparent); border-radius:999px; }
.chart-container::-webkit-scrollbar-track{ background:transparent; }

/* diff shortcode ({{< diff "easy" "FACIL" >}}) - a writeup's own difficulty badge, colored
   by tier (easy/medium/hard/insane) regardless of what word is actually shown (Spanish or
   English) - the level argument picks the color, so using it is one shortcode call instead
   of a raw <span> with inline background/color hex codes hand-copied per post. */
.diff-badge{ padding:2px 8px; font-weight:700; font-size:11px; }
.diff-badge.diff-easy{ background:#9fef00; color:#141a29; }
.diff-badge.diff-medium{ background:#ffaf00; color:#141a29; }
.diff-badge.diff-hard{ background:#ff3e3e; color:#141a29; }
.diff-badge.diff-insane{ background:#9ca3af; color:#141a29; }
/* Same badge box, used by infobox's first-blood rows instead of a difficulty level - blue for
   the user blood, red for root (matches the radar chart's own "User Rate" blue/bar chart's
   hard-difficulty red, so the color vocabulary stays consistent across the box). */
.diff-badge.blood-user{ background:#4ba2bd; color:#141a29; }
.diff-badge.blood-root{ background:#ff3e3e; color:#141a29; }

/* d3 shortcode - same boxed-card treatment as .chart-container, so a D3 visualization
   reads the same way as every other embedded chart/card on the page. */
.d3-container{ border:1px solid var(--border); background:var(--card); padding:16px; margin:16px 0; }

/* --card is an alias for --background in the mono theme (see themes/mono.css) - identical
   to the page behind it, so a chart's own low-opacity gridlines (Chart.js's defaults, tuned
   for a light page, only partially compensated for by the JS-side fix in
   _markup/render-codeblock.html) have almost nothing to contrast against. A visibly lighter
   background gives them real contrast regardless of exactly how light the lines themselves
   are, rather than depending on getting that color exactly right. */
:is([data-theme="mono"],[data-color-scheme="dark"]) .chart-container,
:is([data-theme="mono"],[data-color-scheme="dark"]) .d3-container{
     background:color-mix(in oklab, var(--foreground) 6%, var(--card));
}
.my-chart-svg{ display:block; width:100%; height:auto; }
.my-chart-bar{ fill:var(--foreground); opacity:0.85; }
.my-chart-bar:hover{ opacity:1; }
.my-chart-line{ fill:none; stroke:var(--foreground); stroke-width:2; }
.my-chart-dot{ fill:var(--card); stroke:var(--foreground); stroke-width:2; }
.my-chart-axis text{ fill:var(--muted-foreground); font-family:var(--mono); font-size:10px; }
.my-chart-axis path, .my-chart-axis line{ stroke:var(--border); }

/* article shortcode - linked article preview card */
.article-embed{ display:flex; gap:14px; align-items:center; border:1px solid var(--border); background:var(--card); padding:12px; margin:16px 0; border-radius:0; color:inherit; }
.article-embed:hover{ border-color:color-mix(in oklab, var(--foreground) 40%, var(--border)); }
.article-embed-thumb{ flex-shrink:0; width:64px; height:64px; overflow:hidden; background:var(--bg-elev); }
.article-embed-thumb img{ width:100%; height:100%; object-fit:cover; }
.article-embed-body{ display:flex; flex-direction:column; gap:2px; min-width:0; }
.article-embed-label{ font-family:var(--mono); font-size:10px; letter-spacing:.1em; text-transform:uppercase; color:var(--muted-foreground); }
.article-embed-title{ font-weight:700; font-size:14px; color:var(--foreground); }
.article-embed-meta{ font-family:var(--mono); font-size:11px; color:var(--muted-foreground); }
.article-embed-summary{ font-size:12px; color:var(--muted-foreground); margin-top:4px; line-height:1.5; }
.article-embed--missing{ color:var(--destructive); font-family:var(--mono); font-size:12px; padding:12px; border:1px dashed var(--destructive); }

/* github shortcode - text-only repo card (no thumbnail by design), same bordered-card
   language as .article-embed above */
.gh-card{ display:block; border:1px solid var(--border); background:var(--card); padding:14px 16px; margin:16px 0; color:inherit; transition:border-color .15s; }
.gh-card:hover{ border-color:color-mix(in oklab, var(--foreground) 40%, var(--border)); }
.gh-card__header{ display:flex; align-items:center; gap:8px; }
.gh-card__icon{ flex-shrink:0; color:var(--foreground); }
.gh-card__repo{ font-weight:700; font-size:14px; color:var(--foreground); font-family:var(--mono); }
.gh-card__desc{ margin:8px 0 0; font-size:13px; color:var(--muted-foreground); line-height:1.5; }
.gh-card__meta{ display:flex; flex-wrap:wrap; gap:14px; margin-top:10px; font-family:var(--mono); font-size:11px; color:var(--muted-foreground); }
.gh-card__stat{ display:inline-flex; align-items:center; gap:5px; }
.gh-card__dot{ width:8px; height:8px; border-radius:999px; background:var(--foreground); display:inline-block; }

/* steps shortcode - vertical connected numbered list */
/* margin-left gives the markers (which sit further left than the list's own edge, see
   .steps-marker below) real breathing room from the article's own padding edge instead of
   crowding right up against it - every other element in the article gets the full padding as
   its visual buffer, this was the one thing eating into it. */
.steps{ list-style:none; margin:20px 0 20px 24px; padding:0; counter-reset:steps-counter; }
.steps-item{ position:relative; padding:0 0 24px 36px; border-left:2px solid var(--border); counter-increment:steps-counter; }
.steps-item:last-child{ border-left-color:transparent; padding-bottom:0; }
/* left:-13px (not -15px) centers the marker ON the connecting line/border, which - as a
   2px-wide line at the item's own left:0 edge - has its own center at 1px, not 0px. A
   28px-wide marker centered on that needs left = 1 - 28/2 = -13. */
.steps-marker{ position:absolute; left:-13px; top:0; width:28px; height:28px; border-radius:999px; background:var(--card); border:2px solid var(--foreground); display:flex; align-items:center; justify-content:center; font-family:var(--mono); font-size:12px; font-weight:700; color:var(--foreground); z-index:1; }
.steps-marker::before{ content:counter(steps-counter); }
.steps-title{ font-weight:700; font-size:15px; margin-bottom:4px; padding-top:2px; }
.steps-content{ font-size:14px; color:var(--muted-foreground); line-height:1.6; }
.steps-content p:first-child{ margin-top:0; }
.steps-content p:last-child{ margin-bottom:0; }

/* timeline shortcode - vertical dotted-line event list */
.timeline{ list-style:none; margin:20px 0 20px 16px; padding:0; }
.timeline-item{ position:relative; padding:0 0 24px 28px; border-left:2px solid var(--border); }
.timeline-item:last-child{ border-left-color:transparent; padding-bottom:0; }
/* left:-5px (not -7px) - same centering fix as .steps-marker above: a 12px marker centered
   on the line's 1px center needs left = 1 - 12/2 = -5.
   top:0 (not the old top:4px) for the same reason .steps-marker uses top:0: the connecting
   line (both the static border-left, and its animated ::after replacement below) starts at
   the item's own top edge, always - a border can't be offset independently of its box, so
   whatever top value the marker used had to match it exactly or the line would visibly start
   higher than the dot (a stray line "tail" poking out above it, worst at the very first item
   where there's nothing above to make it look intentional). */
.timeline-marker{ position:absolute; left:-5px; top:0; width:12px; height:12px; border-radius:999px; background:var(--foreground); border:2px solid var(--card); z-index:1; }
.timeline-date{ display:block; font-family:var(--mono); font-size:11px; letter-spacing:.06em; text-transform:uppercase; color:var(--muted-foreground); }
.timeline-title{ font-weight:700; font-size:15px; margin:2px 0 4px; }
.timeline-content{ font-size:14px; color:var(--muted-foreground); line-height:1.6; }
.timeline-content p:first-child{ margin-top:0; }
.timeline-content p:last-child{ margin-bottom:0; }

/* Steps/timeline reveal-on-scroll (static/js/content.js) - each node's marker pops in, its
   connecting line traces down to the NEXT node, and its title/content fade up as the list
   scrolls into view, rather than the whole thing appearing at once. Scoped under .js-reveal,
   added by JS only when IntersectionObserver exists and the visitor hasn't asked for reduced
   motion - without it (or before JS runs) the list just renders in its normal, fully-visible
   static state, so content is never stuck invisible for a no-JS visit.
   The line only draws once content.js has also revealed the NEXT item and added .line-visible
   to this one - not just off this item's own .is-visible - otherwise the line finishes
   drawing toward a marker that isn't there yet (that next item's reveal fires on its own,
   later, separate IntersectionObserver trigger), a visibly disconnected line/circle. This was
   previously done with a CSS :has(+ .steps-item.is-visible) selector, which worked but caused
   rendering glitches during fast scrolling in practice - :has() forces a live relational
   re-check against every item's sibling on each intersection change, stacked on top of the
   transform/opacity transitions already running on every item. content.js now tracks the
   same "next item also visible" condition directly and just toggles a plain class. */
.steps.js-reveal .steps-item,
.timeline.js-reveal .timeline-item{
  border-left-color:transparent;
}
.steps.js-reveal .steps-item::after,
.timeline.js-reveal .timeline-item::after{
  content:"";
  position:absolute;
  /* Full height (not bottom:24px, which was a leftover mistake from an earlier draft) - a
     border-left isn't affected by padding and always spans an element's complete height, so
     the ORIGINAL static border reached all the way down to the next item's marker, passing
     visually behind it (the marker's own opaque background covers the overlap). Stopping
     this ::after 24px short of the bottom left a real, visible gap between the line's end
     and the next marker - not a JS timing bug, this was wrong at every reveal state. */
  left:0; top:0; bottom:0;
  width:2px;
  background:var(--border);
  transform:scaleY(0);
  transform-origin:top;
  transition:transform .4s ease;
  /* No z-index (defaults to auto/0), so it paints in DOM order among the item's other
     positioned descendants - and a ::after pseudo-element is conceptually the LAST child in
     the box, painted after (on top of) .steps-marker/.timeline-marker. The original static
     border never had this problem: a border is part of an element's own box-decoration
     layer, painted before any positioned descendant, not a sibling competing in the same
     stacking layer. steps-marker/timeline-marker carry z-index:1 to sit back on top. */
}
.steps.js-reveal .steps-item:last-child::after,
.timeline.js-reveal .timeline-item:last-child::after{
  display:none;
}
.steps.js-reveal .steps-item.line-visible::after,
.timeline.js-reveal .timeline-item.line-visible::after{
  transform:scaleY(1);
}
.steps.js-reveal .steps-marker,
.timeline.js-reveal .timeline-marker{
  opacity:0;
  transform:scale(.4);
  transition:opacity .3s ease, transform .3s cubic-bezier(.34,1.56,.64,1);
}
.steps.js-reveal .steps-item.is-visible .steps-marker,
.timeline.js-reveal .timeline-item.is-visible .timeline-marker{
  opacity:1;
  transform:scale(1);
}
.steps.js-reveal .steps-title,
.steps.js-reveal .steps-content,
.timeline.js-reveal .timeline-date,
.timeline.js-reveal .timeline-title,
.timeline.js-reveal .timeline-content{
  opacity:0;
  transform:translateY(6px);
  transition:opacity .35s ease .22s, transform .35s ease .22s;
}
.steps.js-reveal .steps-item.is-visible .steps-title,
.steps.js-reveal .steps-item.is-visible .steps-content,
.timeline.js-reveal .timeline-item.is-visible .timeline-date,
.timeline.js-reveal .timeline-item.is-visible .timeline-title,
.timeline.js-reveal .timeline-item.is-visible .timeline-content{
  opacity:1;
  transform:none;
}
