/* Sporty's Partner API docs.
   Brand values come from the course site (courses.sportys.com) and the iOS app's
   color assets: primaryBlue #2972B9, sptDarkBlue #0E283F, red #DC253B, navy text #202B36.
   Headings use Jost and body text uses Lato, the same faces as the course site. */

:root {
  --navy-950: #0c1823;
  --navy-900: #0e283f;
  --navy-800: #202b36;
  --blue-600: #2972b9;
  --blue-500: #3791e9;
  --red-600: #dc253b;
  --green-700: #3f7d0a;
  --amber-700: #9a5b00;

  --bg: #ffffff;
  --bg-subtle: #f4f7fa;
  --bg-raised: #ffffff;
  --border: #e1e7ee;
  --border-strong: #c9d3de;
  --text: #1b2733;
  --text-muted: #566577;
  --heading: #0e283f;
  --link: #2264a6;
  --link-hover: #0e283f;
  --code-inline-bg: #edf2f7;
  --code-inline-text: #0e283f;
  --code-bg: #0e1c2a;
  --code-border: #1d3247;
  --code-text: #dbe6f1;
  --code-muted: #8aa0b6;
  --code-key: #7cc4ff;
  --code-string: #b6e38a;
  --code-number: #ffc27a;
  --code-literal: #ff9db0;
  --sidebar-active-bg: #e8f1fa;
  --topbar-bg: #0e283f;
  --topbar-text: #ffffff;

  --note-bg: #eef5fc;
  --note-border: #2972b9;
  --warn-bg: #fff6e8;
  --warn-border: #c27800;
  --tip-bg: #eff8e8;
  --tip-border: #4d8f12;

  --get: #2264a6;
  --post: #3f7d0a;
  --put: #9a5b00;
  --delete: #c21f33;

  --radius: 8px;
  --topbar-h: 60px;
  --sidebar-w: 268px;
  --content-w: 800px;

  --font-body: "Lato", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-head: "Jost", "Lato", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c1823;
    --bg-subtle: #10202f;
    --bg-raised: #132638;
    --border: #1f3549;
    --border-strong: #2c475f;
    --text: #dfe8f1;
    --text-muted: #9cadbf;
    --heading: #ffffff;
    --link: #6cb4f5;
    --link-hover: #a9d4fa;
    --code-inline-bg: #1a3047;
    --code-inline-text: #d9ebfb;
    --code-bg: #08131d;
    --code-border: #1f3549;
    --sidebar-active-bg: #16304a;
    --topbar-bg: #08131d;
    --note-bg: #10263b;
    --note-border: #4d9be6;
    --warn-bg: #2a2110;
    --warn-border: #d59a35;
    --tip-bg: #15281a;
    --tip-border: #6fb33a;
    --get: #6cb4f5;
    --post: #8fd15a;
    --put: #f0b55c;
    --delete: #ff7d8e;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0c1823;
  --bg-subtle: #10202f;
  --bg-raised: #132638;
  --border: #1f3549;
  --border-strong: #2c475f;
  --text: #dfe8f1;
  --text-muted: #9cadbf;
  --heading: #ffffff;
  --link: #6cb4f5;
  --link-hover: #a9d4fa;
  --code-inline-bg: #1a3047;
  --code-inline-text: #d9ebfb;
  --code-bg: #08131d;
  --code-border: #1f3549;
  --sidebar-active-bg: #16304a;
  --topbar-bg: #08131d;
  --note-bg: #10263b;
  --note-border: #4d9be6;
  --warn-bg: #2a2110;
  --warn-border: #d59a35;
  --tip-bg: #15281a;
  --tip-border: #6fb33a;
  --get: #6cb4f5;
  --post: #8fd15a;
  --put: #f0b55c;
  --delete: #ff7d8e;
  color-scheme: dark;
}

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

html { scroll-padding-top: calc(var(--topbar-h) + 16px); -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16.5px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--link); text-decoration: underline; text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); text-underline-offset: 2px; }
a:hover { color: var(--link-hover); text-decoration-color: currentColor; }

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

.skip-link { position: absolute; left: -9999px; top: 8px; z-index: 100; background: var(--bg); padding: 8px 12px; }
.skip-link:focus { left: 12px; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 20px;
  padding: 0 20px;
  background: var(--topbar-bg);
  color: var(--topbar-text);
  border-bottom: 3px solid var(--red-600);
}
.brand { display: flex; align-items: baseline; gap: 10px; color: inherit; text-decoration: none; white-space: nowrap; }
.brand:hover { color: inherit; }
.brand-name { font-family: var(--font-head); font-weight: 700; font-size: 21px; letter-spacing: 0.2px; }
.brand-divider { width: 1px; height: 20px; background: rgba(255,255,255,0.35); align-self: center; }
.brand-product { font-family: var(--font-head); font-weight: 500; font-size: 17px; color: #cfe2f5; }

.topnav { display: flex; gap: 4px; margin-left: 8px; }
.topnav a {
  color: #d6e4f2; text-decoration: none; font-weight: 700; font-size: 14.5px;
  padding: 6px 10px; border-radius: 6px;
}
.topnav a:hover { color: #fff; background: rgba(255,255,255,0.08); }
.topnav a[aria-current="page"] { color: #fff; background: rgba(255,255,255,0.14); }

.menu-toggle {
  display: none; appearance: none; border: 1px solid rgba(255,255,255,0.3); background: transparent; color: #fff;
  font: 700 14px/1 var(--font-body); padding: 8px 12px; border-radius: 6px; cursor: pointer;
}

/* ---------- Layout ---------- */
.layout { display: flex; align-items: flex-start; max-width: 1280px; margin: 0 auto; }

.sidebar {
  position: sticky; top: var(--topbar-h);
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  padding: 24px 12px 40px 20px;
  border-right: 1px solid var(--border);
  font-size: 14.5px;
}
.sidebar h2 {
  font-family: var(--font-head); font-size: 12px; font-weight: 600; letter-spacing: 0.9px; text-transform: uppercase;
  color: var(--text-muted); margin: 22px 0 6px 10px;
}
.sidebar h2:first-child { margin-top: 0; }
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar li ul { margin: 2px 0 6px 12px; border-left: 1px solid var(--border); padding-left: 4px; }
.sidebar a {
  display: block; padding: 5px 10px; border-radius: 6px; color: var(--text); text-decoration: none; line-height: 1.35;
}
.sidebar li ul a { font-size: 13.8px; color: var(--text-muted); padding: 4px 10px; }
.sidebar a:hover { background: var(--bg-subtle); color: var(--heading); }
.sidebar a.active { background: var(--sidebar-active-bg); color: var(--link); font-weight: 700; }

.content { flex: 1; min-width: 0; padding: 40px 48px 96px; }
.content > * { max-width: var(--content-w); }
.content > .wide { max-width: 1000px; }

/* ---------- Typography ---------- */
h1, h2, h3, h4 { font-family: var(--font-head); color: var(--heading); line-height: 1.25; letter-spacing: 0.1px; }
h1 { font-size: 40px; font-weight: 600; margin: 0 0 12px; }
h2 { font-size: 28px; font-weight: 600; margin: 64px 0 14px; padding-top: 10px; border-top: 1px solid var(--border); }
h3 { font-size: 21px; font-weight: 600; margin: 36px 0 10px; }
h4 { font-size: 17px; font-weight: 600; margin: 26px 0 8px; }
h2 + h3 { margin-top: 18px; }
p { margin: 0 0 16px; }
ul, ol { margin: 0 0 16px; padding-left: 24px; }
li { margin: 4px 0; }
li > p { margin: 0 0 6px; }
strong { color: var(--heading); }
hr { border: 0; border-top: 1px solid var(--border); margin: 40px 0; }

.lede { font-size: 19px; color: var(--text-muted); line-height: 1.6; margin-bottom: 28px; }
.eyebrow { font-family: var(--font-head); font-weight: 600; font-size: 13px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--red-600); margin: 0 0 8px; }

.anchor { color: var(--border-strong); text-decoration: none; margin-left: 8px; font-weight: 400; opacity: 0; transition: opacity .12s; }
h2:hover .anchor, h3:hover .anchor, h4:hover .anchor, .anchor:focus { opacity: 1; }

code, kbd, samp { font-family: var(--font-mono); font-size: 0.88em; }
:not(pre) > code {
  background: var(--code-inline-bg); color: var(--code-inline-text);
  padding: 2px 6px; border-radius: 5px; white-space: nowrap;
}
td :not(pre) > code, li :not(pre) > code, p :not(pre) > code { white-space: normal; overflow-wrap: anywhere; }

/* ---------- Cards ---------- */
.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin: 8px 0 28px; }
@media (max-width: 560px) { .cards { grid-template-columns: 1fr; } }
.card {
  display: block; padding: 16px 18px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg-raised); color: var(--text); text-decoration: none;
}
a.card:hover { border-color: var(--blue-600); color: var(--text); box-shadow: 0 2px 10px rgba(14, 40, 63, 0.08); }
.card h3, .card h4 { margin: 0 0 6px; font-size: 17px; }
.card p { margin: 0; color: var(--text-muted); font-size: 15px; line-height: 1.5; }
.card .card-kicker { font-size: 12px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--link); margin-bottom: 4px; }

/* ---------- Steps ---------- */
.steps { counter-reset: step; list-style: none; padding: 0; margin: 0 0 24px; }
.steps > li { counter-increment: step; position: relative; padding: 0 0 8px 46px; margin: 0 0 18px; }
.steps > li::before {
  content: counter(step); position: absolute; left: 0; top: 0;
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--navy-900); color: #fff; font: 700 14px/1 var(--font-head);
}
:root[data-theme="dark"] .steps > li::before { background: var(--blue-600); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .steps > li::before { background: var(--blue-600); } }
.steps > li > h3, .steps > li > h4 { margin-top: 2px; }

/* ---------- Callouts ---------- */
.callout {
  border-left: 4px solid var(--note-border); background: var(--note-bg);
  padding: 12px 16px; border-radius: 0 var(--radius) var(--radius) 0; margin: 0 0 20px; font-size: 15.5px;
}
.callout p:last-child, .callout ul:last-child { margin-bottom: 0; }
.callout .callout-title { font-weight: 700; color: var(--heading); display: block; margin-bottom: 2px; }
.callout.warn { border-left-color: var(--warn-border); background: var(--warn-bg); }
.callout.tip { border-left-color: var(--tip-border); background: var(--tip-bg); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; margin: 0 0 22px; border: 1px solid var(--border); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th, td { text-align: left; vertical-align: top; padding: 10px 14px; border-bottom: 1px solid var(--border); }
th { background: var(--bg-subtle); font-family: var(--font-head); font-weight: 600; color: var(--heading); font-size: 14px; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td:first-child code { font-weight: 700; }
.req { display: inline-block; font-size: 11.5px; font-weight: 700; letter-spacing: .3px; color: var(--red-600); text-transform: uppercase; }
.opt { display: inline-block; font-size: 11.5px; font-weight: 700; letter-spacing: .3px; color: var(--text-muted); text-transform: uppercase; }
.type { color: var(--text-muted); font-family: var(--font-mono); font-size: 13px; white-space: nowrap; }

/* ---------- Endpoint line ---------- */
.endpoint {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  font-family: var(--font-mono); font-size: 14.5px;
  background: var(--bg-subtle); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 10px 14px; margin: 0 0 16px;
}
.endpoint .path { color: var(--heading); overflow-wrap: anywhere; }
.method {
  display: inline-block; font: 700 12px/1 var(--font-body); letter-spacing: .5px;
  padding: 5px 7px; border-radius: 5px; color: #fff; min-width: 52px; text-align: center;
}
.method.get { background: var(--blue-600); }
.method.post { background: #3f7d0a; }
.method.put { background: #9a5b00; }
.method.delete { background: #c21f33; }
.auth-tag {
  margin-left: auto; font: 700 11.5px/1 var(--font-body); letter-spacing: .3px; text-transform: uppercase;
  color: var(--text-muted); border: 1px solid var(--border-strong); border-radius: 999px; padding: 5px 9px;
}

/* ---------- Code blocks ---------- */
.code {
  position: relative; margin: 0 0 20px; border-radius: var(--radius); overflow: hidden;
  background: var(--code-bg); border: 1px solid var(--code-border);
}
.code-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 7px 10px 7px 14px; border-bottom: 1px solid var(--code-border);
  font: 700 12px/1.2 var(--font-body); letter-spacing: .4px; color: var(--code-muted); text-transform: uppercase;
}
.copy-btn {
  appearance: none; border: 1px solid #2c4660; background: transparent; color: #c5d6e7;
  font: 700 12px/1 var(--font-body); padding: 6px 9px; border-radius: 5px; cursor: pointer; text-transform: none; letter-spacing: 0;
}
.copy-btn:hover { background: #18304a; color: #fff; }
pre {
  margin: 0; padding: 14px 16px; overflow-x: auto;
  color: var(--code-text); font-family: var(--font-mono); font-size: 13.6px; line-height: 1.6;
  tab-size: 2;
}
pre code { font-size: inherit; }
.tok-key { color: var(--code-key); }
.tok-str { color: var(--code-string); }
.tok-num { color: var(--code-number); }
.tok-lit { color: var(--code-literal); }
.tok-com { color: var(--code-muted); font-style: italic; }
.tok-flag { color: var(--code-key); }
.tok-cmd { color: #ffffff; font-weight: 700; }
.tok-meth { color: var(--code-number); font-weight: 700; }

/* Tabs for paired code samples */
.tabs { margin: 0 0 20px; }
.tabs .code { margin: 0; border-top-left-radius: 0; border-top-right-radius: 0; }
.tablist { display: flex; gap: 2px; flex-wrap: wrap; }
.tablist button {
  appearance: none; border: 1px solid var(--code-border); border-bottom: 0; background: #142536; color: var(--code-muted);
  font: 700 12.5px/1 var(--font-body); padding: 9px 12px; border-radius: 7px 7px 0 0; cursor: pointer;
}
.tablist button[aria-selected="true"] { background: var(--code-bg); color: #fff; }
.tabpanel[hidden] { display: none; }

/* ---------- Diagram ---------- */
.figure { margin: 8px 0 28px; padding: 18px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-subtle); }
.figure svg { display: block; width: 100%; height: auto; }
.figure figcaption { margin-top: 10px; font-size: 14px; color: var(--text-muted); }
.dg-box { fill: var(--bg-raised); stroke: var(--border-strong); stroke-width: 1.5; }
.dg-box.brand { fill: var(--navy-900); stroke: var(--navy-900); }
.dg-title { font: 600 18px var(--font-head); fill: var(--heading); }
.dg-title.inv { fill: #ffffff; }
.dg-text { font: 14px var(--font-body); fill: var(--text-muted); }
.dg-text.inv { fill: #c7dbef; }
.dg-line { stroke: var(--blue-600); stroke-width: 2; fill: none; }
.dg-line.alt { stroke: var(--red-600); }
.dg-label { font: 700 13.5px var(--font-body); fill: var(--blue-600); }
.dg-label.alt { fill: var(--red-600); }
.dg-arrow { fill: var(--blue-600); }
.dg-arrow.alt { fill: var(--red-600); }

/* ---------- Event list ---------- */
.event-name { font-family: var(--font-mono); font-weight: 700; color: var(--heading); }

/* ---------- Checklist ---------- */
.checklist { list-style: none; padding-left: 0; }
.checklist li { position: relative; padding-left: 30px; margin: 8px 0; }
.checklist li::before {
  content: ""; position: absolute; left: 2px; top: 5px; width: 16px; height: 16px;
  border: 2px solid var(--border-strong); border-radius: 4px;
}

/* ---------- Footer ---------- */
.footer { margin-top: 72px; padding-top: 20px; border-top: 1px solid var(--border); color: var(--text-muted); font-size: 14px; }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .topnav { display: none; }
  .topnav.persistent { display: flex; }
  .content { padding: 32px 28px 80px; }
}
@media (max-width: 860px) {
  :root { --topbar-h: 56px; }
  .menu-toggle { display: inline-block; }
  .brand-divider, .brand-product { display: none; }
  .sidebar {
    position: fixed; top: var(--topbar-h); left: 0; bottom: 0; z-index: 40;
    height: auto; width: min(320px, 88vw); background: var(--bg);
    transform: translateX(-102%); transition: transform .18s ease; box-shadow: 0 0 40px rgba(0,0,0,.25);
  }
  body.nav-open .sidebar { transform: none; }
  .content { padding: 24px 16px 72px; }
  h1 { font-size: 31px; }
  h2 { font-size: 24px; margin-top: 48px; }
  h3 { font-size: 19px; }
  .lede { font-size: 17.5px; }
  .auth-tag { margin-left: 0; }
}
@media (max-width: 560px) {
  .topnav.persistent .hide-sm { display: none; }
  .topnav.persistent { margin-left: 0; }
}
@media (max-width: 420px) {
  .topbar { gap: 10px; padding: 0 12px; }
  .brand-name { font-size: 18px; }
}
