/* ============================================================================
   ACCENT SYSTEM — five small brand axes (registry: APB_Component_Accents):
   CHIP data-apb-chip · DIVIDER data-apb-divider · IMAGE data-apb-img ·
   INPUT data-apb-input · LINK data-apb-link. Same discipline as buttons/cards:
   fully var-driven presets (pure variable bundles), gated adoption, preset
   isolation via `initial`, reduced-motion, zero important-flags, loads LAST.

   ADOPTION CONTRACT (asserted by tools/apb-accents-smoke.php) — per axis, ONLY
   under an active config ancestor; zero config = byte-identical to today:
   - chip:    .apb-rx-eyebrow (kicker becomes a chip) + .apb-rx-badge visual
              chrome only (bg/fg/border/radius — never its absolute positioning).
              Status badges (.apb-rx-badge--success/--neutral) keep their colors.
   - divider: .apb-rx-section bottom edge (shape painted in the section's OWN
              surface fill over the next section's top padding; last section none).
   - image:   .apb-rx-thumb + .apb-rx-media (the shared media containers).
   - input:   .apb-rx-form input/textarea/select (the shared form primitive).
   - link:    classless anchors inside prose (p/li/figcaption a:not([class])) —
              never buttons/CTAs, which always carry classes.
   ============================================================================ */

/* ================================ CHIP ================================ */
[data-apb-chip]{--apb-rx-chip-bg:initial;--apb-rx-chip-fg:initial;--apb-rx-chip-border:initial;
  --apb-rx-chip-radius:initial;--apb-rx-chip-case:initial;--apb-rx-chip-track:initial;
  --apb-rx-chip-font:initial;--apb-rx-chip-dot:initial}
[data-apb-chip] :is(.apb-rx-eyebrow,.apb-rx-badge:not(.apb-rx-badge--success):not(.apb-rx-badge--neutral)){
  display:inline-flex;align-items:center;gap:7px;
  background:var(--apb-rx-chip-bg,var(--apb-rx-soft,#eef0ff));
  color:var(--apb-rx-chip-fg,var(--apb-rx-accent-text,var(--apb-rx-brand,#4f46e5)));
  border:var(--apb-rx-chip-border,0 solid transparent);
  border-radius:var(--apb-rx-chip-radius,999px);
  padding:5px 12px;font-size:11.5px;font-weight:700;
  letter-spacing:var(--apb-rx-chip-track,.08em);
  text-transform:var(--apb-rx-chip-case,uppercase);
  font-family:var(--apb-rx-chip-font,inherit)}
[data-apb-chip] :is(.apb-rx-eyebrow,.apb-rx-badge:not(.apb-rx-badge--success):not(.apb-rx-badge--neutral))::before{
  content:var(--apb-rx-chip-dot,none);width:6px;height:6px;border-radius:50%;background:currentColor;flex:none;padding:0}
[data-apb-chip="soft"]{--apb-rx-chip-bg:var(--apb-rx-soft,#eef0ff)}
[data-apb-chip="solid"]{--apb-rx-chip-bg:var(--apb-rx-brand,#4f46e5);--apb-rx-chip-fg:#fff}
[data-apb-chip="outline"]{--apb-rx-chip-bg:transparent;--apb-rx-chip-border:1px solid var(--apb-rx-line-accent,#c8caf5);--apb-rx-chip-radius:8px}
[data-apb-chip="pill"]{--apb-rx-chip-bg:color-mix(in srgb,var(--apb-rx-brand,#4f46e5) 10%,var(--apb-rx-surface,#fff));
  --apb-rx-chip-border:1px solid color-mix(in srgb,var(--apb-rx-brand,#4f46e5) 25%,transparent)}
[data-apb-chip="mono"]{--apb-rx-chip-bg:transparent;--apb-rx-chip-fg:var(--apb-rx-muted,#6b7280);
  --apb-rx-chip-border:1px solid var(--apb-rx-line,#e7e8ec);--apb-rx-chip-radius:4px;
  --apb-rx-chip-font:ui-monospace,SFMono-Regular,Menlo,monospace;--apb-rx-chip-track:.14em}
[data-apb-chip="dot"]{--apb-rx-chip-bg:transparent;--apb-rx-chip-dot:"";--apb-rx-chip-case:none;--apb-rx-chip-track:0}

/* ================================ DIVIDER ================================ */
/* The shape is the section's OWN surface fill painted over the next section's top padding.
   Sections without a surface use the page canvas fill (invisible between two plain sections
   by design — dividers earn their keep between alternating surfaces). */
:is(.apb-rx-section[data-apb-divider],[data-apb-divider]>.apb-rx-section){position:relative}
:is(.apb-rx-section[data-apb-divider],[data-apb-divider]>.apb-rx-section)::after{
  content:"";position:absolute;left:0;right:0;bottom:-46px;height:47px;z-index:1;pointer-events:none;
  background:var(--apb-rx-divider-fill,var(--apb-rx-surface,#fff));
  -webkit-mask:var(--apb-rx-divider-mask,none) center bottom/100% 100% no-repeat;
  mask:var(--apb-rx-divider-mask,none) center bottom/100% 100% no-repeat}
:is(.apb-rx-section[data-apb-divider],[data-apb-divider]>.apb-rx-section):last-of-type::after{content:none}
/* the shape lands in the NEXT section's top padding — skip it when that padding is collapsed */
:is(.apb-rx-section[data-apb-divider],[data-apb-divider]>.apb-rx-section):has(+.apb-rx-section:is([data-apb-s-pad="none"],[data-apb-s-pad="tight"]))::after{content:none}
:is(.apb-rx-section[data-apb-divider][data-apb-s-surface="soft"],[data-apb-divider]>.apb-rx-section[data-apb-s-surface="soft"]){--apb-rx-divider-fill:var(--apb-rx-soft,#f2f3f7)}
:is(.apb-rx-section[data-apb-divider][data-apb-s-surface="dark"],[data-apb-divider]>.apb-rx-section[data-apb-s-surface="dark"]){--apb-rx-divider-fill:color-mix(in srgb,#0b0d12 94%,var(--apb-rx-brand,#4f46e5) 6%)}
:is(.apb-rx-section[data-apb-divider][data-apb-s-surface="brand"],[data-apb-divider]>.apb-rx-section[data-apb-s-surface="brand"]){--apb-rx-divider-fill:var(--apb-rx-brand,#4f46e5)}
:is(.apb-rx-section[data-apb-divider],[data-apb-divider]>.apb-rx-section):is([data-apb-s-surface="transparent"],[data-apb-s-surface="image"])::after{content:none}
:is(.apb-rx-section[data-apb-divider="wave"],[data-apb-divider="wave"]>.apb-rx-section)::after{--apb-rx-divider-mask:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 48" preserveAspectRatio="none"><path d="M0 0h1200v10c-200 30-400 38-600 24S200 6 0 26z" fill="black"/></svg>')}
:is(.apb-rx-section[data-apb-divider="curve"],[data-apb-divider="curve"]>.apb-rx-section)::after{--apb-rx-divider-mask:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 48" preserveAspectRatio="none"><path d="M0 0h1200v8c-300 40-900 40-1200 0z" fill="black"/></svg>')}
:is(.apb-rx-section[data-apb-divider="slant"],[data-apb-divider="slant"]>.apb-rx-section)::after{--apb-rx-divider-mask:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 48" preserveAspectRatio="none"><path d="M0 0h1200v6L0 46z" fill="black"/></svg>')}
:is(.apb-rx-section[data-apb-divider="zigzag"],[data-apb-divider="zigzag"]>.apb-rx-section)::after{--apb-rx-divider-mask:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 48" preserveAspectRatio="none"><path d="M0 0h1200v14l-60 22-60-22-60 22-60-22-60 22-60-22-60 22-60-22-60 22-60-22-60 22-60-22-60 22-60-22-60 22-60-22-60 22-60-22-60 22-60-22z" fill="black"/></svg>')}
:is(.apb-rx-section[data-apb-divider="fade"],[data-apb-divider="fade"]>.apb-rx-section)::after{
  -webkit-mask:linear-gradient(180deg,black,transparent) center bottom/100% 100% no-repeat;
  mask:linear-gradient(180deg,black,transparent) center bottom/100% 100% no-repeat;opacity:.5}

/* ================================ IMAGE ================================ */
[data-apb-img]{--apb-rx-img-radius:initial;--apb-rx-img-border:initial;--apb-rx-img-shadow:initial;
  --apb-rx-img-pad:initial;--apb-rx-img-bg:initial}
[data-apb-img] :is(.apb-rx-thumb,.apb-rx-media):not(.apb-rx-media--solid):not(:has(iframe,video)){
  border-radius:var(--apb-rx-img-radius,calc(var(--apb-rx-radius,16px) * .75));
  border:var(--apb-rx-img-border,0 solid transparent);
  box-shadow:var(--apb-rx-img-shadow,none);
  padding:var(--apb-rx-img-pad,0);
  background:var(--apb-rx-img-bg,var(--apb-rx-soft,#f2f3f7))}
[data-apb-img] :is(.apb-rx-thumb,.apb-rx-media):not(.apb-rx-media--solid):not(:has(iframe,video))>img{border-radius:max(0px,calc(var(--apb-rx-img-radius,calc(var(--apb-rx-radius,16px) * .75)) - var(--apb-rx-img-pad,0px)))}
[data-apb-img="rounded"]{--apb-rx-img-radius:18px}
[data-apb-img="sharp"]{--apb-rx-img-radius:0}
[data-apb-img="frame"]{--apb-rx-img-radius:6px;--apb-rx-img-border:1px solid var(--apb-rx-line,#e7e8ec);
  --apb-rx-img-pad:8px;--apb-rx-img-bg:var(--apb-rx-surface,#fff)}
[data-apb-img="polaroid"]{--apb-rx-img-radius:4px;--apb-rx-img-pad:10px;--apb-rx-img-bg:var(--apb-rx-surface,#fff);
  --apb-rx-img-shadow:0 2px 6px rgba(11,13,18,.08),0 14px 30px -12px rgba(11,13,18,.25)}
[data-apb-img="offset"]{--apb-rx-img-radius:10px;--apb-rx-img-shadow:8px 8px 0 color-mix(in srgb,var(--apb-rx-brand,#4f46e5) 16%,var(--apb-rx-soft,#f2f3f7))}
[data-apb-img="shadow"]{--apb-rx-img-radius:14px;--apb-rx-img-shadow:0 3px 8px rgba(11,13,18,.07),0 24px 50px -18px rgba(11,13,18,.3)}

/* ================================ INPUT ================================ */
[data-apb-input]{--apb-rx-input-bg:initial;--apb-rx-input-border:initial;--apb-rx-input-radius:initial;
  --apb-rx-input-shadow:initial}
[data-apb-input] .apb-rx-form :is(input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=submit]):not([type=button]):not([type=range]):not([type=color]):not([type=hidden]),textarea,select){
  background:var(--apb-rx-input-bg,var(--apb-rx-surface,#fff));
  border:var(--apb-rx-input-border,1px solid var(--apb-rx-line,#e7e8ec));
  border-radius:var(--apb-rx-input-radius,calc(var(--apb-rx-radius,16px) * .68));
  box-shadow:var(--apb-rx-input-shadow,none)}
[data-apb-input] .apb-rx-form :is(input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=submit]):not([type=button]):not([type=range]):not([type=color]):not([type=hidden]),textarea,select):focus{
  outline:none;border-color:var(--apb-rx-brand,#4f46e5);box-shadow:0 0 0 3px var(--apb-rx-ring,rgba(79,70,229,.18))}
[data-apb-input="soft"]{--apb-rx-input-bg:var(--apb-rx-soft,#f2f3f7);--apb-rx-input-border:1px solid transparent}
[data-apb-input="outline"]{--apb-rx-input-border:1.5px solid var(--apb-rx-line,#e7e8ec);--apb-rx-input-bg:transparent}
[data-apb-input="underline"]{--apb-rx-input-bg:transparent;--apb-rx-input-radius:0;
  --apb-rx-input-border:0 solid transparent}
[data-apb-input="underline"] .apb-rx-form :is(input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=submit]):not([type=button]):not([type=range]):not([type=color]):not([type=hidden]),textarea,select){border-bottom:2px solid var(--apb-rx-line,#e7e8ec)}
[data-apb-input="underline"] .apb-rx-form :is(input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=submit]):not([type=button]):not([type=range]):not([type=color]):not([type=hidden]),textarea,select):focus{border-bottom-color:var(--apb-rx-brand,#4f46e5);box-shadow:none}
[data-apb-input="pill"]{--apb-rx-input-radius:999px}
[data-apb-input="sharp"]{--apb-rx-input-radius:0}

/* ================================ LINK ================================ */
/* Classless anchors inside prose only — CTAs/buttons always carry classes and are untouched. */
[data-apb-link]{--apb-rx-link-fg:initial;--apb-rx-link-deco:initial;--apb-rx-link-thick:initial;
  --apb-rx-link-offset:initial;--apb-rx-link-bg:initial}
[data-apb-link] :is(p,li,figcaption) a:not([class]){
  color:var(--apb-rx-link-fg,var(--apb-rx-accent-text,var(--apb-rx-brand,#4f46e5)));
  text-decoration:var(--apb-rx-link-deco,underline);
  text-decoration-thickness:var(--apb-rx-link-thick,1px);
  text-underline-offset:var(--apb-rx-link-offset,2px);
  text-decoration-color:color-mix(in srgb,currentColor 45%,transparent);
  background:var(--apb-rx-link-bg,none);border-radius:3px;
  transition:text-decoration-color var(--apb-rx-t-fast,.16s),background var(--apb-rx-t-fast,.16s)}
[data-apb-link] :is(p,li,figcaption) a:not([class]):is(:hover,:focus-visible){text-decoration-color:currentColor}
[data-apb-link="underline"]{--apb-rx-link-deco:underline}
[data-apb-link="thick"]{--apb-rx-link-thick:2.5px;--apb-rx-link-offset:3px}
[data-apb-link="highlight"]{--apb-rx-link-deco:none;--apb-rx-link-fg:inherit;
  --apb-rx-link-bg:linear-gradient(transparent 62%,color-mix(in srgb,var(--apb-rx-brand,#4f46e5) 22%,transparent) 62%)}
[data-apb-link="arrow"]{--apb-rx-link-deco:none}
[data-apb-link="arrow"] :is(p,li,figcaption) a:not([class])::after{
  content:"";display:inline-block;width:11px;height:10px;margin-left:3px;background:currentColor;vertical-align:-1px;
  -webkit-mask:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2.6"><path d="M5 12h14M13 6l6 6-6 6"/></svg>') center/contain no-repeat;
  mask:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2.6"><path d="M5 12h14M13 6l6 6-6 6"/></svg>') center/contain no-repeat}
[data-apb-link="brand"]{--apb-rx-link-deco:none;--apb-rx-link-fg:var(--apb-rx-brand,#4f46e5)}
[data-apb-link="brand"] :is(p,li,figcaption) a:not([class]):is(:hover,:focus-visible){text-decoration:underline;text-decoration-thickness:2px}

/* ================================ ICON ================================ */
[data-apb-icon]{--apb-rx-icon-bg:initial;--apb-rx-icon-fg:initial;--apb-rx-icon-border:initial;--apb-rx-icon-shadow:initial}
[data-apb-icon] .apb-rx-tile-icon:not(.apb-rx-tile-icon--img){
  background:var(--apb-rx-icon-bg,var(--apb-rx-soft,#eef0ff));
  color:var(--apb-rx-icon-fg,var(--apb-rx-accent-text,var(--apb-rx-brand,#4f46e5)));
  border:var(--apb-rx-icon-border,1px solid var(--apb-rx-line-accent,#c8caf5));
  box-shadow:var(--apb-rx-icon-shadow,none)}
[data-apb-icon="filled"]{--apb-rx-icon-bg:var(--apb-rx-brand,#4f46e5);--apb-rx-icon-fg:#fff;--apb-rx-icon-border:0 solid transparent;
  --apb-rx-icon-shadow:0 8px 20px -8px var(--apb-rx-glow,rgba(79,70,229,.35))}
[data-apb-icon="outline"]{--apb-rx-icon-bg:transparent;--apb-rx-icon-border:1.5px solid color-mix(in srgb,var(--apb-rx-brand,#4f46e5) 40%,var(--apb-rx-line,#e7e8ec))}
[data-apb-icon="tint"]{--apb-rx-icon-bg:var(--apb-rx-soft,#eef0ff);--apb-rx-icon-border:0 solid transparent}
[data-apb-icon="bare"]{--apb-rx-icon-bg:transparent;--apb-rx-icon-border:0 solid transparent}
[data-apb-icon="bare"] .apb-rx-tile:hover .apb-rx-tile-icon:not(.apb-rx-tile-icon--img){box-shadow:none}
[data-apb-icon="filled"] [data-apb-tag-accent]{--apb-rx-icon-bg:var(--apb-item-accent);--apb-rx-icon-fg:var(--apb-item-accent-fg);--apb-rx-icon-border:0 solid transparent}
[data-apb-icon="outline"] [data-apb-tag-accent]{--apb-rx-icon-bg:transparent;--apb-rx-icon-fg:var(--apb-rx-ink,#15171B);--apb-rx-icon-border:1.5px solid color-mix(in srgb,var(--apb-item-accent) 55%,var(--apb-rx-line,#e7e8ec))}
[data-apb-icon="tint"] [data-apb-tag-accent]{--apb-rx-icon-bg:color-mix(in srgb,var(--apb-item-accent) 12%,var(--apb-rx-surface,#fff));--apb-rx-icon-fg:var(--apb-rx-ink,#15171B);--apb-rx-icon-border:0 solid transparent}
[data-apb-icon="bare"] [data-apb-tag-accent]{--apb-rx-icon-bg:transparent;--apb-rx-icon-fg:var(--apb-rx-ink,#15171B);--apb-rx-icon-border:0 solid transparent}

/* ================================ RHYTHM ================================ */
/* Page-level spacing personality: scales every section's vertical padding through the pad var the
   engine already computes with. A per-section data-apb-s-pad (element-level rule) still wins. */
[data-apb-rhythm="compact"]{--apb-rx-pad-scale:.8}
[data-apb-rhythm="standard"]{--apb-rx-pad-scale:1}
[data-apb-rhythm="airy"]{--apb-rx-pad-scale:1.35}

/* ================================ reduced motion ================================ */
@media (prefers-reduced-motion:reduce){
  [data-apb-link] :is(p,li,figcaption) a:not([class]){transition:none}
}
