/* Documentation page - hero + search, quick-start cards, topic menu, reading card.
   Loaded after app.css / app-modern.css, so it owns every .docs* rule. */

/* ------------------------------------------------------------------ hero */
.docs-hero {
  position: relative; isolation: isolate; border-radius: 32px;
  padding: clamp(28px, 5vw, 52px) clamp(22px, 5vw, 56px) clamp(26px, 4vw, 44px);
  background: #0b0b0c; color: #fff;
}
.docs-hero::before, .docs-hero::after { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; pointer-events: none; }
.docs-hero::before {
  background:
    radial-gradient(760px 320px at 88% -18%, rgba(255, 255, 255, .17), transparent 62%),
    radial-gradient(520px 260px at -4% 118%, rgba(255, 255, 255, .09), transparent 62%);
}
.docs-hero::after {
  background-image: radial-gradient(rgba(255, 255, 255, .13) 1px, transparent 1px);
  background-size: 22px 22px;
  -webkit-mask-image: linear-gradient(115deg, transparent 25%, #000 95%);
  mask-image: linear-gradient(115deg, transparent 25%, #000 95%);
}
.dh-kicker {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 13px; border-radius: 999px;
  background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .16);
  font-size: .74rem; letter-spacing: .09em; text-transform: uppercase; color: rgba(255, 255, 255, .86);
}
.docs-hero h1 { color: #fff; margin: 20px 0 12px; font-size: clamp(2.3rem, 5vw, 3.6rem); line-height: 1.02; letter-spacing: -.045em; }
.docs-hero .dh-sub { margin: 0; max-width: 54ch; font-size: clamp(1rem, 1.6vw, 1.15rem); line-height: 1.55; color: rgba(255, 255, 255, .72); }

.dh-search { position: relative; margin-top: 30px; max-width: 640px; }
.dh-search-ic { position: absolute; left: 19px; top: 28px; transform: translateY(-50%); color: #7a7a85; pointer-events: none; }
.dh-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.docs-hero .dh-search input {
  width: 100%; height: 56px; padding: 0 58px 0 52px; border-radius: 18px; font-size: 1rem;
  border: 1px solid rgba(255, 255, 255, .2); background: #fff; color: #0b0b0c;
  box-shadow: 0 18px 40px -20px rgba(0, 0, 0, .6);
}
.docs-hero .dh-search input:focus { border-color: #fff; box-shadow: 0 0 0 4px rgba(255, 255, 255, .28), 0 18px 40px -20px rgba(0, 0, 0, .6); }
.docs-hero .dh-search input::placeholder { color: #8a8a94; }
.dh-search input::-webkit-search-cancel-button { display: none; }
.dh-kbd {
  position: absolute; right: 15px; top: 28px; transform: translateY(-50%);
  min-width: 26px; padding: 3px 8px; text-align: center; border-radius: 8px;
  border: 1px solid var(--color-border-strong); background: var(--color-surface-2); color: var(--color-muted-fg); font-size: .78rem;
}
.dh-search input:focus ~ .dh-kbd { display: none; }

.dh-results {
  position: absolute; z-index: 40; left: 0; right: 0; top: calc(100% + 8px); max-height: 400px; overflow-y: auto;
  padding: 6px; border-radius: 20px; background: #fff; color: #0b0b0c; text-align: left;
  border: 1px solid var(--color-border); box-shadow: 0 30px 60px -24px rgba(0, 0, 0, .55);
  scrollbar-width: thin; animation: dh-pop .14s var(--ease) both;
}
.dh-results[hidden] { display: none; }
@keyframes dh-pop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.dh-res { display: block; padding: 11px 14px; border-radius: 13px; color: inherit; text-decoration: none; }
.dh-res[aria-selected="true"], .dh-res:hover { background: var(--color-surface-2); }
.dh-res .dr-t { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; font-family: var(--font-heading); font-size: .96rem; }
.dh-res .dr-t small { font-family: var(--font-body); font-size: .76rem; color: var(--color-muted-fg); letter-spacing: .02em; }
.dh-res .dr-s { margin-top: 3px; font-size: .86rem; line-height: 1.45; color: var(--color-fg-soft); }
.dh-res mark { background: #ffec99; color: inherit; border-radius: 4px; padding: 0 2px; }
.dh-empty { padding: 18px 16px; font-size: .92rem; color: var(--color-muted-fg); }

.dh-popular { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 22px 0 0; font-size: .85rem; color: rgba(255, 255, 255, .55); }
.docs-hero .dh-chip {
  padding: 6px 13px; border-radius: 999px; text-decoration: none; color: #fff;
  background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .14);
  transition: background-color .2s var(--ease), border-color .2s var(--ease);
}
.docs-hero .dh-chip:hover { background: rgba(255, 255, 255, .2); border-color: rgba(255, 255, 255, .3); }

/* ------------------------------------------------------------- quick start */
.docs-quick { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-top: 14px; }
@media (max-width: 1100px) { .docs-quick { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 480px) { .docs-quick { grid-template-columns: minmax(0, 1fr); } }
.dq-card {
  position: relative; display: flex; flex-direction: column; gap: 6px; padding: 20px 20px 22px;
  border-radius: 24px; background: var(--color-surface); border: 1px solid var(--color-border);
  color: var(--color-fg); text-decoration: none; box-shadow: var(--shadow-xs);
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), border-color .25s ease;
}
.dq-card::after {
  content: "\2192"; position: absolute; top: 18px; right: 20px; color: var(--color-muted-fg);
  opacity: 0; transform: translateX(-6px); transition: opacity .2s ease, transform .25s var(--ease);
}
.dq-card:hover { transform: translateY(-3px); border-color: var(--color-border-strong); box-shadow: var(--shadow-md); }
.dq-card:hover::after { opacity: 1; transform: none; }
.dq-ic { display: grid; place-items: center; width: 42px; height: 42px; margin-bottom: 8px; border-radius: 14px; background: var(--color-fg); color: #fff; }
.dq-card strong { font-size: 1.05rem; }
.dq-desc { font-size: .88rem; line-height: 1.45; color: var(--color-muted-fg); }

/* ------------------------------------------------------------------ layout */
.docs { display: grid; grid-template-columns: 252px minmax(0, 1fr); gap: 36px; align-items: start; margin-top: 30px; }
.docs-standalone { max-width: 1280px; }

/* topic menu */
.docs-toc {
  position: sticky; top: 20px; display: flex; flex-direction: column; gap: 2px;
  max-height: calc(100dvh - 40px); overflow-y: auto; padding-right: 6px; scrollbar-width: thin;
}
.docs-toc .kicker { margin: 22px 0 6px 14px; font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--color-muted-fg); }
.docs-toc .kicker:first-child { margin-top: 0; }
.docs-toc a {
  padding: 9px 14px; border-radius: 13px; font-size: .95rem; line-height: 1.3; color: var(--color-fg-soft); text-decoration: none;
  transition: background-color .18s var(--ease), color .18s var(--ease);
}
.docs-toc a:hover { background: var(--color-surface-3); color: var(--color-fg); }
.docs-toc a[aria-current="page"], .docs-toc a[aria-current="page"]:hover { background: var(--color-fg); color: #fff; }
.docs-toc a:focus-visible { outline: 2px solid var(--color-fg); outline-offset: 2px; }

/* reading card */
.docs-content {
  min-width: 0; padding: clamp(22px, 4vw, 52px); border-radius: 30px; font-size: 1.02rem; line-height: 1.72;
  background: var(--color-surface); border: 1px solid var(--color-border); box-shadow: var(--shadow-sm);
}
.docs-content > section { margin: 0; scroll-margin-top: 24px; min-width: 0; }
.docs-content > section[hidden] { display: none; }
.docs-content > section:not([hidden]) { animation: am-rise .35s var(--ease) both; }

.docs-content h2 {
  display: flex; align-items: center; gap: 14px; margin: 0 0 18px; padding: 0; border: 0;
  font-size: clamp(1.65rem, 3vw, 2.15rem); line-height: 1.12; letter-spacing: -.035em;
}
.docs-content h2:focus { outline: none; }
.dh-num {
  display: inline-grid; place-items: center; flex: none; min-width: 44px; height: 44px; padding: 0 10px; border-radius: 14px;
  background: var(--color-fg); color: #fff; font-family: var(--font-mono); font-size: .95rem; letter-spacing: 0;
}
.docs-content h3 {
  margin: 42px 0 10px; padding-top: 30px; border-top: 1px solid var(--color-border);
  font-size: 1.28rem; line-height: 1.25; letter-spacing: -.02em; scroll-margin-top: 24px;
}
.docs-content .lede + h3, .docs-content h2 + h3, .docs-jump + h3 { margin-top: 28px; padding-top: 0; border-top: 0; }
.docs-content .lede { font-size: 1.15rem; line-height: 1.6; color: var(--color-fg-soft); }
.docs-content p, .docs-content li { line-height: 1.72; }
.docs-content > section > p, .docs-content > section > ul, .docs-content > section > ol { max-width: 76ch; }
.docs-content a { text-underline-offset: 3px; text-decoration-thickness: 1px; }
.docs-content a:focus-visible { outline: 2px solid var(--color-fg); outline-offset: 2px; border-radius: 4px; }

/* inline code */
.docs-content span.mono, .docs-content code {
  padding: 1px 7px; border-radius: 8px; font-size: .88em; background: var(--color-surface-2);
  border: 1px solid var(--color-border); overflow-wrap: anywhere;
}

/* bullets + numbered steps */
.docs-content ul { list-style: none; padding-left: 0; }
.docs-content ul > li { position: relative; padding-left: 22px; margin-bottom: 8px; }
.docs-content ul > li::before { content: ""; position: absolute; left: 4px; top: .78em; width: 6px; height: 6px; border-radius: 50%; background: #9a9aa4; }
.docs-content ol { list-style: none; padding-left: 0; counter-reset: dstep; }
.docs-content ol > li { position: relative; counter-increment: dstep; padding-left: 48px; margin-bottom: 16px; }
.docs-content ol > li::before {
  content: counter(dstep); position: absolute; left: 0; top: .12em; display: grid; place-items: center;
  width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--color-border-strong);
  background: var(--color-surface-2); color: var(--color-fg); font-family: var(--font-mono); font-size: .8rem;
}

/* callouts */
.docs-content .callout {
  position: relative; margin: 24px 0; padding: 18px 22px 18px 66px; border-radius: 22px; font-size: .98rem; line-height: 1.6;
  background: var(--color-surface-2); border: 1px solid var(--color-border-strong); color: var(--color-fg-soft);
}
.docs-content .callout::before {
  content: "i"; position: absolute; left: 20px; top: 18px; display: grid; place-items: center; width: 30px; height: 30px;
  border-radius: 50%; background: var(--color-fg); color: #fff; font-family: var(--font-mono); font-weight: 700; font-size: .85rem;
}
.docs-content .callout strong { color: var(--color-fg); }
.docs-content .callout p { margin: 8px 0 0; }
.docs-content .callout.warn { background: var(--color-warn-bg); border-color: #fedf89; }
.docs-content .callout.warn::before { content: "!"; background: var(--color-warn); }
.docs-content .callout.warn strong { color: var(--color-warn); }
.docs-content .callout.danger { background: var(--color-danger-bg); border-color: #f2b8b1; }
.docs-content .callout.danger::before { content: "!"; background: var(--color-danger); }
.docs-content .callout.danger strong { color: var(--color-danger); }

/* tables */
.docs-content .table-wrap { margin: 22px 0; border-radius: 20px; border: 1px solid var(--color-border); box-shadow: none; }
.docs-content table.data { font-size: .94rem; }
.docs-content table.data th { padding: 13px 18px; font-size: .72rem; letter-spacing: .09em; background: var(--color-surface-2); white-space: nowrap; }
.docs-content table.data td { padding: 13px 18px; line-height: 1.5; vertical-align: top; }
.docs-content table.data td:first-child { font-family: var(--font-heading); white-space: nowrap; }

/* "in this topic" jump bar (built by docs.js) */
.docs-jump { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 22px 0 6px; }
.docs-jump .dj-label { margin-right: 4px; font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--color-muted-fg); }
.docs-jump a {
  padding: 6px 14px; border-radius: 999px; font-size: .86rem; line-height: 1.3; text-decoration: none; color: var(--color-fg);
  background: var(--color-surface-2); border: 1px solid var(--color-border);
  transition: background-color .18s var(--ease), border-color .18s var(--ease), color .18s var(--ease);
}
.docs-jump a:hover { background: var(--color-fg); border-color: var(--color-fg); color: #fff; }

/* previous / next */
.docs-pager { display: flex; gap: 14px; margin-top: 48px; padding-top: 26px; border-top: 1px solid var(--color-border); }
.docs-pager a {
  display: flex; flex-direction: column; gap: 4px; min-width: 0; max-width: calc(50% - 7px); padding: 16px 22px;
  border-radius: 20px; background: var(--color-surface); border: 1px solid var(--color-border); color: var(--color-fg); text-decoration: none;
  transition: transform .2s var(--ease), border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.docs-pager a:hover { transform: translateY(-2px); border-color: var(--color-border-strong); box-shadow: var(--shadow-sm); }
.docs-pager .dir { font-size: .74rem; letter-spacing: .09em; text-transform: uppercase; color: var(--color-muted-fg); }
.docs-pager .ttl { font-family: var(--font-heading); font-size: 1.05rem; }
.docs-pager .next { margin-left: auto; text-align: right; align-items: flex-end; }

/* ------------------------------------------------------------- responsive */
@media (max-width: 900px) {
  .docs { grid-template-columns: minmax(0, 1fr); gap: 20px; margin-top: 22px; }
  /* topic menu becomes a swipeable pill row that stays in reach while reading */
  .docs-toc {
    position: sticky; top: 8px; z-index: 20; flex-direction: row; align-items: center; gap: 4px; max-height: none;
    overflow: auto hidden; padding: 6px; border-radius: 999px; scrollbar-width: none;
    background: rgba(247, 247, 248, .88); border: 1px solid var(--color-border); backdrop-filter: blur(10px);
  }
  .docs-toc::-webkit-scrollbar { display: none; }
  .docs-toc .kicker { display: none; }
  .docs-toc a { flex: none; white-space: nowrap; padding: 8px 14px; }
}
@media (max-width: 640px) {
  .docs-hero { border-radius: 26px; }
  .dh-kbd { display: none; }
  .docs-content { border-radius: 24px; font-size: .97rem; }
  .docs-content ol > li { padding-left: 42px; }
  .docs-content .callout { padding: 16px 16px 16px 58px; }
  .docs-content .callout::before { left: 16px; top: 16px; }
  .docs-pager { flex-direction: column; }
  .docs-pager a { max-width: none; }
  .docs-pager .next { margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .docs-content > section:not([hidden]), .dh-results { animation: none; }
  .dq-card, .dq-card::after, .docs-pager a { transition: none; }
  .dq-card:hover, .docs-pager a:hover { transform: none; }
}

@media print {
  .docs-hero, .docs-quick, .docs-toc, .docs-pager, .docs-jump { display: none; }
  .docs { display: block; margin: 0; }
  .docs-content { border: 0; box-shadow: none; padding: 0; }
  .docs-content > section[hidden] { display: block !important; margin-bottom: 28px; }
}

/* ------------------------------------------------------------- screenshots, numbered pins, step legends */
.docs-content figure.shot { margin: 22px 0; border-radius: 20px; overflow: hidden; border: 1px solid var(--color-border-strong); background: var(--color-surface-2); }
.docs-content figure.shot .shot-frame { position: relative; display: block; line-height: 0; cursor: zoom-in; }
.docs-content figure.shot img { display: block; width: 100%; height: auto; }
.docs-content figure.shot figcaption { padding: 11px 18px 13px; font-size: .86rem; line-height: 1.5; color: var(--color-muted-fg); border-top: 1px solid var(--color-border); background: var(--color-surface); }
.docs-content .pin {
  position: absolute; transform: translate(-50%, -50%); display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
  background: var(--color-danger, #d92d20); color: #fff; font: 700 .72rem/1 var(--font-mono); box-shadow: 0 0 0 2px #fff, 0 4px 10px rgba(0, 0, 0, .35);
  pointer-events: none;
}
.docs-content ol.legend > li::before { background: var(--color-danger, #d92d20); border-color: var(--color-danger, #d92d20); color: #fff; }
.docs-content .shot-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.docs-content .shot-row figure.shot { margin: 22px 0 8px; }
.docs-content .shot-row figcaption { min-height: 4.4em; }
.docs-content h3[id^="step"] { scroll-margin-top: 16px; }
@media (max-width: 640px) {
  .docs-content .shot-row { grid-template-columns: minmax(0, 1fr); }
  .docs-content .pin { width: 20px; height: 20px; font-size: .66rem; box-shadow: 0 0 0 2px #fff, 0 3px 8px rgba(0, 0, 0, .35); }
  .docs-content figure.shot figcaption { padding: 9px 14px 11px; }
}
@media print { .docs-content figure.shot { break-inside: avoid; } }
