:root {
  color-scheme: light;
  --dm-blue: #2b99cc;
  --dm-blue-dark: #1f7baa;
  --dm-blue-light: #5bb8dd;
  --dm-bg: #ffffff;
  --dm-bg-alt: #f5f5f5;
  --dm-card: #ffffff;
  --dm-card-border: #e5e7eb;
  --dm-navy: #001a33;
  --dm-navy-light: #002244;
  --dm-darker: #001129;
  --dm-text: #333333;
  --dm-text-muted: #666666;
  --dm-heading: #1a1a1a;
  --dm-line: #e5e7eb;
  --dm-code: #0b1220;
  --dm-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  --dm-shadow-hover: 0 4px 20px rgba(43, 153, 204, 0.1);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, "Helvetica Neue", Arial, "PingFang SC", "PingFang TC",
    "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Microsoft YaHei UI",
    "Microsoft YaHei", "Microsoft JhengHei UI", "Microsoft JhengHei",
    "Yu Gothic UI", "Yu Gothic", Meiryo, "Apple SD Gothic Neo",
    "Malgun Gothic", "Leelawadee UI", Tahoma, "Noto Sans",
    "Noto Sans CJK SC", "Noto Sans CJK TC", "Noto Sans CJK JP",
    "Noto Sans CJK KR", "Noto Sans SC", "Noto Sans TC", "Noto Sans JP",
    "Noto Sans KR", "Noto Sans Thai", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--dm-bg);
  color: var(--dm-text);
  line-height: 1.7;
}

a {
  color: var(--dm-blue);
  text-decoration: none;
}

a:hover {
  color: var(--dm-blue-dark);
  text-decoration: none;
}

.site-shell {
  min-height: 100vh;
  background: var(--dm-bg);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: #000000;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.1);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  width: min(1280px, calc(100% - 3rem));
  min-height: 72px;
  margin: 0 auto;
}

.brand {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  color: #ffffff;
  font-weight: 700;
  letter-spacing: 0;
  white-space: nowrap;
}

.brand-logo-link {
  display: inline-flex;
  align-items: center;
  color: #ffffff;
}

.brand-logo-link:hover {
  color: #ffffff;
}

.brand-logo {
  display: block;
  width: auto;
  height: 31px;
}

.brand-divider {
  display: inline-block;
  width: 1px;
  height: 1.25rem;
  margin: 0 0.85rem;
  background: rgba(255, 255, 255, 0.22);
}

.brand-secondary {
  color: var(--dm-blue-light);
  font-size: 0.95rem;
  font-weight: 600;
}

.brand-secondary:hover {
  color: #ffffff;
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
}

.top-links {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.25rem;
}

.top-links a {
  border-radius: 4px;
  padding: 0.45rem 0.7rem;
  font-size: 0.9rem;
  font-weight: 500;
}

.top-links a {
  color: rgba(255, 255, 255, 0.78);
}

.top-links a:hover,
.top-links a[aria-current="page"] {
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
}

.language-select {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  background: var(--dm-darker);
  color: rgba(255, 255, 255, 0.6);
  padding: 0.25rem 0.5rem;
  font: inherit;
  font-size: 0.75rem;
  line-height: 1.4;
}

.language-select:hover {
  color: #ffffff;
}

.language-select:focus {
  border-color: var(--dm-blue);
  outline: none;
}

.hero {
  overflow: hidden;
  background: var(--dm-navy);
  color: #ffffff;
}

.hero-inner {
  width: min(1280px, calc(100% - 3rem));
  margin: 0 auto;
  padding: clamp(2.1rem, 4vw, 3rem) 0 clamp(1.7rem, 3.4vw, 2.5rem);
}

.eyebrow {
  display: inline-block;
  margin: 0 0 0.75rem;
  border: 1px solid rgba(91, 184, 221, 0.34);
  border-radius: 4px;
  background: rgba(43, 153, 204, 0.12);
  padding: 0.28rem 0.65rem;
  color: var(--dm-blue-light);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero h1 {
  max-width: 880px;
  margin: 0;
  color: #ffffff;
  font-size: clamp(2rem, 3.4vw, 3rem);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: 0;
}

.hero p {
  max-width: 760px;
  margin: 0.75rem 0 0;
  color: rgba(255, 255, 255, 0.76);
  font-size: clamp(0.95rem, 1.2vw, 1.05rem);
  line-height: 1.65;
}

.layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 2rem;
  width: min(1280px, calc(100% - 3rem));
  margin: 0 auto;
  padding: 2rem 0 5rem;
}

.sidebar {
  align-self: start;
  position: sticky;
  top: 96px;
  border: 1px solid var(--dm-card-border);
  border-radius: 4px;
  background: var(--dm-card);
  box-shadow: var(--dm-shadow);
  padding: 1.1rem;
}

.sidebar-label {
  margin: 0 0 0.8rem;
  color: var(--dm-text-muted);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.side-nav {
  display: grid;
  gap: 0.2rem;
}

.side-nav a {
  border-radius: 4px;
  padding: 0.62rem 0.72rem;
  color: var(--dm-text-muted);
  font-size: 0.94rem;
  font-weight: 500;
  line-height: 1.45;
}

.side-nav a:hover,
.side-nav a[aria-current="page"] {
  background: rgba(43, 153, 204, 0.08);
  color: var(--dm-blue-dark);
}

.content {
  min-width: 0;
}

.doc-body {
  border: 1px solid var(--dm-card-border);
  border-radius: 4px;
  background: var(--dm-card);
  box-shadow: var(--dm-shadow);
  padding: clamp(1.5rem, 3vw, 2.5rem);
}

.doc-body h1,
.doc-body h2,
.doc-body h3,
.doc-body h4 {
  color: var(--dm-heading);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: 0;
}

.doc-body h1 {
  display: none;
}

.doc-body h2 {
  margin: 2.6rem 0 1rem;
  border-top: 1px solid var(--dm-line);
  padding-top: 1.45rem;
  font-size: clamp(1.45rem, 2vw, 1.85rem);
}

.doc-body h2:first-child {
  margin-top: 0;
  border-top: 0;
  padding-top: 0;
}

.doc-body h3 {
  margin: 2rem 0 0.75rem;
  font-size: 1.18rem;
}

.doc-body p,
.doc-body li {
  color: var(--dm-text-muted);
}

.doc-body p {
  margin: 0 0 1rem;
}

.doc-body ul,
.doc-body ol {
  margin: 0.75rem 0 1.4rem;
  padding-left: 1.25rem;
}

.doc-body li + li {
  margin-top: 0.35rem;
}

pre {
  overflow-x: auto;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  background: var(--dm-code);
  color: #e5edf5;
  padding: 1rem;
  line-height: 1.6;
}

code {
  border-radius: 4px;
  background: rgba(43, 153, 204, 0.1);
  padding: 0.14rem 0.32rem;
  color: var(--dm-blue-dark);
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Monaco,
    Consolas, "Liberation Mono", "Roboto Mono", "Noto Sans Mono", monospace;
  font-size: 0.92em;
}

pre code {
  background: transparent;
  padding: 0;
  color: inherit;
}

table {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  margin: 1.25rem 0 1.6rem;
  font-size: 0.92rem;
}

th,
td {
  border-bottom: 1px solid var(--dm-line);
  padding: 0.75rem;
  text-align: left;
  vertical-align: top;
  min-width: 8rem;
}

th {
  color: var(--dm-heading);
  background: var(--dm-bg-alt);
  font-weight: 700;
}

td {
  color: var(--dm-text-muted);
}

.ref-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.9rem;
  margin: 1.25rem 0 1.7rem;
}

.ref-card {
  border: 1px solid var(--dm-card-border);
  border-radius: 4px;
  background: var(--dm-bg-alt);
  padding: 1rem;
}

.ref-card:hover {
  border-color: rgba(43, 153, 204, 0.38);
  box-shadow: var(--dm-shadow-hover);
}

.ref-card h3 {
  margin: 0 0 0.3rem;
  color: var(--dm-heading);
  font-size: 1rem;
}

.ref-card p {
  margin: 0;
  color: var(--dm-text-muted);
  font-size: 0.9rem;
}

.footer {
  background: var(--dm-darker);
  color: rgba(255, 255, 255, 0.68);
}

.footer-inner {
  width: min(1280px, calc(100% - 3rem));
  margin: 0 auto;
}

.footer {
  padding: 1.5rem;
  font-size: 0.9rem;
  text-align: center;
}

@media (max-width: 860px) {
  .topbar-inner {
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    padding: 0.9rem 0;
  }

  .brand {
    white-space: normal;
  }

  .topbar-actions {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.7rem;
  }

  .top-links {
    justify-content: flex-start;
  }

  .hero-inner,
  .layout {
    width: min(100% - 2rem, 1280px);
  }

  .hero-inner {
    padding: 2rem 0 1.75rem;
  }

  .layout {
    display: block;
    padding: 1.25rem 0 3rem;
  }

  .sidebar {
    position: static;
    margin-bottom: 1rem;
  }

  .doc-body {
    padding: 1.25rem;
  }
}

/* PM-1042 — collapsible per-slice reference sections */
details.slice {
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 8px;
  margin: 0.75rem 0;
  padding: 0 1rem;
  background: var(--surface, #fff);
}
details.slice > summary {
  cursor: pointer;
  padding: 0.85rem 0.25rem;
  font-size: 1.02rem;
  list-style: none;
}
details.slice > summary::-webkit-details-marker { display: none; }
details.slice > summary::before {
  content: "▸";
  display: inline-block;
  width: 1.1em;
  color: var(--muted, #64748b);
  transition: transform 0.15s ease;
}
details.slice[open] > summary::before { transform: rotate(90deg); }
details.slice > summary code { font-size: 0.85em; }
details.slice[open] { padding-bottom: 0.75rem; }

/* PM-1043 cleanup — per-tool collapsible entries + parameters table */
details.tool {
  margin: 0.35rem 0;
  padding: 0 0.85rem;
  border-left: 2px solid var(--border, #e2e8f0);
}
details.tool > summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.25rem;
}
details.tool > summary::-webkit-details-marker { display: none; }
details.tool > summary::before {
  content: "▸";
  color: var(--muted, #94a3b8);
  font-size: 0.8em;
}
details.tool[open] > summary::before { content: "▾"; }
code.tool-name { font-weight: 600; background: none; padding: 0; }
.tool-scope {
  font-size: 0.72rem;
  color: var(--muted, #475569);
  background: var(--surface-2, #f1f5f9);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 999px;
  padding: 0.05rem 0.5rem;
  white-space: nowrap;
}
.tool-desc { margin: 0.1rem 0 0.4rem; color: var(--text, #334155); }
.params-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted, #64748b);
  margin: 0.5rem 0 0.3rem;
}
.tool-noparams { color: var(--muted, #94a3b8); font-size: 0.9rem; margin: 0.3rem 0 0.5rem; }
details.tool table { font-size: 0.9rem; margin: 0.2rem 0 0.6rem; }
details.tool th, details.tool td { padding: 0.35rem 0.6rem; }
