:root {
  /* Palette ported from the legacy "Layout: Rogue" CMSMS stylesheet
     (rogue.rogueforge.net): navy links, slate-teal chrome, amber-gold
     accent bar, light blue-gray hovers. */
  --bg: #cccccc;
  --paper: #ffffff;
  --panel: #385c72;
  --ink: #333333;
  --ink-soft: #5a6b76;
  --line: #c0c0c0;
  --accent: #18507c;
  --accent-strong: #294b5f;
  --gold: #e7ab0b;
  --hover: #c3d4df;
  --cream: #ffe9af;
  --code-bg: #e4e4e4;
  --shadow: 0 18px 48px rgba(40, 60, 75, .18);
  --content: 76rem;
  --sidebar: 18rem;
  --font-body: Verdana, Geneva, Arial, Helvetica, sans-serif;
  --font-display: Verdana, Geneva, Arial, Helvetica, sans-serif;
  --font-code: "Courier New", Courier, "JetBrains Mono", Consolas, monospace;
}

/* Quicksand (rounded geometric) - self-hosted, matches the logo wordmark.
   Variable file covers the 500-700 weight range; latin subset only. */
@font-face {
  font-family: "Quicksand";
  font-style: normal;
  font-weight: 500 700;
  font-display: swap;
  src: url("fonts/quicksand-latin.woff2") format("woff2");
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: var(--font-body);
  line-height: 1.6;
}

a { color: var(--accent); text-underline-offset: .18em; }
a:hover { color: var(--accent-strong); }

a:focus-visible, button:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}

code, pre { font-family: var(--font-code); }

.skip-link {
  position: absolute; left: 1rem; top: -5rem; z-index: 20;
  padding: .7rem 1rem; color: var(--paper); background: var(--panel);
  border-radius: .45rem;
}
.skip-link:focus { top: 1rem; }

.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;
}

.page-shell {
  width: min(calc(100% - 1.5rem), var(--content));
  margin: 1.2rem auto;
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

/* --- header --- */
.site-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: 1rem clamp(1rem, 3vw, 2rem);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: inline-flex; align-items: center; gap: .5rem;
  text-decoration: none;
}
.brand__logo {
  height: 2.4rem; width: auto; display: block;
}
.brand__name {
  font-family: "Quicksand", var(--font-display);
  font-weight: 600; font-size: 1.5rem; letter-spacing: .04em;
  line-height: 1;
}
.brand__name--rogue { color: #8b83bd; }   /* periwinkle, sampled from the logo */
.brand__name--forge { color: var(--accent-strong); }
.brand:hover .brand__name--rogue { color: #756cab; }
.brand:hover .brand__name--forge { color: var(--accent); }

.top-nav {
  display: flex; flex-wrap: wrap; gap: .3rem .85rem; font-weight: 600;
}
.top-nav a { color: var(--ink); text-decoration: none; }
.top-nav a:hover { color: var(--accent-strong); }

.eyebrow {
  margin: 0 0 .5rem; color: var(--gold); font-weight: 800;
  text-transform: uppercase; letter-spacing: .08em; font-size: .78rem;
  font-family: var(--font-code);
}
.eyebrow a { color: inherit; text-decoration: none; }
.eyebrow a:hover { color: var(--accent-strong); }

/* --- breadcrumbs (home + future doc pages) --- */
.breadcrumbs {
  padding: .7rem clamp(1rem, 3vw, 2rem);
  border-bottom: 1px dotted #000;
  color: var(--ink-soft); font-size: .85rem;
}
.breadcrumbs strong { color: var(--ink); }

/* --- shared two-column layout (home + doc pages, legacy pattern) --- */
.layout {
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  gap: 0;
}
@media (max-width: 60rem) {
  .layout { grid-template-columns: 1fr; }
}

.aside {
  padding: 1.2rem 1rem;
  border-right: 1px solid var(--line);
  background: #eef2f5;
  font-size: .92rem;
  max-height: calc(100vh - 1.2rem);
  overflow-y: auto;
  position: sticky; top: 0;
  align-self: start;
}
@media (max-width: 60rem) {
  .aside {
    position: static; max-height: none;
    border-right: 0; border-bottom: 1px solid var(--line);
  }
}

/* --- shared sidebar nav --- */
.nav__group { margin: 0 0 1.4rem; }
.nav__group:last-child { margin-bottom: 0; }
.nav__heading {
  display: block; margin: 0 0 .4rem;
  font-size: 1rem; font-weight: bold;
  text-align: center; color: var(--accent-strong);
  text-decoration: none;
  padding-bottom: .3rem;
  border-bottom: 2px solid var(--gold);
}
a.nav__heading:hover { color: var(--accent); }
.nav__list {
  list-style: none; padding: .15rem 0 0; margin: 0;
}
.nav__list li { margin: 0; border-bottom: 1px solid var(--line); }
.nav__list li:last-child { border-bottom: 0; }
.nav__item {
  display: block; padding: .4rem .5rem;
  color: var(--accent); text-decoration: none;
  font-size: .9rem; line-height: 1.4;
}
.nav__item:hover {
  color: var(--accent-strong); background: var(--hover);
}
.nav__item.is-active {
  color: #fff; background: var(--panel); font-weight: bold;
}
.nav__family { margin: 0 0 .55rem; }
.nav__family:last-child { margin-bottom: 0; }
.nav__family-label {
  margin: .5rem 0 .1rem; padding: 0 .15rem;
  font-weight: bold; font-size: .9rem; color: var(--ink);
}
.nav__family .nav__list { padding-left: .6rem; }

/* --- shared content column (home welcome + doc article) --- */
.content {
  padding: clamp(1.4rem, 4vw, 2.5rem) clamp(1rem, 4vw, 2.5rem);
  min-width: 0;
}
.content__header {
  border-bottom: 1px solid var(--line);
  padding-bottom: 1.2rem; margin-bottom: 1.4rem;
}
.content__header h1 {
  margin: 0 0 .35rem; font-family: var(--font-display);
  font-size: clamp(1.9rem, 4vw, 2.6rem); line-height: 1.1;
  color: var(--ink);
}
.content__tagline {
  margin: 0 0 .5rem; color: var(--ink); font-size: 1.1rem;
}
.content__description {
  margin: 0; color: var(--ink-soft); font-size: .95rem;
}
.content__source {
  margin: 0; color: var(--ink-soft); font-size: .82rem;
}
.content__source code {
  background: var(--code-bg); padding: .15rem .4rem; border-radius: .25rem;
  font-size: .82rem;
}
.content__about h2 {
  margin: 0 0 .8rem; color: var(--accent-strong);
  font-size: 1.4rem; line-height: 1.4;
  padding: 0 0 1px .55em;
  border-bottom: 1px solid var(--gold);
  border-left: 1em solid var(--gold);
}

/* --- group page --- */
.group-layout {
  padding: clamp(1.5rem, 4vw, 3rem) clamp(1rem, 4vw, 3rem);
}
.group-header h1 {
  margin: 0 0 .4rem; font-family: var(--font-display);
  font-size: clamp(1.9rem, 4vw, 2.8rem);
}
.group-header__summary {
  max-width: 55rem; margin: 0 0 .25rem; color: var(--ink-soft); font-size: 1.05rem;
}
.group-header__count {
  margin: 0 0 1.5rem; color: var(--ink-soft); font-size: .8rem;
  font-weight: 600; text-transform: uppercase; letter-spacing: .05em;
  font-family: var(--font-code);
}
.group-pages {
  list-style: none; padding: 0; margin: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(20rem, 1fr));
  gap: .6rem;
}
.group-pages a {
  display: block; padding: .8rem 1rem;
  background: var(--paper); border: 1px solid var(--line);
  text-decoration: none; color: inherit;
}
.group-pages a:hover {
  border-color: var(--accent); background: var(--hover);
}
.group-pages__title {
  display: block; color: var(--accent-strong); font-weight: 600;
}
.group-pages__slug {
  display: block; color: var(--ink-soft); font-size: .82rem; margin-top: .15rem;
  font-family: var(--font-code);
}

.toc {
  margin: 0 0 2rem; padding: 1rem 1.2rem;
  border: 1px solid var(--line); background: #eef2f5;
  border-left: .6em solid var(--gold);
}
.toc__heading {
  margin: 0 0 .5rem; font-size: .8rem; color: var(--accent-strong);
  text-transform: uppercase; letter-spacing: .06em; font-weight: bold;
}
.toc__list { list-style: none; padding: 0; margin: 0; }
.toc__item { padding: .12rem 0; }
.toc__item--level-3 { padding-left: 1rem; }
.toc__item--level-4 { padding-left: 2rem; }
.toc a { text-decoration: none; }
.toc a:hover { text-decoration: underline; }

/* prose */
.prose { max-width: 56rem; }
.prose h2, .prose h3, .prose h4, .prose h5, .prose h6 {
  scroll-margin-top: 5rem; color: var(--accent-strong);
}
/* Signature legacy "Layout: Rogue" h2: amber-gold left + bottom bar. */
.prose h2 {
  font-size: 1.5rem; line-height: 1.4;
  margin: 2rem 0 .8rem; padding: 0 0 1px .55em;
  border-bottom: 1px solid var(--gold);
  border-left: 1.1em solid var(--gold);
}
.prose h3 { font-size: 1.3rem; margin: 1.6rem 0 .6rem; }
.prose h4 { font-size: 1.1rem; margin: 1.4rem 0 .5rem; }
.prose p { margin: 0 0 1rem; }
.prose ul, .prose ol { padding-left: 1.5rem; margin: 0 0 1rem; }
.prose li { margin: .25rem 0; }
.prose code {
  background: var(--code-bg); padding: .1rem .35rem; border-radius: .25rem;
  font-size: .92em;
}
.prose pre {
  background: var(--code-bg); padding: .75rem 1rem; overflow-x: auto;
  border: 1px solid #000;
  font-size: .9rem; line-height: 1.5;
}
.prose pre code { background: transparent; padding: 0; font-size: inherit; }
.prose blockquote {
  margin: 0 0 1rem; padding: .75rem 1rem;
  border: 1px solid #000; border-left: .6em solid var(--gold);
  color: var(--ink); background: var(--cream);
}
.prose table {
  width: 100%; border-collapse: collapse; margin: 0 0 1rem;
  font-size: .94rem;
}
.prose th, .prose td {
  padding: .5rem .8rem; border-bottom: 1px solid var(--line);
  text-align: left; vertical-align: top;
}
.prose th { background: var(--code-bg); font-weight: 700; }
.prose img { max-width: 100%; height: auto; }
.prose hr {
  border: 0; border-top: 1px solid var(--line); margin: 2rem 0;
}
.prose a { font-weight: 500; }

/* callout used by stub pages - styled like the legacy News box */
.callout {
  margin: 1rem 0 1.5rem; padding: .9rem 1.1rem;
  border: 1px solid #000; border-left: .6em solid var(--gold);
  background: var(--cream); color: var(--ink);
}
.callout strong { color: var(--accent-strong); }

/* footer - slate-teal bar with white text, like the legacy footer */
.site-footer {
  padding: 1.5rem clamp(1rem, 3vw, 2rem);
  background: var(--panel); color: #fff;
  font-size: .85rem; text-align: center;
}
.site-footer p { margin: 0; }
.site-footer a { color: #fff; }
.site-footer a:hover { color: var(--cream); }
