/*
 * THE INLINE REFERENCE THAT OPENS. A press target wrapped around a name, an id
 * or a chip, in two registers.
 *
 * `text` is a reference inside a LINE OF READING, so its box is taller than the
 * line and bleeds the difference back out — wrapping a `Text` must not grow the
 * line it sits in. `control` is a reference that IS a control-band citizen, so
 * it fills the band and bleeds nothing vertically. The HORIZONTAL bleed is
 * common to both: the trigger's own padding must not shift its content off the
 * surface's left edge, or a peekable token sits 8px right of the plain one above
 * it.
 *
 * Both corners are the CONTROL rung. The question the radius ladder asks is what
 * a thing IS and never how big it is (`docs/theming.md` §2.3), and this is
 * something you press directly — so the `text` register's 8px, which sat on no
 * rung, becomes 10 with the rest of the control vocabulary.
 *
 * The press area is a pseudo-element on the short register, not padding: air
 * inside the box would grow it past the line it is bleeding to fit, and air
 * outside it would shift every neighbour.
 */
@layer theme, base, lotics, components, utilities;
@layer lotics.tokens, lotics.reset, lotics.components;

@layer lotics.components {
  .lotics-peek__trigger {
    display: flex;
    flex-direction: row;
    align-items: center;
    box-sizing: border-box;
    position: relative;
    min-width: 0;
    min-height: 32px;
    padding-block: 0;
    padding-inline: var(--lotics-space-8);
    margin-block: calc(var(--lotics-space-4) * -1);
    margin-inline: calc(var(--lotics-space-8) * -1);
    border: 0 solid transparent;
    border-radius: var(--lotics-radius-control);
    background-color: transparent;
    color: var(--lotics-ink-default);
    font-family: var(--font-sans);
    font-size: var(--lotics-text-md);
    line-height: var(--lotics-leading-md);
    letter-spacing: var(--lotics-tracking-md);
    text-align: start;
    appearance: none;
    cursor: pointer;
    touch-action: manipulation;
    transition: background-color var(--lotics-duration-fast) var(--lotics-ease-standard);
  }

  /* 40 − 32, halved: the touch target the short register still answers. */
  .lotics-peek__trigger[data-variant="text"]::after {
    content: "";
    position: absolute;
    inset: calc(var(--lotics-space-4) * -1);
  }

  .lotics-peek__trigger[data-variant="control"] {
    min-height: var(--lotics-control-height);
    margin-block: 0;
  }

  .lotics-peek__trigger:focus-visible {
    outline: var(--lotics-ring-width) solid var(--ring);
    outline-offset: 0;
  }

  /* A control STANDING on a page, never one riding a hoverable row — a peek is
     ruled out of a pressable row on purpose — so it takes the standalone pair
     (`docs/theming.md` §2.3), which is the zinc-100 / zinc-200 it always had. */
  .lotics-peek__trigger:hover {
    background-color: var(--lotics-wash-selected);
  }

  .lotics-peek__trigger:active {
    background-color: var(--lotics-wash-press);
  }

  /* The PANEL's width. The 320 is the reading column inside it; the panel adds
     its own inset on each side, which is the geometry a peek has always had. */
  .lotics-peek__popup {
    --lotics-popover-width: calc(320px + 2 * var(--lotics-popover-inset));
  }
}
