/* Therbie Help — one stylesheet, no external fonts or libraries. */
:root {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-2: #f0f0f3;
  --text: #1d1d1f;
  --text-2: #5f5f66;
  --text-3: #86868b;
  --line: #e2e2e7;
  --accent: #0a84ff;
  --accent-soft: rgba(10, 132, 255, 0.10);
  --green: #28a745;
  --green-soft: rgba(52, 199, 89, 0.12);
  --orange: #e8710a;
  --orange-soft: rgba(255, 149, 0, 0.12);
  --purple: #8e44ad;
  --purple-soft: rgba(175, 82, 222, 0.10);
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.05);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --surface: #161618;
    --surface-2: #1f1f22;
    --text: #f5f5f7;
    --text-2: #b4b4bb;
    --text-3: #8a8a91;
    --line: #2c2c30;
    --accent: #409cff;
    --accent-soft: rgba(64, 156, 255, 0.14);
    --green: #30d158;
    --green-soft: rgba(48, 209, 88, 0.14);
    --orange: #ff9f0a;
    --orange-soft: rgba(255, 159, 10, 0.14);
    --purple: #bf5af2;
    --purple-soft: rgba(191, 90, 242, 0.14);
    --shadow: none;
  }
}

* { box-sizing: border-box; }
html { scroll-padding-top: 76px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 16px;
  height: 60px; padding: 0 20px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 600; font-size: 17px; }
.brand:hover { text-decoration: none; }
.brand img { border-radius: 7px; }
.brand em { font-style: normal; color: var(--text-3); font-weight: 500; }
.nav-toggle { display: none; background: none; border: 0; color: var(--text); padding: 6px; border-radius: 8px; cursor: pointer; }

.search { position: relative; margin-left: auto; width: min(420px, 50vw); display: flex; align-items: center; }
.search > svg { position: absolute; left: 12px; color: var(--text-3); }
.search input {
  width: 100%; height: 38px; padding: 0 40px 0 36px;
  border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); font: inherit; font-size: 15px;
}
.search input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.search kbd {
  position: absolute; right: 10px; font: 12px var(--mono); color: var(--text-3);
  border: 1px solid var(--line); border-radius: 5px; padding: 0 6px;
}
.results {
  position: absolute; top: 46px; left: 0; right: 0;
  max-height: 70vh; overflow: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0,0,0,.18); padding: 6px;
}
.results a { display: block; padding: 10px 12px; border-radius: 8px; color: var(--text); }
.results a:hover, .results a.sel { background: var(--accent-soft); text-decoration: none; }
.results .r-title { font-weight: 600; }
.results .r-sec { font-size: 12px; color: var(--text-3); margin-left: 6px; font-weight: 500; }
.results .r-snip { font-size: 13.5px; color: var(--text-2); margin-top: 2px; }
.results mark { background: transparent; color: var(--accent); font-weight: 600; }
.results .none { padding: 14px; color: var(--text-3); font-size: 14px; }

/* Layout */
.layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); max-width: 1400px; margin: 0 auto; }
.sidebar {
  position: sticky; top: 60px; height: calc(100vh - 60px); overflow: auto;
  padding: 22px 14px 40px 20px; border-right: 1px solid var(--line);
}
.sidebar a { display: block; padding: 6px 10px; border-radius: 8px; color: var(--text-2); font-size: 14.5px; line-height: 1.35; }
.sidebar a:hover { background: var(--surface-2); text-decoration: none; color: var(--text); }
.sidebar a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-home { font-weight: 600; color: var(--text) !important; margin-bottom: 8px; }
.nav-group { margin-top: 18px; }
.nav-label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); padding: 0 10px 6px; }

.content { display: grid; grid-template-columns: minmax(0, 760px) 220px; gap: 48px; padding: 36px 40px 80px; justify-content: center; }
article { min-width: 0; }
.eyebrow { font-size: 13px; font-weight: 600; color: var(--accent); margin-bottom: 4px; }
.eyebrow:empty { display: none; }

/* Type */
h1 { font-size: 36px; line-height: 1.15; letter-spacing: -0.02em; margin: 0 0 12px; }
h2 { font-size: 24px; line-height: 1.25; letter-spacing: -0.01em; margin: 44px 0 10px; padding-top: 4px; }
h3 { font-size: 18px; margin: 28px 0 6px; }
p, ul, ol { margin: 0 0 14px; }
li { margin: 4px 0; }
article > p:first-of-type { font-size: 18.5px; color: var(--text-2); line-height: 1.55; }
strong { font-weight: 600; }
code { font: 14px var(--mono); background: var(--surface-2); padding: 1px 6px; border-radius: 6px; }
pre { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; overflow: auto; }
pre code { background: none; padding: 0; font-size: 13.5px; line-height: 1.55; }
hr { border: 0; border-top: 1px solid var(--line); margin: 36px 0; }
kbd { font: 13px var(--mono); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; background: var(--surface); }

/* Tables */
.table-wrap { overflow-x: auto; margin: 8px 0 22px; -webkit-overflow-scrolling: touch; }
.table-wrap table { margin: 0; min-width: 520px; }
table { width: 100%; border-collapse: separate; border-spacing: 0; margin: 8px 0 22px; font-size: 15px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 13px; font-weight: 600; color: var(--text-2); background: var(--surface-2); }
tr:last-child td { border-bottom: 0; }

/* Figures */
figure { margin: 22px 0 28px; }
figure img { display: block; max-width: 100%; height: auto; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); }
figure.fig-tall img { max-height: 620px; width: auto; }
figure.fig-small img { max-width: min(100%, 520px); }
figcaption { font-size: 13.5px; color: var(--text-3); margin-top: 8px; }
.zoom { cursor: zoom-in; display: inline-block; max-width: 100%; }
.shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }

/* Callouts: > **Tip** text */
blockquote { margin: 18px 0; padding: 14px 18px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }
blockquote p:last-child { margin: 0; }
.callout-tip { background: var(--green-soft); border-color: transparent; }
.callout-tip strong:first-child { color: var(--green); }
.callout-note { background: var(--accent-soft); border-color: transparent; }
.callout-note strong:first-child { color: var(--accent); }
.callout-limit, .callout-important { background: var(--orange-soft); border-color: transparent; }
.callout-limit strong:first-child, .callout-important strong:first-child { color: var(--orange); }

/* On this page */
.toc { position: sticky; top: 92px; align-self: start; font-size: 13.5px; }
.toc-label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); margin-bottom: 8px; }
.toc ul { list-style: none; padding: 0; margin: 0; border-left: 1px solid var(--line); }
.toc li { margin: 0; }
.toc a { display: block; padding: 4px 0 4px 12px; color: var(--text-2); margin-left: -1px; border-left: 2px solid transparent; }
.toc a.on { color: var(--accent); border-left-color: var(--accent); }

/* Pager */
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 56px; }
.pager a { display: block; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--text); font-weight: 600; }
.pager a:hover { border-color: var(--accent); text-decoration: none; }
.pager span { display: block; font-size: 12.5px; color: var(--text-3); font-weight: 500; }
.pager .next { text-align: right; }

/* Home */
.hero { display: flex; gap: 22px; align-items: center; margin-bottom: 8px; }
.hero img { border-radius: 22%; box-shadow: var(--shadow); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; margin: 18px 0 30px; }
.cards a { display: block; padding: 16px 18px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); color: var(--text); box-shadow: var(--shadow); }
.cards a:hover { border-color: var(--accent); text-decoration: none; }
.cards b { display: block; font-size: 16px; margin-bottom: 3px; }
.cards span { display: block; font-size: 14px; color: var(--text-2); line-height: 1.45; }
.home .content { grid-template-columns: minmax(0, 980px); }

/* Lightbox */
.lightbox { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.82); display: flex; align-items: center; justify-content: center; padding: 3vh 3vw; cursor: zoom-out; }
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 10px; box-shadow: 0 20px 60px rgba(0,0,0,.5); }

/* Responsive */
@media (max-width: 1180px) {
  .content { grid-template-columns: minmax(0, 760px); }
  .toc { display: none; }
}
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .nav-toggle { display: block; }
  .sidebar {
    position: fixed; top: 60px; left: 0; bottom: 0; width: 280px; z-index: 15;
    background: var(--bg); transform: translateX(-100%); transition: transform .2s ease;
  }
  body.nav-open .sidebar { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.25); }
  .content { padding: 24px 18px 60px; }
  .search kbd { display: none; }
  .brand span { display: none; }
  .search { width: auto; flex: 1; }
  h1 { font-size: 30px; }
  .pager { grid-template-columns: 1fr; }
}

/* Footer: legal links on every page. */
.site-footer {
  display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: center;
  padding: 20px 16px 28px; border-top: 1px solid var(--line);
  font-size: 13px; color: var(--text-3);
}
.site-footer a { color: var(--text-2); }
