/* onto-to-pages — styling based on the CGS brand palette & type scale. */

:root {
  --color-primary: #2c84b9;      /* Fluvial Blue */
  --color-accent: #46ab9d;       /* Continental Green */
  --color-highlight: #f9c609;    /* Prairie Yellow */
  --color-bg: #fefcf5;           /* Cream */
  --color-surface: #ffffff;
  --color-surface-alt: #f4f7f5;
  --color-text: #48535b;         /* Pavement Gray */
  --color-text-muted: #82848b;   /* Slate Gray */
  --color-border: #c9dee8;       /* Cumulus Gray */
  --color-code-bg: #eef5f3;

  --font-heading: "District Pro", "Segoe UI", system-ui, sans-serif;
  --font-body: "Aptos", "Segoe UI", system-ui, sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;

  --radius: 8px;
  --shadow: 0 1px 3px rgba(72, 83, 91, 0.12), 0 1px 2px rgba(72, 83, 91, 0.08);
}

:root[data-theme="dark"] {
  --color-primary: #86c1e2;      /* Rayleigh Blue reads better on dark */
  --color-accent: #46ab9d;
  --color-highlight: #f9c609;
  --color-bg: #1b2023;
  --color-surface: #242b2f;
  --color-surface-alt: #2b3338;
  --color-text: #e9edee;
  --color-text-muted: #9aa5ab;
  --color-border: #3a454c;
  --color-code-bg: #2a2e31;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --color-primary: #86c1e2;
    --color-accent: #46ab9d;
    --color-highlight: #f9c609;
    --color-bg: #1b2023;
    --color-surface: #242b2f;
    --color-surface-alt: #2b3338;
    --color-text: #e9edee;
    --color-text-muted: #9aa5ab;
    --color-border: #3a454c;
    --color-code-bg: #2a2e31;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
}

a {
  color: var(--color-primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-heading);
  color: var(--color-text);
  line-height: 1.2;
}

code,
pre {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--color-code-bg);
  border-radius: 4px;
  padding: 0.15em 0.4em;
}

/* --- layout ------------------------------------------------------------ */

.page {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  overflow-y: auto;
  border-right: 1px solid var(--color-border);
  background: var(--color-surface);
  padding: 1.5rem 1rem;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.82rem;
  color: var(--color-text-muted);
  margin-bottom: 0.65rem;
}

.back-link:hover {
  color: var(--color-primary);
  text-decoration: none;
}

.sidebar h1 {
  font-size: 1.05rem;
  margin: 0 0 1rem;
}

.sidebar nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sidebar nav li {
  margin-bottom: 0.15rem;
}

.sidebar nav a {
  display: block;
  padding: 0.3rem 0.5rem;
  border-radius: 6px;
  color: var(--color-text);
  font-size: 0.92rem;
}

.sidebar nav a:hover {
  background: var(--color-surface-alt);
  text-decoration: none;
}

.sidebar nav .count {
  flex-shrink: 0;
  background: var(--color-surface-alt);
  color: var(--color-text-muted);
  font-size: 0.72rem;
  line-height: 1.6;
  padding: 0 0.45rem;
  border-radius: 999px;
}

.toc-controls {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 0.3rem;
}

.toc-toggle-all {
  background: none;
  border: none;
  padding: 0.2rem 0.5rem;
  font-size: 0.78rem;
  color: var(--color-text-muted);
  cursor: pointer;
  border-radius: 6px;
}

.toc-toggle-all:hover {
  background: var(--color-surface-alt);
  color: var(--color-primary);
}

.toc-section {
  margin-bottom: 0.1rem;
}

.toc-section summary {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.3rem 0.5rem;
  border-radius: 6px;
  cursor: pointer;
  list-style: none;
  font-size: 0.92rem;
}

.toc-section summary::marker,
.toc-section summary::-webkit-details-marker {
  display: none;
  content: "";
}

.toc-section summary::before {
  content: "";
  flex-shrink: 0;
  width: 0;
  height: 0;
  border-left: 4px solid var(--color-text-muted);
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  transition: transform 0.1s ease;
}

.toc-section[open] summary::before {
  transform: rotate(90deg);
}

.toc-section summary:hover {
  background: var(--color-surface-alt);
}

.sidebar .toc-section-link {
  flex: 1;
  padding: 0;
}

.sidebar .toc-items {
  margin: 0.1rem 0 0.4rem;
  padding-left: 1.1rem;
}

.sidebar .toc-items a {
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.sidebar .toc-items a:hover {
  color: var(--color-primary);
}

main {
  padding: 2rem 2.5rem 4rem;
  max-width: 920px;
}

/* --- top bar / theme toggle -------------------------------------------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  border-radius: 999px;
  width: 2.1rem;
  height: 2.1rem;
  padding: 0;
  cursor: pointer;
}

.theme-toggle:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.theme-toggle .icon-sun {
  display: none;
}

.theme-toggle .icon-moon {
  display: block;
}

:root[data-theme="dark"] .theme-toggle .icon-sun {
  display: block;
}

:root[data-theme="dark"] .theme-toggle .icon-moon {
  display: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun {
    display: block;
  }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon {
    display: none;
  }
}

/* --- header / metadata -------------------------------------------------- */

.doc-header h1 {
  font-size: 2rem;
  margin: 0 0 0.25rem;
}

.doc-header .uri {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--color-text-muted);
  word-break: break-all;
}

.doc-header .description {
  margin-top: 0.75rem;
  max-width: 70ch;
}

.meta-table {
  margin-top: 1.25rem;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.meta-table td {
  padding: 0.2rem 0.6rem 0.2rem 0;
  vertical-align: top;
}

.meta-table td:first-child {
  color: var(--color-text-muted);
  white-space: nowrap;
}

.downloads {
  display: flex;
  gap: 0.5rem;
  margin: 1.25rem 0 0.5rem;
}

.downloads a {
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 0.3rem 0.9rem;
  font-size: 0.82rem;
  color: var(--color-text);
  background: var(--color-surface);
}

.downloads a:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
  text-decoration: none;
}

/* --- sections & info icons --------------------------------------------- */

.section {
  margin-top: 3rem;
}

.section-heading {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-bottom: 2px solid var(--color-border);
  padding-bottom: 0.4rem;
  margin-bottom: 1rem;
}

.section-heading h2 {
  font-size: 1.3rem;
  margin: 0;
}

.info-icon {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 50%;
  background: var(--color-surface-alt);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
  font-size: 0.7rem;
  font-style: italic;
  font-family: Georgia, serif;
  cursor: help;
  flex-shrink: 0;
}

.info-tooltip {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 0.5rem);
  transform: translateX(-50%);
  background: var(--color-text);
  color: var(--color-bg);
  font-family: var(--font-body);
  font-style: normal;
  font-size: 0.78rem;
  line-height: 1.35;
  white-space: normal;
  width: max-content;
  max-width: 240px;
  padding: 0.45rem 0.65rem;
  border-radius: 6px;
  box-shadow: var(--shadow);
  opacity: 0;
  visibility: hidden;
  transform: translateX(-50%) translateY(2px);
  transition: opacity 0.12s ease, transform 0.12s ease;
  z-index: 20;
  pointer-events: none;
}

.info-tooltip::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--color-text);
}

.info-icon:hover .info-tooltip,
.info-icon:focus .info-tooltip,
.info-icon:focus-visible .info-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* --- entity cards -------------------------------------------------------- */

.entity {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  box-shadow: var(--shadow);
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
  scroll-margin-top: 1rem;
}

.entity-nested {
  border-left: 3px solid var(--color-accent);
}

.entity h3 {
  font-size: 1.05rem;
  margin: 0 0 0.2rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.permalink {
  color: var(--color-text-muted);
  font-weight: 400;
  text-decoration: none;
  opacity: 0;
  transition: opacity 0.1s ease;
}

.entity h3:hover .permalink,
.permalink:focus {
  opacity: 1;
}

.permalink:hover {
  color: var(--color-primary);
  text-decoration: none;
}

.entity .curie {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--color-text-muted);
  font-weight: normal;
}

.entity .uri {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--color-text-muted);
  word-break: break-all;
  margin-bottom: 0.5rem;
}

.entity .comment {
  margin: 0.4rem 0;
}

.entity .note {
  margin: 0.3rem 0;
  font-size: 0.82rem;
  font-style: italic;
  color: var(--color-text-muted);
}

.badge {
  display: inline-block;
  font-size: 0.7rem;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  background: var(--color-highlight);
  color: #4a3c00;
  font-weight: 600;
}

.entity-meta {
  margin-top: 0.5rem;
  font-size: 0.85rem;
}

.entity-meta dt {
  display: inline;
  color: var(--color-text-muted);
}

.entity-meta dd {
  display: inline;
  margin: 0 0.75rem 0 0.35rem;
}

.entity-meta .row {
  margin-bottom: 0.15rem;
}

/* --- ontology index (multi-file build) ---------------------------------- */

.ontology-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.ontology-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  box-shadow: var(--shadow);
  padding: 1.1rem 1.3rem;
}

.ontology-card h2 {
  font-size: 1.1rem;
  margin: 0 0 0.3rem;
}

.ontology-card p {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  margin: 0.3rem 0 0;
}

footer.site-footer {
  margin-top: 3rem;
  padding-top: 1rem;
  border-top: 1px solid var(--color-border);
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

footer.site-footer p {
  margin: 0 0 0.6rem;
}

.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--color-text-muted);
}

.footer-brand:hover {
  color: var(--color-primary);
  text-decoration: none;
}

.footer-brand-logo {
  height: 1.4rem;
  width: auto;
  display: block;
}

@media (max-width: 760px) {
  .page {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: static;
    height: auto;
  }
  main {
    padding: 1.25rem;
  }
}

.downloads {
  align-items: center;
}

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

.downloads a.download-link {
  margin-left: -0.4rem;
  padding: 0.3rem 0.6rem;
}

.rdf-box {
  position: relative;
  margin-top: 1.5rem;
}

.rdf-source {
  margin: 0;
  padding: 1rem;
  overflow-x: auto;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: var(--color-code-bg);
  font-size: 0.82rem;
  line-height: 1.5;
}

/* the global code style would paint a second box inside the <pre> */
.rdf-source code {
  background: none;
  padding: 0;
  font-size: inherit;
}

.copy-button {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 0.25rem 0.8rem;
  font: inherit;
  font-size: 0.78rem;
  color: var(--color-text);
  background: var(--color-surface);
  cursor: pointer;
}

.copy-button:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}
