/*
 * sd/eyebrow — the small line above a heading.
 *
 * Three looks from one component: a numbered pill (the default), a drawn mark, or the label alone.
 * The drawn look shares its class names with the eyebrows written by hand on the service pages
 * (src/css/primitives/composition.css), so the base rules are repeated here only as far as the
 * component needs them to stand on a page that has not loaded that file.
 */
.wp-block-sd-eyebrow.sd-eyebrow {
  display: flex;
  align-items: center;
  gap: 9px;
  width: fit-content;
  margin: 0 0 clamp(14px, 1.4vw, 20px);
  font-family: var(--wp--preset--font-family--script);
  font-size: var(--wp--preset--font-size--fixed-18);
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0.05em;
  text-transform: none;
  color: color-mix(in srgb, var(--wp--preset--color--sd-deep-midnight) 62%, transparent);
}

/* In a stack the stack's gap is the space under the eyebrow; its own margin would double it. */
.wp-block-stronger-stack > .wp-block-sd-eyebrow.sd-eyebrow {
  margin-block-end: 0;
}

.wp-block-sd-eyebrow.sd-eyebrow.sd-eyebrow--center {
  margin-inline: auto;
}

/* The number and label are paragraphs so they can be typed in place; they take the eyebrow's type,
   not the page's paragraph type or a card's (three classes, to outrank the card's `p` rule). */
.wp-block-sd-eyebrow.sd-eyebrow > .sd-eyebrow__text,
.wp-block-sd-eyebrow.sd-eyebrow > .sd-eyebrow__pill {
  margin: 0;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
}

.sd-eyebrow__mark {
  flex: none;
  width: 24px;
  height: 24px;
  margin-top: -2px;
}

/* ---------------------------------------------------------------- accent */

/* The rough scribble on its own: larger than the small labelled marks, and no words beside it. */
.wp-block-sd-eyebrow.sd-eyebrow .sd-eyebrow__accent {
  display: block;
  width: 56px;
  height: 34px;
  margin: 0;
  object-fit: contain;
  object-position: left center;
}

.wp-block-sd-eyebrow.sd-eyebrow--center .sd-eyebrow__accent {
  object-position: center;
}

/* ---------------------------------------------------------------- numbered pill */

.wp-block-sd-eyebrow.sd-eyebrow.sd-eyebrow--numbered {
  gap: 12px;
  font-size: var(--wp--preset--font-size--fixed-16);
  line-height: 1;
}

.wp-block-sd-eyebrow.sd-eyebrow--numbered > .sd-eyebrow__text {
  color: color-mix(in srgb, var(--wp--preset--color--sd-deep-midnight) 62%, transparent);
}

[data-theme="dark"] .sd-eyebrow--numbered .sd-eyebrow__text,
[data-theme="brand"] .sd-eyebrow--numbered .sd-eyebrow__text {
  color: color-mix(in srgb, var(--strong-theme-fg, currentcolor) 80%, transparent);
}

.sd-eyebrow--numbered::after {
  content: "";
  flex: 0 0 56px;
  height: 6px;
  background: url("../../assets/decorations/dashes-drawn.svg") left center / 320px 6px repeat-x;
  opacity: 0.55;
}

.sd-eyebrow--numbered.sd-eyebrow--no-rule::after {
  content: none;
}

.wp-block-sd-eyebrow.sd-eyebrow > .sd-eyebrow__pill {
  display: inline-grid;
  place-items: center;
  box-sizing: border-box;
  min-width: 48px;
  height: 30px;
  padding: 3px 13px 0;
  border: 1px solid var(--wp--preset--color--paper-edge);
  border-radius: var(--wp--custom--radius--full);
  background: linear-gradient(var(--wp--preset--color--white), var(--wp--preset--color--sd-cream));
  box-shadow: var(--wp--custom--shadow--raised-quiet);
  font-family: var(--wp--preset--font-family--script);
  font-size: var(--wp--preset--font-size--medium);
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--wp--preset--color--sd-flamingo);
  border-color: transparent;
}

.wp-block-sd-eyebrow.sd-eyebrow > .sd-eyebrow__pill--flamingo {
  border-color: transparent;
  background: var(--wp--preset--color--sd-flamingo);
  box-shadow: var(--wp--custom--shadow--raised-accent);
  color: var(--wp--preset--color--white);
  rotate: -4deg;
}

.wp-block-sd-eyebrow.sd-eyebrow > .sd-eyebrow__pill--ink {
  border-color: transparent;
  background: var(--wp--preset--color--sd-deep-midnight);
  box-shadow: var(--wp--custom--shadow--raised);
  color: var(--wp--preset--color--white);
}

/* ---------------------------------------------------------------- handwriting */

/* The label is in the script face, which sits high in its line: a nudge down centres it on a mark
   beside it. On a dark or brand band the words take the band's own ink. The plain label alone, used
   over small things inside a section, is a size down. */
.wp-block-sd-eyebrow.sd-eyebrow--drawn {
  gap: var(--wp--preset--spacing--v-5-3);
}

/* Beside a mark the words are a size down and stand a little off it, so the mark reads first. */
.wp-block-sd-eyebrow.sd-eyebrow--drawn > .sd-eyebrow__text {
  padding-block-start: 3px;
}

.wp-block-sd-eyebrow.sd-eyebrow--drawn > .sd-eyebrow__mark + .sd-eyebrow__text {
  font-size: var(--wp--preset--font-size--fixed-16);
  letter-spacing: 0.07em;
}

/* The words arrive after the mark: once the eyebrow is seen and the mark has drawn itself, they wipe in
   from the left. Armed by the drawing script (underline.js), so without it they are simply there. */
@media (prefers-reduced-motion: no-preference) {
  .sd-eyebrow--drawn.is-armed > .sd-eyebrow__mark + .sd-eyebrow__text {
    opacity: 0;
    clip-path: inset(-0.4em 100% -0.4em 0);
  }

  .sd-eyebrow--drawn.is-armed.is-seen > .sd-eyebrow__mark + .sd-eyebrow__text {
    opacity: 1;
    clip-path: inset(-0.4em -0.4em -0.4em 0);
    /* The marks take about a second and a half to draw; the words start as the last strokes land. */
    transition: clip-path 650ms cubic-bezier(0.33, 1, 0.68, 1) 1500ms, opacity 250ms ease 1500ms;
  }
}

.wp-block-sd-eyebrow.sd-eyebrow--drawn > .sd-eyebrow__mark {
  width: 22px;
  height: 22px;
  margin-top: 0;
}

/* The mark on its own, with no words beside it, is a little larger. */
.wp-block-sd-eyebrow.sd-eyebrow--drawn > .sd-eyebrow__mark:only-child {
  width: 30px;
  height: 30px;
}

.wp-block-sd-eyebrow.sd-eyebrow--plain {
  font-size: var(--wp--preset--font-size--fixed-16);
}

[data-theme="dark"] .wp-block-sd-eyebrow.sd-eyebrow,
[data-theme="brand"] .wp-block-sd-eyebrow.sd-eyebrow,
.wp-block-stronger-card.is-style-ink .wp-block-sd-eyebrow.sd-eyebrow {
  color: color-mix(in srgb, var(--strong-theme-fg, var(--wp--preset--color--white)) 80%, transparent);
}

/* A mark standing alone on a dark band is drawn in the band's light ink: Flamingo on navy is too dim. */
[data-theme="dark"] .wp-block-sd-eyebrow.sd-eyebrow--drawn > .sd-eyebrow__mark {
  filter: brightness(0) invert(1);
  opacity: 0.85;
}
