/**
 * @file
 * Base styles - element defaults built from the tokens - task T-610.
 *
 * WHAT "BUILT FROM THE TOKENS" MEANS HERE, LITERALLY: this file contains no
 * colour value of its own. Every colour it applies is a var() reference into
 * css/tokens.css, which is the only file in the theme allowed to hold a colour
 * literal. That is not a convention to be remembered - tests/bin/no-colour-literals
 * asserts it on every push, and it has a dirty case that proves the assertion can
 * fail, in the three-digit form the linter forces as well as the six-digit form.
 *
 * The reason the rule is worth a gate rather than a code review: a colour written
 * here is a colour whose contrast nobody computed. The pairs in the token file
 * are checked against the WCAG relative-luminance formula; a hue typed straight
 * into a rule is checked against somebody's eye on somebody's monitor.
 *
 * NO CSS FRAMEWORK, AND NO RESET LIBRARY EITHER. The whole of the reset is the
 * first three rules below - about ten lines. Normalize and its relatives were
 * considered and refused: importing a framework to save ten lines means adding a
 * dependency with its own colour values, its own licence line and its own
 * upgrade schedule to a package whose defining property is that every dependency
 * can be named and justified.
 *
 * SMACSS: this is the `base` layer - element selectors and nothing else. There
 * is not a single class in this file. Layout lives in layout.css and components
 * in components.css, and the library declaration loads them in that order so
 * that a component can override a base rule without either of them fighting
 * over specificity.
 *
 * THE SPACING SCALE LIVES HERE AND NOT IN THE TOKEN FILE, deliberately. The
 * token file is parsed by the contrast checker with a regular expression that
 * expects every value in it to be a bare hex literal; a length in it would be a
 * token with no colour and no pair, which is the exact shape that checker exists
 * to reject. Sizes are not colours and are not checked for contrast.
 */

:root {
  /* A 1.5 ratio, rounded to two decimals, from a 1rem step. In rem so that it
     scales with the reader's own font size along with the type. */
  --agora-space-3xs: 0.25rem;
  --agora-space-2xs: 0.5rem;
  --agora-space-xs: 0.75rem;
  --agora-space-s: 1rem;
  --agora-space-m: 1.5rem;
  --agora-space-l: 2.25rem;
  --agora-space-xl: 3.375rem;

  /* ⚠️ THE SCALE ENDED ONE STEP SHORT OF A COMPOSITION THAT NEEDED IT, which
     is why this step exists rather than because a page asked for a round
     number. The sign-in card pads both of its panels with `xl` - the most
     generous step there was - so "one step more open than that" had nowhere in
     the scale to come from, and the only two ways to write it were a
     multiplier inline or a length typed by hand. Both produce a number whose
     relationship to the other seven is invisible to the next reader.
     3.375 x 1.5 = 5.0625 exactly, which is the same multiplication every value
     above 0.5rem here is already the result of, so this is the scale
     continuing rather than an eighth number joining it. The bottom of the
     scale was extended twice for the same reason, to `2xs` and `3xs`; this is
     that move at the other end and it takes the same naming. */
  --agora-space-2xl: 5.0625rem;

  /* The measure. WCAG 2.2 SC 1.4.8 asks for no more than 80 characters on a
     line of body text; 68ch leaves room for the wider glyphs of Spanish
     accented text without ever reaching that limit. */
  --agora-measure: 68ch;

  /* The width of the page's own content column. */
  --agora-container-width: 75rem;

  /* The mark at hero scale. One length, used three times - the artwork's own
     width, the room reserved for it beside the headline, and the floor under
     the band's height - so the three cannot drift apart. It shrinks with the
     viewport and stops at both ends: never so small it is a smudge, never so
     large it crowds the heading it sits beside. */
  --agora-hero-art-width: clamp(9rem, 28vw, 22rem);

  /* THE FLOOR UNDER THE HERO'S TEXT COLUMN, and the single number that decides
     where the mark stops standing beside the words and starts standing under
     them. This theme contains no media query and this change did not add the
     first one: this basis plus `flex-wrap` IS the narrow layout. 20rem is the
     width at which a headline, a line of text and two buttons still read as a
     composition rather than as a stack of full-width bars. */
  --agora-hero-body-floor: 20rem;

  /* THE BANNER'S SEARCH FIELD. It shares one row with a mark, a name and the
     navigation, so it is the item that gives way: this is the width it asks
     for, not the width it gets, and `flex-shrink` takes it down from here.
     Below the floor the whole row wraps instead. */
  --agora-header-search-width: 18rem;
  --agora-header-search-floor: 9rem;

  /* THE MARK'S WIDTH, AND IT IS A TOKEN BECAUSE TWO RULES NEED THE SAME NUMBER.
     The mark sizes itself from this, and the slogan is indented by this plus
     the gap beside the mark, so that the slogan starts under the NAME rather
     than under the mark. Written once because an indent that is a hand-copied
     duplicate of a width goes stale the first time the width moves, and the
     result is a slogan a few pixels off the name - the kind of defect nobody
     files and everybody sees. */
  --agora-branding-mark: 2.75rem;

  /* THE FLOOR UNDER A TABLE COLUMN, and the single most load-bearing length in
     this file for the kind of content this portal publishes.

     A register of contracts has six or seven columns and one of them is a
     sentence. Given less room than it needs the auto table layout does not
     scroll - it CRUSHES: the short columns collapse to three words each while
     the sentence wraps to fifteen lines, and the row is as tall as that one
     cell. The horizontal scroller in css/components.css was present the whole
     time and had nothing to scroll, because nothing had stopped the columns
     collapsing in the first place.

     10rem IS THE LARGEST FLOOR THAT COSTS THE DESKTOP LAYOUT NOTHING, and that
     is a measurement rather than a preference. Median row height on the
     six-column documents register, rendered and measured at both ends:

         floor    at 560px    at 1440px
         none      257px       137px
         9rem      233px       137px
        10rem      209px       137px
        11rem      185px       161px

     Eleven is better on the phone and costs a line on every row at desktop:
     six columns at 11rem is a floor of 1056px inside a content column of
     1152px, so almost no slack is left for the auto layout to give back to the
     column holding the sentence, and it wraps one line further. At 10rem the
     floor is 960px, 192px of slack remains, the sentence column keeps the width
     it would have had anyway, and the desktop figure is identical to having no
     floor at all. Taking the free win over the tuned one is deliberate: the
     alternative was a media query with a breakpoint chosen to make one demo
     table behave, which is a number that would go stale the first time a view
     exposed a seventh column.

     It is applied to the CELLS rather than as a min-width on the table, and
     that is deliberate rather than a shortcut. A cell floor scales itself with
     however many columns a view happens to expose - no per-count rules and no
     ceiling on the count - and, decisively, it also reaches the tables that
     core builds through `#type: table`, which carry no column-count class at
     all. A rule keyed on that class would have silently done nothing for half
     the tables this theme renders. */
  --agora-table-column-min: 10rem;

  /* Rule widths. The strong variant is for a line that separates data - a table
     header from its body - rather than one that merely encloses a box. */
  --agora-border-width: 1px;
  --agora-border-width-strong: 2px;

  /* The accent rule that closes the banner and opens the footer. It is thick
     enough to read as a deliberate band rather than as a stray hairline, and
     thin enough not to become a stripe. It is the only place a measurement is
     tied to the brand rather than to a function. */
  --agora-rule-accent: 4px;

  /* The height of the header's second-level row, reserved above the width at
     which that row is lifted out of the flow. It is the sub-link's own box
     added up rather than a round number, so it cannot drift away from the rule
     that draws it: the target-size floor of a small control, its padding on
     both sides, and the gap under the row. */
  --agora-subnav-reserve: calc(1.5rem + var(--agora-space-3xs) * 2 + var(--agora-space-2xs));

  /* A radius of two pixels, applied to controls and panels and to nothing else.
     Not zero, because a perfectly square input reads as unfinished next to the
     browser's own widgets; not more, because a public register is not a
     consumer app and rounded corners are the fastest way to make it look like
     one.

     ⚠️ THE VALUE IS NOW SIX PIXELS. The paragraph above is the argument that was
     made for two, it is kept because it is not wrong, and the decision went the
     other way anyway: [andres], 2026-09-04, looking at a rendered page rather
     than at this file, asked for corners that are slightly rounded and not much
     - rounded enough that they are no longer sharp, which he read in a mockup as
     the more modern of the two looks. What two pixels actually drew was a square
     corner with a chamfer nobody could see; at the sizes this theme uses it was
     indistinguishable from zero, so the paragraph above was defending a position
     the rendered page never took.

     SIX IS BOUNDED AT BOTH ENDS AND NEITHER BOUND IS TASTE. Below it the corner
     stops being legible as a corner - that is the two-pixel finding restated.
     Above it a 2.75rem control starts travelling towards the pill it would
     become at 22px, and a pill is the consumer-app look the paragraph above is
     right to refuse. Six reads as deliberately softened on a 44px control and on
     a 300px card alike, which matters because ONE token serves both.

     WHERE IT APPLIES, unchanged in kind and now worth stating as a list because
     the value is large enough for the exceptions to show. Controls: the element
     layer's buttons and text fields, the hero's two actions, the footer's brand
     link, a quick-access link. Panels: a full node's content sheet, the exposed
     filter form, and the register, quick-access and service-area cards. That is
     every use, and there are ten.

     WHERE IT MUST NOT APPLY, and both exclusions are load-bearing at six pixels
     where they cost nothing at two:

       * THE BRAND RULE UNDER A HEADING. It is 3rem by 4px. A radius of six on a
         four-pixel bar is clamped to half its height and the bar becomes a
         capsule - and the same 4px band closes the banner and opens the footer
         as a square-ended rule in both places, so the heading's copy of it would
         have been the only rounded one. It gave up its radius in this change
         rather than inherit this value; see the rule itself in this file.
       * THE TABLE'S SCROLL CONTAINER. It has no radius today and gains none.
         The reason is recorded where the rule lives in css/components.css and
         it is not this token's: `border-collapse: collapse` makes a radius inert
         on a table, and keeping one would mean re-drawing every cell border in
         every table. A square-cornered data table is ordinary; that trade is
         not worth making, and this larger value does not change the arithmetic
         behind it. */
  --agora-radius: 6px;

  /* The label column of a record sheet - the two-column form a full node page
     is laid out in. It is a floor and a ceiling at once, because it is the
     first track of a grid whose second track takes whatever is left: below this
     width the longest labels this portal publishes - "Annual remuneration",
     "Number of bidders" - wrap to two lines against a one-line value and
     ragged-edge the whole column; above it the values start so far in that the
     label stops reading as the thing introducing them. It is expressed in rem
     and not in ch because the labels are set in the bold weight and the values
     are not, so a ch here would be measuring the wrong face. */
  --agora-record-label-width: 17rem;

  /* The chevron drawn between two breadcrumb items. It is sized in em, and it
     is the one length in this block that is: it is a glyph-shaped mark sitting
     on a line of text, so it has to shrink with the text it separates rather
     than with the root. See css/components.css for why it is a pair of borders
     and not a character. */
  --agora-crumb-chevron-size: 0.4em;

  /* WCAG 2.2 SC 2.5.8 (Target Size, Minimum) requires 24 by 24 CSS pixels for a
     pointer target. 2.75rem is 44px at the default root size, which is the AAA
     figure and the one every mobile platform's own guidance uses; meeting the
     larger number costs nothing here and stops the minimum from being eroded by
     a later padding change. */
  --agora-target-size: 2.75rem;

  /* The criterion's OWN figure, 24 CSS pixels, for the controls where the AAA
     one above would distort the thing it is applied to. A breadcrumb crumb is
     the case that brought it: giving a line of orientation text a 44px row
     turns a quiet trail into a band as tall as a menu. Two tokens rather than
     one because the choice between them is a judgement each component has to
     make and record, and a single token would hide that judgement behind a
     name that looked like a constant. */
  --agora-target-size-min: 1.5rem;

  /* A GLYPH INSIDE A CONTROL - the magnifier in the banner's search button,
     the brand marks in the footer's social row. 1.5rem inside a 2.75rem square
     leaves a 0.625rem margin on every side, which is enough for a stroked
     drawing to read as a drawing and not as a smudge, and the square itself
     stays the target. One token so that the two cannot drift apart. */
  --agora-glyph-size: 1.5rem;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--agora-color-text);
  background-color: var(--agora-color-surface);
}

/**
 * Headings, paragraphs and lists.
 *
 * Margins are set on the block-end only, so that a heading is bound to the text
 * it introduces rather than floating between two blocks: proximity is a
 * grouping cue, and a heading equidistant from what it labels and what it
 * follows tells the reader nothing.
 */
h1,
h2,
h3,
h4,
h5,
h6 {
  margin-block-start: var(--agora-space-m);
  margin-block-end: var(--agora-space-2xs);
}

/**
 * The page's own heading, and the one place the brand reaches the content.
 *
 * A SHORT ACCENT RULE UNDER THE <h1>, drawn as a pseudo-element rather than as
 * a border on the heading itself, so that it is the width of a mark and not the
 * width of the title - a full-width rule under a two-word heading reads as a
 * separator between sections, which is the opposite of what it means here.
 *
 * IT IS DECORATION IN THE WCAG SENSE and carries no information, so SC 1.4.11
 * does not apply to it - but the value it uses is checked against this surface
 * anyway, at 3.41:1, because the token file declares every combination this
 * theme may render and an unchecked exception is how the next one gets made.
 *
 * The top margin is removed because the <h1> is the first thing in the main
 * landmark on all but a handful of pages; the space above it belongs to the
 * region, which is where css/layout.css puts it. The bottom margin is a full
 * step rather than the tight one the other headings take, because this heading
 * introduces a whole page and not the paragraph after it.
 */
h1 {
  margin-block-start: 0;
  margin-block-end: var(--agora-space-l);
}

/**
 * The accent rule under the heading.
 *
 * IT USED TO CARRY THE THEME'S RADIUS AND IT NO LONGER DOES, which is a
 * deletion rather than an oversight. The bar is 3rem by 4px; a border radius is
 * clamped to half the box, so at the old two pixels it drew a corner nobody
 * could see and at the current six it would draw a capsule. A rounded bar here
 * would also have been the ONLY rounded one: this is the same 4px band that
 * closes the banner and opens the footer, and in both of those it is a border
 * with square ends. Square everywhere is the consistent answer, and it is the
 * one the page was already showing.
 */
h1::after {
  display: block;
  width: 3rem;
  height: var(--agora-rule-accent);
  margin-block-start: var(--agora-space-xs);
  content: "";
  background-color: var(--agora-color-accent);
}

p,
ul,
ol,
dl,
blockquote,
pre {
  margin-block-start: 0;
  margin-block-end: var(--agora-space-s);
}

p {
  max-width: var(--agora-measure);
}

/**
 * Links.
 *
 * UNDERLINED, ALWAYS, IN BODY TEXT. WCAG 2.2 SC 1.4.1 forbids colour as the
 * only thing distinguishing a link from the text around it, and the usual
 * remedy - "the contrast between link and text is above 3:1" - is a technique
 * with conditions attached rather than a licence to drop the underline. An
 * underline is free, unambiguous and survives being printed in black and white,
 * which a register of public contracts frequently is.
 *
 * The visited colour is a different hue rather than a dimmer one: a reader
 * working through a list of documents needs to know which ones they have opened,
 * and dimming would take the pair below its checked contrast.
 */
a {
  text-decoration: underline;
  text-underline-offset: 0.15em;
  color: var(--agora-color-link);
}

a:visited {
  color: var(--agora-color-link-visited);
}

a:hover {
  color: var(--agora-color-link-hover);
}

/**
 * Media.
 *
 * Never wider than its container, and never distorted: `height: auto` keeps the
 * aspect ratio when the width is constrained, which is what stops a scanned
 * budget page from being squashed into illegibility on a phone.
 */
img,
svg,
video {
  max-width: 100%;
  height: auto;
}

hr {
  margin-block: var(--agora-space-m);
  border: 0;
  border-block-start: var(--agora-border-width) solid var(--agora-color-border);
}

/**
 * Form controls.
 *
 * `font: inherit` is the load-bearing line: browsers default form controls to a
 * smaller system font, and a reader who has raised their browser's font size
 * gets that increase everywhere EXCEPT the fields they have to fill in. The
 * minimum height is the target-size floor described where the token is defined.
 */
input,
select,
textarea {
  max-width: 100%;
  min-height: var(--agora-target-size);
  padding: var(--agora-space-2xs) var(--agora-space-xs);
  color: var(--agora-color-text);
  border: var(--agora-border-width-strong) solid var(--agora-color-border-strong);
  border-radius: var(--agora-radius);
  background-color: var(--agora-color-surface);
  font: inherit;
}

/**
 * Buttons.
 *
 * THE INVERSE SURFACE CARRIES THE INVERSE TEXT, and the choice was made with
 * the checker open rather than by eye. Against --agora-color-surface the brand
 * accent reaches only 3.41, so --agora-color-text-inverse on an accent-filled
 * button would land there too - a fail of SC 1.4.3 by a wide margin - and the
 * near-black --agora-color-text that WOULD pass on it computes to 4.31, still
 * short. No accent-filled button clears the threshold at any legible size, so
 * the accent stays a graphic and the control takes --agora-color-surface-inverse,
 * a declared pair that computes to 14.29.
 *
 * The attribute selectors are here rather than a `.button` class rule because
 * this is the element layer: every one of these is a button whether or not
 * Drupal got round to putting a class on it, and a form built by a contrib
 * module gets the same control as a form built by core.
 */
button,
input[type="submit"],
input[type="button"],
input[type="reset"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: var(--agora-target-size);
  min-height: var(--agora-target-size);
  padding-inline: var(--agora-space-m);
  cursor: pointer;
  transition: background-color 120ms ease-out;
  text-align: center;
  text-decoration: none;
  color: var(--agora-color-text-inverse);
  border: var(--agora-border-width-strong) solid transparent;
  border-radius: var(--agora-radius);
  background-color: var(--agora-color-surface-inverse);
  font-weight: var(--agora-font-weight-bold);
}

button:hover,
input[type="submit"]:hover,
input[type="button"]:hover,
input[type="reset"]:hover {
  background-color: var(--agora-color-surface-inverse-raised);
}

/* A checkbox or a radio is drawn by the browser and must keep its own size; the
   rules above would stretch it into a rectangle. Its target size is met by the
   label beside it, which is clickable and is at least as tall as a line. */
input[type="checkbox"],
input[type="radio"] {
  min-height: 0;
  padding: 0;
}

textarea {
  min-height: calc(var(--agora-target-size) * 3);
}

button {
  min-width: var(--agora-target-size);
  cursor: pointer;
}

/**
 * Tables at element level.
 *
 * Collapsed borders and full width are properties of every table on the site;
 * everything else about a table is in components.css. `caption-side: block-start`
 * is stated rather than left to the default because a caption placed under a
 * long table is read after the data it was supposed to introduce. It is the
 * physical keyword and not the logical `block-start`: stylelint's
 * declaration-property-value-no-unknown rejects the logical value, because
 * browser support for it on this property is not there yet - the blocking
 * linter is the oracle, and the physical keyword is what it accepts.
 *
 * The tabular-figures rule that keeps a column of amounts aligned is NOT here:
 * it is in css/typography.css, where task T-607 put it on the `table` element,
 * and repeating it would create a second place to maintain and a second place
 * to forget.
 */
table {
  width: 100%;
  caption-side: top;
  border-collapse: collapse;
}

th,
td {
  padding: var(--agora-space-xs) var(--agora-space-s);
  text-align: start;
  vertical-align: top;
  border-block-end: var(--agora-border-width) solid var(--agora-color-border);
}

th {
  font-weight: var(--agora-font-weight-bold);
}
