/* Snag Watcher docs. Tokens and rules: DESIGN.md. Light only. */
:root {
  color-scheme: only light;
  --color-bg: #ffffff;
  --color-surface: #f5f5f4;
  --color-text: #111111;
  --color-text-muted: #555555;
  --color-rule: #d9d9d6;
  --color-rule-strong: #111111;
  --color-primary: #d92d0a;
  --code-key: #111111;
  --code-string: #8a2a0a;
  --code-number: #1d4ed8;
  --code-comment: #5b5b57;

  --font-body: "Public Sans", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --text-xs: 0.8125rem;
  --text-sm: 0.875rem;
  --text-md: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.5rem;
  --text-2xl: 2rem;
  --text-endpoint: 2.5rem;

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-12: 3rem;
  --space-16: 4rem;

  --radius: 4px;
  --rule: 1px solid var(--color-rule);
  --rule-strong: 2px solid var(--color-rule-strong);
  --nav-width: 16rem;
  --content-width: 48rem;
  --outline-width: 13rem;
  --top-height: 3.5rem;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-padding-top: calc(var(--top-height) + var(--space-4)); }

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--text-md);
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}

a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
a:hover { color: var(--color-primary); }
:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: var(--space-4); top: -4rem; background: var(--color-bg); padding: var(--space-2) var(--space-3); border: var(--rule-strong); z-index: 10; }
.skip:focus { top: var(--space-2); }

/* Top bar */
.top {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: var(--space-6);
  height: var(--top-height);
  padding: 0 var(--space-6);
  background: var(--color-bg);
  border-bottom: var(--rule-strong);
}
.brand { display: inline-flex; align-items: center; gap: var(--space-2); font-weight: 800; text-decoration: none; letter-spacing: -0.01em; }
.brand-api { font-family: var(--font-mono); font-weight: 500; font-size: var(--text-sm); color: var(--color-text-muted); }
.top-base { margin-left: auto; font-size: var(--text-xs); color: var(--color-text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-base code { font-family: var(--font-mono); }
.menu { display: none; }

/* Three columns */
.shell {
  display: grid;
  grid-template-columns: var(--nav-width) minmax(0, 1fr) var(--outline-width);
  max-width: calc(var(--nav-width) + var(--content-width) + var(--outline-width) + 6rem);
  margin: 0 auto;
}

.sidebar {
  position: sticky;
  top: var(--top-height);
  align-self: start;
  height: calc(100vh - var(--top-height));
  overflow-y: auto;
  padding: var(--space-6) var(--space-6) var(--space-12);
  border-right: var(--rule);
}
.nav-label { margin: var(--space-6) 0 var(--space-2); font-size: var(--text-xs); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--color-text-muted); }
.sidebar ul, .outline ul { list-style: none; margin: 0; padding: 0; }
.sidebar nav a {
  display: block;
  padding: var(--space-1) var(--space-3);
  margin-left: calc(var(--space-3) * -1);
  border-left: 2px solid transparent;
  font-size: var(--text-sm);
  text-decoration: none;
}
.sidebar nav a[aria-current="page"] { color: var(--color-primary); border-left-color: var(--color-primary); font-weight: 600; }

.search { position: relative; }
.search input {
  width: 100%;
  height: 2.5rem;
  padding: 0 var(--space-3);
  border: var(--rule);
  border-radius: var(--radius);
  background: var(--color-bg);
  color: var(--color-text);
  font: inherit;
  font-size: var(--text-sm);
}
.search input:focus { border-color: var(--color-rule-strong); }
.results {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + var(--space-1));
  z-index: 6;
  margin: 0;
  padding: var(--space-1) 0;
  list-style: none;
  background: var(--color-bg);
  border: var(--rule-strong);
  border-radius: var(--radius);
  max-height: 60vh;
  overflow-y: auto;
}
.results a { display: block; padding: var(--space-2) var(--space-3); font-size: var(--text-sm); text-decoration: none; }
.results a[aria-selected="true"], .results a:hover { background: var(--color-surface); color: var(--color-text); }
.results small { display: block; color: var(--color-text-muted); font-size: var(--text-xs); }
.results code { font-family: var(--font-mono); font-size: var(--text-sm); background: none; padding: 0; overflow-wrap: anywhere; }
.results .empty { padding: var(--space-2) var(--space-3); font-size: var(--text-sm); color: var(--color-text-muted); }

main { min-width: 0; padding: var(--space-8) var(--space-12) var(--space-16); }
article { max-width: var(--content-width); }

.outline {
  position: sticky;
  top: var(--top-height);
  align-self: start;
  padding: var(--space-8) var(--space-4) var(--space-8) 0;
  max-height: calc(100vh - var(--top-height));
  overflow-y: auto;
}
.outline a { display: block; padding: var(--space-1) 0; font-size: var(--text-xs); color: var(--color-text-muted); text-decoration: none; }
.outline a:hover, .outline a.active { color: var(--color-text); }
.outline .nav-label { margin-top: 0; }

/* Content */
.kicker { margin: 0 0 var(--space-2); font-size: var(--text-xs); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--color-text-muted); }
h1 { margin: 0 0 var(--space-6); padding-bottom: var(--space-4); border-bottom: var(--rule-strong); font-size: var(--text-2xl); line-height: 1.15; font-weight: 800; letter-spacing: -0.02em; }
h2 { margin: var(--space-12) 0 var(--space-4); padding-top: var(--space-6); border-top: var(--rule); font-size: var(--text-xl); line-height: 1.25; font-weight: 800; letter-spacing: -0.01em; }
h3 { margin: var(--space-8) 0 var(--space-3); font-size: var(--text-lg); line-height: 1.3; font-weight: 600; }
h1 + h2 { margin-top: var(--space-8); padding-top: 0; border-top: 0; }
h2 .anchor, h3 .anchor { text-decoration: none; }
h2 .anchor:hover::after, h3 .anchor:hover::after { content: " #"; color: var(--color-primary); }
p, ul, ol { margin: 0 0 var(--space-4); }
li { margin-bottom: var(--space-1); }
strong { font-weight: 600; }

:not(pre) > code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  padding: 0.1em 0.3em;
  background: var(--color-surface);
  border-radius: 2px;
  overflow-wrap: anywhere;
}

/* The signature: the endpoint line */
.endpoint {
  margin: 0 0 var(--space-8);
  font-family: var(--font-mono);
  font-size: var(--text-endpoint);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}
.endpoint .method { color: var(--color-primary); font-weight: 600; }
.endpoint .param { color: var(--color-text-muted); }

/* Tables */
.table-wrap { margin: 0 0 var(--space-6); overflow-x: auto; border-top: var(--rule-strong); }
table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
th { text-align: left; font-weight: 600; padding: var(--space-2) var(--space-3) var(--space-2) 0; border-bottom: var(--rule); white-space: nowrap; }
td { padding: var(--space-2) var(--space-3) var(--space-2) 0; border-bottom: var(--rule); vertical-align: top; }
td:first-child { white-space: nowrap; }
td:first-child code { background: none; padding: 0; font-weight: 600; }

/* Code */
.code { margin: 0 0 var(--space-6); background: var(--color-surface); border-radius: var(--radius); overflow: hidden; }
.code-bar { display: flex; align-items: center; justify-content: space-between; padding: 0 var(--space-2) 0 var(--space-4); height: 2.25rem; border-bottom: var(--rule); }
.code-lang { font-size: var(--text-xs); color: var(--color-text-muted); font-weight: 500; }
.copy {
  min-height: 1.75rem;
  min-width: 3.5rem;
  padding: 0 var(--space-3);
  border: var(--rule);
  border-radius: var(--radius);
  background: var(--color-bg);
  color: var(--color-text);
  font: inherit;
  font-size: var(--text-xs);
  cursor: pointer;
}
.copy:hover { border-color: var(--color-rule-strong); }
pre { margin: 0; padding: var(--space-4); overflow-x: auto; font-family: var(--font-mono); font-size: var(--text-sm); line-height: 1.55; tab-size: 2; }
pre code { font-family: inherit; }
.hljs-attr { color: var(--code-key); font-weight: 600; }
.hljs-string { color: var(--code-string); }
.hljs-number, .hljs-literal { color: var(--code-number); }
.hljs-comment { color: var(--code-comment); font-style: italic; }
.hljs-keyword, .hljs-built_in { color: var(--color-text); font-weight: 600; }
.hljs-title, .hljs-title.function_ { color: var(--color-text); }
.hljs-variable, .hljs-params { color: var(--color-text); }
.hljs-meta, .hljs-subst { color: var(--color-text-muted); }

.tabs { margin: 0 0 var(--space-6); }
.tabs .code { border-top-left-radius: 0; border-top-right-radius: 0; }
.tab-list { display: flex; gap: var(--space-1); border-bottom: var(--rule); overflow-x: auto; }
.tab-list button {
  min-height: 2.5rem;
  padding: 0 var(--space-3);
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  background: none;
  color: var(--color-text-muted);
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}
.tab-list button[aria-selected="true"] { color: var(--color-text); border-bottom-color: var(--color-rule-strong); }
.tab-list button:hover { color: var(--color-text); }

/* Previous / next */
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); margin-top: var(--space-16); padding-top: var(--space-6); border-top: var(--rule-strong); }
.pager a { display: block; padding: var(--space-2) 0; text-decoration: none; font-weight: 600; }
.pager a span { display: block; font-size: var(--text-xs); font-weight: 500; color: var(--color-text-muted); }
.pager .next { text-align: right; }

/* Narrower screens */
@media (max-width: 80rem) {
  .shell { grid-template-columns: var(--nav-width) minmax(0, 1fr); }
  .outline { display: none; }
}

@media (max-width: 56rem) {
  .top { gap: var(--space-3); padding: 0 var(--space-4); }
  .top-base { display: none; }
  .menu {
    display: inline-block;
    margin-left: auto;
    min-height: 2.75rem;
    padding: 0 var(--space-4);
    border: var(--rule-strong);
    border-radius: var(--radius);
    background: var(--color-bg);
    color: var(--color-text);
    font: inherit;
    font-size: var(--text-sm);
    font-weight: 600;
  }
  .shell { display: block; }
  .sidebar { display: none; position: fixed; inset: var(--top-height) 0 0 0; height: auto; z-index: 4; background: var(--color-bg); border-right: 0; }
  .sidebar.open { display: block; }
  .sidebar nav a { min-height: 2.75rem; display: flex; align-items: center; }
  main { padding: var(--space-6) var(--space-4) var(--space-12); }
  .endpoint { font-size: var(--text-xl); }
  h1 { font-size: var(--text-xl); }
  .search input { font-size: var(--text-md); }
}

@media (pointer: coarse) {
  .copy { min-height: 2.75rem; }
  .tab-list button { min-height: 2.75rem; }
}
