@layer cinder.tokens, cinder.foundation, cinder.components, cinder.utilities;
@layer cinder.components {
  .cinder-page-header {
    /* The size the title is set at. The inline status and the actions read it too: each is one line
       box of this size and centres its content in it, so they share the title's first line's centre
       whatever the variant, the density or the height of a control (COR-2438). */
    --_cinder-page-header-title-size: var(--cinder-text-page-title);
    /* The heading answers to the room it has, not the viewport's, so the title of a header in a
       narrow pane truncates sooner. */
    container-type: inline-size;
    container-name: cinder-page-header;
    min-width: 0;
  }

  /* The rule under the header is opt-in (`divider`); space and the page's own rhythm separate it
     from the content by default (COR-2311). */
  .cinder-page-header[data-cinder-divider='true'] {
    border-bottom: 1px solid var(--cinder-border);
  }

  /* Flush by default (COR-2448): the header draws no padding beside or around its row, so its title
     lines up with what is under it. `inset` opts into the padding. */
  .cinder-page-header[data-cinder-inset='true'] .cinder-page-header__breadcrumbs {
    padding-inline: var(--cinder-space-4);
  }

  .cinder-page-header[data-cinder-inset='true'] .cinder-page-header__row {
    padding: var(--cinder-space-3) var(--cinder-space-4);
  }

  .cinder-page-header__breadcrumbs {
    padding: var(--cinder-space-3) 0 0;
    color: var(--cinder-text-muted);
    font-size: var(--cinder-text-sm);
    line-height: var(--cinder-leading-tight);
  }

  .cinder-page-header__row {
    display: flex;
    align-items: flex-start;
    gap: var(--cinder-space-3);
    min-width: 0;
    padding: 0;
  }

  .cinder-page-header__heading-group {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: var(--cinder-space-1);
    min-width: 0;
  }

  /* The title and, when it is `inline`, the status share one line that stays on the title's first
     line however long the title is. */
  .cinder-page-header__title-line {
    display: flex;
    align-items: flex-start;
    gap: var(--cinder-space-3);
    min-width: 0;
  }

  /* A long title wraps to two lines and then ends in an ellipsis; the full text is in its
     tooltip. */
  .cinder-page-header__title {
    flex: 0 1 auto;
    min-width: 0;
    margin: 0;
    color: var(--cinder-text-default);
    font-size: var(--_cinder-page-header-title-size);
    font-weight: var(--cinder-font-semibold);
    letter-spacing: var(--cinder-tracking-display);
    line-height: var(--cinder-leading-tight);
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
    overflow-wrap: anywhere;
  }

  /* `titleLines={1}`: the title keeps one line, ending in an ellipsis, and takes the free space
     first. The title line wraps, so an inline status that no longer fits beside the title's words
     moves under them instead of squeezing the title to a fragment (COR-2438). */
  .cinder-page-header[data-cinder-title-lines='1'] .cinder-page-header__title-line {
    flex-wrap: wrap;
    row-gap: var(--cinder-space-1);
  }

  /* One line ends at the box's edge, not at a break opportunity: a line clamp breaks the line at its
     last hyphen or space that fits and puts the ellipsis there, so a title such as
     `Explain run run-39-9fa4dea5-0196-…` stopped about 150px short of the actions. `nowrap` with
     `text-overflow` fills the whole inline size before the ellipsis. */
  .cinder-page-header[data-cinder-title-lines='1'] .cinder-page-header__title {
    display: block;
    -webkit-line-clamp: none;
    line-clamp: none;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .cinder-page-header__status {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--cinder-space-1) var(--cinder-space-3);
    min-width: 0;
    color: var(--cinder-text-muted);
    font-size: var(--cinder-text-sm);
    line-height: var(--cinder-leading-snug);
  }

  /* Beside the title: one line box of the title's own size, with the status centred in it, so the
     status shares the centre of the title's first line however the title wraps. */
  .cinder-page-header__status[data-cinder-placement='inline'] {
    flex: none;
    flex-wrap: nowrap;
    min-block-size: calc(var(--_cinder-page-header-title-size) * var(--cinder-leading-tight));
    white-space: nowrap;
  }

  /* A narrow header (a phone) gives the title the full row (owner decision, reversing COR-2337).
     An inline status drops under the title and wraps there, each item whole unless it is wider
     than the line, with no divider left at the end of a line. Every action but the create "+"
     drops to a row of its own under the title and the status; the "+" stays beside the title. */
  @container cinder-page-header (max-width: 32rem) {
    .cinder-page-header__row {
      flex-wrap: wrap;
    }

    .cinder-page-header__heading-group {
      flex-basis: 0;
    }

    .cinder-page-header__actions:not(.cinder-page-header__create-slot) {
      order: 1;
      flex-basis: 100%;
      flex-wrap: wrap;
      block-size: auto;
      margin-inline-start: 0;
    }

    /* Beside the title, once the other actions have moved to their own row. */
    .cinder-page-header__row > .cinder-page-header__actions + .cinder-page-header__create-slot {
      margin-inline-start: auto;
    }

    .cinder-page-header__title-line {
      flex-wrap: wrap;
      row-gap: var(--cinder-space-1);
    }

    .cinder-page-header__status[data-cinder-placement='inline'] {
      flex: 1 1 100%;
      flex-wrap: wrap;
      min-block-size: 0;
      white-space: normal;
    }

    /* Each item is a flex item that moves to the next line whole; only an item wider than a line of
       its own (a maximum-length identifier) breaks, rather than widening the page. */
    .cinder-page-header__status > * {
      max-inline-size: 100%;
      overflow-wrap: anywhere;
    }

    .cinder-page-header__status > .cinder-divider[data-cinder-orientation='vertical'] {
      display: none;
    }

    /* `narrowActions="beside-status"`: the actions sit at the inline end of the status's row
       instead of a row of their own, which gives that row's height back to the page (a chat on a
       phone). The heading's parts become the row's grid items: the title across the top, the
       status and the actions on the line under it, and a description under both. */
    .cinder-page-header[data-cinder-narrow-actions='beside-status'] .cinder-page-header__row {
      display: grid;
      grid-template-columns: minmax(0, 1fr) auto;
      align-items: center;
      gap: var(--cinder-space-1) var(--cinder-space-3);
    }

    .cinder-page-header[data-cinder-narrow-actions='beside-status']
      :is(.cinder-page-header__heading-group, .cinder-page-header__title-line) {
      display: contents;
    }

    .cinder-page-header[data-cinder-narrow-actions='beside-status'] .cinder-page-header__title {
      grid-column: 1 / -1;
      grid-row: 1;
    }

    .cinder-page-header[data-cinder-narrow-actions='beside-status'] .cinder-page-header__status {
      grid-column: 1;
      grid-row: 2;
    }

    .cinder-page-header[data-cinder-narrow-actions='beside-status']
      .cinder-page-header__actions:not(.cinder-page-header__create-slot) {
      grid-column: 2;
      grid-row: 2;
      justify-self: end;
    }

    .cinder-page-header[data-cinder-narrow-actions='beside-status']
      .cinder-page-header__description {
      grid-column: 1 / -1;
      grid-row: 3;
    }

    /* The create "+" stays beside the title, as it does in the default narrow layout. */
    .cinder-page-header[data-cinder-narrow-actions='beside-status']
      .cinder-page-header__row:has(> .cinder-page-header__create-slot)
      .cinder-page-header__title {
      grid-column: 1;
    }

    .cinder-page-header[data-cinder-narrow-actions='beside-status']
      .cinder-page-header__create-slot {
      grid-column: 2;
      grid-row: 1;
      justify-self: end;
    }

    /* With no status there is no line under the title to share, so the actions sit beside the
       title on its first line instead of alone on a second one, the create "+" after them, and a
       description takes the line under the title. */
    .cinder-page-header[data-cinder-narrow-actions='beside-status']
      .cinder-page-header__row:not(:has(.cinder-page-header__status))
      .cinder-page-header__title {
      grid-column: 1;
    }

    .cinder-page-header[data-cinder-narrow-actions='beside-status']
      .cinder-page-header__row:not(:has(.cinder-page-header__status))
      .cinder-page-header__actions:not(.cinder-page-header__create-slot) {
      grid-row: 1;
    }

    .cinder-page-header[data-cinder-narrow-actions='beside-status']
      .cinder-page-header__row:not(:has(.cinder-page-header__status))
      .cinder-page-header__create-slot {
      grid-column: auto;
    }

    /* Both on the title's line need a column each, so a description still spans the row. */
    .cinder-page-header[data-cinder-narrow-actions='beside-status']
      .cinder-page-header__row:not(:has(.cinder-page-header__status)):has(
        > .cinder-page-header__actions:not(.cinder-page-header__create-slot)
      ):has(> .cinder-page-header__create-slot) {
      grid-template-columns: minmax(0, 1fr) auto auto;
    }

    .cinder-page-header[data-cinder-narrow-actions='beside-status']
      .cinder-page-header__row:not(:has(.cinder-page-header__status))
      .cinder-page-header__description {
      grid-row: 2;
    }

    /* A one-line title (`titleLines={1}`) leaves room beside it, so the actions keep the title's
       first line and centre on it at every width, and the status takes the line under both. The
       actions on the status's line centred about 30px under the title's words (COR-2438). */
    .cinder-page-header[data-cinder-narrow-actions='beside-status'][data-cinder-title-lines='1']
      .cinder-page-header__title {
      grid-column: 1;
    }

    .cinder-page-header[data-cinder-narrow-actions='beside-status'][data-cinder-title-lines='1']
      .cinder-page-header__actions:not(.cinder-page-header__create-slot) {
      grid-row: 1;
    }

    .cinder-page-header[data-cinder-narrow-actions='beside-status'][data-cinder-title-lines='1']
      .cinder-page-header__status {
      grid-column: 1 / -1;
    }
  }

  .cinder-page-header__status[data-cinder-placement='below'] {
    margin-block-start: var(--cinder-space-1);
  }

  .cinder-page-header__description {
    min-width: 0;
    /* A readable measure: a description never runs past about 70 characters, even at 1920. */
    max-inline-size: 70ch;
    margin: 0;
    color: var(--cinder-text-muted);
    font-size: var(--cinder-text-sm);
    line-height: var(--cinder-leading-normal);
  }

  .cinder-page-header__actions {
    margin-inline-start: auto;
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    gap: var(--cinder-space-2);
    /* The actions box is exactly the title's first line box (`1lh` at the title's size), and its
       controls are centred in it, so each control's centre is the first line's centre whatever its
       own height: a control taller than the line overflows it evenly above and below rather than
       pushing the others down (COR-2438). The controls are compact, so they never make the header
       taller than its title. Beside the title the title shrinks and truncates; in a narrow header
       all but the create "+" drop to a row of their own (below). */
    font-size: var(--_cinder-page-header-title-size);
    line-height: var(--cinder-leading-tight);
    block-size: 1lh;
    margin-block: 0;
  }

  /* The create "+" sits after the other actions, at their gap rather than the row's. */
  .cinder-page-header__actions + .cinder-page-header__create-slot {
    margin-inline-start: calc(var(--cinder-space-2) - var(--cinder-space-3));
  }

  /* The caption under the actions (`actionsNote`): the title keeps the whole first column, the
     actions sit at the inline end of the first row, and the caption sits under them, as wide as
     they are, so it never narrows the title. */
  .cinder-page-header__row:has(> .cinder-page-header__actions-note) {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: var(--cinder-space-1) var(--cinder-space-3);
  }

  .cinder-page-header__row:has(> .cinder-page-header__actions-note):has(
      > .cinder-page-header__actions:not(.cinder-page-header__create-slot)
    ):has(> .cinder-page-header__create-slot) {
    grid-template-columns: minmax(0, 1fr) auto auto;
  }

  .cinder-page-header__row:has(> .cinder-page-header__actions-note)
    > .cinder-page-header__heading-group {
    grid-column: 1;
    grid-row: 1 / span 2;
  }

  .cinder-page-header__row:has(> .cinder-page-header__actions-note) > .cinder-page-header__actions {
    grid-row: 1;
    justify-self: end;
    margin-inline-start: 0;
  }

  .cinder-page-header__row:has(> .cinder-page-header__actions-note)
    > .cinder-page-header__create-slot {
    grid-column: -2;
  }

  .cinder-page-header__actions-note {
    grid-column: 2 / -1;
    grid-row: 2;
    /* As wide as the actions above it, whatever its own length. */
    inline-size: 0;
    min-inline-size: 100%;
    margin: 0;
    color: var(--cinder-text-muted);
    font-size: var(--cinder-text-sm);
    line-height: var(--cinder-leading-normal);
    text-align: end;
  }

  /* Below 640px of header width the title takes the row, and the actions and their caption start
     the lines under it. */
  @container cinder-page-header (max-width: 40rem) {
    .cinder-page-header__row:has(> .cinder-page-header__actions-note) {
      grid-template-columns: minmax(0, 1fr) auto;
    }

    .cinder-page-header__row:has(> .cinder-page-header__actions-note)
      > .cinder-page-header__heading-group {
      grid-column: 1 / -1;
      grid-row: 1;
    }

    .cinder-page-header__row:has(> .cinder-page-header__actions-note)
      > .cinder-page-header__actions:not(.cinder-page-header__create-slot) {
      grid-column: 1 / -1;
      grid-row: 2;
      justify-self: start;
      flex-wrap: wrap;
      block-size: auto;
    }

    /* The create "+" stays beside the title. */
    .cinder-page-header__row:has(> .cinder-page-header__actions-note)
      > .cinder-page-header__create-slot {
      grid-column: 2;
      grid-row: 1;
    }

    .cinder-page-header__row:has(> .cinder-page-header__actions-note):has(
        > .cinder-page-header__create-slot
      )
      > .cinder-page-header__heading-group {
      grid-column: 1;
    }

    .cinder-page-header__actions-note {
      grid-column: 1 / -1;
      grid-row: 3;
      inline-size: auto;
      min-inline-size: 0;
      text-align: start;
    }
  }

  /* A hero's caption sits under its actions, at the start like they are. */
  .cinder-page-header__hero-copy > .cinder-page-header__actions-note {
    inline-size: auto;
    min-inline-size: 0;
    text-align: start;
  }

  /* The decision action group (approve, deny, edit; Cancel for running or paused work) is drawn
     first among the actions and never collapses into the overflow menu (COR-2320). */
  .cinder-page-header__decisions {
    display: inline-flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: var(--cinder-space-2);
  }

  /* The overflow menu button is an icon-only control at the compact height of the other header
     actions, so it never makes the header taller than its title (COR-2337). The extra class
     outranks the dropdown trigger's own `md` height wherever its stylesheet lands. */
  :where(.cinder-page-header:not([data-cinder-regular-actions]))
    .cinder-page-header__actions
    .cinder-page-header__overflow {
    inline-size: var(--_cinder-compact-control-height);
    min-inline-size: var(--_cinder-compact-control-height);
    block-size: var(--_cinder-compact-control-height);
    min-block-size: var(--_cinder-compact-control-height);
    padding: 0;
  }

  /* A page's own menu among the actions (a Dropdown trigger not drawn as a Button) is compact too,
     like every other header control, rather than the trigger's `md` height. */
  :where(.cinder-page-header:not([data-cinder-regular-actions]))
    .cinder-page-header__actions
    .cinder-dropdown-trigger:not(.cinder-button) {
    min-block-size: var(--_cinder-compact-control-height);
    padding-block: 0;
  }

  /* A Dropdown is an inline block, whose trigger would sit on a baseline in a line box of the
     title's size and so a little above the centre; as a flex box its trigger is centred like every
     other control. */
  .cinder-page-header__actions .cinder-dropdown {
    display: inline-flex;
    align-items: center;
  }

  /* A lighter phrase after the title, in the same heading at the same size. */
  .cinder-page-header__title-soft {
    font-weight: 380;
  }

  /* ── Large title ────────────────────────────────────────────────────────────
     The title at the large page-title step. Once it scrolls away, the sticky bar before the header
     shows it at the default page-title size. The actions keep centring on the title's first line
     box. */
  .cinder-page-header[data-cinder-variant='large'] {
    --_cinder-page-header-title-size: var(--cinder-text-page-title-large);
  }

  /* A sticky bar of no height in the page's flow; its surface hangs below it, over the content,
     so showing it never moves the page. */
  .cinder-page-header__bar {
    --_cinder-page-header-bar-height: 3.5rem;
    --_cinder-page-header-bar-mix: 82%;
    --_cinder-page-header-bar-blur: 16px;
    position: sticky;
    inset-block-start: 0;
    z-index: 1;
    block-size: 0;
  }

  .cinder-page-header__bar-surface {
    position: absolute;
    inset-block-start: 0;
    inset-inline: 0;
    display: flex;
    align-items: center;
    box-sizing: border-box;
    min-block-size: var(--_cinder-page-header-bar-height);
    padding-inline: var(--cinder-space-4);
    background: var(--cinder-surface-canvas);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition:
      opacity var(--cinder-duration-fast) var(--cinder-ease-standard),
      visibility var(--cinder-duration-fast) var(--cinder-ease-standard);
  }

  .cinder-page-header__bar[data-cinder-collapsed] .cinder-page-header__bar-surface {
    opacity: 1;
    visibility: visible;
  }

  /* The decision actions at the bar's inline end, tappable once the bar shows. */
  .cinder-page-header__bar-decisions {
    flex: none;
    margin-inline-start: auto;
    padding-inline-start: var(--cinder-space-3);
  }

  .cinder-page-header__bar[data-cinder-collapsed] .cinder-page-header__bar-surface {
    pointer-events: auto;
  }

  .cinder-page-header__bar-title {
    min-inline-size: 0;
    overflow: hidden;
    color: var(--cinder-text-default);
    font-size: var(--cinder-text-page-title);
    font-weight: var(--cinder-font-semibold);
    letter-spacing: var(--cinder-tracking-display);
    line-height: var(--cinder-leading-tight);
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* Translucent where the platform can blur what scrolls under it; opaque otherwise, and when the
     person asks for less transparency. */
  @supports (backdrop-filter: blur(1px)) {
    .cinder-page-header__bar-surface {
      background: color-mix(
        in oklch,
        var(--cinder-surface-canvas) var(--_cinder-page-header-bar-mix),
        transparent
      );
      backdrop-filter: blur(var(--_cinder-page-header-bar-blur));
    }
  }

  @media (prefers-reduced-transparency: reduce) {
    .cinder-page-header__bar-surface {
      background: var(--cinder-surface-canvas);
      backdrop-filter: none;
    }
  }

  @media (forced-colors: active) {
    .cinder-page-header__bar-surface {
      background: Canvas;
      border-block-end: 1px solid CanvasText;
      backdrop-filter: none;
    }
  }

  /* ── Hero ───────────────────────────────────────────────────────────────────
     A full-bleed band at page level, never a card: no border, no radius, and it spans its parent.
     Its content is capped at the page's content width. The band answers to its own width through
     an unnamed container query on the header, which is already a size container. */
  .cinder-page-header[data-cinder-variant='hero'] {
    --_cinder-hero-band: transparent;
    position: relative;
    isolation: isolate;
    overflow: hidden;
    background: var(--_cinder-hero-band);
    color: var(--cinder-text-default);
  }

  .cinder-page-header[data-cinder-tone='tint'] {
    /* cinder-allow-raw-color: structural-pattern — the tint band, a light or dark indigo wash */
    --_cinder-hero-band: light-dark(oklch(95.5% 0.03 275), oklch(24% 0.06 275));
  }

  /* Saturated indigo, hues 262 to 290 only, kept dark enough that the dark theme's muted text
     clears 4.5:1 on its lightest stop. */
  .cinder-page-header[data-cinder-tone='accent'] {
    /* cinder-allow-raw-color: structural-pattern — accent band gradient start, hue 262 */
    --_cinder-hero-from: oklch(40% 0.19 262);
    /* cinder-allow-raw-color: structural-pattern — accent band gradient end, hue 290 */
    --_cinder-hero-to: oklch(35% 0.19 290);
    --_cinder-hero-band: linear-gradient(135deg, var(--_cinder-hero-from), var(--_cinder-hero-to));
  }

  /* Near-black with an indigo glow at the inline-end corner. */
  .cinder-page-header[data-cinder-tone='night'] {
    /* cinder-allow-raw-color: structural-pattern — the night band's near-black base */
    --_cinder-hero-night: oklch(17% 0.03 275);
    /* cinder-allow-raw-color: structural-pattern — the night band's indigo glow */
    --_cinder-hero-glow: oklch(45% 0.17 275 / 0.45);
    --_cinder-hero-glow-at: 100% 0%;
    --_cinder-hero-band:
      radial-gradient(
        ellipse 60% 90% at var(--_cinder-hero-glow-at),
        var(--_cinder-hero-glow),
        transparent 70%
      ),
      var(--_cinder-hero-night);
  }

  .cinder-page-header[data-cinder-tone='night']:is([dir='rtl'], [dir='rtl'] *):where(
      :not([dir='rtl'] [dir='ltr'], [dir='rtl'] [dir='ltr'] *)
    ) {
    --_cinder-hero-glow-at: 0% 0%;
  }

  /* The decorative layer: dots that fade in from the inline end, and an optional large glyph. It
     is hidden from assistive technology in the markup, and not drawn at all when the person asks
     for more contrast or forces colours. */
  .cinder-page-header__decor {
    position: absolute;
    inset: 0;
    z-index: -1;
    pointer-events: none;
  }

  .cinder-page-header__pattern {
    position: absolute;
    inset: 0;
    background-image: radial-gradient(currentColor 1px, transparent 1.5px);
    background-size: var(--cinder-space-4) var(--cinder-space-4);
    opacity: 0.16;
    -webkit-mask-image: linear-gradient(to left, black, transparent 65%);
    mask-image: linear-gradient(to left, black, transparent 65%);
  }

  .cinder-page-header__pattern:is([dir='rtl'], [dir='rtl'] *):where(
      :not([dir='rtl'] [dir='ltr'], [dir='rtl'] [dir='ltr'] *)
    ) {
    -webkit-mask-image: linear-gradient(to right, black, transparent 65%);
    mask-image: linear-gradient(to right, black, transparent 65%);
  }

  .cinder-page-header__art {
    position: absolute;
    inset-block-end: calc(-1 * var(--cinder-space-6));
    inline-size: min(40cqi, 14rem);
    block-size: min(40cqi, 14rem);
    opacity: 0.08;
    line-height: 0;
  }

  .cinder-page-header__art:where(
    :not([dir='rtl'], [dir='rtl'] *),
    [dir='rtl'] [dir='ltr'],
    [dir='rtl'] [dir='ltr'] *
  ) {
    right: var(--cinder-space-6);
  }

  .cinder-page-header__art:where(
    :is([dir='rtl'], [dir='rtl'] *):not([dir='rtl'] [dir='ltr'], [dir='rtl'] [dir='ltr'] *)
  ) {
    left: var(--cinder-space-6);
  }

  .cinder-page-header__art :where(svg) {
    inline-size: 100%;
    block-size: 100%;
  }

  @media (prefers-contrast: more), (forced-colors: active) {
    .cinder-page-header__decor {
      display: none;
    }
  }

  .cinder-page-header__hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: 'copy focal';
    align-items: end;
    gap: var(--cinder-space-6) var(--cinder-space-10);
    box-sizing: border-box;
    max-inline-size: var(--cinder-content-width);
    margin-inline: auto;
    padding: var(--cinder-space-12) var(--cinder-space-6) var(--cinder-space-10);
  }

  .cinder-page-header__hero-copy {
    grid-area: copy;
    display: flex;
    flex-direction: column;
    gap: var(--cinder-space-2);
    min-inline-size: 0;
  }

  .cinder-page-header[data-cinder-variant='hero'] .cinder-page-header__breadcrumbs {
    padding: 0;
  }

  /* Neutral, never the accent colour. */
  .cinder-page-header__eyebrow {
    margin: 0;
    color: var(--cinder-text-muted);
    font-size: var(--cinder-text-sm);
    font-weight: var(--cinder-font-semibold);
    line-height: var(--cinder-leading-snug);
  }

  /* A display title sized by the band's width, at weight 760; `titleSoft` beside it is 380. */
  .cinder-page-header[data-cinder-variant='hero'] .cinder-page-header__title {
    font-size: clamp(var(--cinder-text-4xl), 6cqi, 3.75rem);
    font-weight: 760;
    -webkit-line-clamp: 3;
    line-clamp: 3;
  }

  .cinder-page-header[data-cinder-variant='hero'] .cinder-page-header__description {
    max-inline-size: var(--cinder-content-width-prose);
    font-size: var(--cinder-text-base);
  }

  .cinder-page-header__facts {
    margin-block-start: var(--cinder-space-1);
    min-inline-size: 0;
  }

  /* Beneath the title, at the buttons' own size. */
  .cinder-page-header__hero-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--cinder-space-2);
    margin-block-start: var(--cinder-space-4);
  }

  .cinder-page-header[data-cinder-variant='hero'] .cinder-page-header__overflow {
    inline-size: var(--cinder-control-height-md);
    min-inline-size: var(--cinder-control-height-md);
    padding-inline: 0;
  }

  /* One focal element per screen: a large tabular value, then its label, then an optional meter. */
  .cinder-page-header__focal {
    grid-area: focal;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: var(--cinder-space-1);
    min-inline-size: 0;
    font-variant-numeric: tabular-nums;
    text-align: end;
  }

  .cinder-page-header__focal > :first-child {
    font-size: clamp(var(--cinder-text-5xl), 11cqi, 5rem);
    font-weight: 760;
    letter-spacing: var(--cinder-tracking-display);
    line-height: 1;
  }

  .cinder-page-header__focal small {
    color: var(--cinder-text-muted);
    font-size: var(--cinder-text-sm);
    line-height: var(--cinder-leading-snug);
  }

  .cinder-page-header__focal > :not(:first-child, small) {
    align-self: stretch;
    min-inline-size: 10rem;
  }

  .cinder-page-header__media {
    grid-area: focal;
    min-inline-size: 0;
    max-inline-size: 40cqi;
  }

  /* Below 720px of band width: one column, the focal value first. */
  @container (width < 720px) {
    .cinder-page-header__hero {
      grid-template-columns: minmax(0, 1fr);
      grid-template-areas:
        'focal'
        'copy';
      align-items: start;
      padding: var(--cinder-space-8) var(--cinder-space-4);
    }

    .cinder-page-header__focal {
      align-items: flex-start;
      text-align: start;
    }

    .cinder-page-header__media {
      max-inline-size: none;
    }
  }

  /* On the accent and night bands the hero provides the controls' defaults: a white primary with
     an indigo label, a translucent secondary, and a translucent segmented-control track. Each
     rule names every state Button styles, so a hover or a press never falls back to the page's
     colours. The bands are dark theme islands, so text inside them already takes its dark value. */
  /* The focus ring is white on the dark bands: the dark theme's indigo ring would sit on an indigo
     band. Both shared ring formulas and Button's own ring hook are redeclared, so filled and
     outlined controls alike draw it. */
  .cinder-page-header[data-cinder-tone='accent'],
  .cinder-page-header[data-cinder-tone='night'] {
    /* cinder-allow-raw-color: structural-pattern — a white focus ring on a dark band */
    --_cinder-hero-ring: oklch(100% 0 0);
    --_cinder-focus-ring-shadow:
      0 0 0 var(--cinder-ring-offset) var(--cinder-ring-offset-color),
      0 0 0 calc(var(--cinder-ring-offset) + var(--cinder-ring-width)) var(--_cinder-hero-ring);
    --_cinder-focus-ring-filled-shadow:
      0 0 0 var(--_cinder-focus-ring-filled-gap) var(--cinder-ring-offset-color),
      0 0 0 calc(var(--_cinder-focus-ring-filled-gap) + var(--cinder-ring-width))
        var(--_cinder-hero-ring);
  }

  :is(.cinder-page-header[data-cinder-tone='accent'], .cinder-page-header[data-cinder-tone='night'])
    .cinder-button {
    --_cinder-button-ring: var(--_cinder-hero-ring);
  }

  /* The segmented control's option ring reads its own private hook, so on a band it is the white
     ring: the public ring token is indigo, about 2.3:1 on the accent band (COR-2445 AC6). */
  :is(.cinder-page-header[data-cinder-tone='accent'], .cinder-page-header[data-cinder-tone='night'])
    .cinder-segmented-control {
    --_cinder-segmented-control-ring: var(--_cinder-hero-ring);
  }

  :is(.cinder-page-header[data-cinder-tone='accent'], .cinder-page-header[data-cinder-tone='night'])
    .cinder-button.button-variant-primary:not(:disabled, [aria-disabled='true']) {
    /* cinder-allow-raw-color: structural-pattern — the hero's white primary fill */
    background: oklch(100% 0 0);
    /* cinder-allow-raw-color: structural-pattern — the indigo label on the white primary */
    color: oklch(42% 0.2 272);
    border-color: transparent;
  }

  :is(.cinder-page-header[data-cinder-tone='accent'], .cinder-page-header[data-cinder-tone='night'])
    .cinder-button.button-variant-secondary:not(:disabled, [aria-disabled='true']) {
    /* cinder-allow-raw-color: structural-pattern — the hero's translucent secondary fill */
    background: oklch(100% 0 0 / 0.12);
    /* cinder-allow-raw-color: structural-pattern — white label, 4.5:1 on every secondary state */
    color: oklch(100% 0 0);
    /* cinder-allow-raw-color: structural-pattern — the translucent secondary's edge */
    border-color: oklch(100% 0 0 / 0.5);
  }

  /* The default filled face (soft) on the band: the same translucent white fill and white label as
     the secondary, with no edge, so a default Button never draws accent text on an accent band. */
  :is(.cinder-page-header[data-cinder-tone='accent'], .cinder-page-header[data-cinder-tone='night'])
    .cinder-button.button-variant-soft:not(:disabled, [aria-disabled='true']) {
    /* cinder-allow-raw-color: structural-pattern — the hero's translucent default fill */
    background: oklch(100% 0 0 / 0.12);
    /* cinder-allow-raw-color: structural-pattern — white label, 4.5:1 on every default state */
    color: oklch(100% 0 0);
    border-color: transparent;
  }

  @media (hover: hover) {
    :is(
        .cinder-page-header[data-cinder-tone='accent'],
        .cinder-page-header[data-cinder-tone='night']
      )
      .cinder-button.button-variant-primary:hover:not(:disabled):not([aria-disabled='true']) {
      /* cinder-allow-raw-color: structural-pattern — the white primary's hover */
      background: oklch(93% 0.03 275);
    }

    :is(
        .cinder-page-header[data-cinder-tone='accent'],
        .cinder-page-header[data-cinder-tone='night']
      )
      .cinder-button.button-variant-secondary:hover:not(:disabled):not([aria-disabled='true']) {
      /* cinder-allow-raw-color: structural-pattern — the translucent secondary's hover */
      background: oklch(100% 0 0 / 0.2);
    }

    :is(
        .cinder-page-header[data-cinder-tone='accent'],
        .cinder-page-header[data-cinder-tone='night']
      )
      .cinder-button.button-variant-soft:hover:not(:disabled):not([aria-disabled='true']) {
      /* cinder-allow-raw-color: structural-pattern — the translucent default's hover */
      background: oklch(100% 0 0 / 0.2);
    }
  }

  :is(.cinder-page-header[data-cinder-tone='accent'], .cinder-page-header[data-cinder-tone='night'])
    .cinder-button.button-variant-primary:active:not(:disabled):not([aria-disabled='true']) {
    /* cinder-allow-raw-color: structural-pattern — the white primary's press */
    background: oklch(88% 0.04 275);
  }

  :is(.cinder-page-header[data-cinder-tone='accent'], .cinder-page-header[data-cinder-tone='night'])
    .cinder-button.button-variant-secondary:active:not(:disabled):not([aria-disabled='true']) {
    /* cinder-allow-raw-color: structural-pattern — the translucent secondary's press */
    background: oklch(100% 0 0 / 0.26);
  }

  :is(.cinder-page-header[data-cinder-tone='accent'], .cinder-page-header[data-cinder-tone='night'])
    .cinder-button.button-variant-soft:active:not(:disabled):not([aria-disabled='true']) {
    /* cinder-allow-raw-color: structural-pattern — the translucent default's press */
    background: oklch(100% 0 0 / 0.26);
  }

  :is(.cinder-page-header[data-cinder-tone='accent'], .cinder-page-header[data-cinder-tone='night'])
    .cinder-segmented-control:not([data-cinder-variant='tablist']) {
    /* cinder-allow-raw-color: structural-pattern — the translucent segmented-control track */
    background: oklch(100% 0 0 / 0.14);
  }
}
