/* ============================================================================
   ALCOVE — alcove.grc.engineering
   Site layer. Consumes the vendored GRC Engineering design-system tokens.
   ============================================================================ */

:root {
  --page-max: 1120px;
  --prose-max: 720px;

  /* Level accents — mapped onto GRCE status semantics, in the source's order.
     L1 legacy-orange (commitment only) → L2 amber (short-lived) →
     L3 green (strong) → L4 engineering blue (threat-informed). */
  --lv1-fg: var(--grc-orange-700); --lv1-bg: var(--grc-orange-100); --lv1-line: var(--grc-orange-400);
  --lv2-fg: var(--amber-600);      --lv2-bg: var(--amber-100);      --lv2-line: var(--amber-500);
  --lv3-fg: var(--green-700);      --lv3-bg: var(--green-100);      --lv3-line: var(--green-500);
  --lv4-fg: var(--eng-blue-700);   --lv4-bg: var(--eng-blue-50);    --lv4-line: var(--eng-blue-500);

  /* Assurance-strip colours (the signature motif) */
  --strip-pass: var(--green-500);
  --strip-risk: var(--amber-500);
  --strip-fail: var(--red-500);
  --strip-void: var(--slate-300);
}

[data-theme="dark"] {
  --lv1-fg: var(--grc-orange-300); --lv1-bg: rgba(255,168,79,0.13); --lv1-line: var(--grc-orange-400);
  --lv2-fg: #F2C14E;               --lv2-bg: rgba(232,163,23,0.14); --lv2-line: var(--amber-500);
  --lv3-fg: #4FD396;               --lv3-bg: rgba(31,157,107,0.14); --lv3-line: var(--green-500);
  --lv4-fg: var(--eng-blue-300);   --lv4-bg: rgba(27,149,193,0.14); --lv4-line: var(--eng-blue-400);

  --strip-pass: #35B87F;
  --strip-risk: #D9A227;
  --strip-void: #2A3644;
}

/* ============================================================ PRIMITIVES ==== */

.wrap { max-width: var(--page-max); margin: 0 auto; padding: 0 var(--space-6); }
.prose { max-width: var(--prose-max); }

.section { padding: var(--space-24) 0; }
.section--tight { padding: var(--space-16) 0; }

.eyebrow {
  font-family: var(--font-mono);
  font-size: var(--eyebrow-size);
  font-weight: var(--eyebrow-weight);
  letter-spacing: var(--eyebrow-tracking);
  text-transform: uppercase;
  /* eng-blue-500 is only 3.34:1 on the near-white canvas — below AA for 11px
     text. Light mode drops to eng-blue-700; dark keeps the bright accent. */
  color: var(--eng-blue-700);
  margin: 0 0 var(--space-5);
  display: block;
}
[data-theme="dark"] .eyebrow { color: var(--brand-accent); }

h1 { font-size: clamp(2.25rem, 6.2vw, var(--text-5xl)); font-weight: var(--fw-semibold); letter-spacing: var(--tracking-tighter); }
h2 { font-size: clamp(1.75rem, 4.2vw, var(--text-3xl)); font-weight: var(--fw-semibold); letter-spacing: var(--tracking-tighter); }
h3 { font-size: var(--text-xl); font-weight: var(--fw-semibold); }
h4 { font-size: var(--text-md); font-weight: var(--fw-semibold); }

.lede { font-size: var(--text-md); line-height: var(--leading-relaxed); color: var(--text-body); }
.muted { color: var(--color-text-muted); }
.small { font-size: var(--text-sm); }

.section > .wrap > h2 { margin-bottom: var(--space-5); }
p { margin: 0 0 var(--space-5); }
p:last-child { margin-bottom: 0; }

.btn {
  display: inline-flex; align-items: center; gap: var(--space-2);
  height: var(--control-h-lg); padding: 0 var(--space-6);
  border-radius: var(--radius-pill);
  font-family: var(--ui-family); font-size: var(--text-sm); font-weight: var(--fw-semibold);
  letter-spacing: 0.01em;
  border: 1px solid transparent; cursor: pointer;
  transition: var(--transition-control);
  white-space: nowrap;
}
.btn--primary { background: var(--brand-accent); color: #fff; box-shadow: var(--glow-eng); }
.btn--primary:hover { background: var(--brand-accent-strong); color: #fff; transform: translateY(-1px); }
.btn--ghost { background: transparent; color: var(--text-strong); border-color: var(--border-strong); }
.btn--ghost:hover { border-color: var(--brand-accent); color: var(--brand-accent); }
.btn--on-ink { background: rgba(255,255,255,0.07); color: #EAF1F6; border-color: rgba(255,255,255,0.22); }
.btn--on-ink:hover { background: rgba(255,255,255,0.14); color: #fff; border-color: rgba(255,255,255,0.4); }

.card {
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-7);
  box-shadow: var(--shadow-xs);
}

.link-arrow { font-family: var(--ui-family); font-weight: var(--fw-semibold); font-size: var(--text-sm); display: inline-flex; align-items: center; gap: 6px; }
.link-arrow svg { width: 15px; height: 15px; transition: transform var(--dur-fast) var(--ease-out); }
.link-arrow:hover svg { transform: translateX(3px); }

/* Blueprint dot-grid — one of the two sanctioned background motifs */
.grc-grid-bg {
  background-image: radial-gradient(circle, rgba(27,149,193,0.14) 1px, transparent 1px);
  background-size: 22px 22px;
}

/* Wide content scrolls inside its own container, never the body */
.scroller { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ================================================================ HEADER ==== */

.site-header {
  position: sticky; top: 0; z-index: 60;
  padding: var(--space-3) 0;
  backdrop-filter: blur(var(--blur-md));
  -webkit-backdrop-filter: blur(var(--blur-md));
  background: color-mix(in srgb, var(--surface-page) 82%, transparent);
  border-bottom: 1px solid transparent;
  transition: border-color var(--dur-base) var(--ease-out), background-color var(--dur-base) var(--ease-out);
}
.site-header[data-scrolled="true"] {
  border-bottom-color: var(--border-subtle);
  background: color-mix(in srgb, var(--surface-page) 92%, transparent);
}
.site-header .wrap { display: flex; align-items: center; gap: var(--space-6); }

.brand { display: inline-flex; align-items: center; gap: var(--space-2-5); margin-right: auto; }
.brand svg { display: block; height: 26px; width: auto; }

.nav { display: flex; align-items: center; gap: var(--space-6); }
.nav a {
  font-family: var(--ui-family); font-size: var(--text-sm); font-weight: var(--fw-medium);
  color: var(--text-body);
}
.nav a:hover { color: var(--brand-accent); }

.header-actions { display: flex; align-items: center; gap: var(--space-2); }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: var(--control-h-md); height: var(--control-h-md);
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-default);
  background: var(--surface-card); color: var(--text-body);
  cursor: pointer; box-shadow: var(--shadow-xs);
  transition: var(--transition-control);
}
.icon-btn:hover { background: var(--surface-sunken); color: var(--text-strong); border-color: var(--border-strong); }
.icon-btn svg { width: 18px; height: 18px; display: block; }

.theme-icon { display: none; position: absolute; }
[data-theme-preference="light"]  .theme-icon-light,
[data-theme-preference="dark"]   .theme-icon-dark,
[data-theme-preference="system"] .theme-icon-auto { display: block; }
#theme-toggle { position: relative; }

@media (max-width: 860px) {
  .nav { display: none; }
}

/* ================================================================== HERO ==== */

.hero {
  position: relative; overflow: hidden;
  background: var(--surface-ink);
  color: var(--text-on-ink);
  padding: var(--space-24) 0 var(--space-20);
  border-bottom: 1px solid var(--border-default);
}
.hero::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: var(--gradient-ink-glow);
}
.hero .wrap { position: relative; z-index: 2; }
.hero h1 { color: #fff; max-width: 17ch; }
.hero .eyebrow { color: var(--eng-blue-300); }
.hero .lede { color: #B9C6D2; max-width: 56ch; margin-top: var(--space-6); font-size: var(--text-md); }
.hero-cta { display: flex; flex-wrap: wrap; gap: var(--space-3); margin-top: var(--space-8); }

.hero-mark { display: block; height: 46px; width: auto; margin-bottom: var(--space-7); }

.proposal-chip {
  display: inline-flex; align-items: center; gap: var(--space-2);
  padding: 5px var(--space-3) 5px var(--space-2-5);
  border-radius: var(--radius-pill);
  border: 1px solid rgba(255,168,79,0.42);
  background: rgba(255,168,79,0.12);
  color: var(--grc-orange-300);
  font-family: var(--font-mono); font-size: var(--text-2xs);
  font-weight: var(--fw-medium); letter-spacing: var(--tracking-wider); text-transform: uppercase;
  margin-bottom: var(--space-6);
}
.proposal-chip .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--grc-orange-400); }

/* Hero backdrop — the assurance-timeline motif, abstracted.
   Rows of day-cells drifting left: the thing a static PDF cannot show. */
.hero-backdrop {
  position: absolute; inset: 0; z-index: 1;
  opacity: 0.4;
  mask-image: linear-gradient(90deg, transparent 0%, #000 26%, #000 74%, transparent 100%);
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 26%, #000 74%, transparent 100%);
}
.hero-backdrop .track {
  display: flex; gap: 5px; height: 30px; margin-bottom: 12px;
  width: max-content;
  animation: drift linear infinite;
}
.hero-backdrop .cell { width: 7px; border-radius: 2px; background: rgba(31,157,107,0.55); }
.hero-backdrop .cell.risk { background: rgba(232,163,23,0.75); }
.hero-backdrop .cell.fail { background: rgba(229,72,77,0.75); }
.hero-backdrop .cell.void { background: rgba(255,255,255,0.09); }

@keyframes drift { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* =========================================================== DEFINE BAND ==== */

.define {
  background: var(--surface-sunken);
  border-bottom: 1px solid var(--border-subtle);
  padding: var(--space-20) 0;
}
.define .wrap { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: var(--space-16); align-items: center; }
.define .expand { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-5); margin: var(--space-6) 0 0; padding: 0; list-style: none; }
.define .expand li {
  font-family: var(--font-mono); font-size: var(--text-xs);
  color: var(--color-text-muted); letter-spacing: 0.02em;
}
.define .expand b { color: var(--brand-accent); font-weight: var(--fw-bold); }

.define-figure {
  border: 1px solid var(--border-default); border-radius: var(--radius-xl);
  background: var(--surface-card); padding: var(--space-6);
  box-shadow: var(--shadow-md);
}

@media (max-width: 900px) { .define .wrap { grid-template-columns: 1fr; gap: var(--space-10); } }

/* ============================================================== PROBLEM ==== */

.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-6); }
@media (max-width: 900px) { .grid-3 { grid-template-columns: 1fr; } }

.flaw { position: relative; }
.flaw .n {
  font-family: var(--font-mono); font-size: var(--text-2xs); letter-spacing: var(--tracking-wider);
  color: var(--grc-orange-600); text-transform: uppercase; display: block; margin-bottom: var(--space-3);
}
[data-theme="dark"] .flaw .n { color: var(--grc-orange-300); }
.flaw h3 { margin-bottom: var(--space-3); }
.flaw p { font-size: var(--text-sm); color: var(--color-text-muted); }
.flaw blockquote {
  margin: var(--space-5) 0 0; padding: var(--space-4);
  border-left: 2px solid var(--grc-orange-400);
  background: var(--surface-sunken); border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: var(--text-sm); font-style: italic; color: var(--text-body);
}

/* =============================================================== LEVELS ==== */

.levels { display: grid; gap: var(--space-4); margin-top: var(--space-10); }

.level {
  display: grid; grid-template-columns: 132px 1.25fr 1fr; gap: var(--space-7);
  align-items: start;
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-left: 4px solid var(--lvl-line, var(--border-strong));
  border-radius: var(--radius-lg);
  padding: var(--space-7);
  transition: box-shadow var(--dur-base) var(--ease-out), transform var(--dur-base) var(--ease-out);
}
.level:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

.level--1 { --lvl-line: var(--lv1-line); --lvl-fg: var(--lv1-fg); --lvl-bg: var(--lv1-bg); }
.level--2 { --lvl-line: var(--lv2-line); --lvl-fg: var(--lv2-fg); --lvl-bg: var(--lv2-bg); }
.level--3 { --lvl-line: var(--lv3-line); --lvl-fg: var(--lv3-fg); --lvl-bg: var(--lv3-bg); }
.level--4 { --lvl-line: var(--lv4-line); --lvl-fg: var(--lv4-fg); --lvl-bg: var(--lv4-bg); }

.level-id { display: flex; flex-direction: column; gap: var(--space-2); }
.level-id .tag {
  align-self: flex-start;
  font-family: var(--font-mono); font-size: var(--text-2xs); font-weight: var(--fw-medium);
  letter-spacing: var(--tracking-wider); text-transform: uppercase;
  color: var(--lvl-fg); background: var(--lvl-bg);
  padding: 4px var(--space-2-5); border-radius: var(--radius-pill);
}
.level-id .num {
  font-family: var(--font-display); font-size: var(--text-4xl); font-weight: var(--fw-bold);
  line-height: 1; color: var(--lvl-fg); letter-spacing: var(--tracking-tighter);
}
.level-id .rungs { display: flex; gap: 3px; margin-top: var(--space-1); }
.level-id .rungs i { width: 16px; height: 4px; border-radius: 2px; background: var(--border-default); }
.level-id .rungs i.on { background: var(--lvl-line); }

.level h3 { font-size: var(--text-md); margin-bottom: var(--space-2); }
.level .req { font-size: var(--text-sm); color: var(--text-body); margin: 0; }
.level .for-label,
.level .req-label {
  font-family: var(--font-mono); font-size: var(--text-2xs); letter-spacing: var(--tracking-wider);
  text-transform: uppercase; color: var(--color-text-muted); display: block; margin-bottom: var(--space-2);
}
.level .for { font-size: var(--text-sm); color: var(--color-text-muted); margin: 0; }
.level em { font-style: italic; }
.level strong { font-weight: var(--fw-bold); color: var(--text-strong); }

@media (max-width: 900px) {
  .level { grid-template-columns: 1fr; gap: var(--space-5); padding: var(--space-6); }
  .level-id { flex-direction: row; align-items: center; gap: var(--space-4); }
  .level-id .rungs { margin-top: 0; }
}

/* =============================================================== TABLES ==== */

.tbl { width: 100%; border-collapse: collapse; font-size: var(--text-sm); min-width: 640px; }
.tbl caption { text-align: left; font-size: var(--text-sm); color: var(--color-text-muted); padding-bottom: var(--space-4); }
.tbl th, .tbl td { text-align: left; padding: var(--space-4) var(--space-5); border-bottom: 1px solid var(--border-subtle); vertical-align: top; }
.tbl thead th {
  font-family: var(--font-mono); font-size: var(--text-2xs); font-weight: var(--fw-medium);
  letter-spacing: var(--tracking-wider); text-transform: uppercase;
  color: var(--color-text-muted); background: var(--surface-sunken);
  border-bottom: 1px solid var(--border-default);
}
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl-shell { border: 1px solid var(--border-default); border-radius: var(--radius-lg); overflow: hidden; background: var(--surface-card); }
.tbl-shell .scroller { border-radius: var(--radius-lg); }

.type-cell { font-family: var(--font-display); font-weight: var(--fw-bold); font-size: var(--text-lg); width: 90px; }
tr.is-alcove { background: var(--lv3-bg); }
tr.is-alcove.is-l4 { background: var(--lv4-bg); }
tr.is-alcove .type-cell { color: var(--lv3-fg); }
tr.is-alcove.is-l4 .type-cell { color: var(--lv4-fg); }

.maps-to {
  font-family: var(--font-mono); font-size: var(--text-2xs); letter-spacing: 0.04em;
  color: var(--color-text-muted); white-space: nowrap;
}

/* ------- the CTC / CTM worked example ------- */
.ctc-tbl th:nth-child(3), .ctc-tbl th:nth-child(4) { color: var(--brand-accent); }
.ctc-tbl .add { color: var(--eng-blue-700); font-weight: var(--fw-semibold); }
[data-theme="dark"] .ctc-tbl .add { color: var(--eng-blue-300); }
.ctc-tbl ol { margin: 0; padding-left: var(--space-5); }
.ctc-tbl ol ol { padding-left: var(--space-4); margin-top: var(--space-1); }
.ctc-tbl li { margin-bottom: var(--space-2); }
.ctc-tbl .mat {
  font-family: var(--font-mono); font-size: var(--text-2xs); letter-spacing: var(--tracking-wider);
  text-transform: uppercase; color: var(--color-text-muted);
  display: block; margin: var(--space-4) 0 var(--space-2);
}
.ctc-tbl .mat:first-child { margin-top: 0; }
.legend { display: flex; flex-wrap: wrap; gap: var(--space-5); margin-top: var(--space-5); font-size: var(--text-xs); color: var(--color-text-muted); }
.legend span { display: inline-flex; align-items: center; gap: var(--space-2); }
.legend i { width: 12px; height: 3px; border-radius: 2px; display: block; }

/* =========================================================== THE ARTIFACT ==== */

.artifact {
  background: var(--surface-card); border: 1px solid var(--border-default);
  border-radius: var(--radius-2xl); padding: var(--space-8); box-shadow: var(--shadow-lg);
  margin-top: var(--space-10);
}
.artifact-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; margin-bottom: var(--space-7); }
.artifact-head h3 { font-size: var(--text-xl); }
.artifact-summary { display: inline-flex; align-items: center; gap: var(--space-2-5); font-family: var(--ui-family); font-size: var(--text-sm); font-weight: var(--fw-semibold); color: var(--status-pass-fg); }
.artifact-summary .ring { width: 22px; height: 22px; border-radius: 50%; background: var(--status-pass-bg); display: inline-flex; align-items: center; justify-content: center; }
.artifact-summary svg { width: 13px; height: 13px; }

.ctrl { padding: var(--space-5) 0; border-top: 1px solid var(--border-subtle); }
.ctrl:first-of-type { border-top: none; padding-top: 0; }
.ctrl-top { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-4); margin-bottom: var(--space-3); }
.ctrl-name { display: flex; align-items: center; gap: var(--space-2-5); font-family: var(--ui-family); font-size: var(--text-sm); font-weight: var(--fw-semibold); color: var(--text-strong); }
.ctrl-name .pip { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.ctrl-uptime { font-family: var(--font-mono); font-size: var(--text-xs); font-weight: var(--fw-medium); white-space: nowrap; }

/* 180 cells at 2px + 2px gaps need ~718px. Below that the strip scrolls inside
   itself rather than widening the page (wide content never scrolls the body). */
.strip { display: flex; gap: 2px; height: 34px; align-items: stretch; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.strip::-webkit-scrollbar { display: none; }
.strip .day { flex: 1 0 2px; min-width: 2px; border-radius: 2px; background: var(--strip-pass); position: relative; transform-origin: bottom; }

@media (max-width: 760px) {
  .strip { gap: 1px; }
  .strip .day { flex: 1 0 1px; min-width: 1px; border-radius: 1px; }
}
.strip .day.risk { background: var(--strip-risk); }
.strip .day.fail { background: var(--strip-fail); }
.strip .day.void { background: var(--strip-void); }
.strip .day::after {
  content: attr(data-label);
  position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%);
  background: var(--surface-ink); color: var(--text-on-ink);
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.02em;
  padding: 5px 8px; border-radius: var(--radius-sm); white-space: nowrap;
  opacity: 0; pointer-events: none; transition: opacity var(--dur-fast) var(--ease-out);
  z-index: 4;
}
.strip .day:hover::after, .strip .day:focus-visible::after { opacity: 1; }
.strip .day:hover { filter: brightness(1.15); }

.strip-axis { display: flex; justify-content: space-between; margin-top: var(--space-2-5); font-family: var(--font-mono); font-size: var(--text-2xs); letter-spacing: var(--tracking-wider); text-transform: uppercase; color: var(--color-text-muted); }

/* Scroll-in: the strips draw themselves, because a photograph cannot. */
.strip .day { transform: scaleY(0.12); opacity: 0.25; }
.artifact.is-live .strip .day { animation: rise var(--dur-slow) var(--ease-out) forwards; animation-delay: var(--d, 0ms); }
@keyframes rise { to { transform: scaleY(1); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .strip .day { transform: none; opacity: 1; } }

.artifact-note { margin-top: var(--space-7); padding-top: var(--space-6); border-top: 1px solid var(--border-subtle); font-size: var(--text-sm); color: var(--color-text-muted); }

/* ========================================================= IMPLEMENTATION ==== */

.impl { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-6); margin-top: var(--space-10); align-items: start; }
@media (max-width: 900px) { .impl { grid-template-columns: 1fr; } }

.impl-card { display: flex; flex-direction: column; height: 100%; }
.impl-card h3 { display: flex; align-items: center; gap: var(--space-3); margin-bottom: var(--space-2); }
.impl-card .kicker { font-family: var(--font-mono); font-size: var(--text-2xs); letter-spacing: var(--tracking-wider); text-transform: uppercase; color: var(--color-text-muted); display: block; margin-bottom: var(--space-4); }
.impl-list { list-style: none; margin: 0 0 var(--space-6); padding: 0; }
.impl-list li { position: relative; padding-left: var(--space-6); margin-bottom: var(--space-3); font-size: var(--text-sm); color: var(--text-body); }
.impl-list li::before {
  content: ""; position: absolute; left: 0; top: 0.55em;
  width: 8px; height: 8px; border-radius: 2px; background: var(--lv3-line);
}
.impl-list.is-proposed li::before { background: transparent; border: 1.5px dashed var(--eng-blue-400); border-radius: 2px; top: 0.45em; }
.impl-list code { font-size: var(--text-xs); background: var(--surface-inset); padding: 2px 5px; border-radius: var(--radius-xs); color: var(--text-strong); }
.impl-card .foot { margin-top: auto; padding-top: var(--space-5); border-top: 1px solid var(--border-subtle); font-size: var(--text-xs); color: var(--color-text-muted); }

.pill-row { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-bottom: var(--space-5); }
.pill {
  font-family: var(--font-mono); font-size: var(--text-2xs); letter-spacing: var(--tracking-wide);
  text-transform: uppercase; padding: 4px var(--space-2-5); border-radius: var(--radius-pill);
  border: 1px solid var(--border-default); color: var(--color-text-muted); background: var(--surface-sunken);
}
.pill--l3 { color: var(--lv3-fg); background: var(--lv3-bg); border-color: transparent; }
.pill--l4 { color: var(--lv4-fg); background: var(--lv4-bg); border-color: transparent; }

/* ============================================================== ECOSYSTEM ==== */

.eco { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-5); margin-top: var(--space-8); }
@media (max-width: 900px) { .eco { grid-template-columns: 1fr; } }
.eco .card { padding: var(--space-6); display: flex; flex-direction: column; gap: var(--space-3); }
.eco h4 { font-size: var(--text-base); }
.eco p { font-size: var(--text-sm); color: var(--color-text-muted); margin: 0; }
.eco .link-arrow { margin-top: auto; padding-top: var(--space-2); }

/* ================================================================== CTA  ==== */

.cta {
  background: var(--surface-ink); color: var(--text-on-ink);
  border-radius: var(--radius-2xl); padding: var(--space-16) var(--space-12);
  position: relative; overflow: hidden; text-align: center;
}
.cta::after { content: ""; position: absolute; inset: 0; background: var(--gradient-ink-glow); pointer-events: none; }
.cta > * { position: relative; z-index: 2; }
.cta h2 { color: #fff; margin-bottom: var(--space-4); }
.cta p { color: #B9C6D2; max-width: 54ch; margin-left: auto; margin-right: auto; }
.cta .hero-cta { justify-content: center; }
@media (max-width: 700px) { .cta { padding: var(--space-12) var(--space-6); } }

/* =============================================================== FOOTER  ==== */

.site-footer { border-top: 1px solid var(--border-subtle); padding: var(--space-12) 0; margin-top: var(--space-24); }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: var(--space-6); align-items: center; justify-content: space-between; }
.site-footer .small { color: var(--color-text-muted); }
.footer-links { display: flex; flex-wrap: wrap; gap: var(--space-5); }
.footer-links a { font-family: var(--ui-family); font-size: var(--text-sm); color: var(--color-text-muted); }
.footer-links a:hover { color: var(--brand-accent); }

/* ====================================================== LIGHT-MODE AA FIX ==== */
/* A bright hue as small text over a ~0.15-alpha tint of the same hue fails AA
   on a near-white card. Darken the foreground in light mode only. */
/* MUST be :root:not([data-theme="dark"]) — a bare :root matches the html element
   in BOTH themes and would drag these dark AA-safe hues into dark mode. */
:root:not([data-theme="dark"]) .pill--l3,
:root:not([data-theme="dark"]) tr.is-alcove .type-cell { color: #0F6B49; }
:root:not([data-theme="dark"]) .pill--l4,
:root:not([data-theme="dark"]) tr.is-alcove.is-l4 .type-cell { color: #114E67; }
:root:not([data-theme="dark"]) .level--2 .level-id .tag,
:root:not([data-theme="dark"]) .level--2 .level-id .num { color: #7A5300; }
:root:not([data-theme="dark"]) .level--1 .level-id .tag,
:root:not([data-theme="dark"]) .level--1 .level-id .num { color: #8A490C; }

/* ============================================================== SKIP LINK ==== */
.skip {
  position: absolute; left: var(--space-4); top: var(--space-4); z-index: 100;
  transform: translateY(-200%);
  background: var(--surface-card); color: var(--text-strong);
  border: 1px solid var(--border-strong); border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-4);
  font-family: var(--ui-family); font-size: var(--text-sm); font-weight: var(--fw-semibold);
}
.skip:focus { transform: translateY(0); }

/* ============================================================== WORDMARK ==== */

.wordmark {
  display: inline-flex; align-items: center;
  font-family: var(--font-display);
  font-weight: var(--fw-bold);
  letter-spacing: 0.005em;
  color: var(--brand-eng);
  line-height: 1;
  white-space: nowrap;
}
.wordmark .wm-o { display: block; flex: none; }
/* .hero-mark sets display:block earlier in this file; .wordmark's inline-flex
   would otherwise win on source order and park the mark beside the chip. */
.wordmark.hero-mark { display: flex; width: fit-content; }
.wordmark--sm { font-size: 22px; }
.wordmark--sm .wm-o { width: 22px; height: 22px; margin: 0 1px; }
.wordmark--lg { font-size: 46px; }
.wordmark--lg .wm-o { width: 46px; height: 46px; margin: 0 2px; }
[data-theme="dark"] .wordmark { color: var(--eng-blue-300); }
.hero .wordmark { color: var(--eng-blue-300); }

@media (max-width: 560px) {
  .wordmark--lg { font-size: 34px; }
  .wordmark--lg .wm-o { width: 34px; height: 34px; }
}

/* ================================================================ LADDER ==== */

.ladder { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2-5); }
.ladder-row {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  background: var(--rung-bg);
  border-left: 3px solid var(--rung-line);
}
.ladder-row .lv {
  font-family: var(--font-mono); font-size: var(--text-2xs); font-weight: var(--fw-bold);
  letter-spacing: var(--tracking-wide); color: var(--rung-fg);
  width: 1.2em; flex: none;
}
.ladder-row .txt { font-size: var(--text-sm); color: var(--text-body); }
.ladder-row .txt em { font-style: italic; font-weight: var(--fw-bold); }
.ladder--1 { --rung-bg: var(--lv1-bg); --rung-line: var(--lv1-line); --rung-fg: var(--lv1-fg); margin-right: 24%; }
.ladder--2 { --rung-bg: var(--lv2-bg); --rung-line: var(--lv2-line); --rung-fg: var(--lv2-fg); margin-right: 16%; }
.ladder--3 { --rung-bg: var(--lv3-bg); --rung-line: var(--lv3-line); --rung-fg: var(--lv3-fg); margin-right: 8%; }
.ladder--4 { --rung-bg: var(--lv4-bg); --rung-line: var(--lv4-line); --rung-fg: var(--lv4-fg); }
:root:not([data-theme="dark"]) .ladder--1 .lv { color: #8A490C; }
:root:not([data-theme="dark"]) .ladder--2 .lv { color: #7A5300; }
:root:not([data-theme="dark"]) .ladder--3 .lv { color: #0F6B49; }
:root:not([data-theme="dark"]) .ladder--4 .lv { color: #114E67; }

@media (max-width: 560px) {
  .ladder--1, .ladder--2, .ladder--3 { margin-right: 0; }
}

/* ============================================================ UTILITIES ==== */

.visually-hidden-caption {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

img, svg, video { max-width: 100%; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
