/*
 * Font faces are declared in fonts.css, imported here.
 * This keeps font declarations separate from design system rules
 * and makes it easy to switch between self-hosted and Google Fonts.
 *
 * If you prefer to link fonts.css separately in HTML <head>, remove
 * this @import and add:
 *   <link rel="stylesheet" href="fonts.css"> before signalarc.css
 */
@import url('./fonts.css');


/* ═══════════════════════════════════════════════════════════════════════
   SIGNALARC DESIGN SYSTEM v2.0
   
   Typography
     Headings  : Roboto Slab (300–700)
     Body/UI   : Lato (300–900)
     Code      : JetBrains Mono (400–500)

   Scale       : Major Third ×1.25 from 19px root. Min rendered size: 14px.
   Palette     : Warm ink on antique cream, single deep teal accent.
   Theme       : Light only — color-scheme: light declared on <html>.
   
   Accessibility
     - WCAG AA colour contrast throughout
     - Minimum text size: 14px (~0.74rem at 19px root)
     - Focus indicators: 3px solid teal outline
     - Reduced-motion: all animations disabled when prefers-reduced-motion
     - All interactive elements: minimum 44×44px touch target
═══════════════════════════════════════════════════════════════════════ */


/* ── Design tokens ──────────────────────────────────────────────────── */

:root {
  /* Colour */
  --ink:          #1a1815;   /* primary text                             */
  --ink-2:        #38342e;   /* secondary text, card body                */
  --ink-3:        #5e5850;   /* muted — captions, placeholders           */
  --ink-4:        #9a9186;   /* very muted — fine print                  */

  --paper:        #f7f3ed;   /* page background                          */
  --paper-2:      #edeae3;   /* tinted sections, table rows, callouts    */
  --paper-3:      #e4e0d8;   /* borders, striping                        */
  --white:        #ffffff;   /* card surfaces                            */

  --teal:         #1a6e6e;   /* primary accent                           */
  --teal-dark:    #115454;   /* hover / active                           */
  --teal-tint:    #e0f2f2;   /* teal background wash                     */
  --teal-mid:     #3aa8a8;   /* lighter teal for accents                 */

  --slate:        #2e4c65;   /* secondary — badges, diagrams             */
  --slate-tint:   #e0eaf3;   /* slate background wash                    */

  --green:        #2d6a2d;   /* success / tip states                     */
  --green-tint:   #e4f2e4;

  --rule:         #d0c9bb;   /* default border                           */
  --rule-heavy:   #a09486;   /* stronger border                          */
  --shadow:       rgba(26, 24, 21, 0.09);

  /* Type scale — Major Third (×1.25) from 19px */
  --root:   19px;
  --t-sm:   0.74rem;    /* ~14px — minimum. labels, captions, code      */
  --t-base: 1rem;       /*  19px — body text                            */
  --t-md:   1.15rem;    /* ~22px — lead paragraphs                      */
  --t-lg:   1.25rem;    /* ~24px — card titles                          */
  --t-xl:   1.563rem;   /* ~30px — h3, section headings                 */
  --t-2xl:  1.953rem;   /* ~37px — h2                                   */
  --t-3xl:  2.441rem;   /* ~46px — inner page h1                        */
  --t-4xl:  3.052rem;   /* ~58px — hero h1 min                          */
  --t-5xl:  3.815rem;   /* ~72px — hero h1 max                          */

  /* Spacing — 8px grid expressed in rem at 19px root */
  --s1:  0.25rem;   /*  ~5px  */
  --s2:  0.5rem;    /* ~10px  */
  --s3:  0.75rem;   /* ~14px  */
  --s4:  1rem;      /* ~19px  */
  --s5:  1.25rem;   /* ~24px  */
  --s6:  1.5rem;    /* ~29px  */
  --s8:  2rem;      /* ~38px  */
  --s10: 2.5rem;    /* ~48px  */
  --s12: 3rem;      /* ~57px  */
  --s16: 4rem;      /* ~76px  */
  --s20: 5rem;      /* ~95px  */
  --s24: 6rem;      /* ~114px */
  --s32: 8rem;      /* ~152px */

  /* Layout */
  --max-w:   84rem;
  --measure: 40rem;   /* optimal line length ~65 chars at 19px */
  --wide:    54rem;   /* wider measure for lead paragraphs      */

  /* Font stacks */
  --display: 'Roboto Slab', 'Rockwell', Georgia, serif;
  --body:    'Lato', 'Helvetica Neue', Arial, sans-serif;
  --mono:    'JetBrains Mono', 'Fira Code', 'Cascadia Code', Menlo,
             Consolas, 'Courier New', monospace;

  /* Motion */
  --ease:     cubic-bezier(0.25, 0, 0.25, 1);
  --ease-out: cubic-bezier(0, 0, 0.3, 1);
  --fast:     140ms;
  --mid:      260ms;
  --slow:     420ms;
}


/* ── Reset ──────────────────────────────────────────────────────────── */

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

html {
  font-size: var(--root);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  color-scheme: light;          /* forces light regardless of OS setting  */
  scroll-behavior: smooth;
  hanging-punctuation: first last;
}

body {
  font-family: var(--body);
  font-size: var(--t-base);
  line-height: 1.78;
  color: var(--ink);
  background-color: var(--paper);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}


/* ── Accessibility utilities ────────────────────────────────────────── */

/* Skip link — must be first focusable element in every page */
.skip-link {
  position: absolute;
  top: -300%;
  left: var(--s4);
  z-index: 9999;
  background: var(--teal);
  color: #fff;
  font-family: var(--body);
  font-size: var(--t-sm);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: var(--s3) var(--s6);
  text-decoration: none;
  border-radius: 0 0 4px 4px;
  transition: top var(--fast);
}
.skip-link:focus {
  top: 0;
}

/* Visually hidden — accessible to screen readers */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Global focus indicator */
:focus-visible {
  outline: 3px solid var(--teal);
  outline-offset: 3px;
  border-radius: 2px;
}

/* Ensure sufficient touch targets (44×44px minimum) */
button,
[role="button"],
input,
select,
textarea,
a {
  min-height: 44px;
  /* height is not forced — this ensures padding compensates where needed */
}

/* Inline links don't need enforced height */
p a,
li a,
td a,
th a,
blockquote a,
figcaption a {
  min-height: unset;
}


/* ── Typography ─────────────────────────────────────────────────────── */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--display);
  color: var(--ink);
  text-wrap: balance;
  line-height: 1.15;
}

h1 {
  font-size: clamp(var(--t-3xl), 5vw, var(--t-5xl));
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.06;
}

h2 {
  font-size: var(--t-3xl);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-top: var(--s16);
  margin-bottom: var(--s6);
}

h3 {
  font-size: var(--t-2xl);
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.25;
  margin-top: var(--s12);
  margin-bottom: var(--s4);
}

h4 {
  font-size: var(--t-xl);
  font-weight: 500;
  line-height: 1.3;
  margin-top: var(--s10);
  margin-bottom: var(--s3);
}

h5 {
  font-size: var(--t-lg);
  font-weight: 700;
  margin-top: var(--s8);
  margin-bottom: var(--s2);
}

h6 {
  font-size: var(--t-base);
  font-weight: 700;
  margin-top: var(--s6);
  margin-bottom: var(--s2);
}

p {
  max-width: var(--measure);
  line-height: 1.78;
  text-wrap: pretty;
}

p + p {
  margin-top: var(--s4);
}

/* Lead paragraph — used immediately after major headings */
.lead {
  font-size: var(--t-md);
  line-height: 1.65;
  color: var(--ink-2);
  max-width: var(--wide);
}

/* Links */
a {
  color: var(--teal);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
  text-decoration-color: color-mix(in srgb, var(--teal) 30%, transparent);
  transition: color var(--fast), text-decoration-color var(--fast);
}
a:hover {
  color: var(--teal-dark);
  text-decoration-color: var(--teal-dark);
}

/* External links get a visual indicator */
a[target="_blank"]::after {
  content: " ↗";
  font-size: 0.8em;
  vertical-align: super;
  speak: never;             /* decorative — screen readers get aria-label */
  aria-hidden: "true";
}

/* Inline elements */
strong  { font-weight: 700; }
em      { font-style: italic; }
small   { font-size: var(--t-sm); color: var(--ink-3); line-height: 1.55; }
mark    { background: var(--teal-tint); color: var(--ink); padding: 0 0.2em; }
del     { color: var(--ink-3); }
ins     { color: var(--green); text-decoration-color: var(--green); }

abbr[title] {
  font-variant-caps: all-small-caps;
  letter-spacing: 0.05em;
  text-decoration: underline dotted;
  text-decoration-color: var(--rule-heavy);
  cursor: help;
}

/* Horizontal rule */
hr {
  border: none;
  border-top: 1px solid var(--rule);
  margin-block: var(--s12);
}

/* Blockquote */
blockquote {
  position: relative;
  font-family: var(--display);
  font-size: var(--t-xl);
  font-weight: 300;
  line-height: 1.45;
  color: var(--ink);
  padding: var(--s10) var(--s12) var(--s10) var(--s16);
  margin-block: var(--s16);
  border-left: 3px solid var(--teal);
  letter-spacing: -0.01em;
}
blockquote::before {
  content: '\201C';
  position: absolute;
  left: var(--s4);
  top: 0.05em;
  font-size: 8rem;
  line-height: 1;
  color: var(--teal);
  opacity: 0.12;
  pointer-events: none;
  aria-hidden: "true";
}
blockquote p {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  color: inherit;
  max-width: 36rem;
  margin-top: 0;
}
blockquote p + p {
  margin-top: var(--s4);
}
blockquote cite {
  display: block;
  margin-top: var(--s6);
  font-family: var(--body);
  font-size: var(--t-sm);
  font-style: normal;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
}
blockquote cite::before {
  content: '— ';
}

/* Lists */
ul, ol {
  padding-left: var(--s6);
  max-width: var(--measure);
}
li {
  margin-bottom: var(--s2);
  line-height: 1.72;
}

/* Styled content lists */
.content-list {
  list-style: none;
  padding-left: var(--s6);
}
.content-list > li {
  position: relative;
}
.content-list > li::before {
  content: '–';
  position: absolute;
  left: calc(-1 * var(--s5));
  color: var(--teal);
  font-family: var(--display);
  line-height: 1.72;
}

/* Definition list */
dl { max-width: var(--measure); }
dt {
  font-family: var(--body);
  font-size: var(--t-sm);
  font-weight: 700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--ink-2);
  margin-top: var(--s6);
}
dd {
  margin-left: var(--s5);
  color: var(--ink-2);
  border-left: 2px solid var(--rule);
  padding-left: var(--s5);
  margin-top: var(--s1);
}


/* ── Code ───────────────────────────────────────────────────────────── */

code, kbd, samp, var {
  font-family: var(--mono);
  font-size: 0.87em;
  font-variant-ligatures: normal;
}

/* Inline code */
:not(pre) > code {
  background: var(--teal-tint);
  color: var(--teal-dark);
  padding: 0.14em 0.48em 0.10em;
  border: 1px solid color-mix(in srgb, var(--teal) 20%, transparent);
  font-size: 0.85em;
  white-space: nowrap;
}

/* Keyboard input */
kbd {
  background: var(--paper-2);
  border: 1px solid var(--rule-heavy);
  border-bottom-width: 2px;
  padding: 0.12em 0.6em;
  font-size: var(--t-sm);
  color: var(--ink-2);
  box-shadow: 0 1px 0 var(--rule-heavy);
}

/* Code block container */
.code-block {
  position: relative;
  margin-block: var(--s10);
}

pre {
  background: #f2f0eb;
  color: #2a2724;
  padding: var(--s10);
  overflow-x: auto;
  line-height: 1.45;
  tab-size: 2;
  border: 1px solid var(--rule);
  border-left: 4px solid var(--teal);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.04);
}

pre code {
  font-family: var(--mono);
  font-size: var(--t-sm);
  color: inherit;
  background: none;
  border: none;
  padding: 0;
  white-space: pre;
  line-height: 1.45;
}

/* Language label via data attribute */
pre[data-lang]::before {
  content: attr(data-lang);
  display: block;
  font-family: var(--body);
  font-size: var(--t-sm);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--teal);
  margin-bottom: var(--s6);
  padding-bottom: var(--s4);
  border-bottom: 1px solid var(--rule);
}

/* Copy button */
.copy-btn {
  position: absolute;
  top: var(--s4);
  right: var(--s5);
  min-height: 44px;             /* accessible touch target */
  padding: var(--s2) var(--s5);
  background: var(--paper-2);
  border: 1px solid var(--rule);
  color: var(--ink-3);
  font-family: var(--body);
  font-size: var(--t-sm);
  font-weight: 700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all var(--fast);
}
.copy-btn:hover {
  background: var(--paper-3);
  color: var(--ink);
  border-color: var(--rule-heavy);
}
.copy-btn[data-copied="true"] {
  color: var(--green);
  border-color: var(--green);
}

/* Syntax tokens — light theme */
.tok-comment  { color: #6e6660; font-style: italic; }
.tok-keyword  { color: #1a6e6e; }
.tok-string   { color: #2d6a2d; }
.tok-number   { color: #7a4e00; }
.tok-function { color: #1a3e7a; }
.tok-type     { color: #5a2e7a; }
.tok-operator { color: #4a4440; }
.tok-punct    { color: #8a8278; }
.tok-element  { color: #1a6e6e; }
.tok-attrib   { color: #1a3e7a; }
.tok-value    { color: #2d6a2d; }
.tok-ns       { color: #5a2e7a; }
.tok-pi       { color: #6e6660; font-style: italic; }


/* ── Layout ─────────────────────────────────────────────────────────── */

.container {
  width: min(var(--max-w), 100% - 3rem);
  margin-inline: auto;
}

/* Sections */
.section {
  padding-block: var(--s24);
}
.section + .section {
  border-top: 1px solid var(--rule);
}
.section--tint {
  background: var(--paper-2);
}

/* Two-column editorial grid: main text + sticky marginalia */
.editorial {
  display: grid;
  grid-template-columns: minmax(0, 46rem) 17rem;
  gap: var(--s20);
  align-items: start;
}
@media (max-width: 68rem) {
  .editorial {
    grid-template-columns: 1fr;
  }
}

/* Section title block */
.section-title {
  margin-bottom: var(--s16);
}
.section-title h2 {
  margin-top: 0;
  margin-bottom: var(--s6);
}


/* ── Header ─────────────────────────────────────────────────────────── */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--paper) 96%, transparent);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border-bottom: 1px solid var(--rule);
}

/* Teal head-rule — the primary brand stripe */
.site-header::before {
  content: '';
  display: block;
  height: 3px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    var(--teal) 10%,
    var(--teal) 90%,
    transparent 100%
  );
}

.header-inner {
  display: flex;
  align-items: center;
  padding-block: var(--s5);
}

/* Logo */
.logo {
  display: flex;
  align-items: center;
  gap: var(--s3);
  text-decoration: none;
  flex-shrink: 0;
  min-height: 44px;
}
.logo__mark {
  width: 2.4rem;
  height: 2.4rem;
  flex-shrink: 0;
}
.logo__name {
  font-family: var(--display);
  font-size: var(--t-xl);
  font-weight: 400;
  letter-spacing: -0.015em;
  color: var(--ink);
  line-height: 1;
}
.logo__name em {
  color: var(--teal);
  font-style: normal;
}
.logo:hover .logo__name {
  color: var(--ink);
  text-decoration: none;
}

/* Suppress the external link indicator on the logo */
.logo::after {
  display: none;
}


/* ── Hero ───────────────────────────────────────────────────────────── */

.hero {
  padding-block: var(--s32);
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--rule);
}

/* Subtle radial washes — purely atmospheric, not informational */
.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  aria-hidden: "true";
  background:
    radial-gradient(ellipse 55% 80% at 68% 38%,
      color-mix(in srgb, var(--teal) 6%, transparent) 0%, transparent 72%),
    radial-gradient(ellipse 40% 60% at 5% 70%,
      color-mix(in srgb, var(--slate) 4%, transparent) 0%, transparent 72%);
}

.hero__inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s20);
  align-items: end;
  position: relative;
  z-index: 1;
}
@media (max-width: 56rem) {
  .hero__inner { grid-template-columns: 1fr; }
  .hero__visual { order: -1; }
}

.hero h1 { margin-bottom: var(--s8); }
.hero h1 em { font-style: italic; color: var(--teal); }
.hero .lead { margin-bottom: var(--s12); }
.hero__actions {
  display: flex;
  align-items: center;
  gap: var(--s6);
  flex-wrap: wrap;
}


/* ── Eyebrow label ──────────────────────────────────────────────────── */

/* 
  The .eyebrow class styles a paragraph that precedes a heading.
  It is a <p> element — not a heading — and must not replace headings.
  It provides visual context and the teal rule decoration.
*/
.eyebrow {
  font-family: var(--body);
  font-size: var(--t-sm);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--teal);
  display: flex;
  align-items: center;
  gap: var(--s4);
  margin-bottom: var(--s6);
}
.eyebrow::before {
  content: '';
  width: 2.5rem;
  height: 2px;
  background: var(--teal);
  flex-shrink: 0;
}


/* ── Page header (inner pages) ──────────────────────────────────────── */

.page-header {
  padding-block: var(--s20) var(--s16);
  border-bottom: 1px solid var(--rule);
  position: relative;
}
.page-header::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 5rem;
  height: 3px;
  background: var(--teal);
}
.page-header h1 {
  margin-bottom: var(--s6);
  margin-top: 0;
}


/* ── Breadcrumb ─────────────────────────────────────────────────────── */

/*
  Use: <nav aria-label="Breadcrumb"><ol class="breadcrumb">
  The <nav> provides the landmark. <ol> is correct — breadcrumbs are ordered.
*/
.breadcrumb {
  list-style: none;
  padding: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--s2);
  font-size: var(--t-sm);
  font-weight: 700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--ink-4);
  margin-bottom: var(--s8);
}
.breadcrumb a {
  color: var(--ink-3);
  text-decoration: none;
  min-height: unset;
}
.breadcrumb a:hover { color: var(--teal); }
.breadcrumb [aria-current="page"] { color: var(--ink-2); }
.breadcrumb li + li::before {
  content: '›';
  color: var(--rule-heavy);
  margin-right: var(--s2);
  font-weight: 400;
}
/* Suppress external link arrow inside breadcrumb */
.breadcrumb a::after { display: none; }


/* ── Cards ──────────────────────────────────────────────────────────── */

/*
  Card grid: background colour shows through 1px gap as divider rule.
  Each card should be an <article> with aria-labelledby its heading.
*/
.card-grid {
  display: grid;
  background: var(--rule);
  gap: 1px;
}
.card-grid--2 { grid-template-columns: repeat(auto-fit, minmax(min(22rem, 100%), 1fr)); }
.card-grid--3 { grid-template-columns: repeat(auto-fit, minmax(min(18rem, 100%), 1fr)); }
.card-grid--4 { grid-template-columns: repeat(auto-fit, minmax(min(14rem, 100%), 1fr)); }

.card {
  background: var(--paper);
  border-top: 3px solid var(--rule-heavy);
  padding: var(--s10);
  transition: border-top-color var(--mid), box-shadow var(--mid);
}
.card:hover {
  border-top-color: var(--teal);
  box-shadow: 0 4px 20px var(--shadow);
  position: relative;
  z-index: 1;
}

/* Card taxonomy label — use <p> or <span>, not a heading */
.card__tax {
  font-size: var(--t-sm);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--teal);
  display: block;
  margin-bottom: var(--s4);
}

/* Card headings — h3 inside a card */
.card h3 {
  font-size: var(--t-xl);
  font-weight: 400;
  margin-top: 0;
  margin-bottom: var(--s4);
  line-height: 1.22;
}

/* Card body text — always 19px, never reduced */
.card p {
  font-size: var(--t-base);
  color: var(--ink-2);
  max-width: 100%;
  line-height: 1.65;
}

/* Card link */
.card__link {
  display: inline-flex;
  align-items: center;
  gap: var(--s3);
  margin-top: var(--s8);
  min-height: 44px;
  font-size: var(--t-sm);
  font-weight: 700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--teal);
  text-decoration: none;
  transition: gap var(--fast);
}
.card__link::after {
  content: '→';
  font-size: 1.1em;
  transition: transform var(--fast);
  /* Overrides the external link ↗ — internal links don't need it */
  speak: auto;
}
.card__link:hover { gap: var(--s4); text-decoration: none; }
.card__link:hover::after { transform: translateX(4px); }

/* Standard / specification card */
.card--std {
  border-top: 1px solid var(--rule);
  border-left: 4px solid var(--teal);
  background: var(--white);
}
.card--std:hover {
  border-top-color: var(--rule);
  border-left-color: var(--teal-dark);
}

/* Reference code label in standard cards */
.card__ref {
  font-family: var(--mono);
  font-size: var(--t-sm);
  color: var(--teal);
  letter-spacing: 0.02em;
  display: block;
  margin-bottom: var(--s4);
}


/* ── Buttons ────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s3);
  min-height: 44px;
  padding: var(--s3) var(--s10);
  font-family: var(--body);
  font-size: var(--t-base);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  border: 1.5px solid;
  cursor: pointer;
  transition: all var(--fast);
  white-space: nowrap;
  line-height: 1.2;
}
/* Suppress external link arrow on buttons */
.btn::after { display: none; }

.btn--primary {
  background: var(--teal);
  color: #fff;
  border-color: var(--teal);
}
.btn--primary:hover {
  background: var(--teal-dark);
  border-color: var(--teal-dark);
  color: #fff;
  text-decoration: none;
  box-shadow: 0 4px 16px rgba(26, 110, 110, 0.28);
}

.btn--secondary {
  background: transparent;
  color: var(--ink);
  border-color: var(--rule-heavy);
}
.btn--secondary:hover {
  background: var(--paper-2);
  border-color: var(--ink);
  color: var(--ink);
  text-decoration: none;
}

.btn--sm {
  min-height: 44px;
  padding: var(--s2) var(--s6);
  font-size: var(--t-sm);
}


/* ── Badges ─────────────────────────────────────────────────────────── */

.badge {
  display: inline-block;
  font-size: var(--t-sm);
  font-weight: 700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  padding: 0.26em 0.8em;
  border: 1.5px solid;
  vertical-align: middle;
  line-height: 1.4;
}
.badge--pub   { color: var(--slate);  border-color: var(--slate);  background: var(--slate-tint); }
.badge--new   { color: var(--teal);   border-color: var(--teal);   background: var(--teal-tint);  }
.badge--draft { color: var(--ink-3);  border-color: var(--rule);   background: var(--paper-2);    }


/* ── Callouts ───────────────────────────────────────────────────────── */

/*
  Use role="note" on informational callouts.
  The icon span should have aria-hidden="true".
*/
.callout {
  display: grid;
  grid-template-columns: 2rem 1fr;
  gap: var(--s6);
  padding: var(--s8) var(--s10);
  margin-block: var(--s10);
  border-left: 3px solid;
  background: var(--paper-2);
}
.callout__icon {
  font-size: var(--t-xl);
  line-height: 1.55;
  flex-shrink: 0;
  color: var(--teal);
}
.callout__body p {
  max-width: 100%;
  font-size: var(--t-base);
  line-height: 1.72;
  margin-top: 0;
}
.callout__body p + p { margin-top: var(--s3); }

.callout--info    { border-color: var(--slate);   }
.callout--info    .callout__icon { color: var(--slate); }
.callout--tip     {
  border-color: var(--green);
  background: color-mix(in srgb, var(--green) 4%, var(--paper-2));
}
.callout--tip     .callout__icon { color: var(--green); }
.callout--warning { border-color: var(--teal);        }
.callout--note    { border-color: var(--rule-heavy);  }
.callout--note    .callout__icon { color: var(--ink-3); }


/* ── Tables ─────────────────────────────────────────────────────────── */

/*
  Always wrap in .table-wrap for horizontal scroll.
  Every table needs a <caption>. Use visually-hidden if caption is redundant.
*/
.table-wrap {
  overflow-x: auto;
  margin-block: var(--s10);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--t-base);
  border-top: 2px solid var(--ink);
  border-bottom: 1px solid var(--ink);
}

caption {
  font-size: var(--t-sm);
  font-weight: 700;
  color: var(--ink-3);
  text-align: left;
  padding-bottom: var(--s4);
  letter-spacing: 0.04em;
}

thead th {
  font-size: var(--t-sm);
  font-weight: 700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--ink-2);
  padding: var(--s5) var(--s6) var(--s4);
  text-align: left;
  border-bottom: 1px solid var(--ink);
  white-space: nowrap;
}

td {
  padding: var(--s5) var(--s6);
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
  line-height: 1.72;
}

tr:last-child td { border-bottom: none; }

/* Zebra striping — subtle, never rely on colour alone for information */
tbody tr:nth-child(even)  { background: var(--paper-2); }
tbody tr:hover            { background: var(--teal-tint); }


/* ── Figures & diagrams ─────────────────────────────────────────────── */

figure {
  margin-block: var(--s12);
}

figcaption {
  font-size: var(--t-sm);
  color: var(--ink-3);
  margin-top: var(--s4);
  border-top: 1px solid var(--rule);
  padding-top: var(--s4);
  line-height: 1.65;
}

.diagram {
  margin-block: var(--s12);
  border: 1px solid var(--rule);
  background: var(--white);
}

.diagram__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--s4) var(--s8);
  border-bottom: 1px solid var(--rule);
  background: var(--paper-2);
  font-size: var(--t-sm);
  font-weight: 700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.diagram__body {
  padding: var(--s10);
  display: flex;
  justify-content: center;
}


/* ── Tabs (ARIA tablist pattern) ────────────────────────────────────── */

/*
  HTML pattern:
    <div class="tabs">
      <ul role="tablist" aria-label="...">
        <li role="presentation">
          <button role="tab" aria-selected="false" aria-controls="panel-ID"
                  id="tab-ID" tabindex="-1">Label</button>
        </li>
      </ul>
      <div role="tabpanel" id="panel-ID" aria-labelledby="tab-ID" hidden>
        Content
      </div>
    </div>
  JS activates first tab on load; arrow keys navigate between tabs.
*/
.tabs { margin-block: var(--s10); }

.tab-list {
  list-style: none;
  padding: 0;
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--rule);
  overflow-x: auto;
  scrollbar-width: none;
}

.tab-btn {
  padding: var(--s4) var(--s8) var(--s5);
  min-height: 44px;
  border: none;
  border-bottom: 3px solid transparent;
  background: none;
  font-family: var(--body);
  font-size: var(--t-sm);
  font-weight: 700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--ink-3);
  cursor: pointer;
  margin-bottom: -1px;
  white-space: nowrap;
  transition: color var(--fast), border-color var(--fast);
}
.tab-btn:hover { color: var(--ink); }
.tab-btn[aria-selected="true"] {
  color: var(--teal);
  border-bottom-color: var(--teal);
}

.tab-panel { padding-top: var(--s10); }
.tab-panel[hidden] { display: none; }


/* ── Marginalia (sticky sidebar) ────────────────────────────────────── */

.marginalia {
  position: sticky;
  top: calc(4.5rem + var(--s8));
  align-self: start;
}

.margin-block {
  margin-bottom: var(--s10);
  padding-bottom: var(--s8);
  border-bottom: 1px solid var(--rule);
}
.margin-block:last-child { border-bottom: none; }

/* Margin headings — use <h2> with appropriate aria-level or <p> for non-heading labels */
.margin-head {
  font-size: var(--t-sm);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-4);
  display: block;
  margin-bottom: var(--s5);
}

/* Table of contents */
.toc {
  list-style: none;
  padding: 0;
}
.toc a {
  display: block;
  font-size: var(--t-base);
  color: var(--ink-3);
  text-decoration: none;
  padding-block: var(--s3);
  border-bottom: 1px solid var(--rule);
  transition: color var(--fast), padding-left var(--fast);
  min-height: 44px;
  display: flex;
  align-items: center;
}
.toc a:hover,
.toc a[aria-current="true"] {
  color: var(--teal);
  padding-left: var(--s2);
  text-decoration: none;
}
/* Suppress external link indicator on ToC */
.toc a::after { display: none; }

/* Tag cloud */
.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
  list-style: none;
  padding: 0;
}
.tag {
  display: inline-block;
  font-family: var(--mono);
  font-size: var(--t-sm);
  color: var(--ink-3);
  border: 1px solid var(--rule);
  padding: 0.28em 0.7em;
  text-decoration: none;
  transition: all var(--fast);
  min-height: unset;           /* tags are small by design */
}
a.tag:hover {
  color: var(--teal);
  border-color: var(--teal);
  background: var(--teal-tint);
  text-decoration: none;
}
/* Suppress external link arrow on tags */
.tag::after { display: none !important; }


/* ── Resource list ──────────────────────────────────────────────────── */

.resource-list {
  list-style: none;
  padding: 0;
}
.resource-item {
  display: grid;
  grid-template-columns: 3.5rem 1fr;
  gap: var(--s6);
  align-items: start;
  padding: var(--s6) var(--s8);
  border-bottom: 1px solid var(--rule);
  text-decoration: none;
  color: inherit;
  transition: background var(--fast);
  min-height: 44px;
}
.resource-list li:first-child .resource-item { border-top: 1px solid var(--rule); }
.resource-item:hover { background: var(--paper-2); }
.resource-item:hover .resource__title { color: var(--teal); }
/* Suppress external link arrow — resource items use their own indicator */
.resource-item::after { display: none; }

.resource__icon {
  width: 3.5rem;
  height: 3.5rem;
  display: grid;
  place-items: center;
  background: var(--paper-2);
  border: 1px solid var(--rule);
  font-size: var(--t-xl);
  flex-shrink: 0;
}
.resource__title {
  font-weight: 700;
  font-size: var(--t-lg);
  color: var(--ink);
  line-height: 1.3;
  transition: color var(--fast);
}
.resource__meta {
  font-size: var(--t-sm);
  color: var(--ink-4);
  margin-top: var(--s2);
  line-height: 1.55;
}


/* ── Footer ─────────────────────────────────────────────────────────── */

/*
  Semantic structure:
    <footer>                    — landmark, no role="contentinfo" needed
      <div class="footer-grid">
        <div class="footer-brand">     — brand/description
        <nav aria-label="Standards">   — each column is a nav with heading
          <h2 class="footer-col__head">
          <ul>
        ...
      <div class="footer-base">
        <small>copyright</small>
        <nav aria-label="Legal links">
*/
.site-footer {
  margin-top: auto;
  border-top: 1px solid var(--rule);
  padding-block: var(--s20) var(--s12);
  background: var(--paper-2);
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr repeat(3, 1fr);
  gap: var(--s12);
  padding-bottom: var(--s12);
  border-bottom: 1px solid var(--rule);
  margin-bottom: var(--s8);
}
@media (max-width: 56rem) {
  .footer-grid { grid-template-columns: 1fr 1fr; gap: var(--s8); }
}
@media (max-width: 36rem) {
  .footer-grid { grid-template-columns: 1fr; }
}

.footer-brand__name {
  font-family: var(--display);
  font-size: var(--t-xl);
  font-weight: 400;
  letter-spacing: -0.015em;
  display: block;
  margin-bottom: var(--s4);
  color: var(--ink);
  text-decoration: none;
}
.footer-brand__name em {
  color: var(--teal);
  font-style: normal;
}
.footer-brand__name:hover { color: var(--ink); text-decoration: none; }
.footer-brand__name::after { display: none; }

.footer-brand__tagline {
  font-size: var(--t-base);
  color: var(--ink-3);
  max-width: 22rem;
  line-height: 1.7;
}

/* Footer nav column headings — semantic h2/h3 styled to match design */
.footer-col__head {
  font-size: var(--t-sm);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-4);
  margin-bottom: var(--s5);
  margin-top: 0;
}

.footer-links {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--s3);
}
.footer-links a {
  font-size: var(--t-base);
  color: var(--ink-2);
  text-decoration: none;
  transition: color var(--fast);
  min-height: unset;
}
.footer-links a:hover { color: var(--teal); }

/* Footer base bar */
.footer-base {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: var(--s4);
}

.footer-copy {
  font-size: var(--t-sm);
  color: var(--ink-4);
}
.footer-copy a {
  color: var(--ink-3);
  min-height: unset;
}

.footer-legal {
  list-style: none;
  padding: 0;
  display: flex;
  gap: var(--s6);
}
.footer-legal a {
  font-size: var(--t-sm);
  font-weight: 700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--ink-4);
  text-decoration: none;
  min-height: unset;
  transition: color var(--fast);
}
.footer-legal a:hover { color: var(--ink-2); }


/* ── Animations ─────────────────────────────────────────────────────── */

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(1.4rem); }
  to   { opacity: 1; transform: none; }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.anim-up { animation: fadeUp var(--slow) var(--ease-out) both; }
.anim-in { animation: fadeIn var(--slow) var(--ease-out) both; }
.d1 { animation-delay:  90ms; }
.d2 { animation-delay: 180ms; }
.d3 { animation-delay: 270ms; }
.d4 { animation-delay: 360ms; }

/* Disable all motion when user prefers reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}


/* ── Images & media ─────────────────────────────────────────────────
   Responsive images prevent layout shift (CLS — Core Web Vitals).
   Always provide width and height attributes on <img> elements so the
   browser can reserve space before the image loads.
   Always provide descriptive alt text — used by screen readers AND
   image search / Google Image SEO.
──────────────────────────────────────────────────────────────────── */

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Prevent content layout shift from images without explicit dimensions */
img[width][height] {
  aspect-ratio: attr(width) / attr(height);
}

video {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Responsive iframe wrapper (e.g. YouTube embeds) */
.embed-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
}
.embed-wrap iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
}


/* ── Print ──────────────────────────────────────────────────────────── */

@media print {
  .site-header,
  .site-footer,
  .copy-btn   { display: none !important; }

  body {
    font-size: 11.5pt;
    color: #000;
    background: #fff;
  }

  h1 { font-size: 26pt; }
  h2 { font-size: 20pt; }
  h3 { font-size: 15pt; }

  a[href^="http"]::after {
    content: ' [' attr(href) ']';
    font-size: 0.75em;
    color: #444;
  }

  pre {
    border: 1pt solid #ccc;
    background: #f5f2ee;
    color: #000;
    page-break-inside: avoid;
  }

  h1, h2, h3, h4 { page-break-after: avoid; }
  figure, blockquote, table { page-break-inside: avoid; }
}
