/* The docs (tour fix k): hub, sidebar, search, steps, screenshots, code. The article also carries .legal-doc for its typography (legal.css). */
.d-wrap { max-width: 1240px; margin: 0 auto; padding: 0 24px; }
.d-hero { padding: 72px 0 40px; text-align: center; }
.d-hero h1 { font-family: var(--font-display); font-size: var(--fs-display); line-height: 1.1; margin: 0 0 12px; letter-spacing: -0.01em; }
.d-hero p { color: var(--muted); font-size: var(--fs-lead); margin: 0 auto 28px; max-width: 560px; }

.d-search { position: relative; max-width: 640px; margin: 0 auto; text-align: left; }
.d-search input { width: 100%; box-sizing: border-box; font: inherit; font-size: 18px; padding: 18px 96px 18px 52px; border: 1px solid var(--line); border-radius: var(--r-input); background: var(--surface); color: var(--ink); box-shadow: var(--shadow); outline: none; }
.d-search input:focus { border-color: var(--ink); }
.d-search .d-ico { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); font-size: 20px; color: var(--muted); }
.d-search kbd { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); font: 600 12px var(--mono); color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 3px 7px; background: var(--bg); }
.d-results { position: absolute; z-index: 5; left: 0; right: 0; top: calc(100% + 8px); background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-lg); padding: 8px; list-style: none; margin: 0; }
.d-results a { display: block; padding: 10px 14px; border-radius: 12px; color: var(--ink); text-decoration: none; }
.d-results [aria-selected="true"] a { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--lime); }
.d-results b { display: block; font-weight: 600; }
.d-results small { color: var(--muted); font-size: var(--fs-small); }
.d-results mark { background: var(--lime); color: var(--lime-ink); border-radius: 3px; padding: 0 2px; }
.d-results .d-path { font-size: var(--fs-label); color: var(--faint); }

.d-group { padding: 32px 0 8px; }
.d-group h2 { font-size: var(--fs-label); text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 0 0 14px; font-weight: 600; }
.d-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.d-card { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); padding: 22px 22px 20px; color: var(--ink); text-decoration: none; transition: border-color .2s var(--ease), transform .2s var(--ease); }
.d-card:hover { border-color: var(--ink); transform: translateY(-2px); }
.d-card .d-ic { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; background: var(--accent-soft); color: var(--ink); margin-bottom: 14px; }
.d-card .d-ic .ph { font-size: 22px; }
.d-card h3 { margin: 0 0 6px; font-size: 18px; }
.d-card p { margin: 0; color: var(--muted); font-size: var(--fs-small); line-height: 1.5; }
.d-card .d-tag { float: right; font: 600 11px var(--mono); border: 1px solid var(--line); border-radius: 6px; padding: 2px 6px; color: var(--muted); }
.d-plat { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.d-plat span { font-size: var(--fs-label); border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; color: var(--muted); }

/* Page layout: sidebar | article | on this page */
.d-page { display: grid; grid-template-columns: 240px minmax(0, 1fr) 200px; gap: 48px; padding: 40px 0 80px; }
.d-side { position: sticky; top: 88px; align-self: start; font-size: var(--fs-small); }
.d-side .d-search input { font-size: 15px; padding: 11px 44px 11px 38px; box-shadow: none; border-radius: 12px; }
.d-side .d-search .d-ico { left: 12px; font-size: 16px; }
.d-side .d-search kbd { right: 10px; }
.d-side p { font-size: var(--fs-label); text-transform: uppercase; letter-spacing: 0.08em; color: var(--faint); margin: 22px 0 6px; font-weight: 600; }
.d-side ul { list-style: none; margin: 0; padding: 0; }
.d-side a { display: block; padding: 6px 10px; border-radius: 10px; color: var(--muted); text-decoration: none; }
.d-side a:hover { color: var(--ink); }
.d-side a[aria-current] { color: var(--ink); background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--lime); font-weight: 600; }
.d-side ul ul a { padding-left: 22px; }
.d-crumb { font-size: var(--fs-small); color: var(--faint); margin-bottom: 10px; }
.d-crumb a { color: inherit; }
.d-art h1 { font-family: var(--font-display); font-size: 40px; line-height: 1.15; margin: 0 0 12px; }
.d-art .d-checked { font-size: var(--fs-label); color: var(--faint); margin: 0 0 32px; }
.d-art h2 { font-size: 24px; margin: 44px 0 12px; scroll-margin-top: 90px; }
.d-art p, .d-art li { line-height: 1.65; }
.d-steps { list-style: none; counter-reset: s; padding: 0; margin: 16px 0; }
.d-steps > li { counter-increment: s; position: relative; padding: 0 0 18px 48px; }
.d-steps > li::before { content: counter(s); position: absolute; left: 0; top: -2px; width: 30px; height: 30px; border-radius: 50%; background: var(--ink); color: var(--bg); font-weight: 700; font-size: 14px; display: grid; place-items: center; }
.d-steps > li:not(:last-child)::after { content: ""; position: absolute; left: 14px; top: 34px; bottom: 4px; width: 2px; background: var(--line); }
.d-shot { margin: 18px 0 8px; border: 1px solid var(--line); border-radius: 18px; overflow: hidden; background: var(--surface); box-shadow: var(--shadow); }
.d-shot .d-shot-img { aspect-ratio: 16 / 8; display: grid; place-items: center; color: var(--faint); font-size: var(--fs-small); background: repeating-linear-gradient(135deg, var(--bg) 0 12px, var(--surface) 12px 24px); }
.d-shot figcaption { padding: 10px 16px; font-size: var(--fs-small); color: var(--muted); border-top: 1px solid var(--line); }
.d-code { position: relative; margin: 14px 0; background: var(--dark); color: var(--on-dark); border-radius: 16px; padding: 18px 110px 18px 20px; font: 14px/1.6 var(--mono); overflow-x: auto; }
.d-code .d-copy { position: absolute; top: 10px; right: 10px; font: 600 12px var(--font); color: var(--on-dark); background: rgb(255 255 255 / 0.08); border: 1px solid rgb(255 255 255 / 0.16); border-radius: 8px; padding: 5px 10px; cursor: pointer; }
.d-code .c { color: var(--on-dark-muted); }
.d-code .k { color: var(--lime); }
.d-note { margin: 16px 0; padding: 14px 18px; border-radius: 14px; background: var(--warn-soft); color: var(--ink); font-size: var(--fs-small); }
.d-next { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 48px; }
.d-next a { border: 1px solid var(--line); border-radius: 16px; padding: 14px 18px; color: var(--ink); text-decoration: none; }
.d-next small { display: block; color: var(--faint); font-size: var(--fs-label); }
.d-next a:last-child { text-align: right; }
.d-toc { position: sticky; top: 88px; align-self: start; font-size: var(--fs-small); }
.d-toc p { font-size: var(--fs-label); color: var(--faint); margin: 0 0 8px; font-weight: 600; }
.d-toc a { display: block; padding: 4px 0 4px 12px; border-left: 2px solid var(--line); color: var(--muted); text-decoration: none; }
.d-toc a[aria-current] { border-color: var(--ink); color: var(--ink); }
.d-menu { display: none; }

@media (max-width: 1100px) { .d-page { grid-template-columns: 220px minmax(0, 1fr); } .d-toc { display: none; } }
@media (max-width: 760px) {
  .d-wrap { padding: 0 16px; }
  .d-hero { padding: 40px 0 24px; }
  .d-page { display: block; padding-top: 16px; }
  .d-side { display: none; }
  .d-menu { display: flex; justify-content: space-between; align-items: center; border: 1px solid var(--line); border-radius: 14px; padding: 12px 16px; margin-bottom: 20px; background: var(--surface); font-weight: 600; }
  .d-art h1 { font-size: 30px; }
  .d-next { grid-template-columns: 1fr; }
  .d-search kbd { display: none; }
}

/* Search results, live region, phone menu (behaviour in docs.js) */
.d-results[hidden] { display: none; }
.d-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.d-side .d-results { width: min(420px, calc(100vw - 32px)); }
.d-toc ol { list-style: none; margin: 0; padding: 0; }
.d-art .d-lede { font-size: var(--fs-lead); color: var(--muted); margin: 0 0 24px; }
.d-art h1 { margin-top: 0; }
.d-help { margin-top: 48px; }
.d-menu { width: 100%; font: inherit; color: var(--ink); cursor: pointer; }
@media (max-width: 760px) {
  .d-side[data-open] { display: block; position: static; margin-bottom: 20px; }
}
.d-results li { list-style: none; }
.d-msg { padding: 10px 14px; color: var(--muted); }
.d-code .d-copy { display: inline-flex; gap: 6px; align-items: center; }
.d-toc a[aria-current="true"] { border-color: var(--ink); color: var(--ink); }

/* Review of task 1: long inline code wraps (legal.css keeps it on one line), the docs number nothing by themselves, and on a phone the Docs button sits above the list it opens */
.d-art code { white-space: normal; overflow-wrap: anywhere; }
.d-art pre code { white-space: pre; overflow-wrap: normal; }
.d-art.legal-doc h2::before { content: none; }

/* Code blocks: dark, with room for the Copy button (beats .legal-doc pre) */
.d-art pre.d-code { position: relative; margin: 16px 0; padding: 46px 20px 18px; border-radius: 16px; background: var(--dark); color: var(--on-dark); font: 14px/1.6 var(--mono); }
.d-art pre.d-code code { color: inherit; background: none; padding: 0; font-size: inherit; }
.d-art pre.d-code .d-copy { position: absolute; top: 8px; right: 8px; }
.d-art pre.d-code .d-copy:hover { border-color: rgb(255 255 255 / 0.4); }
.d-search input:focus-visible, .d-menu:focus-visible, .d-card:focus-visible, .d-copy:focus-visible, .d-side a:focus-visible, .d-toc a:focus-visible, .d-next a:focus-visible, .d-results a:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.d-copy:focus-visible { outline-color: var(--lime); }
