/*
 * Every rule lives here: the Content-Security-Policy (web.config, scripts/server.mjs) allows neither
 * inline style attributes nor <style> blocks. Colours follow the Oxygenius brand (clock-site, web app).
 */

:root {
  color-scheme: light dark;
  --page: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #eef1f7;
  --header: #1c3775;
  --header-text: #dbe2e9;
  --title: #1b1d23;
  --text: #3d4352;
  --muted: #646b7b;
  --border: #dde2ec;
  --primary: #1c3775;
  --link: #1c4fb0;
  --accent: #00c1d4;
  --code-bg: #eef1f7;
  --code-text: #1b2a4d;
  --pre-bg: #14213d;
  --pre-text: #e6ecf8;
  --read-bg: #e3f4ea;
  --read-text: #1d5e36;
  --write-bg: #fdf0dc;
  --write-text: #7a4a00;
  --danger-bg: #fbe4e4;
  --danger-text: #8a1f1f;
  --info-bg: #e2eef9;
  --info-text: #17436b;
  --info-border: #a9cce3;
  --warn-bg: #fff6e0;
  --warn-border: #f0c96a;
  --warn-text: #5c4300;
  --focus: #00a3b4;
  --shadow: 0 2px 10px rgba(28, 55, 117, 0.08);
  --radius: 10px;
  --mono: ui-monospace, SFMono-Regular, "Cascadia Code", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --page: #0f1626;
    --surface: #172036;
    --surface-2: #1d2843;
    --header: #13254f;
    --title: #eef2fb;
    --text: #c9d2e3;
    --muted: #93a0b8;
    --border: #2b3856;
    --primary: #8fb3f2;
    --link: #99cbec;
    --code-bg: #22304f;
    --code-text: #dce6f8;
    --pre-bg: #0b1120;
    --read-bg: #173726;
    --read-text: #9fe0b8;
    --write-bg: #3d2c10;
    --write-text: #f3cf8e;
    --danger-bg: #3d1a1a;
    --danger-text: #f2b0b0;
    --info-bg: #14304a;
    --info-text: #d4e6f1;
    --info-border: #24577a;
    --warn-bg: #3a2f12;
    --warn-border: #7a6224;
    --warn-text: #f3e0b0;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
  }
}

* {
  box-sizing: border-box;
}

html {
  scroll-padding-top: 80px;
}

body {
  margin: 0;
  background: var(--page);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  overflow-wrap: break-word;
}

a {
  color: var(--link);
  text-underline-offset: 2px;
}

a:hover {
  text-decoration-thickness: 2px;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

h1,
h2,
h3,
h4 {
  color: var(--title);
  line-height: 1.25;
}

h1 {
  margin: 0 0 12px;
  font-size: 2rem;
}

h2 {
  margin: 40px 0 12px;
  padding-top: 8px;
  font-size: 1.45rem;
  border-top: 1px solid var(--border);
}

h3 {
  margin: 28px 0 8px;
  font-size: 1.15rem;
}

h4 {
  margin: 20px 0 6px;
  font-size: 1rem;
}

.heading-anchor {
  margin-left: 6px;
  color: var(--muted);
  font-weight: 400;
  text-decoration: none;
  opacity: 0;
}

h2:hover .heading-anchor,
h3:hover .heading-anchor,
.heading-anchor:focus {
  opacity: 1;
}

p,
ul,
ol {
  margin: 0 0 14px;
}

li + li {
  margin-top: 4px;
}

code {
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--code-bg);
  color: var(--code-text);
  font-family: var(--mono);
  font-size: 0.88em;
}

pre {
  margin: 0;
  padding: 16px;
  overflow-x: auto;
  border-radius: var(--radius);
  background: var(--pre-bg);
  color: var(--pre-text);
  font-family: var(--mono);
  font-size: 0.85rem;
  line-height: 1.5;
}

pre code {
  padding: 0;
  background: none;
  color: inherit;
  font-size: inherit;
}

.skip-link {
  position: absolute;
  top: -48px;
  left: 12px;
  z-index: 100;
  padding: 8px 14px;
  border-radius: 6px;
  background: var(--surface);
  color: var(--title);
}

.skip-link:focus {
  top: 12px;
}

/* Header */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--header);
  color: var(--header-text);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  max-width: 1320px;
  height: 64px;
  margin: 0 auto;
  padding: 0 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #ffffff;
  text-decoration: none;
}

.brand img {
  display: block;
  width: 132px;
  height: auto;
}

.brand-badge {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent);
  color: #0d2b3e;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.header-links {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-left: auto;
  font-size: 0.92rem;
}

.header-links a {
  color: var(--header-text);
  text-decoration: none;
}

.header-links a:hover {
  color: #ffffff;
  text-decoration: underline;
}

.lang-switch {
  display: inline-flex;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 999px;
}

.lang-switch a,
.lang-switch span {
  padding: 2px 10px;
  font-size: 0.8rem;
  font-weight: 600;
}

.lang-switch span {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
}

.nav-toggle {
  display: none;
  margin-left: auto;
  padding: 6px 12px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 8px;
  background: transparent;
  color: #ffffff;
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}

/* Layout */

.layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 40px;
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 20px;
}

.sidebar {
  position: sticky;
  top: 64px;
  align-self: start;
  max-height: calc(100vh - 64px);
  padding: 28px 0 40px;
  overflow-y: auto;
  font-size: 0.93rem;
}

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

.sidebar li + li {
  margin-top: 2px;
}

.sidebar a {
  display: block;
  padding: 6px 12px;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
}

.sidebar a:hover {
  background: var(--surface-2);
  color: var(--title);
}

.sidebar a[aria-current="page"] {
  background: var(--surface-2);
  color: var(--primary);
  font-weight: 600;
}

.sidebar .subnav {
  margin: 4px 0 8px 12px;
  padding-left: 8px;
  border-left: 2px solid var(--border);
  font-size: 0.88rem;
}

.sidebar .subnav a {
  padding: 4px 10px;
}

.sidebar code {
  padding: 0;
  background: none;
  color: inherit;
  font-size: 0.8rem;
  overflow-wrap: anywhere;
}

.sidebar-title {
  margin: 0 0 8px;
  padding: 0 12px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.content {
  min-width: 0;
  max-width: 900px;
  padding: 36px 0 72px;
}

.lead {
  margin-bottom: 24px;
  color: var(--muted);
  font-size: 1.12rem;
}

.breadcrumb {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.88rem;
}

.breadcrumb a {
  color: var(--muted);
}

/* Footer */

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.88rem;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px 32px;
  max-width: 1320px;
  margin: 0 auto;
  padding: 24px 20px;
}

.footer-inner ul {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.footer-inner li + li {
  margin-top: 0;
}

.footer-inner a {
  color: var(--muted);
}

/* Components */

.hero {
  margin: 0 0 28px;
  padding: 28px;
  border-radius: 16px;
  background: linear-gradient(135deg, #1c3775 0%, #25468f 60%, #1f6f9a 100%);
  color: #dbe2e9;
}

.hero h1 {
  color: #ffffff;
}

.hero p {
  max-width: 680px;
  font-size: 1.08rem;
}

.hero a {
  color: #99e6f0;
}

.hero .endpoint {
  margin-top: 18px;
  border-color: rgba(255, 255, 255, 0.25);
  background: rgba(8, 18, 40, 0.45);
}

.hero .endpoint code {
  color: #ffffff;
}

.hero .endpoint-label {
  color: #99cbec;
}

.endpoint {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin: 16px 0;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.endpoint-label {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.endpoint code {
  padding: 0;
  background: none;
  font-size: 0.95rem;
  word-break: break-all;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
  margin: 16px 0 24px;
}

.card {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.card h3 {
  margin: 0 0 6px;
  font-size: 1.02rem;
}

.card p {
  margin: 0;
  font-size: 0.93rem;
}

a.card {
  color: inherit;
  text-decoration: none;
}

a.card:hover {
  border-color: var(--primary);
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin: 16px 0 24px;
}

.stat {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.stat strong {
  display: block;
  color: var(--title);
  font-size: 1.6rem;
  line-height: 1.2;
}

.stat span {
  color: var(--muted);
  font-size: 0.88rem;
}

.steps {
  margin: 0 0 20px;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.steps > li {
  position: relative;
  margin: 0 0 14px;
  padding: 2px 0 0 44px;
  counter-increment: step;
}

.steps > li::before {
  position: absolute;
  top: 0;
  left: 0;
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 50%;
  background: var(--primary);
  color: var(--surface);
  font-size: 0.9rem;
  font-weight: 700;
  content: counter(step);
}

.callout {
  margin: 18px 0;
  padding: 14px 16px;
  border: 1px solid var(--info-border);
  border-left-width: 4px;
  border-radius: var(--radius);
  background: var(--info-bg);
  color: var(--info-text);
}

.callout.warning {
  border-color: var(--warn-border);
  background: var(--warn-bg);
  color: var(--warn-text);
}

.callout p:last-child,
.callout ul:last-child {
  margin-bottom: 0;
}

.callout-title {
  display: block;
  margin-bottom: 4px;
  font-weight: 700;
}

.code-block {
  position: relative;
  margin: 12px 0 20px;
}

.copy-button {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 3px 10px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: #e6ecf8;
  font: inherit;
  font-size: 0.78rem;
  cursor: pointer;
}

.copy-button:hover {
  background: rgba(255, 255, 255, 0.18);
}

.endpoint .copy-button {
  position: static;
  margin-left: auto;
  border-color: var(--border);
  background: var(--surface-2);
  color: var(--text);
}

.hero .endpoint .copy-button {
  border-color: rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.table-wrap {
  margin: 12px 0 22px;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

th,
td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

th {
  background: var(--surface-2);
  color: var(--title);
  font-weight: 600;
  white-space: nowrap;
}

tr:last-child td {
  border-bottom: 0;
}

td.nowrap,
th.nowrap {
  white-space: nowrap;
}

.param-name code {
  white-space: nowrap;
}

.param-name .depth {
  color: var(--muted);
}

.required {
  color: var(--danger-text);
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

.optional {
  color: var(--muted);
  font-size: 0.78rem;
  white-space: nowrap;
}

.type {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.82rem;
  white-space: nowrap;
}

.meta {
  color: var(--muted);
  font-size: 0.85rem;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 18px;
}

.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge.read {
  background: var(--read-bg);
  color: var(--read-text);
}

.badge.write {
  background: var(--write-bg);
  color: var(--write-text);
}

.badge.destructive {
  background: var(--danger-bg);
  color: var(--danger-text);
}

.badge.info {
  background: var(--info-bg);
  color: var(--info-text);
}

details {
  margin: 12px 0 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

details > summary {
  padding: 10px 14px;
  color: var(--title);
  font-weight: 600;
  cursor: pointer;
}

details[open] > summary {
  border-bottom: 1px solid var(--border);
}

details > .details-body {
  padding: 12px 14px;
}

details .table-wrap {
  margin: 0;
  border: 0;
}

.description-quote {
  margin: 12px 0 20px;
  padding: 14px 16px;
  border-left: 4px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--surface);
}

.description-quote p {
  margin: 0;
}

.tool-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
  margin: 18px 0 8px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.tool-filter input[type="search"] {
  flex: 1 1 240px;
  min-width: 0;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--page);
  color: var(--title);
  font: inherit;
}

.tool-filter label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.92rem;
  white-space: nowrap;
}

.filter-count {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.88rem;
}

.tool-group[hidden],
tr[hidden] {
  display: none;
}

.example {
  margin: 20px 0 28px;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.example h3 {
  margin-top: 0;
}

.prompt {
  margin: 10px 0 14px;
  padding: 12px 14px;
  border-radius: 12px 12px 12px 4px;
  background: var(--surface-2);
  color: var(--title);
  font-style: italic;
}

.flow {
  margin: 0 0 12px;
  padding-left: 22px;
}

.pager {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 40px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 0.92rem;
}

.pager a {
  max-width: 48%;
}

.pager .next {
  margin-left: auto;
  text-align: right;
}

.diagram {
  margin: 12px 0 22px;
  padding: 16px;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.diagram ol {
  margin: 0;
}

dl.facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 8px 20px;
  margin: 12px 0 24px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

dl.facts dt {
  color: var(--title);
  font-weight: 600;
}

dl.facts dd {
  margin: 0;
}

.not-found {
  padding: 60px 0;
  text-align: center;
}

/* Small screens */

@media (max-width: 900px) {
  .layout {
    display: block;
  }

  .header-links .hide-small {
    display: none;
  }

  .js .nav-toggle {
    display: inline-block;
  }

  .js .header-links {
    margin-left: 0;
  }

  .sidebar {
    position: static;
    max-height: none;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
  }

  .js .sidebar {
    display: none;
  }

  .js .sidebar.open {
    display: block;
  }

  .content {
    padding-top: 24px;
  }

  h1 {
    font-size: 1.65rem;
  }

  dl.facts {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  dl.facts dd {
    margin-bottom: 8px;
  }
}

@media (max-width: 520px) {
  .header-inner {
    gap: 10px;
    padding: 0 14px;
  }

  .layout,
  .footer-inner {
    padding-right: 16px;
    padding-left: 16px;
  }

  .brand img {
    width: 110px;
  }

  .hero {
    padding: 20px;
  }
}

@media print {
  .site-header,
  .sidebar,
  .copy-button,
  .tool-filter {
    display: none;
  }

  .layout {
    display: block;
  }
}
