/* Fonts are self-hosted: see fonts.css. */
/* Open Source Games: component styles. Every color, length and family comes from tokens.css. */

.osg-root {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
.osg-root *, .osg-root *::before, .osg-root *::after { box-sizing: border-box; }

.osg-root a:focus-visible,
.osg-focus:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: var(--radius-0);
}

/* ---------- PageHeader ---------- */
.osg-header {
  display: grid;
  gap: var(--space-3);
  padding-bottom: var(--space-6);
  border-bottom: var(--border-frame) var(--ink);
}
.osg-header-repo {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.4;
  font-weight: 500;
  color: var(--ink-muted);
}
.osg-header-repo a { color: var(--play); text-decoration: none; }
.osg-header-repo a:hover { text-decoration: underline; text-underline-offset: 3px; }
.osg-header-title {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 56px;
  line-height: 0.95;
  font-weight: 800;
  font-stretch: 125%;
  letter-spacing: -0.015em;
  color: var(--ink);
  text-wrap: balance;
}
.osg-header-intro {
  margin: 0;
  max-width: var(--measure);
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink);
}

/* ---------- TableOfContents: a text-mode dialog ---------- */
.osg-toc {
  position: relative;
  margin: var(--space-3) var(--space-1) var(--space-2) 0;
  padding: var(--space-6) var(--space-6) var(--space-4);
  background: var(--paper-raised);
  border: var(--border-frame) var(--ink);
  box-shadow: var(--shadow-dialog);
}
.osg-toc-title {
  position: absolute;
  top: -0.85em;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  padding: 0 var(--space-2);
  background: var(--paper-raised);
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.3;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--ink);
}
.osg-toc-list {
  margin: 0;
  padding: 0;
  list-style: none;
  columns: 2 220px;
  column-gap: var(--space-8);
}
.osg-toc-item { break-inside: avoid; }
.osg-toc-link {
  display: flex;
  align-items: baseline;
  gap: var(--space-1);
  padding: 2px var(--space-1);
  margin: 0 calc(-1 * var(--space-1));
  color: var(--ink);
  text-decoration: none;
  font-size: 14px;
  line-height: 1.5;
}
.osg-toc-name { min-width: 0; }
.osg-toc-dots {
  flex: 1 1 auto;
  min-width: var(--space-4);
  border-bottom: 1px dotted var(--rule-strong);
  transform: translateY(-0.3em);
}
.osg-toc-count {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--ink-muted);
}
.osg-toc-link:hover .osg-toc-name { text-decoration: underline; text-underline-offset: 3px; }
.osg-toc-link[aria-current="location"] { background: var(--highlight); color: var(--on-highlight); }
.osg-toc-link[aria-current="location"] .osg-toc-count { color: var(--on-highlight); }
.osg-toc-link[aria-current="location"] .osg-toc-dots { border-bottom-color: var(--on-highlight); }

/* ---------- GenreSection ---------- */
.osg-genre { display: grid; gap: var(--space-4); scroll-margin-top: var(--space-4); }
.osg-genre + .osg-genre { margin-top: var(--space-12); }
.osg-genre-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-1) var(--space-4);
  padding-bottom: var(--space-2);
  border-bottom: var(--border-hairline) var(--rule);
}
.osg-genre-title {
  margin: 0;
  min-width: 0;
  font-family: var(--font-sans);
  font-size: 30px;
  line-height: 1.05;
  font-weight: 800;
  font-stretch: 125%;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-wrap: balance;
}
.osg-genre-title a { color: inherit; text-decoration: none; }
.osg-genre-title a:hover { text-decoration: underline; text-decoration-thickness: 3px; text-underline-offset: 5px; }
.osg-genre-count {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.4;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--ink-muted);
  white-space: nowrap;
}

/* ---------- FamilyHeading ---------- */
.osg-family {
  margin: var(--space-8) 0 0;
  padding-top: var(--space-3);
  border-top: var(--border-frame) var(--rule-strong);
  font-family: var(--font-sans);
  font-size: 19px;
  line-height: 1.3;
  font-weight: 600;
  font-style: italic;
  color: var(--ink);
  text-wrap: balance;
}
.osg-family:first-child { margin-top: 0; }
.osg-family a { color: var(--play); text-decoration: none; }
.osg-family a:hover { text-decoration: underline; text-underline-offset: 3px; }
.osg-family .osg-source { font-style: normal; margin-left: var(--space-2); vertical-align: 2px; }

/* ---------- SubgroupLabel ---------- */
.osg-subgroup {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin: var(--space-4) 0 0;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.3;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.osg-subgroup:first-child { margin-top: 0; }
.osg-subgroup::after { content: ""; flex: 1 1 auto; border-top: var(--border-hairline) var(--rule); }

/* ---------- EntryList + Entry ---------- */
.osg-entries {
  display: grid;
  gap: var(--space-4);
  margin: 0;
  padding: 0;
  list-style: none;
}
.osg-entries--nested { gap: var(--space-3); margin-top: var(--space-3); margin-left: 6px; }
.osg-entries--nested > .osg-entry { position: relative; padding-left: var(--space-6); }
.osg-entries--nested > .osg-entry::before {
  content: "";
  position: absolute;
  left: 0;
  top: calc(-1 * var(--space-3));
  width: 16px;
  height: calc(var(--space-3) + 0.7em);
  border-left: var(--border-hairline) var(--rule-strong);
  border-bottom: var(--border-hairline) var(--rule-strong);
}
.osg-entries--nested > .osg-entry::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: calc(-1 * var(--space-3));
  border-left: var(--border-hairline) var(--rule-strong);
}
.osg-entries--nested > .osg-entry:last-child::after { display: none; }

.osg-entry { display: grid; gap: 2px; min-width: 0; }
.osg-entry-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-1) var(--space-2); }
.osg-entry-title {
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.35;
  font-weight: 700;
  color: var(--ink);
  overflow-wrap: anywhere;
}
a.osg-entry-title { color: var(--play); text-decoration: none; }
a.osg-entry-title:hover { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.osg-entries--nested .osg-entry-title { font-size: 15px; }
.osg-entry-desc {
  margin: 0;
  max-width: var(--measure);
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink);
}
.osg-entries--nested .osg-entry-desc { font-size: 13px; line-height: 1.5; }
.osg-entry-desc a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--rule-strong);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.osg-entry-desc a:hover { color: var(--play); text-decoration-color: currentColor; }
.osg-entry-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px var(--space-4);
  margin-top: 2px;
}
.osg-entry-supports { margin-top: var(--space-1); display: grid; gap: 2px; }
.osg-entry-supports-label {
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.3;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.osg-entry-supports ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0 var(--space-4);
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 14px;
}

/* ---------- SourceLink ---------- */
.osg-source {
  display: inline-flex;
  align-items: baseline;
  gap: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.4;
  font-weight: 500;
  font-style: normal;
  color: var(--source);
  text-decoration: none;
  white-space: nowrap;
}
.osg-source-bracket { color: var(--ink-muted); }
.osg-source:hover .osg-source-word { text-decoration: underline; text-underline-offset: 3px; }
.osg-source-host { margin-left: var(--space-2); color: var(--ink-muted); font-weight: 400; }

/* ---------- EngineTag ---------- */
.osg-engine {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 var(--space-2);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.4;
  font-weight: 500;
  color: var(--ink);
}
.osg-engine-kind {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.osg-engine-name { color: var(--ink); text-decoration: none; }
a.osg-engine-name { text-decoration: underline dotted var(--rule-strong); text-underline-offset: 3px; }
a.osg-engine-name:hover { color: var(--play); text-decoration-color: currentColor; }

/* ---------- OriginalRef ---------- */
.osg-orig { font-style: italic; color: var(--ink); }
.osg-orig a {
  color: inherit;
  text-decoration: underline dotted var(--rule-strong);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.osg-orig a:hover { color: var(--play); text-decoration-color: currentColor; }

/* ---------- LineageTag ---------- */
.osg-lineage {
  display: inline-block;
  padding: 1px 6px;
  border: var(--border-hairline) var(--rule-strong);
  border-radius: var(--radius-1);
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.3;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
  white-space: nowrap;
  transform: translateY(-1px);
}

@media (prefers-reduced-motion: reduce) {
  .osg-root * { scroll-behavior: auto !important; transition: none !important; }
}
