/* ===========================================================================
   Docs & legal pages — polished reading design.
   Relies on the CSS custom properties defined in style.css (link both).
   Namespaced under .dp so it never touches the app UI.
   =========================================================================== */

.dp {
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ── Sticky top nav ──────────────────────────────────────── */
.dp-nav {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 16px;
  padding: 14px 28px;
  background: color-mix(in srgb, var(--bg2) 88%, transparent);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.dp-brand {
  font-size: 17px; font-weight: 800; letter-spacing: -.3px;
  color: var(--text); text-decoration: none;
}
.dp-brand span { color: var(--accent); }
.dp-nav-links { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.dp-nav-links a {
  font-size: 13.5px; color: var(--text2); text-decoration: none;
  padding: 6px 12px; border-radius: 8px; transition: background .15s, color .15s;
}
.dp-nav-links a:hover { background: var(--bg3); color: var(--text); }
.dp-nav-links a.primary { color: var(--accent); font-weight: 600; }
.dp-theme {
  background: none; border: 1px solid var(--border); border-radius: 8px;
  cursor: pointer; padding: 5px 9px; font-size: 15px; line-height: 1; color: var(--text2);
}
.dp-theme:hover { background: var(--bg3); }

/* ── Hero ────────────────────────────────────────────────── */
.dp-hero {
  max-width: 1080px; margin: 0 auto; padding: 64px 28px 28px;
}
.dp-eyebrow {
  display: inline-block; font-size: 12.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .09em; color: var(--accent);
  margin-bottom: 14px;
}
.dp-hero h1 {
  font-size: clamp(30px, 5vw, 44px); font-weight: 800; line-height: 1.08;
  letter-spacing: -.025em; margin: 0 0 16px;
}
.dp-hero .dp-sub {
  font-size: 18px; line-height: 1.6; color: var(--text2);
  max-width: 640px; margin: 0;
}

/* ── Layout (TOC + article) ──────────────────────────────── */
.dp-layout {
  max-width: 1080px; margin: 0 auto; padding: 28px 28px 96px;
  display: grid; grid-template-columns: 1fr; gap: 40px;
}
@media (min-width: 940px) {
  .dp-layout.has-toc { grid-template-columns: 220px minmax(0, 1fr); gap: 56px; }
}

/* ── Table of contents ───────────────────────────────────── */
.dp-toc { display: none; }
@media (min-width: 940px) {
  .dp-toc {
    display: block; position: sticky; top: 92px; align-self: start;
    max-height: calc(100vh - 120px); overflow-y: auto;
  }
}
.dp-toc-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; color: var(--text2); margin-bottom: 12px; padding-left: 12px;
}
.dp-toc a {
  display: block; padding: 6px 12px; font-size: 13.5px; line-height: 1.4;
  color: var(--text2); text-decoration: none; border-left: 2px solid transparent;
  border-radius: 0 6px 6px 0; transition: color .15s, border-color .15s, background .15s;
}
.dp-toc a:hover { color: var(--text); background: var(--bg3); }
.dp-toc a.active { color: var(--accent); border-left-color: var(--accent); font-weight: 600; }

/* ── Article prose ───────────────────────────────────────── */
.dp-article { max-width: 760px; font-size: 16px; line-height: 1.75; color: var(--text); }
.dp-article section { scroll-margin-top: 92px; }
.dp-article section + section { margin-top: 44px; }
.dp-article h2 {
  font-size: 24px; font-weight: 700; letter-spacing: -.01em;
  margin: 0 0 16px; padding-left: 14px; position: relative;
}
.dp-article h2::before {
  content: ""; position: absolute; left: 0; top: 6px; bottom: 6px;
  width: 4px; border-radius: 2px; background: var(--accent);
}
.dp-article h3 { font-size: 17px; font-weight: 700; margin: 28px 0 10px; }
.dp-article p { margin: 0 0 16px; color: color-mix(in srgb, var(--text) 88%, var(--text2)); }
.dp-article ul, .dp-article ol { margin: 0 0 16px; padding-left: 24px; }
.dp-article li { margin-bottom: 8px; color: color-mix(in srgb, var(--text) 88%, var(--text2)); }
.dp-article li::marker { color: var(--text2); }
.dp-article strong { color: var(--text); font-weight: 650; }
.dp-article a { color: var(--accent); text-decoration: none; border-bottom: 1px solid transparent; }
.dp-article a:hover { border-bottom-color: currentColor; }

.dp-article code {
  font-family: var(--mono); font-size: 13.5px;
  background: var(--bg3); color: var(--text);
  padding: 2px 6px; border-radius: 5px; word-break: break-word;
}
.dp-article pre {
  background: var(--bg3); border: 1px solid var(--border); border-radius: 10px;
  padding: 16px 18px; overflow-x: auto; margin: 0 0 18px;
}
.dp-article pre code { background: none; padding: 0; font-size: 13px; line-height: 1.6; }

/* Steps (numbered getting-started) */
.dp-article ol.dp-steps { counter-reset: step; list-style: none; padding-left: 0; }
.dp-article ol.dp-steps > li {
  position: relative; padding-left: 44px; margin-bottom: 16px; min-height: 30px;
}
.dp-article ol.dp-steps > li::before {
  counter-increment: step; content: counter(step);
  position: absolute; left: 0; top: 0;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent); color: #fff; font-size: 13px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

/* Callout */
.dp-callout {
  display: flex; gap: 12px; align-items: flex-start;
  background: color-mix(in srgb, var(--accent) 8%, var(--bg2));
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--border));
  border-radius: 12px; padding: 14px 16px; margin: 0 0 18px;
  font-size: 14.5px; color: var(--text2);
}
.dp-callout .ico { flex-shrink: 0; font-size: 16px; line-height: 1.5; }
.dp-callout code { font-size: 12.5px; }

.dp-note { color: var(--text2); font-size: 13.5px; }

/* ── Footer ──────────────────────────────────────────────── */
.dp-footer {
  border-top: 1px solid var(--border); background: var(--bg2);
}
.dp-footer-in {
  max-width: 1080px; margin: 0 auto; padding: 28px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 16px;
  font-size: 13.5px; color: var(--text2);
}
.dp-footer-in .brand { font-weight: 700; color: var(--text); }
.dp-footer-in nav { margin-left: auto; display: flex; gap: 18px; }
.dp-footer-in a { color: var(--text2); text-decoration: none; }
.dp-footer-in a:hover { color: var(--text); }

/* ===========================================================================
   Landing page
   =========================================================================== */
.dp-lp-hero {
  max-width: 1080px; margin: 0 auto; padding: 76px 28px 56px; text-align: center;
}
.dp-lp-hero h1 {
  font-size: clamp(34px, 6vw, 56px); font-weight: 800; line-height: 1.06;
  letter-spacing: -.03em; margin: 14px auto 20px; max-width: 900px;
}
.dp-lp-hero .dp-sub { font-size: clamp(17px, 2.2vw, 20px); max-width: 680px; margin: 0 auto 32px; }
.dp-cta-row { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.dp-btn {
  display: inline-flex; align-items: center; gap: 8px; text-decoration: none;
  padding: 13px 24px; border-radius: 10px; font-size: 15px; font-weight: 600;
  border: 1px solid var(--border); color: var(--text); background: var(--bg2);
  transition: transform .12s, background .15s, box-shadow .15s;
}
.dp-btn:hover { transform: translateY(-1px); background: var(--bg3); }
.dp-btn-primary {
  background: var(--accent); border-color: var(--accent); color: #fff;
  box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 32%, transparent);
}
.dp-btn-primary:hover { background: var(--accent); filter: brightness(1.06); }
.dp-hero-note { margin-top: 16px; font-size: 13.5px; color: var(--text2); }

.dp-section { max-width: 1080px; margin: 0 auto; padding: 56px 28px; }
.dp-section-head { text-align: center; max-width: 680px; margin: 0 auto 40px; }
.dp-section-head h2 {
  font-size: clamp(24px, 3.4vw, 32px); font-weight: 700; letter-spacing: -.02em; margin: 0 0 12px;
}
.dp-section-head p { color: var(--text2); font-size: 16.5px; line-height: 1.6; margin: 0; }

.dp-grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.dp-card {
  background: var(--bg2); border: 1px solid var(--border); border-radius: 14px;
  padding: 24px; transition: transform .15s, box-shadow .15s, border-color .15s;
}
.dp-card:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(0,0,0,.07); border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); }
.dp-card .ic { font-size: 22px; line-height: 1; margin-bottom: 12px; display: block; }
.dp-card h3 { font-size: 16.5px; font-weight: 700; margin: 0 0 8px; }
.dp-card p { font-size: 14.5px; line-height: 1.65; color: var(--text2); margin: 0; }

.dp-steps-row { display: grid; gap: 24px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); counter-reset: lpstep; }
.dp-step { position: relative; padding-top: 46px; }
.dp-step::before {
  counter-increment: lpstep; content: counter(lpstep);
  position: absolute; top: 0; left: 0; width: 34px; height: 34px; border-radius: 50%;
  background: var(--accent); color: #fff; font-weight: 700; font-size: 15px;
  display: flex; align-items: center; justify-content: center;
}
.dp-step h3 { font-size: 16.5px; margin: 0 0 8px; font-weight: 700; }
.dp-step p { color: var(--text2); font-size: 14.5px; line-height: 1.65; margin: 0; }

.dp-band { background: var(--bg2); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }

.dp-faq details {
  border: 1px solid var(--border); border-radius: 12px; background: var(--bg2);
  padding: 16px 18px; margin-bottom: 12px;
}
.dp-faq summary {
  cursor: pointer; font-weight: 650; font-size: 15.5px; list-style: none;
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.dp-faq summary::-webkit-details-marker { display: none; }
.dp-faq summary::after { content: "+"; color: var(--accent); font-size: 20px; font-weight: 400; }
.dp-faq details[open] summary::after { content: "−"; }
.dp-faq p { margin: 12px 0 0; color: var(--text2); font-size: 14.5px; line-height: 1.7; }

.dp-final { text-align: center; padding: 72px 28px 84px; }
.dp-final h2 { font-size: clamp(26px, 3.6vw, 34px); font-weight: 800; letter-spacing: -.02em; margin: 0 0 14px; }
.dp-final p { color: var(--text2); font-size: 17px; margin: 0 0 26px; }

.dp-code-demo {
  max-width: 720px; margin: 40px auto 0; text-align: left;
  background: var(--bg3); border: 1px solid var(--border); border-radius: 12px;
  padding: 16px 18px; overflow-x: auto;
}
.dp-code-demo code { font-family: var(--mono); font-size: 13px; line-height: 1.7; color: var(--text); }

/* ===========================================================================
   Code beautifier tools (JSON / XML viewers)
   =========================================================================== */
.tool-wrap { max-width: 1180px; margin: 0 auto; padding: 20px 28px 40px; }
.tool-bar {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px;
}
.tool-bar .spacer { margin-left: auto; }
.tool-btn {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  padding: 8px 14px; border-radius: 8px; font-size: 13.5px; font-weight: 600;
  border: 1px solid var(--border); color: var(--text); background: var(--bg2);
  transition: background .15s, border-color .15s;
}
.tool-btn:hover { background: var(--bg3); }
.tool-btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.tool-btn-primary:hover { filter: brightness(1.07); background: var(--accent); }
.tool-select {
  background: var(--bg2); border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 10px; color: var(--text); font-size: 13px; font-family: inherit;
}

.tool-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 840px) { .tool-grid { grid-template-columns: 1fr; } }
.tool-pane {
  display: flex; flex-direction: column; min-height: 440px;
  background: var(--bg2); border: 1px solid var(--border); border-radius: 12px; overflow: hidden;
}
.tool-pane-head {
  display: flex; align-items: center; gap: 8px; padding: 9px 14px;
  border-bottom: 1px solid var(--border); font-size: 12.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .05em; color: var(--text2);
}
.tool-pane-head .spacer { margin-left: auto; }
.tool-copy {
  display: inline-flex; align-items: center; gap: 5px; cursor: pointer;
  background: none; border: 1px solid var(--border); border-radius: 6px;
  padding: 3px 9px; font-size: 12px; color: var(--text2); text-transform: none; letter-spacing: 0;
}
.tool-copy:hover { background: var(--bg3); color: var(--text); }
.tool-input, .tool-output {
  flex: 1; width: 100%; margin: 0; border: 0; resize: none; outline: none;
  padding: 14px; background: transparent; color: var(--text);
  font-family: var(--mono); font-size: 13px; line-height: 1.6; tab-size: 2;
  overflow: auto; white-space: pre;
}
.tool-input::placeholder { color: var(--text2); opacity: .7; }
.tool-output { white-space: pre; margin: 0; }
.tool-error {
  margin-top: 14px; padding: 12px 14px; border-radius: 10px;
  background: color-mix(in srgb, var(--red) 12%, var(--bg2));
  border: 1px solid color-mix(in srgb, var(--red) 42%, var(--border));
  color: var(--red); font-size: 13.5px; font-family: var(--mono); white-space: pre-wrap;
}
.tool-error.hidden { display: none; }

/* Nav dropdown (CSS-only, works on hover + tap via focus-within) */
.dp-dd { position: relative; }
.dp-dd > .dp-dd-btn {
  font-size: 13.5px; color: var(--text2); background: none; border: none; cursor: pointer;
  padding: 6px 12px; border-radius: 8px; font-family: inherit;
}
.dp-dd:hover > .dp-dd-btn, .dp-dd:focus-within > .dp-dd-btn { background: var(--bg3); color: var(--text); }
.dp-dd-menu {
  position: absolute; top: calc(100% + 4px); right: 0; min-width: 180px;
  background: var(--bg2); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 10px 26px rgba(0,0,0,.14); padding: 6px; z-index: 40;
  opacity: 0; visibility: hidden; transform: translateY(-4px); transition: opacity .12s, transform .12s;
}
.dp-dd:hover .dp-dd-menu, .dp-dd:focus-within .dp-dd-menu {
  opacity: 1; visibility: visible; transform: translateY(0);
}
.dp-dd-menu a {
  display: block; padding: 8px 12px; border-radius: 7px; font-size: 13.5px;
  color: var(--text); text-decoration: none;
}
.dp-dd-menu a:hover { background: var(--bg3); }
