/* R ONE map style. Riviosa Gothic Book 400 only; black and white with a small red accent; light and dark. */
@font-face { font-family: "Riviosa Gothic"; font-weight: 400; font-style: normal; font-display: swap;
  src: url("/assets/fonts/riviosa-gothic-book.woff2") format("woff2"); }

:root {
  color-scheme: light;
  --bg: #ffffff; --surface: #f5f5f7; --card: #ffffff; --ink: #1d1d1f; --ink-2: #424245; --muted: #6e6e73;
  --line: #d2d2d7; --line-soft: #e8e8ed; --invert-bg: #1d1d1f; --invert-ink: #ffffff;
  --accent: #b0261c; --accent-ink: #b0261c;
  --radius: 14px; --gap: clamp(16px, 2.6vw, 28px);
  --font: "Riviosa Gothic", -apple-system, "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
  --dur: 180ms;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark; --bg: #000; --surface: #161617; --card: #1d1d1f; --ink: #f5f5f7; --ink-2: #d2d2d7; --muted: #a1a1a6;
    --line: #424245; --line-soft: #2c2c2e; --invert-bg: #f5f5f7; --invert-ink: #000; --accent: #c9352a; --accent-ink: #ff6b5f;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark; --bg: #000; --surface: #161617; --card: #1d1d1f; --ink: #f5f5f7; --ink-2: #d2d2d7; --muted: #a1a1a6;
  --line: #424245; --line-soft: #2c2c2e; --invert-bg: #f5f5f7; --invert-ink: #000; --accent: #c9352a; --accent-ink: #ff6b5f;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 17px/1.5 var(--font); letter-spacing: -0.005em; -webkit-font-smoothing: antialiased; }
*, *::before, *::after { font-weight: 400 !important; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { line-height: 1.12; letter-spacing: -0.02em; }
a { color: inherit; text-underline-offset: 4px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--invert-bg); color: var(--invert-ink); padding: 8px 12px; border-radius: 8px; z-index: 10; }
.skip:focus { left: 8px; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

.top { position: sticky; top: 0; z-index: 5; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; height: 56px; padding: 0 max(16px, 3vw);
  background: color-mix(in srgb, var(--bg) 84%, transparent); backdrop-filter: saturate(180%) blur(18px); -webkit-backdrop-filter: saturate(180%) blur(18px); border-bottom: 1px solid var(--line-soft); }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 7px; background: var(--accent); color: #fff; font-size: 15px; flex: none; }
.brand-title { font-size: 17px; letter-spacing: .02em; white-space: nowrap; }
.top-mid { justify-self: center; color: var(--muted); font-size: 14px; }
.top-right { justify-self: end; display: flex; align-items: center; gap: 10px; }
.theme-btn { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: transparent; cursor: pointer; }
.theme-btn:hover { background: var(--surface); }

main { max-width: 1180px; margin: 0 auto; padding: 0 max(16px, 3vw) 64px; }
.hero { text-align: center; padding: clamp(40px, 7vw, 88px) 0 clamp(20px, 4vw, 40px); }
.hero h1 { font-size: clamp(32px, 5.4vw, 56px); max-width: 22ch; margin: 0 auto; text-wrap: balance; }
.lede { color: var(--muted); max-width: 660px; margin: 16px auto 0; font-size: clamp(16px, 1.6vw, 19px); }
.eyebrow { color: var(--muted); font-size: 13px; letter-spacing: .08em; text-transform: uppercase; margin-bottom: 8px; }
.sec-h { font-size: clamp(26px, 3.4vw, 40px); margin-bottom: 10px; }
.sec-sub { color: var(--muted); margin-bottom: 20px; max-width: 760px; }
.panel { margin-top: clamp(56px, 8vw, 104px); }
.center { text-align: center; margin-left: auto; margin-right: auto; }

/* Segmented control */
.seg { display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; margin: 4px auto 22px; background: var(--surface); border-radius: 999px; padding: 3px; width: fit-content; max-width: 100%; }
.seg button { border: 0; background: transparent; border-radius: 999px; padding: 7px 18px; cursor: pointer; font-size: 15px; color: var(--muted); min-height: 36px; }
.seg button[aria-selected="true"], .seg button[aria-pressed="true"] { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }

/* Map */
.stage { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: var(--gap); align-items: stretch; }
.map-wrap { background: var(--surface); border-radius: 20px; padding: var(--gap); container-type: inline-size; min-width: 0; }
.group { display: grid; gap: 10px; }
.group + .group { margin-top: 14px; }
.group-title { font-size: 12px; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; }
.group-nodes { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.group.box { border: 1.5px solid var(--ink); border-radius: 16px; padding: 12px; background: var(--bg); }
.group.branch { border-left: 1.5px dashed var(--line); padding-left: 12px; margin-left: 6px; }
.node { position: relative; text-align: left; cursor: pointer; border: 1px solid var(--line); background: var(--card); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; min-height: 64px;
  transition: border-color var(--dur), background var(--dur), color var(--dur), opacity var(--dur); }
.node:hover { border-color: var(--ink-2); }
.node .n-kind { font-size: 12px; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; padding-right: 16px; }
.node .n-name { font-size: 18px; letter-spacing: -0.01em; }
.node .n-tag { font-size: 14px; color: var(--muted); }
.node .n-ev { position: absolute; top: 12px; right: 12px; width: 10px; height: 10px; border-radius: 50%; }
.node[aria-pressed="true"] { background: var(--invert-bg); color: var(--invert-ink); border-color: var(--invert-bg); }
.node[aria-pressed="true"] .n-kind, .node[aria-pressed="true"] .n-tag { color: color-mix(in srgb, var(--invert-ink) 70%, transparent); }
.node[aria-pressed="true"] .n-ev { --dot: var(--invert-ink); }
/* Selection and relationships are shown with borders, never by fading text: every node keeps full contrast. */
.map.has-sel .node.linked:not([aria-pressed="true"]) { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }.node[hidden] { display: none; }

/* Status marks are shapes so they read in black and white. */
.n-ev, .dot { --dot: var(--ink); }
.st-fill { background: var(--dot); }
.st-ring { background: transparent; box-shadow: inset 0 0 0 3px var(--dot); }
.st-dash { background: transparent; border: 1.5px dashed var(--dot); }
.st-dot { background: transparent; border: 1.5px dotted var(--dot); }
.st-red { background: var(--accent); }
.st-hollow { background: transparent; border: 1.5px solid var(--dot); }
.st-faint { background: transparent; border: 1.5px solid var(--line); }
.top-link { font-size: 14px; color: var(--muted); white-space: nowrap; }
@media (max-width: 480px) { .brand-title { display: none; } }
.legend { list-style: none; padding: 0; margin: 18px 0 0; display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: center; font-size: 13px; color: var(--muted); }
.legend li { display: inline-flex; align-items: center; gap: 7px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; padding: 3px 11px 3px 9px; border-radius: 999px; background: var(--surface); color: var(--ink-2); white-space: nowrap; }

.inspector { position: sticky; top: 72px; align-self: start; height: min(calc(100vh - 88px), 780px); min-height: 420px; background: var(--card); border: 1px solid var(--line-soft); border-radius: 20px; }
.ins-scroll { position: absolute; inset: 0; overflow: auto; padding: 22px; border-radius: 20px; }
.ins-scroll:focus { outline: none; }
.ins-kind { font-size: 12px; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; }
.inspector h2 { font-size: 28px; margin: 4px 0 10px; }
.inspector h3 { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 18px 0 6px; }
.inspector ul { margin: 0; padding-left: 18px; }
.inspector li { margin: 3px 0; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; font-size: 15px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.unknown { color: var(--muted); font-style: italic; }
.blocker { color: var(--accent-ink); }
.links { display: flex; flex-wrap: wrap; gap: 6px; }
.link-btn { border: 1px solid var(--line); background: transparent; border-radius: 999px; padding: 4px 13px; cursor: pointer; font-size: 14px; min-height: 32px; }
.link-btn:hover { background: var(--surface); }
.go { display: inline-block; margin-top: 8px; }
.go::after { content: " →"; }

/* Cards, tables, buttons */
.cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.card { background: var(--surface); border-radius: var(--radius); padding: 22px; }
.card h3 { font-size: 21px; margin-bottom: 8px; }
.card p { color: var(--muted); }
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--line-soft); background: var(--card); }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
thead th { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
tbody tr:last-child th, tbody tr:last-child td { border-bottom: 0; }
caption { caption-side: bottom; text-align: left; padding: 10px 14px; font-size: 13px; color: var(--muted); }
tr.flagged th, tr.flagged td { background: color-mix(in srgb, var(--accent) 7%, transparent); }
td.gap { color: var(--accent-ink); }
.btn { border-radius: 999px; padding: 9px 22px; cursor: pointer; font-size: 15px; min-height: 42px; border: 1px solid transparent; text-decoration: none; display: inline-flex; align-items: center; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.secondary { background: transparent; color: var(--ink); border-color: var(--ink); }
.btn.tertiary { background: transparent; color: var(--ink); padding: 6px 2px; min-height: 36px; text-decoration: underline; }
.btn:disabled { opacity: .3; cursor: default; }
.ctl { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin-top: 20px; }

/* Walkthrough */
.stepper { list-style: none; margin: 0 0 16px; padding: 0; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }
.stepper button { width: 100%; height: 100%; text-align: left; cursor: pointer; border: 1px solid var(--line-soft); background: var(--surface); border-radius: 10px; padding: 9px 10px; display: grid; gap: 2px; min-height: 60px; }
.stepper .s-n { font-size: 12px; color: var(--muted); }
.stepper .s-l { font-size: 14px; line-height: 1.2; }
.stepper button[aria-current="step"] { background: var(--invert-bg); color: var(--invert-ink); border-color: var(--invert-bg); }
.stepper button[aria-current="step"] .s-n { color: color-mix(in srgb, var(--invert-ink) 70%, transparent); }
.stepper button.stale { border: 1px dashed var(--ink); }
.stepper button.stale .s-n::after { content: " · stale"; }
.walk { display: grid; grid-template-columns: 1.4fr 1fr; gap: 12px; }
.walk-card { background: var(--surface); border-radius: var(--radius); padding: 24px; display: grid; gap: 12px; align-content: start; min-width: 0; }
.walk-card h3 { font-size: 24px; }
.walk-card .chip { background: var(--card); }
.meta { display: flex; flex-wrap: wrap; gap: 6px; }
.persp { padding-left: 12px; border-left: 2px solid var(--ink); color: var(--ink-2); }
.rec { font: 14px/1.6 var(--mono); background: var(--card); border-radius: 10px; padding: 12px 14px; margin: 0; white-space: pre-wrap; word-break: break-word; }
.rec .k { color: var(--muted); }
.note { font-size: 15px; color: var(--ink-2); }
.note .lbl { color: var(--accent-ink); }

.banner { margin: 16px auto 0; max-width: 760px; text-align: center; font-size: 14px; color: var(--muted); border: 1px dashed var(--line); border-radius: 12px; padding: 10px 14px; }
.filters { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-bottom: 16px; }
.filters button { border: 1px solid var(--line); background: transparent; border-radius: 999px; padding: 5px 14px; cursor: pointer; font-size: 14px; min-height: 34px; display: inline-flex; align-items: center; gap: 7px; }
.filters button[aria-pressed="true"] { background: var(--invert-bg); color: var(--invert-ink); border-color: var(--invert-bg); }
.filters button[aria-pressed="true"] .dot { --dot: var(--invert-ink); }
.foot { margin-top: 72px; padding-top: 20px; border-top: 1px solid var(--line-soft); text-align: center; color: var(--muted); font-size: 13px; }
.foot a { color: var(--muted); }

/* Utility and owner inventory */
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.gap-top { margin-top: 10px; }
.after-cards { margin-top: 16px; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: 14px; color: var(--muted); }
.statusbar { display: flex; gap: 12px; align-items: center; justify-content: center; flex-wrap: wrap; margin: 14px auto 0; max-width: 760px; color: var(--muted); font-size: 15px; }
.statusbar .blocker, #status.blocker { color: var(--accent-ink); }
.btn.small { min-height: 34px; padding: 5px 16px; font-size: 14px; }
.inv-tools { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-bottom: 10px; }
.search input { min-width: min(320px, 70vw); border: 1px solid var(--line); border-radius: 999px; padding: 8px 16px; background: var(--card); min-height: 40px; }
.filter-btn { border: 1px solid var(--line); background: transparent; border-radius: 999px; padding: 6px 16px; cursor: pointer; font-size: 15px; min-height: 40px; }
.filter-btn[aria-pressed="true"] { background: var(--invert-bg); color: var(--invert-ink); border-color: var(--invert-bg); }
.inv-count { text-align: center; color: var(--muted); font-size: 14px; margin-bottom: 14px; }
.inv-group + .inv-group { margin-top: 22px; }
.inv-group .group-title { margin-bottom: 8px; }
.inv-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); }
.inv-row { background: var(--surface); border-radius: var(--radius); padding: 14px 16px; display: grid; gap: 6px; border: 1px solid transparent; min-width: 0; }
.inv-row.sel { border-color: var(--ink); }
.inv-row.attn { box-shadow: inset 3px 0 0 var(--accent); }
.inv-main { all: unset; cursor: pointer; display: grid; gap: 6px; }
.inv-main:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: 6px; }
.inv-name { font-size: 18px; }
.inv-main .chip { justify-self: start; background: var(--card); }
.inv-meta, .inv-src { font-size: 13px; color: var(--muted); }
.inv-note { font-size: 14px; }
.inv-open .go { margin-top: 0; }
/* Out-of-date list: dashed outlines plus the status text; text keeps full contrast. */
body.stale .inv-row, body.stale .map-wrap { outline: 1.5px dashed var(--accent); outline-offset: -1.5px; }
p.center { text-align: center; }

@media (max-width: 1020px) {
  .stage { grid-template-columns: 1fr; }
  .inspector { position: static; height: auto; min-height: 0; }
  .ins-scroll { position: static; }
  .stepper { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .top { grid-template-columns: auto 1fr auto; }
  .top-mid { display: none; }
  .walk { grid-template-columns: 1fr; }
  .stepper { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 400px) {
  body { font-size: 16px; }
  .group-nodes { grid-template-columns: 1fr; }
  .walk-card, .card { padding: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
