:root {
  --bg: #ffffff;
  --fg: #333333;
  --heading: #33394b;
  --muted: #4a4a4a;
  --border: #f1f1f1;
  --accent: #006be6;
  --accent-hover: #0056b8;
  --code-bg: #f8f9fa;
  --code-fg: #006be6;
  --deprecated-bg: #fef3c7;
  --deprecated-fg: #92400e;
  --sidebar-bg: #ffffff;
  --sidebar-width: 320px;
  --search-bg: #ffffff;
  --search-border: #cbd5e1;
  --search-focus: #006be6;
  --result-hover: #f1f5f9;
}

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

body {
  font-family: 'Figtree', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--fg);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  color: var(--heading);
}

h1 {
  font-family: 'Gowun Batang', serif;
}

.layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  padding: 1.5rem 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  padding: 0.5rem 1.5rem 1.75rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.5rem;
}

.sidebar-header-links {
  display: flex;
  flex-direction: column;
}

.sidebar-header-link {
  font-size: 1rem;
  font-weight: 700;
  color: var(--fg);
  text-decoration: none;
}

.sidebar-header-link:hover {
  color: var(--accent);
  text-decoration: none;
}

.sidebar-logo {
  width: 100%;
  max-width: 120px;
  height: auto;
  display: block;
  margin-bottom: 1.25rem;
}

.search-container {
  padding: 0.5rem 1.5rem;
  position: relative;
}

.search-input {
  width: 100%;
  padding: 0.6rem 0.875rem;
  font-size: 1rem;
  border: 1px solid var(--search-border);
  border-radius: 6px;
  background: var(--search-bg);
  color: var(--fg);
  outline: none;
}

.search-input:focus {
  border-color: var(--search-focus);
  box-shadow: 0 0 0 2px rgba(0, 107, 230, 0.15);
}

.search-results {
  position: absolute;
  left: 1.5rem;
  right: 1.5rem;
  top: 100%;
  background: var(--search-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  max-height: 320px;
  overflow-y: auto;
  z-index: 100;
}

.search-group-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0.5rem 0.75rem 0.25rem;
  letter-spacing: 0.05em;
}

.search-result {
  display: block;
  padding: 0.375rem 0.75rem;
  font-size: 0.875rem;
  color: var(--fg);
  text-decoration: none;
  cursor: pointer;
}

.search-result:hover,
.search-result.highlighted {
  background: var(--result-hover);
  color: var(--accent);
}

.search-result strong {
  color: var(--accent);
  font-weight: 700;
}

.nav-group {
  margin: 0;
  border: none;
}

.nav-group summary {
  padding: 0.5rem 1.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: #111827;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.nav-group summary::-webkit-details-marker { display: none; }

.nav-group summary::before {
  content: "\25B6";
  display: inline-block;
  margin-right: 0.5rem;
  font-size: 0.65rem;
  transition: transform 0.15s;
}

.nav-group[open] summary::before {
  transform: rotate(90deg);
}

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

.nav-group li a {
  display: block;
  padding: 0.4rem 1.5rem 0.4rem 2.25rem;
  font-size: 0.95rem;
  color: #6b7280;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-group li a:hover {
  background: #f3f4f6;
  color: #111827;
}

.nav-group li.active a {
  color: var(--accent);
  font-weight: 600;
  background: #eef2ff;
}

.content {
  flex: 1;
  width: 70%;
  max-width: 960px;
  padding: 2rem 3rem;
  margin: 0 auto;
}

.content h1 { margin-bottom: 1rem; font-size: 2.25rem; font-family: 'Gowun Batang', serif; font-weight: 700; color: var(--heading); }
.content h2 { margin: 2.5rem 0 1rem; font-size: 1.875rem; border-bottom: 1px solid var(--border); padding-bottom: 0.5rem; font-weight: 600; color: var(--heading); }
.content h3 { font-size: 1.5rem; margin: 2rem 0 0.75rem; color: var(--heading); }
.content h4 { margin-bottom: 0.25rem; font-size: 0.875rem; color: var(--muted); }
.content p { margin-bottom: 0.75rem; }
.content ul { margin: 0 0 1rem 1.5rem; }
.content li { margin-bottom: 0.25rem; }

.page-footer {
  margin-top: 3rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.8125rem;
  color: #6b7280;
  text-align: right;
}

.page-footer p {
  margin: 0;
}

.page-footer time {
  font-variant-numeric: tabular-nums;
}

a { color: var(--accent); text-decoration: none; font-weight: 500; }
a:hover { color: var(--accent-hover); text-decoration: underline; }

code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; font-size: 0.9rem; }
pre { background: rgb(39, 40, 34); padding: 1rem; border-radius: 6px; overflow-x: auto; margin-bottom: 1rem; border: none; }
code { background: var(--code-bg); color: var(--code-fg); padding: 0.125rem 0.375rem; border-radius: 3px; border: 1px solid var(--border); box-shadow: none; text-shadow: none; }
pre code { background: none; padding: 0; border: none; color: rgb(248, 248, 242); box-shadow: none; text-shadow: none; }

table { width: 100%; border-collapse: collapse; margin-bottom: 1rem; font-size: 0.875rem; }
th, td { text-align: left; padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--border); }
th { font-weight: 600; background: var(--code-bg); }

.content .fields-table,
.content .args-table,
.content .enum-table {
  table-layout: auto;
}

.kind-label { font-size: 0.75rem; text-transform: uppercase; color: var(--muted); font-weight: 400; letter-spacing: 0.05em; }
.badge.deprecated { background: var(--deprecated-bg); color: var(--deprecated-fg); font-size: 0.7rem; font-weight: 600; padding: 0.125rem 0.375rem; border-radius: 3px; text-transform: uppercase; }
.deprecation-reason { font-size: 0.8rem; color: var(--muted); font-style: italic; }
.type-builtin { color: var(--muted); }

.field-args-row td { border-bottom: 1px solid var(--border); padding: 0.25rem 0.75rem 0.75rem; }
.field-args-indent { margin-left: 0; }
.field-args-indent .args-table { margin: 0; background: var(--code-bg); }

.code-blocks { display: flex; flex-direction: column; gap: 1rem; margin-bottom: 1rem; }
.code-block { position: relative; }
.code-block h4 { margin-bottom: 0.25rem; }

.expandable-fragment {
  color: inherit;
}
.expand-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.2em;
  height: 1.2em;
  margin-left: 0.35em;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.55);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.75em;
  line-height: 1;
  vertical-align: middle;
  position: relative;
  top: -1px;
  user-select: none;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.expand-btn > span {
  font-weight: 700;
  position: relative;
  top: -0.5px;
  left: -0.25px;
}
.expand-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.6);
  color: rgba(255, 255, 255, 0.9);
}

.code-block-toolbar {
  position: absolute;
  top: 2.75rem;
  right: 0.75rem;
  display: inline-flex;
  gap: 0.5rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  z-index: 2;
}

.code-block:hover .code-block-toolbar,
.code-block:focus-within .code-block-toolbar {
  opacity: 1;
  pointer-events: auto;
}

@media (hover: none) {
  .code-block-toolbar {
    opacity: 1;
    pointer-events: auto;
  }
}

.reset-code-btn[hidden] {
  display: none;
}

.reset-code-btn,
.copy-code-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 6px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.72);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.reset-code-btn:hover,
.copy-code-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.35);
  color: rgba(255, 255, 255, 0.9);
}

.reset-code-btn:focus-visible,
.copy-code-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.reset-code-btn .reset-code-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.copy-code-btn .copy-code-icon,
.copy-code-btn .copy-code-success-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.copy-code-btn .copy-code-success-icon { display: none; }
.copy-code-btn.copied .copy-code-icon { display: none; }
.copy-code-btn.copied .copy-code-success-icon { display: flex; }

@media (max-width: 768px) {
  .layout { flex-direction: column; }
  .sidebar {
    width: 100%;
    min-width: 100%;
    height: auto;
    position: static;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
}
