/* Roadmaps by jurisdiction. Self-contained: does not rely on Tailwind utilities
   inside the roadmap components. Every component class starts with rm-. */

:root {
  --rm-gold: #f2ca50;
  --rm-gold-hi: #f7d87a;
  --rm-ink: #e2e0fa;
  --rm-muted: #d0c5af;
  --rm-lav: #c1c1ff;
  --rm-bg: #0c0c1e;
  --rm-panel: #1e1e31;
  --rm-panel-lo: #1a1a2c;
  --rm-line: rgba(77, 70, 53, .35);
  --rm-line-hi: rgba(242, 202, 80, .45);
  --rm-rec: #a78bfa;
  --rm-opt: #9ca3af;
  --rm-alt: #34d399;
  --rm-warn: #f2ca50;
  --rm-mid: 240px;      /* width of the middle (stage) column on the desktop track */
  --rm-offset: 96px;    /* fixed header height used for scroll-margin */
}
html[lang="pt-BR"] { --rm-offset: 140px; }
/* Phones: nav-fix.css lets the PT language banner scroll and keeps the nav sticky,
   so the fixed-header padding on <main> would only leave a blank band. */
@media (max-width: 767px) {
  html[lang="pt-BR"] { --rm-offset: 84px; }
  html[lang="pt-BR"] main#main { padding-top: 8px; }
}

/* ---------- Things the pages need that Tailwind lacks or that live inline elsewhere ---------- */
html { scroll-behavior: smooth; }
body { background: var(--rm-bg); color: var(--rm-ink); font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif; }
.material-symbols-outlined { font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24; }
.grid-bg { background-image: radial-gradient(circle at 2px 2px, rgba(77, 70, 53, .15) 1px, transparent 0); background-size: 40px 40px; }
.nav-mobile-menu { display: none; }
.nav-mobile-menu.show { display: flex; }
.lang-notice {
  background-color: #0d1a12;
  background-image: linear-gradient(90deg, rgba(0,150,70,.35) 0%, rgba(0,100,50,.28) 100%);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid rgba(0,230,118,.35);
  box-shadow: 0 2px 10px rgba(0,0,0,.35);
  position: fixed; top: 0; left: 0; right: 0; z-index: 60;
  min-height: 44px; display: flex; align-items: center; justify-content: center;
}
.rm-sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
[hidden] { display: none !important; }

/* ---------- Base inside the roadmap area ---------- */
.rm-wrap, .rm-wrap *, .rm-wrap *::before, .rm-wrap *::after { box-sizing: border-box; }
:where(.rm-wrap) h1, :where(.rm-wrap) h2, :where(.rm-wrap) h3, :where(.rm-wrap) p,
:where(.rm-wrap) ol, :where(.rm-wrap) ul, :where(.rm-wrap) dl, :where(.rm-wrap) dd,
:where(.rm-wrap) table { margin: 0; }
:where(.rm-wrap) ol, :where(.rm-wrap) ul { padding: 0; list-style: none; }
:where(.rm-wrap) button { font: inherit; color: inherit; cursor: pointer; }
:where(.rm-wrap) a { color: var(--rm-gold); }
.rm-wrap { max-width: 1200px; margin: 0 auto; padding: 0 24px 72px; overflow-wrap: anywhere; line-height: 1.6; }
.rm-wrap a, .rm-wrap button { -webkit-tap-highlight-color: transparent; }
.rm-wrap :focus-visible, .rm-lang a:focus-visible { outline: 2px solid var(--rm-gold); outline-offset: 2px; border-radius: 6px; }

.rm-eyebrow, .rm-pill {
  font: 500 .72rem/1.2 'Fira Code', ui-monospace, monospace;
  letter-spacing: .16em; text-transform: uppercase; color: var(--rm-gold);
}
.rm-pill { display: inline-block; border: 1px solid var(--rm-line-hi); background: rgba(242,202,80,.08); border-radius: 999px; padding: 6px 14px; }
.rm-hero { padding: 28px 0 8px; }
.rm-hero h1, .rm-head h1 {
  font-family: 'Space Grotesk', sans-serif; font-weight: 700; letter-spacing: -.03em;
  line-height: 1.08; font-size: clamp(2rem, 5vw, 3.2rem); margin: 14px 0 16px; color: var(--rm-ink);
}
.rm-hero h1 span, .rm-head h1 span { color: var(--rm-gold); }
.rm-hero p, .rm-tagline { color: var(--rm-muted); font-size: 1.08rem; max-width: 760px; margin: 0 0 14px; }
.rm-stats { font: 500 .82rem/1.5 'Fira Code', ui-monospace, monospace; color: var(--rm-lav); margin-top: 14px; }

/* ---------- Buttons and links ---------- */
.rm-btn, .rm-btn--solid {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px;
  border: 1px solid rgba(242,202,80,.4); background: transparent; color: var(--rm-gold);
  border-radius: 10px; padding: 8px 16px; font-size: .88rem; font-weight: 600;
  text-decoration: none; transition: background-color .15s, border-color .15s;
}
.rm-btn:hover { background: rgba(242,202,80,.08); }
.rm-btn--solid { background: var(--rm-gold); color: #0c0c1e; border-color: var(--rm-gold); }
.rm-btn--solid:hover { background: var(--rm-gold-hi); }
.rm-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
html:not(.rm-js) button[data-rm-action] { display: none; }

/* ---------- Breadcrumb ---------- */
.rm-crumbs { padding: 20px 0 0; font-size: .85rem; }
.rm-crumbs ol { display: flex; flex-wrap: wrap; gap: 4px 0; }
.rm-crumbs li { color: var(--rm-muted); }
.rm-crumbs li + li::before { content: "/"; margin: 0 10px; color: rgba(208,197,175,.5); }
.rm-crumbs a { text-decoration: none; }
.rm-crumbs a:hover { text-decoration: underline; }
.rm-crumbs [aria-current] { color: var(--rm-ink); }

/* ---------- Notice ---------- */
.rm-notice {
  background: var(--rm-panel); border: 1px solid var(--rm-line); border-left: 3px solid var(--rm-gold);
  border-radius: 14px; padding: 18px 22px; color: var(--rm-muted); margin: 24px 0 0; line-height: 1.65;
}
.rm-notice strong { color: var(--rm-ink); }
.rm-notice p + p { margin-top: 8px; }
.rm-notice--blocked { background: rgba(242,202,80,.07); border-color: var(--rm-line-hi); border-left-width: 4px; }

/* ---------- Header (jurisdiction page) ---------- */
.rm-head { padding-top: 8px; }
.rm-reg { color: var(--rm-lav); font-size: .95rem; margin: -6px 0 14px; }

/* ---------- Facts strip ---------- */
.rm-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 28px; }
.rm-fact { background: var(--rm-panel-lo); border: 1px solid var(--rm-line); border-radius: 12px; padding: 14px 16px; }
.rm-fact dt { font: 500 .7rem/1.3 'Fira Code', ui-monospace, monospace; letter-spacing: .08em; text-transform: uppercase; color: var(--rm-gold); margin-bottom: 6px; }
.rm-fact dd { color: var(--rm-ink); font-size: .9rem; line-height: 1.55; }

/* ---------- Legend and type toggles ---------- */
.rm-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 32px 0 20px; }
.rm-legend-label { font: 500 .72rem 'Fira Code', ui-monospace, monospace; letter-spacing: .12em; text-transform: uppercase; color: var(--rm-muted); margin-right: 4px; }
.rm-legend-btn {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 6px 14px;
  background: var(--rm-panel-lo); border: 1px solid var(--rm-line); border-left-width: 4px; border-radius: 10px;
  font-size: .88rem; font-weight: 500; color: var(--rm-ink);
}
.rm-legend-btn[data-type="recommended"], .rm-legend-btn--recommended { border-left-color: var(--rm-rec); }
.rm-legend-btn--optional { border-left-color: var(--rm-opt); }
.rm-legend-btn--alternative { border-left-color: var(--rm-alt); }
.rm-legend-btn .rm-ico { width: 16px; height: 16px; }
.rm-legend-btn--recommended .rm-ico { color: var(--rm-rec); }
.rm-legend-btn--optional .rm-ico { color: var(--rm-opt); }
.rm-legend-btn--alternative .rm-ico { color: var(--rm-alt); }
.rm-legend-n { font: 500 .78rem 'Fira Code', ui-monospace, monospace; color: var(--rm-muted); }
.rm-legend-btn[aria-pressed="false"] { opacity: .55; text-decoration: line-through; text-decoration-color: rgba(226,224,250,.4); }
.rm-legend-btn[aria-disabled="true"] { cursor: default; }
.rm-legend-btn:not([aria-disabled="true"]):hover { border-color: var(--rm-line-hi); }
html:not(.rm-js) .rm-legend-btn { pointer-events: none; }
.rm-ico { width: 14px; height: 14px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Layout: stage index + track ---------- */
.rm-layout { display: block; }
.rm-toc { margin: 0 0 22px; }
.rm-toc-title { font: 500 .72rem 'Fira Code', ui-monospace, monospace; letter-spacing: .14em; text-transform: uppercase; color: var(--rm-muted); margin-bottom: 8px; }
.rm-toc ol { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 8px; scroll-snap-type: x proximity; }
.rm-toc li { flex: none; scroll-snap-align: start; }
.rm-toc a {
  display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 6px 12px;
  background: var(--rm-panel-lo); border: 1px solid var(--rm-line); border-radius: 10px;
  color: var(--rm-ink); text-decoration: none; font-size: .85rem; white-space: nowrap;
}
.rm-toc a:hover { border-color: var(--rm-line-hi); }
.rm-toc a[aria-current="true"] { border-color: var(--rm-gold); }
.rm-toc-n { font: 500 .78rem 'Fira Code', ui-monospace, monospace; color: var(--rm-gold); }

/* ---------- Track (mobile first: spine on the left) ---------- */
.rm-track { position: relative; padding-left: 38px; }
.rm-track::before {
  content: ""; position: absolute; left: 13px; top: 0; bottom: 0; width: 4px; border-radius: 2px;
  background: linear-gradient(180deg, rgba(242,202,80,.15), rgba(242,202,80,.55) 8%, rgba(242,202,80,.55) 92%, rgba(242,202,80,.15));
}
.rm-stage { position: relative; padding-bottom: 36px; scroll-margin-top: var(--rm-offset); }
.rm-stage:last-child { padding-bottom: 0; }
.rm-stage-node {
  position: relative; z-index: 1; background: var(--rm-panel); border: 2px solid var(--rm-gold);
  border-radius: 14px; padding: 14px 18px; box-shadow: 0 0 0 4px var(--rm-bg);
}
.rm-stage-node::before {
  content: ""; position: absolute; left: -30px; top: 50%; width: 14px; height: 14px; margin-top: -7px;
  background: var(--rm-gold); border-radius: 50%; box-shadow: 0 0 0 4px var(--rm-bg);
}
.rm-stage-num { display: block; font: 500 .72rem/1.3 'Fira Code', ui-monospace, monospace; letter-spacing: .1em; text-transform: uppercase; color: var(--rm-gold); }
.rm-stage-title { font: 700 1.2rem/1.25 'Space Grotesk', sans-serif; letter-spacing: -.01em; color: var(--rm-ink); margin-top: 4px; }
.rm-topics { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }

.rm-topic {
  position: relative; scroll-margin-top: var(--rm-offset);
  background: var(--rm-panel-lo); border: 1px solid var(--rm-line); border-left: 4px solid var(--rm-rec);
  border-radius: 10px; transition: border-color .15s, background-color .15s;
}
.rm-topic--optional { border-left-color: var(--rm-opt); }
.rm-topic--alternative { border-left-color: var(--rm-alt); }
.rm-topic::before {   /* tick to the spine */
  content: ""; position: absolute; left: -29px; top: 28px; width: 25px; border-top: 2px dotted rgba(242,202,80,.5);
}
.rm-topic:hover { border-color: rgba(242,202,80,.35); }
.rm-topic:has(.rm-node[aria-expanded="true"]) { background: var(--rm-panel); border-color: var(--rm-line-hi); }
.rm-topic--optional:has(.rm-node[aria-expanded="true"]), .rm-topic--optional:hover { border-left-color: var(--rm-opt); }
.rm-topic--alternative:has(.rm-node[aria-expanded="true"]), .rm-topic--alternative:hover { border-left-color: var(--rm-alt); }
.rm-topic--recommended:has(.rm-node[aria-expanded="true"]), .rm-topic--recommended:hover { border-left-color: var(--rm-rec); }
.rm-topic-h { font: inherit; }

.rm-node {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas: "ref title caret" ". type caret";
  column-gap: 12px; row-gap: 6px; align-items: start; width: 100%; min-height: 56px;
  padding: 14px 14px 14px 12px; background: transparent; border: 0; border-radius: 8px;
  text-align: left; color: var(--rm-ink);
}
.rm-node:focus-visible { outline-offset: -2px; }
.rm-ref { grid-area: ref; font: 500 .8rem/1.5 'Fira Code', ui-monospace, monospace; color: var(--rm-gold); padding-top: 1px; min-width: 2.2em; }
.rm-node-title { grid-area: title; font: 600 1rem/1.4 'Space Grotesk', sans-serif; color: var(--rm-ink); }
.rm-type {
  grid-area: type; justify-self: start; display: inline-flex; align-items: center; gap: 6px;
  font: 500 .68rem/1 'Fira Code', ui-monospace, monospace; letter-spacing: .06em; text-transform: uppercase;
  color: var(--rm-rec); border: 1px solid currentColor; border-radius: 6px; padding: 4px 8px 4px 6px;
}
.rm-topic--optional .rm-type { color: var(--rm-opt); }
.rm-topic--alternative .rm-type { color: var(--rm-alt); }
.rm-caret { grid-area: caret; align-self: center; width: 10px; height: 10px; margin: 0 4px; display: none; }
.rm-js .rm-caret { display: block; border-right: 2px solid var(--rm-gold); border-bottom: 2px solid var(--rm-gold); transform: rotate(45deg); transition: transform .15s; }
.rm-js .rm-node[aria-expanded="true"] .rm-caret { transform: rotate(-135deg); }
.rm-js .rm-node { cursor: pointer; }

.rm-panel { padding: 2px 16px 16px 14px; }
.rm-js .rm-panel:not([hidden]) { animation: rm-open .18s ease-out; }
@keyframes rm-open { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.rm-detail { color: var(--rm-ink); font-size: .95rem; line-height: 1.65; margin-left: 0; }
.rm-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 14px 0 0; }
.rm-chips-label { font: 500 .72rem 'Fira Code', ui-monospace, monospace; letter-spacing: .06em; text-transform: uppercase; color: var(--rm-muted); }
.rm-chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 4px 10px;
  border: 1px solid rgba(242,202,80,.4); border-radius: 999px; color: var(--rm-gold);
  font: 500 .76rem/1.3 'Fira Code', ui-monospace, monospace; text-decoration: none;
}
.rm-chip:hover { background: rgba(242,202,80,.1); }
.rm-chip-t { font-family: 'Inter', sans-serif; font-weight: 500; color: var(--rm-ink); }
.rm-chip--related { border-style: dashed; border-color: rgba(193,193,255,.55); color: var(--rm-lav); }
.rm-chip--toc { border-style: dotted; border-color: rgba(208,197,175,.5); color: var(--rm-muted); }
.rm-chip-en { flex-shrink: 0; white-space: nowrap; display: inline-block; font: 500 .62rem 'Fira Code', ui-monospace, monospace; border: 1px solid currentColor; border-radius: 4px; padding: 1px 4px; color: var(--rm-muted); }
.rm-perma { margin: 12px 0 0; font-size: .8rem; }
.rm-perma a { color: var(--rm-muted); }
.rm-perma a:hover { color: var(--rm-gold); }

/* ---------- Desktop track: spine in the middle, topics left and right ---------- */
@media (min-width: 900px) {
  .rm-track { padding-left: 0; }
  .rm-track::before { left: 50%; margin-left: -2px; }
  .rm-stage { display: grid; grid-template-columns: minmax(0, 1fr) var(--rm-mid) minmax(0, 1fr); align-items: start; row-gap: 14px; padding-bottom: 44px; }
  .rm-stage-node { grid-column: 2; grid-row: 1; text-align: center; align-self: start; }
  .rm-stage-node::before { display: none; }
  .rm-topics { display: contents; }
  .rm-topic:nth-child(odd) { grid-column: 1; margin-right: 34px; }
  .rm-topic:nth-child(even) { grid-column: 3; margin-left: 34px; }
  .rm-topic { margin-top: 0; }
  .rm-topic::before {
    top: 28px; left: auto; width: calc(34px + var(--rm-mid) / 2); border-top: 2px dotted rgba(242,202,80,.5);
  }
  .rm-topic:nth-child(odd)::before { right: calc(-34px - var(--rm-mid) / 2 - 1px); }
  .rm-topic:nth-child(even)::before { left: calc(-34px - var(--rm-mid) / 2 - 1px); }
  .rm-topic::after {  /* dot where the connector meets the spine */
    content: ""; position: absolute; top: 23px; width: 10px; height: 10px; border-radius: 50%;
    background: var(--rm-gold); box-shadow: 0 0 0 3px var(--rm-bg);
  }
  .rm-topic:nth-child(odd)::after { right: calc(-34px - var(--rm-mid) / 2 - 5px); }
  .rm-topic:nth-child(even)::after { left: calc(-34px - var(--rm-mid) / 2 - 5px); }
  .rm-topic:nth-child(odd)::after, .rm-topic:nth-child(even)::after { z-index: 0; }
  .rm-stage-title { font-size: 1.25rem; }
  /* An open topic spans the full track width so long text is not squeezed into one column. */
  .rm-topic:has(.rm-node[aria-expanded="true"]) {
    grid-column: 1 / -1; margin-left: 0; margin-right: 0; background: var(--rm-bg); z-index: 1;
  }
  .rm-topic:has(.rm-node[aria-expanded="true"])::before,
  .rm-topic:has(.rm-node[aria-expanded="true"])::after { display: none; }
  .rm-topic:has(.rm-node[aria-expanded="true"]) .rm-detail { max-width: 78ch; }
}
@media (min-width: 1100px) { :root { --rm-mid: 280px; } }

/* Stage index becomes a sticky sidebar */
@media (min-width: 1200px) {
  .rm-layout { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 36px; align-items: start; }
  .rm-toc { position: sticky; top: calc(var(--rm-offset) + 8px); margin: 0; max-height: calc(100vh - var(--rm-offset) - 32px); overflow-y: auto; }
  .rm-toc ol { flex-direction: column; overflow: visible; padding: 0; }
  .rm-toc a { white-space: normal; align-items: flex-start; padding: 8px 12px; }
  .rm-toc-n { padding-top: 1px; }
}

/* ---------- Pitfalls, sources, related, disclaimer, pager ---------- */
.rm-section { margin-top: 56px; scroll-margin-top: var(--rm-offset); }
.rm-section > h2, .rm-howto > h2 { font: 700 clamp(1.4rem, 3vw, 1.9rem)/1.2 'Space Grotesk', sans-serif; letter-spacing: -.02em; color: var(--rm-ink); margin-bottom: 14px; }
.rm-pitfalls { display: grid; gap: 10px; }
.rm-pitfalls li { position: relative; background: var(--rm-panel-lo); border: 1px solid var(--rm-line); border-left: 3px solid var(--rm-gold); border-radius: 10px; padding: 12px 16px; color: var(--rm-ink); font-size: .93rem; line-height: 1.6; }
.rm-sources { counter-reset: src; display: grid; gap: 8px; }
.rm-sources li { counter-increment: src; display: grid; grid-template-columns: 2.2em minmax(0, 1fr); font-size: .9rem; }
.rm-sources li::before { content: counter(src) "."; font: 500 .8rem/1.7 'Fira Code', ui-monospace, monospace; color: var(--rm-muted); }
.rm-sources a { color: var(--rm-ink); text-decoration-color: rgba(242,202,80,.5); text-underline-offset: 3px; }
.rm-sources a:hover { color: var(--rm-gold); }
.rm-host { font: 500 .74rem 'Fira Code', ui-monospace, monospace; color: var(--rm-muted); margin-left: 8px; white-space: nowrap; }
.rm-related-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.rm-related-list a {
  display: block; height: 100%; background: var(--rm-panel); border: 1px solid var(--rm-line); border-radius: 12px;
  padding: 14px 16px; color: var(--rm-ink); text-decoration: none; font-size: .92rem; min-height: 44px;
}
.rm-related-list a:hover { border-color: var(--rm-line-hi); color: var(--rm-gold); }
.rm-disclaimer { margin-top: 40px; color: var(--rm-muted); font-size: .88rem; border-top: 1px solid var(--rm-line); padding-top: 18px; max-width: 760px; }
.rm-pager { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; margin-top: 40px; align-items: stretch; }
.rm-pager a { display: flex; flex-direction: column; justify-content: center; gap: 2px; min-height: 56px; background: var(--rm-panel); border: 1px solid var(--rm-line); border-radius: 12px; padding: 10px 16px; text-decoration: none; color: var(--rm-ink); }
.rm-pager a:hover { border-color: var(--rm-line-hi); }
.rm-pager small { font: 500 .68rem 'Fira Code', ui-monospace, monospace; letter-spacing: .1em; text-transform: uppercase; color: var(--rm-gold); }
.rm-pager .rm-next { text-align: right; }
.rm-pager .rm-all { align-items: center; text-align: center; }
.rm-lang {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; margin-top: 40px;
  background: var(--rm-panel-lo); border: 1px solid var(--rm-line); border-radius: 14px; padding: 18px 22px; color: var(--rm-muted);
}
.rm-lang a { color: var(--rm-gold); font-weight: 600; }
.rm-print-only { display: none; }

/* ---------- Index page ---------- */
.rm-filters { display: none; margin-top: 28px; padding: 18px 20px; background: var(--rm-panel-lo); border: 1px solid var(--rm-line); border-radius: 14px; }
.rm-js .rm-filters { display: block; }
.rm-filter-group { border: 0; padding: 0; margin: 0 0 14px; min-width: 0; }
.rm-filter-group legend { font: 500 .72rem 'Fira Code', ui-monospace, monospace; letter-spacing: .12em; text-transform: uppercase; color: var(--rm-muted); padding: 0; margin-bottom: 8px; }
.rm-filter-row { display: flex; flex-wrap: wrap; gap: 8px; }
.rm-chipbtn {
  min-height: 36px; padding: 6px 14px; background: transparent; color: var(--rm-ink);
  border: 1px solid var(--rm-line); border-radius: 999px; font-size: .85rem; font-weight: 500;
  transition: background-color .15s, border-color .15s;
}
.rm-chipbtn:hover { border-color: var(--rm-line-hi); }
.rm-chipbtn[aria-pressed="true"] { background: var(--rm-gold); color: #0c0c1e; border-color: var(--rm-gold); font-weight: 600; }
.rm-count { font: 500 .82rem 'Fira Code', ui-monospace, monospace; color: var(--rm-lav); margin: 4px 0 0; }

.rm-group { margin-top: 36px; }
.rm-region { font: 700 1.15rem 'Space Grotesk', sans-serif; color: var(--rm-gold); margin-bottom: 12px; }
.rm-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
.rm-card { position: relative; background: var(--rm-panel); border: 1px solid var(--rm-line); border-radius: 16px; transition: border-color .15s, transform .15s; }
.rm-card:hover { border-color: rgba(242,202,80,.55); }
.rm-card[data-status="blocked"] { border-color: var(--rm-line-hi); box-shadow: inset 0 0 0 1px rgba(242,202,80,.25); }
.rm-card-link { display: flex; flex-direction: column; height: 100%; padding: 18px; color: inherit; text-decoration: none; border-radius: 16px; }
.rm-code { display: inline-grid; place-items: center; width: 44px; height: 32px; margin-bottom: 12px; background: rgba(242,202,80,.1); border: 1px solid var(--rm-line-hi); border-radius: 8px; font: 700 .85rem 'Fira Code', ui-monospace, monospace; color: var(--rm-gold); letter-spacing: .04em; }
.rm-card-title { font: 700 1.2rem/1.25 'Space Grotesk', sans-serif; color: var(--rm-ink); }
.rm-card-reg { font-size: .82rem; color: var(--rm-lav); margin: 2px 0 12px; line-height: 1.4; }
.rm-card-facts { display: grid; align-content: start; gap: 8px; margin-bottom: 14px; flex: 1; }
.rm-card-facts dt { font: 500 .66rem 'Fira Code', ui-monospace, monospace; letter-spacing: .08em; text-transform: uppercase; color: var(--rm-muted); }
.rm-card-facts dd { font-size: .86rem; color: var(--rm-ink); line-height: 1.45; }
.rm-flag { display: inline-block; vertical-align: middle; margin-left: 8px; font: 500 .62rem/1 'Fira Code', ui-monospace, monospace; letter-spacing: .06em; text-transform: uppercase; color: var(--rm-warn); border: 1px solid rgba(242,202,80,.5); background: rgba(242,202,80,.08); border-radius: 6px; padding: 4px 7px; }
.rm-diff { display: flex; align-items: center; gap: 10px; font-size: .82rem; font-weight: 600; color: var(--rm-ink); margin-bottom: 8px; }
.rm-diff-bar { --lv: 3; --c: #f2ca50; flex: none; width: 58px; height: 6px; border-radius: 3px; background: linear-gradient(90deg, var(--c) calc(var(--lv) * 20%), rgba(226,224,250,.14) 0);
  -webkit-mask: repeating-linear-gradient(90deg, #000 0 10px, transparent 10px 12px); mask: repeating-linear-gradient(90deg, #000 0 10px, transparent 10px 12px); }
.rm-diff--medium .rm-diff-bar { --lv: 1; --c: #34d399; }
.rm-diff--medium-high .rm-diff-bar { --lv: 2; --c: #a3e635; }
.rm-diff--high .rm-diff-bar { --lv: 3; --c: #f2ca50; }
.rm-diff--very-high .rm-diff-bar { --lv: 4; --c: #fb923c; }
.rm-diff--blocked .rm-diff-bar { --lv: 5; --c: #ffb4ab; }
.rm-card-foot { font: 500 .72rem 'Fira Code', ui-monospace, monospace; color: var(--rm-gold); }

.rm-table-wrap { margin-top: 14px; overflow-x: auto; border: 1px solid var(--rm-line); border-radius: 14px; background: var(--rm-panel); }
.rm-compare { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .86rem; min-width: 980px; }
.rm-compare caption { text-align: left; }
.rm-compare th, .rm-compare td { text-align: left; vertical-align: top; padding: 12px 14px; border-bottom: 1px solid var(--rm-line); color: var(--rm-ink); line-height: 1.5; }
.rm-compare thead th { font: 500 .68rem 'Fira Code', ui-monospace, monospace; letter-spacing: .08em; text-transform: uppercase; color: var(--rm-gold); background: var(--rm-panel-lo); white-space: nowrap; position: sticky; top: 0; }
.rm-compare tbody th { position: sticky; left: 0; background: var(--rm-panel); font-weight: 600; min-width: 150px; box-shadow: 1px 0 0 var(--rm-line); }
.rm-compare tbody th a { color: var(--rm-ink); text-decoration: none; }
.rm-compare tbody th a:hover { color: var(--rm-gold); text-decoration: underline; }
.rm-compare tbody tr:last-child th, .rm-compare tbody tr:last-child td { border-bottom: 0; }
.rm-compare .rm-diff { margin: 0; white-space: nowrap; }

.rm-howto { margin-top: 56px; }
.rm-howto-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.rm-howto-item { background: var(--rm-panel-lo); border: 1px solid var(--rm-line); border-left: 4px solid var(--rm-rec); border-radius: 10px; padding: 14px 16px; color: var(--rm-muted); font-size: .9rem; }
.rm-howto-item--optional { border-left-color: var(--rm-opt); }
.rm-howto-item--alternative { border-left-color: var(--rm-alt); }
.rm-howto-item .rm-type { margin-bottom: 8px; }
.rm-howto-item--optional .rm-type { color: var(--rm-opt); }
.rm-howto-item--alternative .rm-type { color: var(--rm-alt); }

/* ---------- Breakpoints ---------- */
@media (min-width: 640px) { .rm-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .rm-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1200px) { .rm-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 1023px) { .rm-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 899px) {
  .rm-node, .rm-chipbtn, .rm-chip, .rm-legend-btn { min-height: 44px; }
  .rm-chip { padding: 8px 12px; }
  .rm-chipbtn { min-height: 44px; }
}
@media (max-width: 759px) {
  .rm-howto-grid, .rm-related-list { grid-template-columns: 1fr; }
  .rm-pager { grid-template-columns: 1fr 1fr; }
  .rm-pager .rm-all { grid-column: 1 / -1; grid-row: 2; }
  /* comparison table becomes stacked cards */
  .rm-table-wrap { border: 0; background: transparent; overflow: visible; }
  .rm-compare, .rm-compare tbody, .rm-compare tr, .rm-compare th, .rm-compare td { display: block; min-width: 0; width: 100%; }
  .rm-compare thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
  .rm-compare tbody tr { background: var(--rm-panel); border: 1px solid var(--rm-line); border-radius: 14px; margin-bottom: 12px; padding: 6px 0; }
  .rm-compare tbody th { position: static; box-shadow: none; background: transparent; font: 700 1.05rem 'Space Grotesk', sans-serif; border-bottom: 1px solid var(--rm-line); }
  .rm-compare td { border-bottom: 0; padding: 6px 14px; }
  .rm-compare td::before { content: attr(data-label); display: block; font: 500 .66rem 'Fira Code', ui-monospace, monospace; letter-spacing: .08em; text-transform: uppercase; color: var(--rm-muted); }
}
@media (max-width: 639px) {
  .rm-facts { grid-template-columns: 1fr; }
  .rm-wrap { padding: 0 16px 56px; }
}
@media (max-width: 480px) {
  .rm-detail, .rm-chips, .rm-perma { margin-left: 0; }
  .rm-actions .rm-btn, .rm-actions .rm-btn--solid { flex: 1 1 calc(50% - 5px); justify-content: center; }
}

/* ---------- Motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Print ---------- */
@media print {
  html, body { background: #fff !important; color: #000 !important; }
  #main-nav, .lang-notice, footer, .rm-actions, .rm-legend, .rm-filters, .rm-pager, .rm-toc, .rm-lang,
  .rm-caret, .rm-perma, .rm-chips-label, #cookie-banner, .cookie-banner, [id*="cookie"], .grid-bg::before { display: none !important; }
  .grid-bg { background-image: none !important; }
  main { padding-top: 0 !important; }
  .rm-wrap { max-width: none; padding: 0; color: #000; }
  .rm-wrap, .rm-wrap * { text-shadow: none !important; box-shadow: none !important; animation: none !important; }
  .rm-hero h1, .rm-head h1, .rm-section > h2, .rm-stage-title, .rm-node-title, .rm-detail, .rm-fact dd, .rm-pitfalls li, .rm-sources a, .rm-sources li, .rm-card-title { color: #000 !important; }
  .rm-hero p, .rm-tagline, .rm-reg, .rm-stats, .rm-disclaimer, .rm-host, .rm-fact dt, .rm-eyebrow, .rm-ref, .rm-stage-num, .rm-chip-t, .rm-chip { color: #333 !important; }
  .rm-head h1 span, .rm-hero h1 span { color: #000 !important; }
  .rm-wrap a, .rm-crumbs [aria-current] { color: #000 !important; }
  .rm-panel[hidden] { display: block !important; }
  .rm-topic[hidden] { display: none !important; }
  .rm-track { padding-left: 0; }
  .rm-track::before, .rm-topic::before, .rm-topic::after, .rm-stage-node::before { display: none !important; }
  .rm-stage { display: block; padding-bottom: 18px; }
  .rm-stage-node { background: #f2ca50 !important; border: 2px solid #000; text-align: left; break-after: avoid; page-break-after: avoid; break-inside: avoid; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .rm-topics { display: block; margin-top: 10px; }
  .rm-topic { display: block; margin: 0 0 8px !important; background: #fff !important; border: 1px solid #000 !important; border-left-width: 5px !important; break-inside: avoid; page-break-inside: avoid; }
  .rm-topic--optional { border-left-style: dashed; }
  .rm-topic--alternative { border-left-style: double; }
  .rm-node { min-height: 0; padding: 8px 10px; }
  .rm-type { color: #000 !important; }
  .rm-panel { padding: 0 10px 10px; }
  .rm-detail, .rm-chips { margin-left: 0; }
  .rm-chips { margin-top: 6px; }
  .rm-fact, .rm-pitfalls li, .rm-notice { background: #fff !important; border-color: #888 !important; color: #000 !important; }
  .rm-facts { grid-template-columns: repeat(2, 1fr); }
  .rm-sources a::after { content: " (" attr(href) ")"; font-size: .8em; word-break: break-all; }
  .rm-host { display: none; }
  .rm-print-only { display: block; font-size: .8rem; color: #333; margin: 6px 0 14px; }
  .rm-section { margin-top: 22px; }
  .rm-chip { border-color: #888 !important; }
  .rm-related-list a { border-color: #888; color: #000 !important; background: #fff; }
}
