:root {
  --bg: #272822;
  --bg-elevated: #2f3029;
  --bg-subtle: #23241f;
  --bg-strong: #1e1f1c;
  --text: #f8f8f2;
  --text-muted: #c4c4b4;
  --text-faint: #9a9a88;
  --border: #46473f;
  --border-subtle: #393a33;
  --accent: #a6e22e;
  --accent-hover: #c1f15b;
  --accent-secondary: #66d9ef;
  --accent-warm: #e6db74;
  --accent-danger: #f92672;
  --focus: #ae81ff;
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --shell-max: 1480px;
  --prose-max: 76ch;
  --tech-prose-max: 88ch;
  --article-sidebar: 17rem;
  --article-gap: clamp(3rem, 5vw, 4.5rem);
  --article-layout-width: min(100%, calc(var(--prose-max) + var(--article-sidebar) + var(--article-gap)));
  --article-layout-width-tech: min(100%, calc(var(--tech-prose-max) + var(--article-sidebar) + var(--article-gap)));
  --radius: 4px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font: 1rem/1.75 var(--font-sans);
}

a {
  color: var(--accent);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--accent-hover);
}

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

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

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

pre,
.highlight {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  display: block;
  overflow-x: auto;
  background: var(--bg-subtle);
}

th,
td {
  border: 1px solid var(--border);
  padding: 0.75rem 0.9rem;
  text-align: left;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  background: var(--text);
  color: var(--bg-subtle);
  padding: 0.6rem 0.8rem;
  z-index: 20;
}

.skip-link:focus {
  top: 1rem;
}

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

.page-shell {
  width: min(calc(100% - 2 * clamp(1.25rem, 4vw, 4rem)), var(--shell-max));
  margin-inline: auto;
}

.narrow-shell {
  max-width: var(--prose-max);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(35, 36, 31, 0.96);
}

.header-inner {
  display: flex;
  gap: 1.5rem;
  align-items: flex-end;
  justify-content: space-between;
  padding: 1rem 0 0.9rem;
}

.footer-inner {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 0;
}

.site-brand {
  display: inline-flex;
  flex-direction: column;
  gap: 0.15rem;
  color: inherit;
  text-decoration: none;
}

.site-title {
  font-size: 1.4rem;
  line-height: 1.1;
  font-weight: 750;
  letter-spacing: 0.01em;
}

.site-subtitle {
  color: var(--text-faint);
  font-size: 0.92rem;
}

.site-nav {
  position: relative;
}

.menu-toggle {
  display: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  color: var(--text);
  padding: 0.55rem 0.8rem;
  font: inherit;
}

.menu-list {
  display: flex;
  gap: 1.1rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.menu-list a {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 600;
  padding-bottom: 0.25rem;
  border-bottom: 2px solid transparent;
}

.menu-list a:hover,
.menu-list a[aria-current="page"] {
  color: var(--text);
}

.menu-list a[aria-current="page"] {
  border-color: var(--accent);
}

.site-main {
  padding: 2.75rem 0 4.5rem;
}

.page-header,
.home-intro {
  margin-bottom: 2rem;
}

.eyebrow {
  margin: 0 0 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-faint);
  font-size: 0.76rem;
  font-weight: 700;
}

h1,
h2,
h3,
h4 {
  margin: 0 0 0.75rem;
  line-height: 1.15;
  font-weight: 700;
}

h1 {
  font-size: clamp(2.5rem, 5vw, 4rem);
}

h2 {
  font-size: clamp(1.45rem, 2.4vw, 2.15rem);
}

h3 {
  font-size: 1.2rem;
}

p,
ul,
ol,
dl,
blockquote {
  margin-top: 0;
  margin-bottom: 1.15rem;
}

.lede,
.lede-stack p,
.home-intro p {
  max-width: var(--prose-max);
  color: var(--text-muted);
  font-size: 1.04rem;
}

.lede-stack p + p {
  margin-top: 0.8rem;
}

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.7rem;
  border-bottom: 1px solid var(--border-subtle);
}

.section-heading p {
  margin: 0;
  color: var(--text-faint);
}

.home-section {
  margin-top: 3.5rem;
}

.home-title {
  font-size: clamp(3.5rem, 7vw, 6.5rem);
  line-height: 0.95;
  letter-spacing: -0.03em;
  max-width: 10ch;
}

.home-hero {
  padding-block: clamp(4rem, 9vh, 8rem);
  margin-bottom: 3.5rem;
}

.home-search-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  margin-top: 1.6rem;
  align-items: start;
}

.home-search {
  width: min(100%, 760px);
}

.home-search-form input,
.search-form input {
  width: 100%;
  padding: 1rem 1.05rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  color: var(--text);
  font: inherit;
}

.search-submit-button {
  min-height: 3.25rem;
  padding: 0.95rem 1.2rem;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--bg-strong);
  font: inherit;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}

.search-submit-button:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.search-inline-message {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--text-faint);
  font-size: 0.95rem;
}

.home-columns,
.section-group-grid {
  display: grid;
  gap: clamp(1.5rem, 3vw, 3rem);
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.home-gateways {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(2.5rem, 6vw, 7rem);
}

.home-gateway {
  padding-top: 1.25rem;
  border-top: 2px solid var(--border);
}

.home-gateway h2 {
  font-size: clamp(1.45rem, 2.6vw, 2rem);
}

.home-gateway p {
  max-width: 38rem;
  color: var(--text-muted);
  margin-bottom: 0.85rem;
}

.home-gateway-gaming {
  border-color: var(--accent-warm);
}

.home-gateway-tech {
  border-color: var(--accent-secondary);
}

.section-panel {
  padding-top: 1rem;
  border-top: 2px solid var(--border);
}

.section-feature-title {
  font-size: clamp(1.8rem, 3vw, 2.75rem);
  max-width: 22ch;
}

.section-panel p {
  max-width: 42rem;
  color: var(--text-muted);
  margin-bottom: 0.85rem;
}

.section-panel ul,
.group-links,
.flat-links {
  list-style: none;
  margin: 0;
  padding: 0;
}

.group-links li + li,
.flat-links li + li {
  margin-top: 0.45rem;
}

.section-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.9rem;
  font-weight: 600;
}

.section-link::after {
  content: "→";
}

.home-panel-gaming {
  border-color: var(--accent-warm);
}

.home-panel-tech {
  border-color: var(--accent-secondary);
}

.post-list,
.term-list,
.group-list {
  margin: 0;
  padding: 0;
}

.post-list {
  width: min(100%, 1180px);
}

.post-row,
.term-row {
  list-style: none;
  padding: clamp(2rem, 4vw, 3.25rem) 0;
  border-bottom: 1px solid var(--border-subtle);
}

.post-row:first-child,
.term-row:first-child {
  border-top: 1px solid var(--border-subtle);
}

.group-row {
  list-style: none;
  padding: 1.15rem 0;
  border-bottom: 1px solid var(--border-subtle);
}

.group-row:first-child {
  border-top: 1px solid var(--border-subtle);
}

.post-row {
  display: grid;
  grid-template-columns: minmax(150px, 210px) minmax(0, 1fr);
  gap: clamp(1.5rem, 4vw, 4rem);
  align-items: start;
}

.post-row-meta-column {
  display: grid;
  gap: 0.8rem;
  min-width: 0;
}

.post-row-topline,
.search-result-topline {
  display: grid;
  gap: 0.5rem;
  align-content: start;
}

.post-row-date {
  display: grid;
  gap: 0.15rem;
  color: var(--text-faint);
  font-size: 0.9rem;
}

.post-row-date span {
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.post-row-main-column {
  min-width: 0;
}

.search-result-main {
  min-width: 0;
}

.post-row-title,
.search-result-title {
  margin-bottom: 0.35rem;
  font-size: clamp(1.35rem, 2vw, 1.8rem);
}

.post-row-title a,
.search-result-title a {
  color: var(--text);
  text-decoration: none;
}

.post-row-title a:hover,
.search-result-title a:hover {
  color: var(--accent);
}

.post-row-summary,
.search-result-summary,
.term-row p,
.group-row p {
  color: var(--text-muted);
  margin-bottom: 0.65rem;
}

.post-row-summary,
.search-result-summary {
  font-size: 1.05rem;
}

.article-kicker-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.8rem;
  align-items: center;
  margin-bottom: 0.8rem;
}

.area-chip,
.meta-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.2;
}

.area-chip::before {
  content: "";
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 999px;
  background: currentColor;
}

.area-gaming {
  color: var(--accent-warm);
}

.area-tech {
  color: var(--accent-secondary);
}

.meta-chip {
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

.article-meta-line,
.post-row-secondary-meta,
.search-result-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.7rem;
  color: var(--text-faint);
  font-size: 0.9rem;
}

.article-meta-line span,
.post-row-secondary-meta span,
.search-result-meta span {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.article-meta-line span + span::before,
.post-row-secondary-meta span + span::before,
.search-result-meta span + span::before {
  content: "•";
  color: var(--border);
  margin-right: 0.35rem;
}

.read-note-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.5rem;
  font-weight: 600;
}

.read-note-link::after {
  content: "→";
}

.flat-link-grid {
  display: grid;
  gap: 0.6rem 1.4rem;
  grid-template-columns: repeat(auto-fit, minmax(10rem, max-content));
  align-items: start;
}

.flat-link-grid a {
  color: var(--text-muted);
}

.flat-link-grid a:hover {
  color: var(--accent);
}

.term-link {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  color: inherit;
  text-decoration: none;
}

.term-count {
  color: var(--text-faint);
  white-space: nowrap;
}

.article-shell {
  width: min(calc(100% - 2 * clamp(1.25rem, 4vw, 4rem)), 1280px);
}

.article-shell-tech {
  --article-layout-width: var(--article-layout-width-tech);
}

.article-header {
  width: min(100%, var(--article-layout-width));
  margin: 0 auto 1.75rem;
}

.article-header h1,
.article-header .lede,
.article-meta-line {
  max-width: var(--prose-max);
}

.article-shell-tech .article-header h1,
.article-shell-tech .article-header .lede,
.article-shell-tech .article-meta-line {
  max-width: var(--tech-prose-max);
}

.article-layout {
  display: block;
  width: min(100%, var(--article-layout-width));
  margin: 0 auto;
}

.article-shell-with-sidebar .article-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(15rem, var(--article-sidebar));
  gap: var(--article-gap);
  align-items: start;
}

.article-primary {
  min-width: 0;
}

.article-sidebar {
  min-width: 0;
}

.article-content {
  max-width: none;
}

.article-content > p,
.article-content > ul,
.article-content > ol,
.article-content > dl,
.article-content > blockquote,
.article-content > h2,
.article-content > h3,
.article-content > h4,
.article-content > h5,
.article-content > h6 {
  max-width: var(--prose-max);
}

.article-shell-tech .article-content > p,
.article-shell-tech .article-content > ul,
.article-shell-tech .article-content > ol,
.article-shell-tech .article-content > dl,
.article-shell-tech .article-content > blockquote,
.article-shell-tech .article-content > h2,
.article-shell-tech .article-content > h3,
.article-shell-tech .article-content > h4,
.article-shell-tech .article-content > h5,
.article-shell-tech .article-content > h6 {
  max-width: var(--tech-prose-max);
}

.article-content > :first-child {
  margin-top: 0;
}

.article-content > :last-child {
  margin-bottom: 0;
}

.article-content p,
.article-content li {
  overflow-wrap: anywhere;
}

.article-content h2,
.article-content h3,
.article-content h4 {
  margin-top: 2.1rem;
}

.article-content ul,
.article-content ol {
  padding-left: 1.35rem;
}

.article-content blockquote {
  padding: 0.2rem 0 0.2rem 1rem;
  border-left: 3px solid var(--border);
  color: var(--text-muted);
}

.article-content pre,
.article-content .highlight,
.article-content table,
.article-content figure,
.article-content > img {
  width: min(100%, var(--article-layout-width));
  max-width: none;
}

.article-content pre,
.article-content .highlight pre {
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-strong);
  color: var(--text);
}

.article-content :not(pre) > code {
  padding: 0.12rem 0.32rem;
  border-radius: var(--radius);
  background: var(--bg-subtle);
  color: var(--text);
}

.toc-box {
  position: sticky;
  top: 6rem;
  padding-left: 1rem;
  border-left: 2px solid var(--border);
}

.toc-box + .detail-panel,
.detail-panel + .toc-box {
  margin-top: 1.5rem;
}

.toc-box h2 {
  margin-bottom: 0.7rem;
  font-size: 1rem;
}

.toc-box ul {
  margin: 0;
  padding-left: 1.1rem;
}

.detail-panel {
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-subtle);
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  margin: 0;
}

.detail-grid dt {
  color: var(--text-faint);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.detail-grid dd {
  margin: 0.2rem 0 0;
}

.character-sheet.article-content {
  max-width: min(100%, 92ch);
}

.article-nav {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  width: min(100%, var(--article-layout-width));
  margin: 2.2rem auto 0;
}

.nav-card {
  display: block;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border-subtle);
  color: inherit;
  text-decoration: none;
}

.nav-label {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--text-faint);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.search-shell {
  max-width: 70rem;
}

.search-form {
  margin-bottom: 1rem;
}

.search-helper {
  color: var(--text-faint);
  margin: 0 0 0.55rem;
}

.search-status {
  color: var(--text-faint);
  margin: 0 0 1rem;
}

.search-results {
  border-top: 1px solid var(--border-subtle);
}

.search-result {
  display: grid;
  grid-template-columns: minmax(150px, 210px) minmax(0, 1fr);
  gap: clamp(1.5rem, 4vw, 4rem);
  padding: clamp(2rem, 4vw, 3.25rem) 0;
  border-bottom: 1px solid var(--border-subtle);
}

.search-result:hover,
.search-result:focus-within {
  background: transparent;
}

.pagination {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 2rem;
  color: var(--text-faint);
}

.pagination a {
  color: var(--text);
}

.site-footer {
  border-top: 1px solid var(--border-subtle);
}

.site-footer p {
  margin: 0;
  color: var(--text-faint);
}

@media (max-width: 1180px) {
  .article-shell-with-sidebar .article-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .article-content,
  .article-shell-tech .article-content,
  .article-header,
  .article-header h1,
  .article-header .lede,
  .article-meta-line,
  .article-nav {
    max-width: min(100%, var(--tech-prose-max));
  }

  .article-sidebar {
    display: grid;
    gap: 1.5rem;
    margin-top: 1.5rem;
  }

  .toc-box {
    position: static;
  }
}

@media (max-width: 950px) {
  .home-hero,
  .home-gateways,
  .home-columns,
  .section-group-grid,
  .article-nav {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .home-search-form {
    grid-template-columns: 1fr;
  }

  .search-submit-button {
    width: 100%;
  }

  .post-row,
  .search-result {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
}

@media (max-width: 800px) {
  .header-inner,
  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .menu-toggle {
    display: inline-flex;
  }

  .menu-list {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 0.5rem);
    min-width: 13rem;
    flex-direction: column;
    padding: 0.85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-elevated);
  }

  .site-nav[data-open="true"] .menu-list {
    display: flex;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
