/* sharp-runtime documentation — shared stylesheet */

:root {
  --bg: #ffffff;
  --bg-sidebar: #f4f6f8;
  --bg-code: #f0f2f5;
  --bg-callout-note: #e8f4fd;
  --bg-callout-warn: #fff8e1;
  --bg-callout-todo: #f3e5f5;
  --bg-callout-nv: #fce4ec;
  --border: #dde1e7;
  --text: #1a1a2e;
  --text-muted: #5a6475;
  --accent: #0066cc;
  --accent-hover: #0052a3;
  --code-text: #24292e;
  --sidebar-width: 260px;
  --header-height: 54px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1a1d23;
    --bg-sidebar: #13151a;
    --bg-code: #252830;
    --bg-callout-note: #1a2a3a;
    --bg-callout-warn: #2a2510;
    --bg-callout-todo: #2a1a2a;
    --bg-callout-nv: #2a1a1a;
    --border: #2e3340;
    --text: #e2e8f0;
    --text-muted: #8892a4;
    --accent: #5eaaff;
    --accent-hover: #82beff;
    --code-text: #abb2bf;
  }
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ---- TOP HEADER ---- */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-height);
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 1rem;
  z-index: 100;
  gap: 1rem;
}
.site-header .logo {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
}
.site-header .logo span { color: var(--text); font-weight: 400; }
.header-search {
  flex: 1;
  max-width: 340px;
}
.header-search input {
  width: 100%;
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.9rem;
}
.header-search input:focus { outline: 2px solid var(--accent); }
.theme-toggle {
  margin-left: auto;
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.3rem 0.6rem;
  color: var(--text);
  cursor: pointer;
  font-size: 0.85rem;
}
.theme-toggle:hover { background: var(--bg-code); }

/* ---- LAYOUT ---- */
.page-body {
  display: flex;
  margin-top: var(--header-height);
  flex: 1;
}

/* ---- SIDEBAR ---- */
.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  height: calc(100vh - var(--header-height));
  position: sticky;
  top: var(--header-height);
  overflow-y: auto;
  padding: 1rem 0;
}
.sidebar nav ul { list-style: none; }
.sidebar nav ul li { padding: 0; }
.sidebar .nav-section {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 0.9rem 1rem 0.25rem;
}
.sidebar nav a {
  display: block;
  padding: 0.3rem 1rem 0.3rem 1.25rem;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.88rem;
  border-left: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}
.sidebar nav a:hover,
.sidebar nav a.active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: rgba(0,102,204,0.05);
}

/* ---- MAIN CONTENT ---- */
.content {
  flex: 1;
  min-width: 0;
  padding: 2rem 2.5rem;
  max-width: 900px;
}

/* ---- BREADCRUMB ---- */
.breadcrumb {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}
.breadcrumb a { color: var(--accent); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb span + span::before { content: " › "; }

/* ---- HEADINGS ---- */
h1 { font-size: 2rem; margin-bottom: 0.5rem; line-height: 1.25; }
h2 { font-size: 1.45rem; margin-top: 2.5rem; margin-bottom: 0.6rem; border-bottom: 1px solid var(--border); padding-bottom: 0.3rem; }
h3 { font-size: 1.15rem; margin-top: 1.8rem; margin-bottom: 0.4rem; }
h4 { font-size: 1rem; margin-top: 1.4rem; margin-bottom: 0.3rem; color: var(--text-muted); }

.page-subtitle {
  font-size: 1.05rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
  margin-top: 0.25rem;
}

/* ---- PROSE ---- */
p { margin-bottom: 1rem; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
ul, ol { margin-bottom: 1rem; padding-left: 1.5rem; }
li { margin-bottom: 0.25rem; }
strong { font-weight: 600; }

/* ---- CODE ---- */
code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.87em;
  background: var(--bg-code);
  color: var(--code-text);
  padding: 0.1em 0.35em;
  border-radius: 4px;
  border: 1px solid var(--border);
}
pre {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  overflow-x: auto;
  margin: 1.25rem 0;
  font-size: 0.88rem;
  line-height: 1.6;
}
pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: inherit;
}

/* ---- TABLES ---- */
.table-wrap { overflow-x: auto; margin: 1.25rem 0; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
th {
  background: var(--bg-code);
  font-weight: 600;
  text-align: left;
  padding: 0.5rem 0.8rem;
  border-bottom: 2px solid var(--border);
}
td {
  padding: 0.45rem 0.8rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
tr:hover td { background: var(--bg-code); }

/* ---- CALLOUT BOXES ---- */
.callout {
  border-radius: 8px;
  padding: 0.9rem 1.1rem;
  margin: 1.25rem 0;
  border-left: 4px solid;
  font-size: 0.92rem;
}
.callout-title {
  font-weight: 700;
  margin-bottom: 0.3rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.callout.note { background: var(--bg-callout-note); border-color: #0ea5e9; }
.callout.note .callout-title { color: #0369a1; }
.callout.warning { background: var(--bg-callout-warn); border-color: #f59e0b; }
.callout.warning .callout-title { color: #b45309; }
.callout.todo { background: var(--bg-callout-todo); border-color: #a855f7; }
.callout.todo .callout-title { color: #7c3aed; }
.callout.needs-verification { background: var(--bg-callout-nv); border-color: #ef4444; }
.callout.needs-verification .callout-title { color: #b91c1c; }

/* ---- STATUS BADGES ---- */
.badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.badge-done { background: #d1fae5; color: #065f46; }
.badge-partial { background: #fef9c3; color: #92400e; }
.badge-stub { background: #fce7f3; color: #9d174d; }
.badge-todo { background: #ede9fe; color: #5b21b6; }
.badge-posix { background: #ffedd5; color: #c2410c; }

@media (prefers-color-scheme: dark) {
  .badge-done { background: #064e3b; color: #6ee7b7; }
  .badge-partial { background: #451a03; color: #fbbf24; }
  .badge-stub { background: #4c1d95; color: #ddd6fe; }
  .badge-todo { background: #3b0764; color: #e9d5ff; }
  .badge-posix { background: #431407; color: #fdba74; }
}

/* ---- CARD GRID ---- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}
.card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.1rem;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
  display: block;
}
.card:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 12px rgba(0,102,204,0.12);
  text-decoration: none;
}
.card h3 { margin-top: 0; font-size: 1rem; color: var(--accent); }
.card p { font-size: 0.85rem; color: var(--text-muted); margin: 0; }

/* ---- PREV/NEXT NAV ---- */
.page-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.9rem;
}
.page-nav a {
  display: flex;
  flex-direction: column;
  color: var(--text);
  text-decoration: none;
  gap: 0.2rem;
}
.page-nav a:hover .page-nav-label { color: var(--accent); }
.page-nav-label { font-weight: 600; color: var(--accent); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; }
.page-nav .prev { align-items: flex-start; }
.page-nav .next { align-items: flex-end; }

/* ---- SEARCH RESULTS ---- */
#search-results { margin-top: 1rem; }
.search-result-item { padding: 0.75rem 0; border-bottom: 1px solid var(--border); }
.search-result-item a { font-weight: 600; }
.search-result-item p { font-size: 0.88rem; color: var(--text-muted); margin: 0.2rem 0 0; }

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .content { padding: 1.25rem 1rem; }
  h1 { font-size: 1.5rem; }
}

/* ---- DARK MODE OVERRIDE (manual toggle) ---- */
body.dark {
  --bg: #1a1d23;
  --bg-sidebar: #13151a;
  --bg-code: #252830;
  --bg-callout-note: #1a2a3a;
  --bg-callout-warn: #2a2510;
  --bg-callout-todo: #2a1a2a;
  --bg-callout-nv: #2a1a1a;
  --border: #2e3340;
  --text: #e2e8f0;
  --text-muted: #8892a4;
  --accent: #5eaaff;
  --accent-hover: #82beff;
  --code-text: #abb2bf;
}
body.light {
  --bg: #ffffff;
  --bg-sidebar: #f4f6f8;
  --bg-code: #f0f2f5;
  --bg-callout-note: #e8f4fd;
  --bg-callout-warn: #fff8e1;
  --bg-callout-todo: #f3e5f5;
  --bg-callout-nv: #fce4ec;
  --border: #dde1e7;
  --text: #1a1a2e;
  --text-muted: #5a6475;
  --accent: #0066cc;
  --accent-hover: #0052a3;
  --code-text: #24292e;
}

hr { border: none; border-top: 1px solid var(--border); margin: 2rem 0; }

.file-path {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: monospace;
  display: inline-block;
  margin-bottom: 0.5rem;
}
