/* ===========================================================================
   CORNERPOST WORKS - DESIGN TOKENS
   ===========================================================================

   THE ONE PLACE A VALUE IS DECIDED. UI Standard v1.9 section 16: "correct
   shared tokens, primitives, modal/overlay architecture, fields, collections,
   and utilities BEFORE workspace-specific implementations", and section 15: a
   scoped stylesheet "may not redefine shared tokens, button roles, modal
   behavior, field treatment, collection behavior, or other established Works
   patterns differently for one workspace".

   So: no colour, spacing, radius, shadow, or type value appears anywhere else
   in HQ. `npm run check:ui` fails the build on a literal outside this file.

   THE FILE HAS TWO HALVES, and the division is the whole theme system:

     1. CONSTANTS - the brand palette and every measurement. These do not
        change, ever, for any theme. A theme that could move a brand colour
        would not be a theme; it would be a second brand.
     2. SEMANTIC ROLES - what a surface, an ink or a border MEANS. Only these
        are remapped by theme, and they are the only names the components
        below are allowed to use.

   WHERE EACH VALUE COMES FROM, because a token nobody can trace is a token
   somebody will change:

     Brand palette      Cornerpost Marketing & Communications Design Standard,
                        section 8 "Approved Color Palette". Eight colours, and
                        HQ uses the ones the UI Standard calls for.
     Interface khaki    UI Standard 3.6, which specifies #d8c792 explicitly
                        "for Works interface use" - a lighter interface variant
                        of the brand khaki #C1A97F. The UI Standard governs
                        inside Works, so both values are correct in their own
                        scope and neither is a mistake.
     Borders            UI Standard 3.2, both light values given numerically.
     Shadows            UI Standard 3.3, both light values given numerically.
     Spacing            UI Standard 3.4, the authoritative seven-step scale.
     Breakpoints        UI Standard 3.5, 640px and 1024px.
     Focus ring         UI Standard 3.1, "3px brass ring at 45% opacity".
     Collection type    UI Standard 9.6, which states the canonical Customers
                        sizes to two decimal places.
     Dark roles         Derived here, because the UI Standard's numeric values
                        are light-surface values and it gives none for a dark
                        one. Every derived value is stated with the contrast
                        ratio it achieves; `check:ui` refuses a dark role that
                        redefines a brand constant.

   WHAT IS DELIBERATELY ABSENT: a compact scale. UI Standard section 2 -
   "Works makes room for useful information rather than hiding it to force
   density. There is no compact mode." There is no --space-compact, no
   --control-height-sm, and no font role below the secondary role.
   =========================================================================== */

/* ===========================================================================
   1. CONSTANTS - identical in every theme.
   =========================================================================== */
:root {
  /* -----------------------------------------------------------------
     BRAND PALETTE - Marketing & Communications Design Standard, section 8.
     Named exactly as that standard names them, so a reader can check.

     NO THEME MAY REASSIGN ANY OF THESE. That is the difference between a
     theme and a repaint, and `check:ui` enforces it.
     ----------------------------------------------------------------- */
  --brand-deep-brown: #4b3212;
  --brand-brass: #9f7c3a;
  --brand-khaki: #c1a97f;
  --brand-cream: #d9d1c1;
  --brand-green: #171c17;
  --brand-charcoal-green: #2c312b;
  --brand-warm-gray: #66685c;
  --brand-sage-gray: #66725c;
  /* TWO WARM BROWNS, NAMED BY THE OWNER ON 25 OCTOBER 2026 for deliberate use
     in Field: "#7E6C54" and "#584C3B". They are ADDITIONS to the palette, not
     replacements - nothing above or below changed value, and no existing role
     was redefined, so HQ renders exactly as it did.

     MEASURED, NOT ASSUMED. --brand-bark carries #f2f1ec at 7.40:1 and
     --brand-cream at 5.51:1, which is why it is the workspace-header ground in
     both themes. --brand-taupe carries #f2f1ec at only 4.47:1 - under the 4.5
     body-text floor - so it is NOT used as a ground for small text anywhere;
     its one role is a warm muted ink on the light surfaces, where it reads
     5.05:1 on white. */
  --brand-bark: #584c3b;
  --brand-taupe: #7e6c54;

  /* Works interface khaki. UI Standard 3.6 specifies this value for
     interface use; it is lighter than the brand khaki above because it has to
     read as a title against the green ground in a modal header. */
  --khaki: #d8c792;

  /* WORKS INTERFACE BRASS - the brand brass, darkened until it carries body
     text on the light surfaces. The brand value is 3.88:1 on white and 3.34:1
     on the hovered row, both below the 4.5:1 a reference needs; this is
     5.87:1 and 5.05:1.

     AND IT HAS TO LOOK DIFFERENT FROM INK, which is the half that was missed
     the first time. --brand-deep-brown clears contrast easily - 11.9:1 - and
     sits 1.46:1 from --ink, so a customer's name drawn in it read as ordinary
     body text on the deployed build: accessible, and invisible as a
     reference. This is 2.96:1 from --ink, which is a colour a reader can see
     is a different colour.

     The brand palette above is untouched, the way --khaki leaves
     --brand-khaki untouched. */
  --brass-ink: #7d6029;

  /* -----------------------------------------------------------------
     FOCUS - UI Standard 3.1. ONE canonical indicator, applied through
     :focus-visible, and the SAME indicator in both themes: brass at 45%
     reads against the light surfaces and the dark ones, so a second focus
     treatment would be a second thing to get wrong.
     ----------------------------------------------------------------- */
  /* INK ON THE GREEN GROUND - SHARED, and that is the point of it.
     A primary action is Cornerpost green in BOTH themes: the ground does not
     follow the theme, so the ink on it must not either.

     THIS IS A CORRECTION. .btn-primary used --ink-on-chrome, which was
     correct while the frame was green in both themes and became wrong the
     moment the Light theme gave the frame a light ground: the token turned
     into dark ink, and every primary button in Light rendered #1b1a18 on
     #2c312b - 1.09:1, which is unreadable. Found by looking at the first
     full-page screenshot of the customer record, not by any gate. The
     contrast suite was asking a hand-written list of thirteen chrome
     selectors and no button was on it; it asks about every button role now. */
  --ink-on-green: #f2f1ec;

  --focus-ring-color: rgb(159 124 58 / 45%); /* brass at 45% */
  --focus-ring-width: 3px;
  --focus-ring: 0 0 0 var(--focus-ring-width) var(--focus-ring-color);

  /* -----------------------------------------------------------------
     SPACING - UI Standard 3.4. The authoritative scale is 4, 6, 8, 12, 16,
     20, 24px and nothing else. Historical 17px and 18px values are not new
     tokens: 18px maps to the 16px role.
     ----------------------------------------------------------------- */
  --space-1: 4px;
  --space-2: 6px;
  --space-3: 8px;
  --space-4: 12px;
  --space-5: 16px;
  --space-6: 20px;
  --space-7: 24px;

  /* -----------------------------------------------------------------
     TYPE
     -----------------------------------------------------------------
     NO WEBFONT IS LOADED. The Marketing standard names Bahnschrift as "a
     frequent functional typeface for clear, modern, durable information and
     supporting text" and says the three named faces "are not the only
     typefaces permitted". Bahnschrift ships with Windows, which is what the
     office runs, so it is preferred and the stack falls back through faces
     that are already present. Self-hosting Barlow Semi Condensed for display
     type is a decision for the owner, not a thing to introduce quietly: it
     would be the first font asset Works ships.

     THE COLLECTION ROLES ARE NOT ROUND NUMBERS, deliberately. UI Standard
     9.6 states the canonical Customers treatment as "primary approximately
     16.8px / 700 ... secondary approximately 13.76px / 400 in muted text",
     and those are the values, not a tidier approximation of them. */
  --font-sans: 'Bahnschrift', 'Bahnschrift SemiLight', 'DIN Alternate', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-mono: ui-monospace, 'Cascadia Mono', 'Consolas', monospace;

  /* Type roles. A role is a size AND a weight AND a colour intent: picking a
     size on its own is how a workspace ends up with eleven of them. */
  --type-page-size: 24px;      /* the one h1 per workspace */
  --type-page-weight: 700;
  --type-section-size: 18px;   /* h2 - maps to the 16px spacing role, 3.4 */
  --type-section-weight: 700;
  --type-body-size: 16px;
  --type-body-weight: 400;
  --type-strong-weight: 600;
  --type-record-primary-size: 16.8px;   /* 9.6, canonical */
  --type-record-primary-weight: 700;
  --type-record-secondary-size: 13.76px; /* 9.6, canonical, muted */
  --type-record-secondary-weight: 400;
  --type-label-size: 14px;
  --type-label-weight: 600;
  --type-line: 1.45;
  --type-line-tight: 1.25;

  /* -----------------------------------------------------------------
     GEOMETRY - UI Standard 3.4. 44px minimum on desktop, tablet AND mobile,
     with no compact variant. The radius is one value, "based on the approved
     Customers + New Customer treatment" (4.2).
     ----------------------------------------------------------------- */
  --control-height: 44px;

  /* FORM FIELD RHYTHM - the form standard of 2 November 2026 needs these two
     figures to be SEPARATELY nameable, because the gap inside a field and the
     gap between rows of fields are different distances that used to be the
     same declaration. The field's three rows belong to the FORM's grid now
     (that is what makes adjacent controls share a row), so the form's row-gap
     is spent inside the field and the separation between rows of fields is
     derived from the difference rather than written down a second time. */
  --field-gap: var(--space-2);
  --form-row-gap: var(--space-5);
  --control-padding-x: var(--space-5);
  --radius: 6px;
  --radius-sm: 4px;
  --border-width: 1px;

  /* The header is the one place a height is not a control height: it is a
     container, and 56px is what holds a 44px control with the 6px of the
     spacing scale above and below it. Component geometry, not a new spacing
     token - 3.4 permits exactly this and asks that the reason be stated. */
  --chrome-height: 56px;

  /* THE SIDEBAR, in its two states. Component geometry with its reasons:

       292px expanded  MEASURED, not guessed. The longest name in the
                       approved architecture is "Inspections & Care Plans",
                       which renders 180px wide in Bahnschrift at the body
                       size; 16 + 20 icon + 12 + 180 + 16 + 3 border + 44
                       chevron = 292. At 260 it truncated to "Inspecti...",
                       which is a navigation item that cannot be read.
       64px  collapsed a 44px target centred in it with the 4px/6px steps of
                       the spacing scale either side. Narrower would mean a
                       target below the minimum; wider would be a column
                       pretending to be a rail. */
  --sidebar-width: 292px;
  --sidebar-rail: 64px;

  /* The icon size. 3.7 does not give one; 20px is the size at which a 2px
     stroke sits beside 16px body text without either shouting. */
  --icon-size: 20px;

  /* THE WORDMARK'S BOX, in two sizes. The approved lockup is 1000x323 after
     cropping, and these hold it at its own proportions: 116x36 beside a 44px
     header control, and 200x62 on the sign-in card where it is the only
     thing on the screen worth looking at. Component geometry with its
     reason, which 3.4 permits. */
  --wordmark-width: 116px;
  --wordmark-height: 36px;
  /* On a phone the header holds a toggle, the wordmark, the environment, a
     refresh and the account in 380px. Measured: at 116px they came to 417px
     and the page scrolled sideways. 88px is the narrowest the lockup stays
     legible at, and it is the one thing in that row that can give. */
  --wordmark-width-small: 88px;
  --wordmark-width-large: 200px;
  --wordmark-height-large: 62px;

  /* A person's name is arbitrary-length business data and the only such
     thing in the header, so the header is where it is bounded. */
  --identity-max: 180px;

  /* The account popover. Wide enough for "System / Follow this device."
     without wrapping, which is the longest line it holds. */
  --menu-width: 280px;

  /* The persistent record summary - the left column of a canonical record.
     The owner's requirement is "a fixed-width column (approximately 280-320
     pixels)", and this is ONE value inside that range rather than a
     per-screen choice: every record in Works carries the same column, so the
     identity sits in the same place whichever record you opened. It is a
     MEASURE, not spacing - a display name, a phone number and a label column
     have to fit in it, and the record's sections take the rest. */
  --record-summary-width: 304px;

  /* Page geometry. Section 5.1: the header, supporting controls and content
     "shar[e] consistent horizontal page geometry", so one value sets all
     three and they cannot drift apart. */
  --page-gutter: var(--space-7);
  --page-max: 1440px;

  --layer-chrome: 20;
}

/* ===========================================================================
   2. SEMANTIC ROLES - the only names a component may use, and the only
      things a theme changes.
   ===========================================================================

   THE APPLICATION FRAME IS CORNERPOST GREEN IN BOTH THEMES. The header and
   the sidebar are the frame; UI Standard 5.1 gives the green ground to the
   application frame and to modal headers, and keeps it off ordinary
   workspace headers. A theme that moved the frame off brand would be the
   "simply inverted" result the owner ruled out, so what a theme changes is
   the CONTENT surfaces the frame contains.

   LIGHT is the default and is written on :root, so a document with no
   data-theme attribute at all - a stylesheet loaded before the theme script
   runs, a printed page, a page with JavaScript off - is a correct Light
   document rather than an unstyled one.
   =========================================================================== */
:root,
:root[data-theme='light'] {
  color-scheme: light;

  --surface: #ffffff;
  /* WARM, NOT STARK. The page ground a card sits on. */
  --surface-sunken: #f4f2ec;
  /* INSET: a region recessed INSIDE a card - a column header, a hovered row,
     an expanded filter row. It used to share --surface-sunken with the page
     itself, which is why an inset inside a card was the same tone as the
     ground behind the card and the hierarchy collapsed. */
  --surface-inset: #f0eee6;
  --surface-raised: #ffffff;
  /* THE APPLICATION FRAME, and it follows the theme. Owner decision of 17
     October 2026: the whole of HQ answers the theme, header and sidebar
     included. --ink-on-chrome on it: 13.9:1. */
  --surface-chrome: #eae6da;
  /* Hover LIFTS in both themes. Brass is the focus ring in both, and needs
     3:1 against whatever it lands on: 3.37:1 here. */
  --surface-chrome-raised: #f2efe5;

  --ink: #1b1a18;
  --ink-muted: var(--brand-warm-gray);
  --ink-on-chrome: #1b1a18;
  --ink-on-chrome-muted: #5e6054;
  /* A BRAND ACCENT THAT FOLLOWS THE FRAME. The modal title used --khaki
     directly - a brand CONSTANT as text on chrome. Fine while the chrome
     was always dark, and 1.35:1 the moment it was not. */
  --ink-on-chrome-accent: var(--brand-deep-brown); /* 9.5:1 on the light frame */
  /* THE ACCENT A REFERENCE IS DRAWN IN, measured on the content surface -
     --surface, and --surface-inset the moment the row is hovered: 5.87:1 and
     5.05:1.

     IT WAS --brand-deep-brown AND THAT WAS WRONG, though every contrast
     assertion passed. A reference has to clear 4.5:1 against its ground AND
     be visibly a different colour from the text around it; the deep brown did
     the first at 11.9:1 and failed the second at 1.46:1 from --ink, so a
     customer's name read as ordinary body text. Found by looking at the
     deployed build. */
  --ink-accent: var(--brass-ink);

  /* BORDERS - UI Standard 3.2. Two roles, and only two: a standard edge
     defines an object boundary, a subtle divider separates related content
     inside a structure that is already defined. "Arbitrary near-identical
     gray values are not independent design roles." */
  --border: #d7d8d2;
  --border-subtle: #e5e5df;
  --border-chrome: #d5d0bf;

  /* THE WORKSPACE HEADER - the band a workspace's name sits in, and the same
     band in both themes so a workspace is recognisable whichever theme a
     technician runs. Owner direction of 25 October 2026: "Every workspace must
     have a clearly differentiated header... Use deliberate background
     contrast", and, for Light, "Do not interpret Light theme as prohibiting
     darker surfaces or stronger contrast."

     THIS IS NOT THE APPLICATION FRAME. --surface-chrome stays the light warm
     tone the owner settled on 17 October; this is a second, deeper band BELOW
     it. */
  --surface-workspace-header: var(--brand-bark);
  --ink-on-workspace-header: #f2f1ec; /* 7.40:1 on the bark band */
  --ink-on-workspace-header-muted: var(--brand-cream); /* 5.51:1 */

  /* THE GROUND A COLLAPSIBLE SECTION HEADER SITS ON. It was --surface-inset,
     which in Light is #f0eee6 against a #f4f2ec page - a 1.02:1 step, which is
     the "surfaces are nearly identical" the owner reported. Cream is a real
     step and carries --ink at 11.4:1. */
  --surface-section-header: var(--brand-cream);

  /* A WARM SECONDARY INK for the light surfaces, where the grey --ink-muted
     reads cold against a warm page. 5.05:1 on --surface. */
  --ink-muted-warm: var(--brand-taupe);

  /* ELEVATION - UI Standard 3.3. "Borders and spacing do most structural
     work. Shadows are used only when depth improves hierarchy." There is no
     generic --shadow: that standard says the ambiguous token "should be
     retired or deliberately aliased", and it is retired here. */
  --shadow-primary: 0 8px 24px rgb(0 0 0 / 6%);
  --shadow-subtle: 0 2px 8px rgb(0 0 0 / 4%);
  --scrim: rgb(23 28 23 / 55%); /* Cornerpost green, dimmed */

  /* SEMANTIC STATE - UI Standard 3.6: "Brand accents do not substitute for
     semantic error, warning, success, or informational meaning." These are
     deliberately NOT brand colours. */
  --state-error: #96271b;
  --state-error-surface: #fdf3f1;
  --state-warn: #8a5a00;
  --state-warn-surface: #fdf8ee;
  --state-success: #1f5d50;
  --state-success-surface: #f0f7f4;
  --state-info: #2a4f6e;
  --state-info-surface: #f1f5f8;

  /* THE ACCENT ON A CONTENT SURFACE. Brass is the Works accent, and on white
     it clears 3:1 against the surface - enough for a border, a rule or an
     underline, which is all it is ever used for. It is NEVER body text: at
     4.2:1 it would miss 4.5:1, and 3.6 is explicit that a brand accent does
     not carry meaning on its own. */
  --accent: var(--brand-brass);
  --accent-on-chrome: var(--brand-brass);

  /* The wordmark, which is an asset rather than a colour: the green lockup on
     a light card, the khaki lockup on the green frame. */
  --wordmark-on-surface: url('/assets/cornerpost-wordmark-green.png');
  /* GREEN ON A LIGHT FRAME. The khaki cut was drawn for a dark ground and is
     1.8:1 against this one - the brand is kept by using the other cut, not by
     keeping a dark header nobody asked for. */
  --wordmark-on-chrome: url('/assets/cornerpost-wordmark-green.png');
}

/* ---------------------------------------------------------------------------
   DARK

   Written once, in a custom-property block, and applied two ways below:
   explicitly when the person chose Dark, and through prefers-color-scheme
   when they chose System. One block, so the two paths cannot drift.

   HOW THESE VALUES WERE CHOSEN, since the UI Standard gives none:

     * The surfaces are the brand green darkened and lifted, not grey. A
       neutral dark would have thrown away the identity the Light theme has.
     * The inks are the brand cream and a warm grey, not white: #ffffff on a
       dark surface is the glare everybody complains about at night.
     * The state colours are lightened to clear 4.5:1 on their own surfaces,
       because #96271b on a dark ground is unreadable. They remain
       non-brand, which is 3.6's requirement.
     * The accent on a content surface becomes KHAKI rather than brass.
       Brass on a dark surface is about 4:1 - fine for a rule, short of text -
       and khaki is the interface variant the UI Standard already defines for
       exactly this problem in modal headers. Brass is unchanged on the green
       frame, where it has always worked.

   Each ratio is asserted by the browser suite rather than claimed here.
   ------------------------------------------------------------------------ */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']):not([data-theme='dark']) {
    color-scheme: dark;

    --surface: #1c211b;
    /* DEEPER THAN THE CARD, so a card reads as a card. */
    --surface-sunken: #131711;
    /* INSET inside a card - column header, hovered row, filter row. It shared
       --surface-sunken with the page before, so an inset inside a card was
       the same tone as the ground behind it. */
    --surface-inset: #252a24;
    --surface-raised: #2b312a;
    /* THE FRAME LIFTS IN DARK, and it is still the brand's green.
       Amended 17 October 2026: a theme may choose WHICH brand green a surface
       role points at, though it still may not repaint the constant itself.
       Light puts the deep --brand-green against a white page; against a dark
       page that same green was #171c17 behind a #1c211b ground - five RGB
       points - so the frame stopped reading as a frame and the navigation
       looked like it had ignored the theme entirely.
       --ink-on-chrome (#f2f1ec) on --brand-charcoal-green: 11.8:1. */
    --surface-chrome: var(--brand-charcoal-green);
    /* One step further up, so a hovered or active row still separates from
       the frame it sits on. Derived rather than a brand constant, because
       the palette holds no third green.
     ITS LIGHTNESS IS CAPPED BY THE FOCUS RING, not by taste: the ring is
     --brand-brass in BOTH themes, and a 3:1 non-text edge is what makes it
     visible. #363c35 looked better and put brass at 2.92:1 - measured, and
     caught by the contrast case. This is 3.19:1, with ink at 10.9:1. */
    --surface-chrome-raised: #313630;

    --ink: #ece9e1;
    --ink-muted: #a8a99d;
    --ink-on-chrome: #f2f1ec;
    --ink-on-chrome-muted: #b9bbb1;
    /* A BRAND ACCENT THAT FOLLOWS THE FRAME. The modal title used --khaki
       directly - a brand CONSTANT as text on chrome. Fine while the chrome
       was always dark, and 1.35:1 the moment it was not. */
    --ink-on-chrome-accent: var(--khaki); /* 7.0:1 on the dark frame */
  /* 7.21:1 on --surface, 6.44:1 on --surface-inset, and 1.87:1 from --ink -
     the BRAND khaki rather than the lighter interface one, for the same
     reason the light theme uses a darker brass: --khaki is 1.38:1 from dark
     ink, which is not a difference a reader sees. */
  --ink-accent: var(--brand-khaki);

    --border: #3a4139;
    --border-subtle: #2a302a;
    /* Lifted with the ground it divides: #30372f against a #2c312b frame
       is four points of difference and no edge at all. */
    --border-chrome: #3f463d;
    /* The same bark band as Light: a workspace is the same shape in both. */
    --surface-workspace-header: var(--brand-bark);
    --ink-on-workspace-header: #f2f1ec;
    --ink-on-workspace-header-muted: var(--brand-cream);
    /* The dark section-header ground the owner accepted on 25 October. */
    --surface-section-header: #252a24;
    /* NO WARM INK IN DARK. A warm brown on a near-black ground is not
       legible, so this role resolves to the ordinary muted ink rather than
       to an invented colour. The role exists so a screen names one thing. */
    --ink-muted-warm: var(--ink-muted);

    --shadow-primary: 0 8px 24px rgb(0 0 0 / 45%);
    --shadow-subtle: 0 2px 8px rgb(0 0 0 / 30%);
    --scrim: rgb(0 0 0 / 65%);

    --state-error: #f0a79b;
    --state-error-surface: #2e201d;
    --state-warn: #e3bd79;
    --state-warn-surface: #2b2519;
    --state-success: #8fd0bf;
    --state-success-surface: #192c27;
    --state-info: #a3c5e2;
    --state-info-surface: #1b2630;

    --accent: var(--khaki);
    --accent-on-chrome: var(--brand-brass);

    --wordmark-on-surface: url('/assets/cornerpost-wordmark-khaki.png');
    --wordmark-on-chrome: url('/assets/cornerpost-wordmark-khaki.png');
  }
}

:root[data-theme='dark'] {
  color-scheme: dark;

  --surface: #1c211b;
  /* DEEPER THAN THE CARD, so a card reads as a card. */
  --surface-sunken: #131711;
  /* INSET inside a card - column header, hovered row, filter row. It shared
     --surface-sunken with the page before, so an inset inside a card was
     the same tone as the ground behind it. */
  --surface-inset: #252a24;
  --surface-raised: #2b312a;
  /* THE FRAME LIFTS IN DARK, and it is still the brand's green.
     Amended 17 October 2026: a theme may choose WHICH brand green a surface
     role points at, though it still may not repaint the constant itself.
     Light puts the deep --brand-green against a white page; against a dark
     page that same green was #171c17 behind a #1c211b ground - five RGB
     points - so the frame stopped reading as a frame and the navigation
     looked like it had ignored the theme entirely.
     --ink-on-chrome (#f2f1ec) on --brand-charcoal-green: 11.8:1. */
  --surface-chrome: var(--brand-charcoal-green);
  /* One step further up, so a hovered or active row still separates from
     the frame it sits on. Derived rather than a brand constant, because
     the palette holds no third green.
     ITS LIGHTNESS IS CAPPED BY THE FOCUS RING, not by taste: the ring is
     --brand-brass in BOTH themes, and a 3:1 non-text edge is what makes it
     visible. #363c35 looked better and put brass at 2.92:1 - measured, and
     caught by the contrast case. This is 3.19:1, with ink at 10.9:1. */
  --surface-chrome-raised: #313630;

  --ink: #ece9e1;
  --ink-muted: #a8a99d;
  --ink-on-chrome: #f2f1ec;
  --ink-on-chrome-muted: #b9bbb1;
  /* A BRAND ACCENT THAT FOLLOWS THE FRAME. The modal title used --khaki
     directly - a brand CONSTANT as text on chrome. Fine while the chrome
     was always dark, and 1.35:1 the moment it was not. */
  --ink-on-chrome-accent: var(--khaki); /* 7.0:1 on the dark frame */
  /* 7.21:1 on --surface, 6.44:1 on --surface-inset, and 1.87:1 from --ink -
     the BRAND khaki rather than the lighter interface one, for the same
     reason the light theme uses a darker brass: --khaki is 1.38:1 from dark
     ink, which is not a difference a reader sees. */
  --ink-accent: var(--brand-khaki);

  --border: #3a4139;
  --border-subtle: #2a302a;
  /* Lifted with the ground it divides: #30372f against a #2c312b frame
     is four points of difference and no edge at all. */
  --border-chrome: #3f463d;
  /* The same bark band as Light: a workspace is the same shape in both. */
  --surface-workspace-header: var(--brand-bark);
  --ink-on-workspace-header: #f2f1ec;
  --ink-on-workspace-header-muted: var(--brand-cream);
  /* The dark section-header ground the owner accepted on 25 October. */
  --surface-section-header: #252a24;
  /* NO WARM INK IN DARK. A warm brown on a near-black ground is not
     legible, so this role resolves to the ordinary muted ink rather than
     to an invented colour. The role exists so a screen names one thing. */
  --ink-muted-warm: var(--ink-muted);

  --shadow-primary: 0 8px 24px rgb(0 0 0 / 45%);
  --shadow-subtle: 0 2px 8px rgb(0 0 0 / 30%);
  --scrim: rgb(0 0 0 / 65%);

  --state-error: #f0a79b;
  --state-error-surface: #2e201d;
  --state-warn: #e3bd79;
  --state-warn-surface: #2b2519;
  --state-success: #8fd0bf;
  --state-success-surface: #192c27;
  --state-info: #a3c5e2;
  --state-info-surface: #1b2630;

  --accent: var(--khaki);
  --accent-on-chrome: var(--brand-brass);

  --wordmark-on-surface: url('/assets/cornerpost-wordmark-khaki.png');
  --wordmark-on-chrome: url('/assets/cornerpost-wordmark-khaki.png');
}

/* ---------------------------------------------------------------------------
   BREAKPOINTS - UI Standard 3.5: 640px and 1024px. They are written here as
   comments rather than custom properties because CSS cannot interpolate a
   custom property into a media query, and inventing a build step to do it
   would be a dependency in exchange for nothing.

   `check:ui` enforces that no stylesheet declares a layout breakpoint at any
   other width, which is the guarantee that mattered.

     narrow   ..639px    phone      persistent navigation, rail by default
     medium   640..1023  tablet     persistent navigation, rail by default
     wide     1024px..   desktop    persistent navigation, expanded by default

   THE TABLE USED TO SAY "overlay drawer" FOR THE FIRST TWO. It was corrected
   when UI Standard 3.5 was amended (approved 24 October 2026): HQ navigation
   is a column beside the workspace at every width, in one of two states, and
   there is no width at which it becomes an overlay. What changes below 1024px
   is how wide the EXPANDED column is allowed to be - not what it is.

   3.5 now states HQ and Field separately. Field's overlay drawer is correct
   and unchanged; it is simply not this table's subject.
   ------------------------------------------------------------------------ */

/* ---------------------------------------------------------------------------
   RESET - the minimum that makes the tokens predictable. Not a framework.
   ------------------------------------------------------------------------ */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  /* 16px base, so the 16.8px and 13.76px roles in 9.6 are the sizes they say
     they are rather than a multiple of somebody's browser setting. */
  font-size: 16px;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--type-body-size);
  font-weight: var(--type-body-weight);
  line-height: var(--type-line);
  color: var(--ink);
  background: var(--surface-sunken);
  -webkit-font-smoothing: antialiased;
}

/* ONE FOCUS TREATMENT, EVERYWHERE. UI Standard 3.1. */
:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: var(--radius-sm);
}

/* A mouse user does not get a ring; a keyboard user always does. `:focus`
   without `:focus-visible` is what made the old HQ look as though it had no
   focus treatment at all. */
:focus:not(:focus-visible) {
  outline: none;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  line-height: var(--type-line-tight);
}

h1 {
  font-size: var(--type-page-size);
  font-weight: var(--type-page-weight);
}

h2 {
  font-size: var(--type-section-size);
  font-weight: var(--type-section-weight);
}

h3 {
  font-size: var(--type-body-size);
  font-weight: var(--type-strong-weight);
}

p {
  margin: 0;
}

/* THE ICON PRIMITIVE. One size, one stroke, inheriting its colour - so an
   icon never decides anything this file owns. */
.icon {
  width: var(--icon-size);
  height: var(--icon-size);
  flex: 0 0 auto;
}

/* Announced, never shown. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  /* Both, because the modern one is not everywhere and a half-hidden
     announcement is worse than either. */
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

[hidden] {
  display: none !important;
}

/* MOTION IS A PREFERENCE. UI Standard 2 asks for calm; the sidebar and the
   drawer are the only things in the shell that move, and somebody who has
   asked their system for less motion gets none. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
