/* =====================================================================
   Shared UI design system — reusable component layer.
   Used across all current sites (Crimson Cat, PolyglotMint, event pages,
   landing pages). STRUCTURE is shared; each site sets its BRAND tokens
   (palette + fonts) and inherits every component below unchanged.

   Usage on a new page:
     1) define the brand tokens in :root (or rely on the fallbacks below),
     2) <link rel="stylesheet" href="/assets/ui.css">  (after brand tokens),
     3) use the classes (.btn, .card, .chip, .field, accordions, …).

   See GLOBAL_SITE_STANDARDS.md §13 for the written rules.
   Change a value HERE once and every page that links this file updates.
   ===================================================================== */

:root{
  /* ---- 6. Spacing scale (4px base — use these, never one-off values) ---- */
  --sp-1:4px; --sp-2:8px; --sp-3:12px; --sp-4:16px; --sp-5:24px;
  --sp-6:32px; --sp-7:48px; --sp-8:64px; --sp-9:96px;

  /* ---- 5. Radius system ---- */
  --r-sm:8px; --r-md:12px; --r-lg:16px; --r-xl:22px; --r-pill:999px;

  /* ---- 5. Elevation (brand may tune the rgba tint) ---- */
  --shadow-sm:0 1px 2px rgba(17,17,17,.06), 0 4px 14px rgba(17,17,17,.05);
  --shadow-md:0 6px 24px rgba(1,75,65,.10), 0 2px 6px rgba(17,17,17,.06);
  --shadow-lg:0 18px 50px rgba(1,75,65,.16), 0 6px 16px rgba(17,17,17,.08);

  /* ---- 10. Motion (one speed + easing everywhere) ---- */
  --motion-fast:.15s; --motion:.2s; --motion-slow:.35s;
  --ease:cubic-bezier(.4,0,.2,1);
  --hover-lift:-2px;

  /* ---- 7. Type scale (fluid; same scale on every page) ---- */
  --fs-eyebrow:12px; --fs-micro:11px; --fs-meta:13px;
  --fs-body:17px;  --fs-lead:clamp(18px,2.2vw,21px);
  --fs-h4:18px;    --fs-h3:clamp(20px,2.4vw,25px);
  --fs-h2:clamp(28px,4vw,40px); --fs-h1:clamp(34px,5.5vw,58px);
  --fw-regular:400; --fw-medium:500; --fw-semibold:600; --fw-bold:700;
  --lh-tight:1.12; --lh-snug:1.3; --lh-body:1.65;

  /* ---- Section rhythm (6) ---- */
  --section-gap-desktop:96px; --section-gap-tablet:72px; --section-gap-mobile:56px;
  --section-pad-y:var(--section-gap-desktop);

  /* ---- BRAND tokens (FALLBACKS = PolyglotMint; override per site) ---- */
  --bg:#FBF4E4; --surface:#ffffff; --surface-warm:#FDFAF0; --line:#e2d8bf;
  --ink:#111111; --ink-soft:#3a3a36; --ink-faint:#6f6f67;
  --accent:#13C4B7;          /* primary action fill */
  --accent-ink:#04332e;      /* text on accent fill */
  --accent-strong:#016B5C;   /* outline / secondary structure */
  --accent-deep:#014b41;
  --link:#016B5C; --link-hover:#FF5E1A;
  --danger:#b3261e; --danger-bg:#fbe9e7;
  --success:#1d7a5f; --success-bg:#e6f4ee;
  --sans:"Inter",system-ui,-apple-system,sans-serif;
  --serif:"Fraunces",Georgia,serif;
  --serif-body:"Source Serif 4",Georgia,serif;
  --mono:"IBM Plex Mono",ui-monospace,monospace;
}

@media(max-width:980px){ :root{ --section-pad-y:var(--section-gap-tablet); } }
@media(max-width:640px){ :root{ --section-pad-y:var(--section-gap-mobile); } }
@media(prefers-reduced-motion:reduce){ :root{ --motion-fast:0s; --motion:0s; --motion-slow:0s; --hover-lift:0px; } }

/* =====================================================================
   2. BUTTONS — primary / secondary / outline / ghost. One radius (pill),
   one hover-lift, consistent active + disabled. CTA hierarchy per page:
   exactly one .btn--primary, then secondary/outline, then ghost/links.
   ===================================================================== */
.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:9px;
  font-family:var(--sans); font-weight:var(--fw-semibold); font-size:15px; line-height:1.2;
  padding:13px 22px; border-radius:var(--r-pill); border:1.5px solid transparent;
  cursor:pointer; text-decoration:none; white-space:nowrap;
  transition:transform var(--motion-fast) var(--ease), background var(--motion) var(--ease),
             color var(--motion) var(--ease), border-color var(--motion) var(--ease), box-shadow var(--motion) var(--ease);
}
.btn:hover{ transform:translateY(var(--hover-lift)); }
.btn:active{ transform:translateY(0); }
.btn:focus-visible{ outline:2px solid var(--accent); outline-offset:2px; }
.btn[disabled], .btn.is-disabled{ opacity:.5; cursor:not-allowed; transform:none; box-shadow:none; }

/* Variants accept BOTH the BEM name (.btn--primary) and the single-dash alias
   (.btn-primary) so older markup migrates without churn. Prefer `--` going forward. */
.btn--primary, .btn-primary{ background:var(--accent); color:var(--accent-ink); box-shadow:0 6px 20px rgba(19,196,183,.30); }
.btn--primary:hover, .btn-primary:hover{ background:var(--accent-strong); color:#fff; }
.btn--secondary, .btn-secondary{ background:var(--accent-strong); color:#fff; }
.btn--secondary:hover, .btn-secondary:hover{ background:var(--accent-deep); }
.btn--outline, .btn-outline{ background:transparent; color:var(--accent-strong); border-color:var(--accent-strong); }
.btn--outline:hover, .btn-outline:hover{ background:var(--accent-strong); color:#fff; }
.btn--ghost, .btn-ghost{ background:transparent; color:var(--accent-strong); border-color:transparent; padding-left:6px; padding-right:6px; }
.btn--ghost:hover, .btn-ghost:hover{ color:var(--link-hover); transform:none; }
.btn .arrow{ display:inline-flex; align-items:center; line-height:1; position:relative; top:-1px; transition:transform var(--motion) var(--ease); }
.btn:hover .arrow{ transform:translateX(3px); }

/* =====================================================================
   3. LINKS — one underline/hover/color rule; one external-link treatment.
   ===================================================================== */
.ui a, a.ui-link{ color:var(--link); text-decoration:underline; text-underline-offset:2px; text-decoration-thickness:1px; transition:color var(--motion-fast) var(--ease); }
.ui a:hover, a.ui-link:hover{ color:var(--link-hover); }
/* External links open in a new tab and get a subtle, baseline-aligned ↗ (text glyph, never emoji). */
.ui a[target="_blank"]::after, a.ui-link[target="_blank"]::after{
  content:"\2197\FE0E"; font-family:inherit; font-size:.8em; vertical-align:baseline; margin-left:2px; opacity:.85; text-decoration:none;
}

/* ── Brand lockup (logo + wordmark) — CANONICAL, applies to every page ───
   The header brand is always an <a> to the homepage (same tab), wrapping the
   icon + wordmark. .nav-brand = dark masthead, .lp-brand = light temp header.

   .nav-brand = dark masthead;  .lp-brand = minimal cream temp header (no bar).
   Default:   Polyglot = white (dark) / ink (cream); Mint = mint; mint icon tile.
   Hover:     inversion — Polyglot → mint; Mint → white (dark) / ink (cream);
              icon tile → dark ink, lines + dots → mint.
   Plus: pointer cursor, subtle 1px lift, visible keyboard focus ring.
   New pages that load ui.css get all of this for free — do NOT restyle the
   brand per page. (Legacy pages carry an identical inline copy.) */
.nav-brand, .lp-brand{ cursor:pointer; transition:transform var(--motion-fast) var(--ease); }
.nav-brand:hover, .lp-brand:hover{ transform:translateY(-1px); }
.nav-brand:focus-visible, .lp-brand:focus-visible{ outline:2px solid var(--accent); outline-offset:4px; border-radius:8px; }
.nav-brand .nav-word{ color:#fff; }
.lp-brand{ color:var(--ink); }
.nav-brand .nav-word .accent, .lp-brand .accent{ color:var(--accent); }
.nav-brand .nav-word, .nav-brand .nav-word .accent,
.lp-brand .nav-word, .lp-brand .accent{ transition:color .2s ease; }
.nav-brand .nav-mark rect, .nav-brand .nav-mark line, .nav-brand .nav-mark circle,
.lp-brand .lp-mark rect, .lp-brand .lp-mark line, .lp-brand .lp-mark circle{ transition:fill .2s ease, stroke .2s ease; }
.nav-brand:hover .nav-word, .lp-brand:hover .nav-word{ color:var(--accent); }  /* Polyglot -> mint */
.nav-brand:hover .nav-word .accent{ color:#fff; }                              /* Mint -> white on dark */
.lp-brand:hover .accent{ color:var(--ink); }                                   /* Mint -> ink on cream */
.nav-brand:hover .nav-mark rect, .lp-brand:hover .lp-mark rect{ fill:#04332e; }
.nav-brand:hover .nav-mark line, .lp-brand:hover .lp-mark line{ stroke:#13C4B7; }
.nav-brand:hover .nav-mark circle, .lp-brand:hover .lp-mark circle{ fill:#13C4B7; }
.nav-brand:hover .nav-mark rect, .lp-brand:hover .lp-mark rect{ fill:#04332e; }
.nav-brand:hover .nav-mark line, .lp-brand:hover .lp-mark line{ stroke:#13C4B7; }
.nav-brand:hover .nav-mark circle, .lp-brand:hover .lp-mark circle{ fill:#13C4B7; }

/* ── Inline BODY links — global editorial style ─────────────────────────
   The one rule for links inside prose/content blocks (article bodies, essays,
   temp pages, FAQ answers, legal pages). Quietly clickable, not loud:
   muted teal, semibold, no default underline; hover darkens slightly and shows
   a thin offset underline; visible keyboard focus ring. NOT for nav links,
   CTA buttons, footer links, chips, cards, or share controls — those keep
   their own component styles. Legacy pages that don't load ui.css yet carry
   an identical inline copy of this rule; change it HERE first. */
.prose a, .prose-body a, .body a, .legal a, .tail a, .ans a, .sec-body a, .lp-body a,
.ms a, .lead a{
  color:var(--link); font-weight:var(--fw-semibold); text-decoration:none;
  transition:color var(--motion-fast) var(--ease);
}
.prose a:hover, .prose-body a:hover, .body a:hover, .legal a:hover, .tail a:hover,
.ans a:hover, .sec-body a:hover, .lp-body a:hover, .ms a:hover, .lead a:hover{
  color:var(--accent-deep); text-decoration:underline;
  text-decoration-thickness:1px; text-underline-offset:3px;
}
.prose a:focus-visible, .prose-body a:focus-visible, .body a:focus-visible,
.legal a:focus-visible, .tail a:focus-visible, .ans a:focus-visible,
.sec-body a:focus-visible, .lp-body a:focus-visible, .ms a:focus-visible, .lead a:focus-visible{
  outline:2px solid var(--accent); outline-offset:2px; border-radius:2px;
}

/* =====================================================================
   4. FORMS — one input height, label, placeholder, error/success, required.
   ===================================================================== */
.field{ display:block; margin-top:var(--sp-4); }
.label{ display:block; font-family:var(--sans); font-size:var(--fs-meta); font-weight:var(--fw-semibold); color:var(--ink); margin-bottom:6px; }
.label .req{ color:var(--danger); margin-left:2px; }      /* required-field indicator */
.input, .textarea, .select{
  width:100%; font-family:var(--sans); font-size:15px; line-height:1.4; color:var(--ink);
  background:var(--surface); border:1px solid var(--line); border-radius:var(--r-sm);
  padding:12px 14px; min-height:46px;                      /* one input height */
  transition:border-color var(--motion) var(--ease), box-shadow var(--motion) var(--ease);
}
.textarea{ min-height:120px; resize:vertical; }
.input::placeholder, .textarea::placeholder{ color:var(--ink-faint); }
.input:focus, .textarea:focus, .select:focus{ outline:none; border-color:var(--accent); box-shadow:0 0 0 3px rgba(19,196,183,.16); }
.input[aria-invalid="true"], .field.has-error .input{ border-color:var(--danger); }
.field-msg{ font-family:var(--sans); font-size:12.5px; line-height:1.45; margin-top:6px; }
.field-msg--error{ color:var(--danger); }
.field-msg--success{ color:var(--success); }
.form-alert{ font-family:var(--sans); font-size:13.5px; line-height:1.5; border-radius:var(--r-sm); padding:12px 14px; }
.form-alert--error{ color:var(--danger); background:var(--danger-bg); }
.form-alert--success{ color:var(--success); background:var(--success-bg); }

/* =====================================================================
   5. CARDS — one radius system, shadow/border logic, padding scale,
   image-ratio rules (3:2 covers, 1:1 avatars/logos).
   ===================================================================== */
.card{ background:var(--surface); border:1px solid var(--line); border-radius:var(--r-lg); padding:var(--sp-6); box-shadow:var(--shadow-sm); transition:transform var(--motion) var(--ease), box-shadow var(--motion-slow) var(--ease); }
.card--flat{ box-shadow:none; }
.card--interactive:hover{ transform:translateY(var(--hover-lift)); box-shadow:var(--shadow-md); }
.card--warm{ background:var(--surface-warm); }
.card__media{ position:relative; display:block; border-radius:var(--r-md); overflow:hidden; background:var(--bg); aspect-ratio:3/2; }
.card__media img{ position:absolute; inset:0; width:100%; height:100%; object-fit:cover; display:block; }
.card__media--square{ aspect-ratio:1/1; }
.card__body{ padding-top:var(--sp-4); }

/* =====================================================================
   1 + 8. ACCORDIONS — chevron down (closed) → rotated up (open). Never +/×.
   One icon, size, stroke, color behavior, animation everywhere.
   Markup: a toggle with aria-expanded (or <details open>) containing
   <svg class="acc-ico" ...><path d="M2.5 4.5l3.5 3 3.5-3"/></svg>.
   ===================================================================== */
.acc-ico{ width:16px; height:16px; flex:0 0 auto; color:var(--ink-faint); transition:transform var(--motion) var(--ease), color var(--motion) var(--ease); }
[aria-expanded="true"] > .acc-ico,
[aria-expanded="true"] .acc-ico,
details[open] > summary .acc-ico{ transform:rotate(180deg); color:var(--accent-strong); }

/* =====================================================================
   8. ICONS — one library/style: line icons, 24-view, round caps,
   stroke-width 2 (1.6 for ≤14px), sized in fixed steps. No mixed styles.
   ===================================================================== */
.icon{ width:18px; height:18px; flex:0 0 auto; display:inline-block; vertical-align:middle; fill:none; stroke:currentColor; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }
.icon--sm{ width:14px; height:14px; stroke-width:1.6; }
.icon--lg{ width:24px; height:24px; }

/* =====================================================================
   12. BADGES / CHIPS — one shape, size, padding, text style.
   Color = MEANING: neutral (default), accent (active/selected),
   success, warning, danger. Same meaning across the whole site.
   ===================================================================== */
.chip{ display:inline-flex; align-items:center; gap:6px; font-family:var(--mono); font-size:var(--fs-micro); font-weight:var(--fw-semibold); letter-spacing:.08em; text-transform:uppercase; color:var(--accent-deep); background:rgba(19,196,183,.10); border:1px solid rgba(1,107,92,.20); padding:4px 10px; border-radius:var(--r-sm); white-space:nowrap; transition:background var(--motion) var(--ease), border-color var(--motion) var(--ease), color var(--motion) var(--ease); }
.chip--active, .chip[aria-pressed="true"]{ background:var(--accent); border-color:var(--accent); color:var(--accent-ink); }
.chip--success{ color:var(--success); background:var(--success-bg); border-color:transparent; }
.chip--danger{ color:var(--danger); background:var(--danger-bg); border-color:transparent; }
.chip--neutral{ color:var(--ink-faint); background:var(--bg); border-color:var(--line); }

/* =====================================================================
   11. EMPTY STATES — one layout: centered icon/illustration, message,
   one CTA. Quiet, not alarming.
   ===================================================================== */
.empty{ display:flex; flex-direction:column; align-items:center; text-align:center; gap:var(--sp-4); padding:var(--sp-8) var(--sp-5); color:var(--ink-soft); }
.empty__icon{ width:40px; height:40px; color:var(--ink-faint); opacity:.8; }
.empty__title{ font-family:var(--serif); font-weight:var(--fw-semibold); font-size:var(--fs-h4); color:var(--ink); }
.empty__text{ font-family:var(--serif-body); font-size:15.5px; line-height:1.6; max-width:42ch; margin:0; }
.empty .btn{ margin-top:var(--sp-2); }

/* =====================================================================
   7. TYPOGRAPHY helpers — same scale/weights/line-heights everywhere.
   ===================================================================== */
.eyebrow{ font-family:var(--mono); font-size:var(--fs-eyebrow); letter-spacing:.18em; text-transform:uppercase; color:var(--accent-strong); }
/* Decorative aqua-dash variant (PolyglotMint). Plain .eyebrow is the default;
   add .eyebrow--bar only where the leading dash is intended: class="eyebrow eyebrow--bar". */
.eyebrow--bar{ display:inline-flex; align-items:center; }
/* Dash is inline-block with margin + vertical-align so it renders even when a page
   scopes the eyebrow to display:block (where an inline ::before would have zero
   width). 9px gap via margin-right works in both flex and block contexts. */
.eyebrow--bar::before{ content:""; display:inline-block; flex:0 0 auto; vertical-align:middle; width:22px; height:2px; border-radius:2px; background:var(--accent); margin-right:9px; }
.h1{ font-family:var(--serif); font-weight:var(--fw-semibold); font-size:var(--fs-h1); line-height:var(--lh-tight); letter-spacing:-.02em; }
.h2{ font-family:var(--serif); font-weight:var(--fw-semibold); font-size:var(--fs-h2); line-height:var(--lh-tight); letter-spacing:-.01em; }
.h3{ font-family:var(--serif); font-weight:var(--fw-semibold); font-size:var(--fs-h3); line-height:var(--lh-snug); }
.lead{ font-family:var(--serif-body); font-size:var(--fs-lead); line-height:1.55; color:var(--ink-soft); }
.prose-body{ font-family:var(--serif-body); font-size:var(--fs-body); line-height:var(--lh-body); color:var(--ink); }

/* 6. Section rhythm utility (matches the homepage system) */
.sec-pad{ padding:var(--section-pad-y) 0; }
.hero + .sec-pad, .sec-pad + .sec-pad{ padding-top:0; }

/* 7. Global standard-page spacing (non-article pages that use <main>) ------------
   One source of truth for the vertical rhythm of standard/utility pages. Article
   pages don't use <main>, so their rail/footer rhythm is untouched. Tokens:
     --std-section-gap     space between major (h2) sections
     --std-precta-gap      lead-in above a final call-to-action section (.std-final-cta)
     --std-cta-footer-gap  last content / CTA buttons → footer
   Values: desktop / tablet(≤980) / mobile(≤640). */
:root{
  --std-section-gap:88px;
  --std-precta-gap:72px;
  --std-cta-footer-gap:88px;
}
@media(max-width:980px){ :root{ --std-section-gap:72px; --std-precta-gap:64px; --std-cta-footer-gap:72px; } }
@media(max-width:640px){ :root{ --std-section-gap:56px; --std-precta-gap:48px; --std-cta-footer-gap:64px; } }

/* last content/CTA → footer. Legacy per-page bottom spacing is normalized to 0 so this
   token is the ONLY thing controlling the distance to the footer / newsletter pre-footer. */
main{ padding-bottom:var(--std-cta-footer-gap); }
main .legal, main .ms, main .legal-wrap,
main .faq-layout, main .lex-layout, main .reach-container{ padding-bottom:0; }
.pmx-prefoot{ margin-top:0 !important; }

/* ── Editorial "scrapbook" figures — OPT-IN ONLY ───────────────────────────
   Two image modes on PolyglotMint:
   • Academic / article figures (default): NOT wrapped. Figures stay centered or
     full-width in the article flow, placed after the paragraph that analyzes
     them. These get NO class here and are unaffected by these rules.
   • Editorial scrapbook figures: opt in by adding .scrapbook-figure (aliases
     .wrap-figure / .float-figure) to a <figure>. Text wraps around them; they
     never crowd headings or the next section. Pair the enlarge control with
     .view-larger. Use only on About / field / personal / conceptual pages. */
.scrapbook-figure, .wrap-figure, .float-figure{
  float:right; clear:right;
  width:min(380px, 42%);          /* 340–420px range, capped at 42% of the text column */
  margin:32px 0 28px 52px;        /* >=32px below a preceding heading; 52px text gutter */
}
.scrapbook-figure > img, .wrap-figure > img, .float-figure > img{
  display:block; width:100%; height:auto; border-radius:18px;
}
.scrapbook-figure > figcaption, .wrap-figure > figcaption, .float-figure > figcaption{ margin-top:8px; }

/* ── Image captions — GLOBAL spacing rule ─────────────────────────────────
   Captions sit 8px below their image (connected, not glued), line-height 1.3.
   Never exceed 10px margin-top unless a specific layout requires it. */
figure figcaption, .image-caption, .caption{ margin-top:8px; line-height:1.3; }
/* Clearfix: keep the float inside its own section (never leaks into the next). */
.prose::after, .legal::after, .ms::after,
.about-section::after, .article-section::after, .content-section::after{
  content:""; display:table; clear:both;
}
@media(max-width:800px){
  .scrapbook-figure, .wrap-figure, .float-figure{
    float:none; width:100%; max-width:none; margin:28px 0 32px;
  }
}

/* ── Editorial insert system (magazine-style side rail) — OPT-IN ───────────
   Two image/insert modes on PolyglotMint:
   • MODE 1 — Academic / article figures (DEFAULT): not wrapped, no class. They
     stay centered / full-width in the article flow, placed after the paragraph
     that discusses them, and never drift into the next section.
   • MODE 2 — Editorial side-rail inserts (opt-in): give a section body a right
     rail. Wrap it in .editorial-row containing a .editorial-main reading column
     and a .editorial-rail. Drop inserts (.editorial-insert + a variant:
     .rail-image / .rail-quote / .rail-card / .rail-note / .rail-related) into
     the rail. The rail collapses BELOW the text before the reading column gets
     cramped, so text never drops under ~58ch. For a single paragraph-anchored
     cut-in, use the floated .scrapbook-figure instead. */
.editorial-row{ display:grid; grid-template-columns:minmax(0,680px) minmax(300px,360px); gap:clamp(48px,5vw,64px); align-items:start; max-width:1120px; margin-inline:auto; }
.editorial-main{ max-width:700px; min-width:0; }
.editorial-rail{ max-width:380px; margin-top:48px; }   /* >=40px (preferred 48) below the section heading */

.editorial-insert{ margin:0 0 36px; }
.editorial-insert:last-child{ margin-bottom:0; }
.editorial-insert > img, .rail-image > img{ display:block; width:100%; height:auto; border-radius:18px; border:1px solid var(--line); box-shadow:0 6px 22px rgba(17,17,17,.08); }
.editorial-insert figcaption{ margin-top:8px; font-family:var(--serif-body); font-size:.9rem; line-height:1.3; color:var(--ink-faint); }

/* ── "↗ View larger" button — mirrors the Psychomedia .board-expand button EXACTLY
   (source of truth), with native <button> chrome reset so it never renders as a
   default browser button. Apply .view-larger-button to a larger-view trigger on
   other pages (e.g. About). Psychomedia keeps its own identical .board-expand rule. */
.view-larger-button, .view-larger{
  appearance:none; -webkit-appearance:none;
  display:inline-flex; align-items:center; gap:6px; margin-top:10px;
  font-family:var(--sans); font-size:12px; font-weight:500;
  color:var(--teal); background:rgba(251,245,233,.6);
  border:1px solid var(--teal); border-radius:8px; padding:6px 13px;
  cursor:pointer; transition:background .16s ease;
}
.view-larger-button:hover, .view-larger:hover{ background:#ECF7F2; }
.view-larger-button:focus-visible, .view-larger:focus-visible{ outline:2px solid var(--teal); outline-offset:2px; }
.view-larger-button svg, .view-larger svg{ width:13px; height:13px; }

/* Insert variants — PolyglotMint styling (no external branding). */
.rail-quote{ font-family:var(--serif); font-style:italic; font-size:1.3rem; line-height:1.45; text-align:center; color:var(--teal-deep); padding:30px 14px; border-top:2px solid var(--aqua); border-bottom:2px solid var(--aqua); }
.rail-quote cite{ display:block; margin-top:14px; font-family:var(--mono); font-style:normal; font-size:11px; letter-spacing:.08em; text-transform:uppercase; color:var(--ink-faint); }
.rail-card, .rail-related{ background:var(--white); border:1px solid var(--line); border-radius:14px; padding:22px 24px; box-shadow:0 1px 2px rgba(17,17,17,.05); }
.rail-note{ background:var(--cream-deep); border:1px solid var(--line); border-radius:14px; padding:20px 22px; }
.rail-card .rail-label, .rail-related .rail-label, .rail-note .rail-label{ display:block; font-family:var(--mono); font-size:11px; letter-spacing:.12em; text-transform:uppercase; color:var(--teal); margin-bottom:10px; }
.rail-card h3, .rail-related h3, .rail-note h3{ font-family:var(--serif); font-weight:600; font-size:19px; line-height:1.2; letter-spacing:-.01em; }
.rail-card p, .rail-related p, .rail-note p{ font-family:var(--serif-body); font-size:15px; line-height:1.6; color:var(--ink-soft); margin-top:10px; }
.rail-related a{ display:inline-flex; align-items:center; gap:.35rem; margin-top:14px; font-family:var(--sans); font-weight:600; font-size:14px; color:var(--teal); border-bottom:1px solid transparent; transition:border-color .15s ease; }
.rail-related a:hover, .rail-related a:focus-visible{ border-bottom-color:currentColor; }

/* Keep inserts contained inside their own section (clearfix / new block-context). */
.article-section, .content-section, .about-section, .editorial-row{ display:flow-root; }

/* Stack before the reading column gets cramped; keep groups (image+caption+button) together. */
@media(max-width:1050px){
  .editorial-row{ grid-template-columns:1fr; }
  .editorial-main{ max-width:none; }
  .editorial-rail{ max-width:none; margin-top:28px; }
}
@media(max-width:850px){
  .editorial-insert{ margin:28px 0 36px; }
}

/* Major-section rhythm on standard utility pages (the shared .legal content wrapper).
   The first heading sits near the top; a section flagged .std-final-cta gets the
   slightly tighter pre-CTA lead-in. */
main .legal > h2{ margin-top:var(--std-section-gap); }
main .legal > h2:first-child{ margin-top:24px; }
main .legal > h2.std-final-cta{ margin-top:var(--std-precta-gap); }

/* 8. Reusable responsive table → stacked cards on mobile --------------------------
   Add class "pmx-rtable" to a <table> and data-label="…" to each <td>. Desktop keeps the
   normal table (style it however you like). At ≤640px each row becomes a quiet card with
   the header shown as a small label above each value — no horizontal scroll, no shrunk text,
   no lost content. Cards use the site's cream card style. */
@media(max-width:640px){
  table.pmx-rtable{ min-width:0 !important; width:100%; border-collapse:separate; border-spacing:0; }
  table.pmx-rtable thead{ position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap; border:0; }
  table.pmx-rtable tbody, table.pmx-rtable tr, table.pmx-rtable td{ display:block; width:100%; }
  table.pmx-rtable tr{ background:var(--cream-deep,#F4EAD3); border:1px solid var(--line,#e2d8bf); border-radius:12px; padding:6px 2px; margin:0 0 14px; }
  table.pmx-rtable tr:last-child{ margin-bottom:0; }
  table.pmx-rtable td{ border:0 !important; padding:9px 16px; white-space:normal !important; }
  table.pmx-rtable td::before{ content:attr(data-label); display:block; font-family:var(--mono,monospace); font-size:10.5px; font-weight:600; letter-spacing:.1em; text-transform:uppercase; color:var(--ink-faint,#6f6f67); margin-bottom:3px; }
  table.pmx-rtable td:empty{ display:none; }
}

/* 9. Standard-page horizontal-overflow guard --------------------------------------
   Keeps a stray wide child (break-out sections, wide tables, images) from forcing a
   horizontal scrollbar. Scoped to pages that use <main> (i.e. NOT article pages), and
   uses overflow-x:clip (not hidden) so it never establishes a scroll container that
   could break the article rails' position:sticky. */
body:has(main){ max-width:100%; overflow-x:clip; }
@media(max-width:640px){
  main, main *{ box-sizing:border-box; }
  main :where(p,ul,ol,li,figure,img,table,div,blockquote){ max-width:100%; }
  main img{ height:auto; }
}

