/* ============================================================
   headings.css — heading block type styles
   ============================================================
   A heading and the text that belongs with it: the label above,
   the title itself, the subtitle or intro below. Size comes from the
   .title-* utility on the element; these classes own colour, weight
   and the rhythm between the parts.
   Conventions: _shared/bricks-builder/css-conventions.md

   Contents
     1. Section heading
     2. Headline — the Highlight Heading element's block + colour families
     3. Label text, subtitle & section intro

   Last updated: 2026-10-11 (auto-stamped by the pre-commit hook)
   ============================================================ */


/* ------------------------------------------------------------
   1. Section heading — the section header's title
   ------------------------------------------------------------
   The section title. Centres its own text (the .section-header sets
   no text-align, so each part owns its alignment).
   ------------------------------------------------------------ */
.section-heading {
    font-size: var(--title-2);
    color: var(--text-heading);
    text-align: center;
}


/* ------------------------------------------------------------
   2. Headline — label + highlighted title + subtitle, in ONE colour family
   ------------------------------------------------------------
   The look for the custom "Highlight Heading" element
   (elements/highlight-heading.php): label over the title, optional
   subtitle below. The highlighted focus word reuses the .text-highlight
   + .font-highlight utilities; which colour that is, the family rules
   further down decide.
   ------------------------------------------------------------ */
.headline {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.headline > * {
    margin: 0;
}

.headline-title {
    /* Font size comes from the .title-* utility the element adds. */
    color: var(--text-heading);
    line-height: var(--line-height-heading);
    text-wrap: balance;
}

/* Legibility shadow when the heading sits on a dark surface — a dark
   section, or the whole page in dark mode (page dark mode is one big
   dark surface). */
:is([data-brx-theme="dark"], .section--dark, .section--dark-neutral) .headline-title {
    text-shadow: var(--text-shadow-on-dark);
}

/* Colour family — the element's "Colour style" choice as a class on the
   root, next to .headline (a family axis combined with the block, like
   .section--hero-* on a section; the element writes both classes, nobody
   types them). Everything inside speaks the PRIMARY family by default —
   the word reads --text-highlight-primary, the badge the primary inverse
   pair — so .headline--primary needs no rule: it is the spoken default,
   not an override. Inside an Accent hero it stays accent: the hero points
   the working names one level up, and nothing here points them back
   (farvefamilier-plan.md §2a, 14-09-2026). No class = follows the section.
   The same working names as the section-level axis in layout.css §3
   (.colour-accent / .colour-neutral, shared with the hero), in the same
   order, so the two blocks diff cleanly. Set ON the element: a value set
   on the element beats anything inherited from a dark section, a hero or
   a .colour-* section — and this file loads after layout.css, so at equal
   specificity the element's own choice wins. Links are not remapped
   here: a headline has none. */
.headline--accent {
    --action-primary: var(--action-accent);
    --action-primary-hover: var(--action-accent-hover);
    --action-primary-text: var(--action-accent-text);
    --text-highlight-primary: var(--text-highlight-accent);
    --list-marker-primary: var(--list-marker-accent);
    --border-highlight-primary: var(--border-highlight-accent);
    --surface-inverse-primary: var(--surface-inverse-accent);
    --text-inverse-primary: var(--text-inverse-accent);
}

/* Neutral: greys only. The family has no colour to highlight with, so
   the whole title goes --text-strong (black / white) and the highlighted
   word is marked by weight instead — 700 against the title's 500, via
   the .font-highlight knob. Decided on a trial page, 14-09-2026. */
.headline--neutral {
    --action-primary: var(--action-neutral);
    --action-primary-hover: var(--action-neutral-hover);
    --action-primary-text: var(--action-neutral-text);
    --text-highlight-primary: var(--text-strong);
    --list-marker-primary: var(--text-strong);
    --border-highlight-primary: var(--border-strong);
    --surface-inverse-primary: var(--surface-inverse-neutral);
    --text-inverse-primary: var(--text-inverse-neutral);
    --text-heading: var(--text-strong);
    --font-highlight-weight: 700;
}

/* ------------------------------------------------------------
   3. Label text, subtitle & section intro
   ------------------------------------------------------------
   Reusable subheading type styles: the small label above a heading,
   and the subtitle or section intro below it. Used by the Highlight
   Heading element and standalone. Variants are STANDALONE — use one
   alone, never together with the base class.

   Named .label-text, not .eyebrow: "eyebrow" is trade jargon, and the
   panel already calls the field "Label above title" (renamed 05-09).
   Plain `.label` is unavailable — Bricks prints it on form labels and
   ships frontend CSS for it.
   ------------------------------------------------------------ */

/* One size only (Katrine, 05-09). It was --text-l (20px), which made
   the label bigger than the body text it introduces; --text-m matches
   the body and the all-caps tracking still reads as a label.
   Grey in EVERY colour family (Katrine, 14-09): a label in the family's
   colour fought the highlighted word for attention — same hue, same
   saturation, same weight. --text-secondary flips per surface (grey-500
   on light, white at 70 % on dark — a translucent white takes a photo's
   tint, where a fixed grey sank in): 5.0:1 on the page background, 5.6:1
   on white, 5.1:1 on the beige band, 9.1:1 on grey-900 (DESIGN-SYSTEM.md
   §2.4). The family shows in the badge, the word and the buttons instead. */
.label-text {
    font-size: var(--text-m);
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.1em;                 /* tracking for all-caps */
}

/* Badge — one standalone variant (never stacked with .label-text), ONE
   colour rule: the family's inverse pair — deep tone on light surfaces,
   light tint on dark surfaces and in dark mode. The flip is in the
   tokens, so no dark-context rule is needed. The primary names are the
   working names; an Accent or Neutral family (hero.css §9a, the
   .headline--* rules above) points them at its own pair. The old
   "neutral on its own" mix went when the neutral family got real tokens
   (14-09-2026). GOTCHA: the pill is painted on the inner <span>, not the
   <p>. The p is a stretched flex item inside .headline, so a background
   on it would run full-width and ignore the text-align control.
   Vertical padding in em keeps the pill slim. Size raised from --text-xs
   to --text-s (Katrine, 05-09): 12px all-caps with tracking sat below
   comfortable reading. */
.label-text--badge > span {
    display: inline-block;
    padding: 0.35em var(--space-xs);
    border-radius: var(--radius-1);
    font-size: var(--text-s);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;   /* px on purpose — stays put at this tiny size */
    background-color: var(--surface-inverse-primary);
    color: var(--text-inverse-primary);
}

/* One selector, so the --soft variant works alone (standalone rule). */
:is(.subtitle, .subtitle--soft) {
    font-size: var(--text-l);
    text-wrap: pretty;
}

.subtitle {
    font-weight: 600;
    color: var(--text-heading);
}

/* Muted variant — the colour token flips per surface, so it reads as
   soft grey on the dark footer with no extra rules. */
.subtitle--soft {
    font-weight: 400;
    color: var(--text-secondary);
}

.section-intro {
    font-size: var(--text-l);
}

/* Hide an empty part so the gap doesn't reserve space for it. */
.label-text:empty,
.subtitle:empty,
.subtitle--soft:empty,
.section-intro:empty {
    display: none;
}
