/* ==========================================================================
   COMPONENTS — the construction grammar.
   --------------------------------------------------------------------------
   These encode what the SITE needs (a panel, a tag, a stepped process, a human
   decision marker), not how a particular brand looks. Every visual property
   resolves to a token, so a direction with soft cards and round corners is the
   same markup with --radius and --shadow-* changed.
   ========================================================================== */


/* ---- Band: a bordered container whose cells share edges, no gaps ---- */
.band {
  border: var(--border-w) solid var(--line);
  border-radius: var(--radius);
  display: grid;
  overflow: hidden;
}
.band > * { padding: var(--space-4) var(--space-5); border-left: var(--border-w) solid var(--line); }
.band--2 { grid-template-columns: repeat(2, 1fr); }
.band--3 { grid-template-columns: repeat(3, 1fr); }
.band--4 { grid-template-columns: repeat(4, 1fr); }
.band--2 > :nth-child(2n+1),
.band--3 > :nth-child(3n+1),
.band--4 > :nth-child(4n+1) { border-left: 0; }
.band--2 > :nth-child(n+3),
.band--3 > :nth-child(n+4),
.band--4 > :nth-child(n+5) { border-top: var(--border-w) solid var(--line); }

@media (max-width: 860px) {
  .band--2, .band--3, .band--4 { grid-template-columns: 1fr; }
  .band > * { border-left: 0; border-top: var(--border-w) solid var(--line); }
  .band > :first-child { border-top: 0; }
}


/* ---- Ledger: label/value rows. The dense-page workhorse. ---- */
.ledger { border-top: var(--border-w) solid var(--line); }
.ledger > div {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: var(--space-5);
  padding-block: var(--space-4);
  border-bottom: var(--border-w) solid var(--line);
  align-items: start;
}
@media (max-width: 720px) {
  .ledger > div { grid-template-columns: 1fr; gap: var(--space-2); }
}


/* ---- Panel: a full-bleed inverse surface ---- */
.panel {
  background: var(--ground-inverse);
  color: var(--ink-inverse);
  border: var(--border-w) solid var(--line-inverse);
  border-radius: var(--radius);
}
.panel--raised { background: var(--ground-raised); }
.panel--shadow { box-shadow: var(--shadow-panel); }

/* Every panel opens with a metadata row: title left, state right. */
.topline {
  display: flex;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border-bottom: var(--border-w) solid var(--line-inverse);
  font-family: var(--font-label);
  font-size: var(--size-label);
  font-weight: var(--label-weight);
  letter-spacing: var(--label-tracking);
  text-transform: var(--label-transform);
  color: var(--ink-inverse-muted);
}
.topline > :first-child { color: var(--ink-inverse); }
.topline .is-accent { color: var(--accent-dark); }


/* ---- Chip: an outlined tag for sources and agents. Never filled. ---- */
.chip {
  display: inline-block;
  border: var(--border-w) solid var(--line);
  border-radius: var(--radius);
  padding: 5px 8px;
  font-family: var(--font-label);
  font-size: var(--size-label);
  font-weight: var(--label-weight);
  letter-spacing: var(--label-tracking);
  text-transform: var(--label-transform);
  color: var(--ink);
}
.panel .chip, .section--inverse .chip { border-color: var(--line-inverse); color: var(--ink-inverse); }
.chips { display: flex; flex-wrap: wrap; gap: var(--space-2); }


/* ---- Stepped rule: the process primitive. A continuous line with nodes
        sitting on it, each masking the line with the ground colour. ---- */
.steps { position: relative; padding-block: var(--space-5) var(--space-7); }
.steps::before {
  content: ""; position: absolute; left: 0; right: 0; top: calc(var(--space-5) + 10px);
  height: var(--border-w); background: var(--line);
}
.panel .steps::before, .section--inverse .steps::before { background: var(--line-inverse); }
.steps ol { list-style: none; margin: 0; padding: 0; display: grid; position: relative; }
.steps li { text-align: center; }
.steps b {
  display: inline-grid; place-items: center;
  width: 21px; height: 21px; border-radius: 50%;
  border: var(--border-w) solid var(--line);
  background: var(--ground);
  font-family: var(--font-label); font-size: 9px; font-weight: 600;
  color: var(--ink);
}
.panel .steps b, .section--inverse .steps b { background: var(--ground-inverse); border-color: var(--line); color: var(--ink-inverse); }
.steps li.is-active b { background: var(--accent); border-color: var(--accent); color: var(--accent-on); }
.panel .steps li.is-active b,
.section--inverse .steps li.is-active b {
  background: var(--accent-dark); border-color: var(--accent-dark); color: var(--ground-inverse);
}
.steps span { display: block; margin-top: var(--space-2); }


/* ---- Gate: marks a named human decision. The only place H is a symbol. ---- */
.gate {
  display: inline-grid; place-items: center;
  width: 17px; height: 17px; border-radius: 50%;
  border: var(--border-w) solid var(--accent);
  color: var(--accent-text);
  font-family: var(--font-label); font-size: 9px; font-weight: 600;
  vertical-align: middle;
}
.panel .gate, .section--inverse .gate { color: var(--accent-dark); border-color: var(--accent-dark); }


/* ---- Buttons: assets/css/buttons.css, the one source (15 Oct). ---- */


/* ---- Status ---- */
.status { display: inline-flex; align-items: center; gap: var(--space-2); }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.status--ok      { color: var(--ok); }
.status--pending { color: var(--pending); }
.status--risk    { color: var(--risk); }

/* ---- Chip with a mark: a vendor logo (assets/img/logos, the -on-dark or
        -on-light file to suit the section) or the Unlock mark, which is a mask
        so it takes the chip's text colour. ---- */
.chip--logo { display: inline-flex; align-items: center; gap: 8px; }
.chip__logo { flex: none; display: block; width: auto; height: 14px; }
.chip__mark {
  flex: none;
  width: 14px; height: 14px;
  background: currentColor;
  -webkit-mask: url(../img/mark.svg) center / contain no-repeat;
          mask: url(../img/mark.svg) center / contain no-repeat;
}

/* ==========================================================================
   DIAGRAM PANELS (4 Nov, after modal.com): the shared parts that make the
   explainer drawings (Problems, Use cases, the closing call to action) read
   as a running system. Panels are solid surfaces a step above their band
   (the frame styles in problems.css and use-cases.css). Inside, a panel can
   carry a header — a status dot and a DM Mono title over a hairline — and a
   count footer. The dot follows the accent jobs: Sage running or done,
   Ember waiting on a person, grey idle. svg-scoped so they outrank each
   drawing's base text rule.
   ========================================================================== */
svg .diagram-dot { fill: color-mix(in srgb, var(--heading) 40%, var(--ground)); }
svg .diagram-dot--lit { fill: var(--accent-text); }
svg .diagram-dot--person { fill: var(--accent); }
svg .diagram-rule { fill: none; stroke: color-mix(in srgb, var(--heading) 14%, var(--ground)); stroke-width: 1; }
svg text.diagram-title { fill: color-mix(in srgb, var(--heading) 86%, var(--ground)); text-transform: uppercase; }
svg text.diagram-count { fill: color-mix(in srgb, var(--heading) 46%, var(--ground)); text-transform: uppercase; }

/* ==========================================================================
   MODULE UNITS (4 Nov, after modal.com's per-product units): each module
   counts its work in its own shape — Spec square, Code hexagon, Review
   triangle (delta), On-call circle — always Sage (Sage green on dark, Sage
   B900 on light), never a diamond (the gate) and never a colour per module.
   Sprite: assets/img/units.svg. A lit unit is a Sage outline over a Sage
   tint; a dim one is a faint outline (work not there yet).
   ========================================================================== */
.unit {
  --unit-color: var(--accent-text);
  flex: none; width: var(--unit-size, 12px); height: var(--unit-size, 12px); overflow: visible;
  color: var(--unit-color); stroke: var(--unit-color); stroke-width: 1.25px;
  fill: color-mix(in srgb, var(--unit-color) 20%, transparent);
}
.unit--dim { --unit-color: color-mix(in srgb, var(--heading) 26%, var(--ground)); fill: none; }

/* ==========================================================================
   Light bands, with depth (27 Nov, user: "our darker sections look good, but
   the lighter ones fall flat … in the home page as well"). The dark bands
   work on three things the light ones lacked: a colour field, surfaces that
   stand clear of the band, and text bright against its ground. In light:
   - a still colour field in the band itself, two illustration colours (lime
     rising at the foot's right, butter at the top's left), faint, as the
     dark cards' fields are;
   - white surfaces lifted off the band: a hairline edge (heading 8%) and a
     soft two-layer shadow (.surface-light; the Governance cards, the
     Platform page's frames and strips);
   - the section head's line in the body colour (muted read washed on cream).
   Before: web/versions/before-light-depth/.
   ========================================================================== */
.section--paper { position: relative; isolation: isolate; }
.section--paper::before {
  content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(44% 62% at 90% 100%, color-mix(in srgb, var(--ill-lime) 24%, transparent), transparent 72%),
    radial-gradient(38% 52% at 4% 0%, color-mix(in srgb, var(--ill-butter) 22%, transparent), transparent 70%);
}
.section--paper .section-head p { color: var(--ink); }
.section--paper .governance li,
.section--paper .platform-frame,
.section--paper .platform-strip {
  border: var(--border-w, 1px) solid color-mix(in srgb, var(--heading) 12%, transparent);   /* 8% until 29 Nov (option A) */
  background: var(--white);
  box-shadow:
    0 1px 2px color-mix(in srgb, var(--heading) 7%, transparent),
    0 var(--space-3) var(--space-6) color-mix(in srgb, var(--heading) 8%, transparent);
}
.section--paper .platform-frame__bar { background: color-mix(in srgb, var(--heading) 3%, var(--white)); }
.section--paper .platform-frame__side { background: color-mix(in srgb, var(--heading) 2%, var(--white)); }
.section--paper .platform-frame__card { background: var(--white); }

/* ==========================================================================
   Sections are never solid (27 Nov, user, on the light bands' fields: "make
   this a rule, sections are never solid, always have some sort of gradient
   in them"). Every band carries a still, faint field of its own:
   - light bands: lime and butter, above;
   - dark bands: Sage B900 rising at the foot's right and a breath of teal at
     the top's left — night-deep, night-2, teal, the Problems band, the
     contact page, the legal pages.
   Bands that already carry their own art keep it and take no second field:
   the hero (streaks), the outer loop (its glow sits on the drawing), the
   closing board, the footer. Low specificity (:where), so a band's own
   background or ::before always wins. Before: web/versions/before-light-depth/.
   ========================================================================== */
:where(.section--night-deep, .section--night-2, .section--teal, .section.problems, .section.demo, .legal):not(.hero, .platform-hero, .sdlc-section, .cta, .not-found) {
  position: relative; isolation: isolate;
}
:where(.section--night-deep, .section--night-2, .section--teal, .section.problems, .section.demo, .legal):not(.hero, .platform-hero, .sdlc-section, .cta, .not-found)::before {
  content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(46% 64% at 92% 100%, color-mix(in srgb, var(--sage-ink) 26%, transparent), transparent 72%),
    radial-gradient(40% 54% at 2% 0%, color-mix(in srgb, var(--ill-teal) 7%, transparent), transparent 70%);
}

/* ==========================================================================
   Main items, one scale (27 Nov, user, after an audit of every title-and-line
   block on the live pages: "for family 1, lets do 16px text size. icon size
   24px and in a box"). A section's main items — the Problems cards, the
   Governance cards, the Platform page's Interfaces cards and harness points —
   share: the title in DM Sans 24, its line at 16 in the body colour 12px
   under it, a 24px icon above the title where there is one, and a box round
   each. Before: 14px lines and 20px icons on the homepage, the harness points
   open on the band (web/versions/before-item-scale/).
   ========================================================================== */
/* (set in problems.css, governance.css and platform.css, each block's own file) */

/* TEXT SCALE (27 Nov, user, after an audit of every text style on the live
   pages: 47 in use, the text under titles at 13, 14 or 16px on line heights
   from 1.43 to 1.75). One running-text style for content — Inter 15px,
   175% leading, -0.01em — wherever a line of text sits under a heading or a
   title: section intros and ledes, card and point text, the use cases' rows,
   FAQ answers, the closing steps, table cells, notes and text links. And one
   tracking for Inter titles, -0.01em. The root is doubled so this wins over
   each component's own size; drawings, mockups, tags, buttons, the header
   and the footer bar keep theirs. Tokens in tokens.css. */
:root:root :is(
  .section-head p, .section-head__text p, .permission-classes__lead p, .enforce-box__intro, .lede, .platform-security__intro,
  .problem p, .governance li p, .interfaces__line, .faq__item p,
  .cta-steps__text p, .cta__note, .site-footer__tag,
  .use-case__flow dt, .use-case__flow dd, .use-case__steps li,
  .platform-flow__point p, .platform-example__copy p, .platform-marks p, .platform-traits p,
  .platform-models__caption--point p, .platform-connect__card p, .platform-connect__sub,
  .platform-points p, .platform-facts dd, .spec-table td, .platform-more,
  .demo-form__note, .link-label
) { font-size: var(--text-size); line-height: var(--text-leading); letter-spacing: var(--text-tracking); }
:root:root :is(
  .problem h3, .platform-flow__point h3, .platform-example__copy h3, .platform-marks h3, .platform-traits h3,
  .platform-models__caption--point h3, .platform-points h3, .platform-facts dt, .platform-flow__lead,
  .workflows__tab, .outer-loop__case-title a, .interfaces__toggle, .hero__term, .platform-hero__term, .spec-table tbody th
) { letter-spacing: var(--text-tracking); }

/* One section heading (27 Nov, user: the closing board's h2 and the section
   heads' "are different?"): the closing board, the FAQ and the contact page
   set theirs in the section heads' style — DM Sans 500, 108%, -0.02em —
   where they were regular weight on 112% or -0.03em. */
:root:root :is(.cta h2, .faq__head h2, .cta__board-copy :is(h1, h2)) { font-weight: 500; line-height: var(--leading-heading); letter-spacing: var(--display-tracking); }

/* WORDS INSIDE DRAWINGS ARE INTER (28 Nov, the illustration audit: the
   older drawings still set their labels in DM Mono uppercase; the rule since
   27 Nov is Inter in every illustration, code windows the one exception).
   Sentence case, no tracking, weight 500 for titles; sizes in each drawing's
   own units, chosen so nothing renders under 11px (the audit's floor).
   :root lifts these over the drawings' own later rules; the Problems
   drawings' words (.pr-art__word) keep theirs. */
:root .pr-art text:not(.pr-art__word) { font-family: var(--font-body); font-size: 11px; font-weight: 500; letter-spacing: 0; text-transform: none; }
:root svg text.diagram-title, :root svg text.diagram-count { text-transform: none; letter-spacing: 0; }
:root svg text.diagram-count { font-weight: 400; }
:root .hero-tip .pr-art text:not(.pr-art__word) { font-size: 12px; }
:root .cta-steps .pr-art text:not(.pr-art__word) { font-size: 13px; }
:root .use-case__art text { font-family: var(--font-body); font-size: 10px; font-weight: 500; letter-spacing: 0; text-transform: none; }
:root .use-case__art .use-case__mono { font-family: var(--font-body); font-size: 10px; font-weight: 500; }
:root .use-case__art .use-case__small { font-size: 9px; }
:root .cta-steps .cta-steps__caption { font: 500 12px/1.5 var(--font-body); letter-spacing: 0; text-transform: none; }

/* A spot of colour in the dark drawings (28 Nov, illustration audit, after
   Tailark's tinted pills): what Unlock.ai lit — the frames with a Sage edge
   — takes a faint Sage fill too, in the Problems, closing-step and hero
   drawings (.pr-art) and the Use cases drawings */
:root .pr-art .pr-art__frame--lit { fill: color-mix(in srgb, var(--accent-text) 10%, var(--ground)); }
:root .use-case__art .use-case__solid.use-case__line--lit { fill: color-mix(in srgb, var(--accent-text) 10%, var(--ground)); }

/* THE SUPABASE PASS (28 Nov, user, after supabase.com: on dark, greys carry
   the drawing and green is a small accent — a dot, a check, one lit line —
   never a fill and never everywhere). The last pass's faint Sage fill on lit
   frames is undone; their Sage edge stays the one accent. */
:root .pr-art .pr-art__frame--lit { fill: color-mix(in srgb, var(--heading) 9%, var(--ground)); }
/* Problems: the developers card's agent bars are each developer's own agents,
   not Unlock.ai's, so they are grey; the impact map's wire network is grey,
   the services it touches keep their Sage edge */
.problem:nth-child(5) .pr-art__bar--lit { fill: color-mix(in srgb, var(--heading) 30%, var(--ground)); }
:root .problem--tall .pr-art__wire--lit { stroke: color-mix(in srgb, var(--heading) 36%, var(--ground)); }
