/* ==========================================================================
   COMPONENTS · SIDENOTE (TERM VARIANT) — the floated glossary definition note.
   GlossaryAnchorInjector splices a `--term` twin of the citation sidenote right
   after a term's first-occurrence `.op-term` anchor, so the field's vocabulary
   reads as one apparatus with the numbered citations. It reuses `_sidenote.css`
   wholesale — the desktop float into the reserved aside column and the mobile
   toggle-driven card both come from the base `.op-sidenote` rules — and only
   re-skins the parts that mark it as a term note rather than a numbered one.

   Canonical markup (inside an .o-apparatus reading column), emitted by
   GlossaryAnchorInjector#note:
     …the <a class="op-term" …>headword</a>
     <input type="checkbox" id="gn-1" class="op-sidenote__toggle u-visually-hidden">
     <small class="op-sidenote op-sidenote--term" role="doc-glossary">
       <span class="op-sidenote__index">Headword</span> Definition text,
       <a href="/glossary/slug">Full entry</a>.
     </small>

   Note there is no numbered `<label for>` marker as the citation carries — the
   wavy `.op-term` underline is the in-text affordance — so the checkbox toggle
   itself is the tap target on mobile (revealed below).
   ========================================================================== */

/* — The index label is the HEADWORD, not a number — so drop the base note's
     lining-numeral (`--font-data`) treatment for the furniture face, sized to sit
     with the definition prose. The accent colour is inherited from the base
     `.op-sidenote__index`. — */
.op-sidenote--term .op-sidenote__index {
  font-family: var(--font-furniture);
  font-size: inherit;
  font-weight: var(--weight-semibold);
}

/* ----- DESKTOP (apparatus engaged): the float, width and negative margin all come
   from the base `.op-sidenote` rule; only re-skin the keyline into the vocabulary
   card's accent (the top-stacked glossary aside this note replaces used the same
   2px accent-keyline), so a term note is legible as vocabulary beside its term. The
   double-class selector out-specifies the base 1px hairline regardless of glob
   order. ----- */
@media (min-width: 72rem) {
  .op-sidenote.op-sidenote--term {
    border-left: 2px solid var(--accent-keyline);
  }
}

/* ----- XL: the left margin opens for citations (base `.op-sidenote` moves there).
   A term note stays in the RIGHT margin — re-assert the right float/clear, the
   negative RIGHT margin and the right-edge keyline, out-specifying the base
   citation rule with the double class. Citations left, glossary right: two
   independent stacks that can never collide. ----- */
@media (min-width: 78rem) {
  .op-sidenote.op-sidenote--term {
    inline-size: var(--apparatus-aside-dual);
    float: right;
    clear: right;
    margin-left: 0;
    margin-right: calc(-1 * (var(--apparatus-gap) + var(--apparatus-aside-dual)));
    padding-left: var(--space-xs);
    padding-right: 0;
    border-right: 0;
    border-left: 2px solid var(--accent-keyline);
  }
}

/* ----- MOBILE / TABLET: the card itself (hidden until :checked, then the raised
   bordered popover) is the base `.op-sidenote` mobile treatment. What the base
   citation relies on — a `<label for>` to flip the checkbox — the term note does
   not emit, so reveal the checkbox toggle itself as a small apparatus marker and
   let it be the tap target. The high-specificity `!important` block is deliberate:
   it un-hides the toggle from `.u-visually-hidden`, but ONLY for a toggle that
   directly precedes a term note (never a citation's, which keeps its own label). ----- */
@media (max-width: 71.99rem) {
  input[type="checkbox"].op-sidenote__toggle:has(+ .op-sidenote--term) {
    position: static !important;
    width: 0.9em !important;
    height: 0.9em !important;
    margin: 0 0 0 0.15em !important;
    overflow: visible !important;
    clip: auto !important;
    clip-path: none !important;
    appearance: none;
    -webkit-appearance: none;
    vertical-align: 0.08em;
    /* `!important`: `.u-visually-hidden` sets `border: 0 !important`, so a plain
       declaration would leave the resting (unfocused) toggle borderless. */
    border: 1px solid var(--accent-keyline) !important;
    border-radius: var(--radius-xs);
    background: var(--surface-raised);
    cursor: pointer;
  }
  input[type="checkbox"].op-sidenote__toggle:has(+ .op-sidenote--term):checked {
    background: var(--accent);
    border-color: var(--accent) !important;
  }
  input[type="checkbox"].op-sidenote__toggle:has(+ .op-sidenote--term):focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
  }
}
