/* Ownbit documentation & security center — additive styles.
   Uses the design tokens from styles.css; mobile-first; a11y-aware. */

.doc-main { padding-bottom: 8px; }
.doc-container { width: var(--container); max-width: 860px; margin: 0 auto; }
.doc-hero { padding-top: 26px; }

/* Breadcrumb */
.doc-breadcrumb {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  font-size: 0.86rem; color: var(--muted); margin-bottom: 20px;
}
.doc-breadcrumb a { color: var(--accent); }
.doc-breadcrumb a:hover { text-decoration: underline; }
.doc-breadcrumb [aria-current="page"] { color: var(--muted-2); }
.crumb-sep { color: var(--line-strong); }

/* Head */
.doc-head { max-width: 44em; }
.doc-head h1 {
  font-size: clamp(1.8rem, 5vw, 2.6rem); line-height: 1.15;
  letter-spacing: -0.015em; margin: 10px 0 0;
}
.doc-lede {
  margin-top: 16px; font-size: 1.12rem; color: var(--muted);
  border-left: 3px solid var(--accent); padding-left: 16px;
}
.doc-lede b { color: var(--text); font-weight: 600; }
.doc-head .tag-row { margin-top: 18px; }

/* On-this-page TOC */
.doc-toc {
  margin: 26px 0 6px; padding: 16px 18px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: var(--surface-soft);
  display: flex; flex-direction: column; gap: 8px;
}
.doc-toc-h {
  font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--muted-2); font-weight: 700;
}
.doc-toc a { color: var(--accent); font-weight: 600; font-size: 0.95rem; }
.doc-toc a:hover { text-decoration: underline; }

/* Body typography */
.doc-body { margin-top: 8px; }
.doc-section { padding: 22px 0; border-top: 1px solid var(--line); }
.doc-section:first-child { border-top: 0; }
.doc-body h2 {
  font-size: clamp(1.35rem, 3.4vw, 1.7rem); line-height: 1.25;
  letter-spacing: -0.01em; margin: 4px 0 14px; scroll-margin-top: 78px;
}
.doc-body h3 { font-size: 1.12rem; margin: 22px 0 8px; }
.doc-body p { margin: 0 0 14px; color: #33465f; }
.doc-body p b { color: var(--text); font-weight: 600; }
.doc-body a:not(.btn):not(.doc-rel) {
  color: var(--accent); border-bottom: 1px solid var(--accent-3);
}
.doc-body a:not(.btn):not(.doc-rel):hover { border-bottom-color: var(--accent); }

.doc-list, .doc-olist { margin: 0 0 16px; padding-left: 4px; }
.doc-list { list-style: none; }
.doc-list li {
  position: relative; padding: 6px 0 6px 26px; color: #33465f; line-height: 1.55;
}
.doc-list li::before {
  content: "✓"; position: absolute; left: 0; top: 6px;
  color: var(--success); font-weight: 800;
}
.doc-olist { padding-left: 22px; }
.doc-olist li { padding: 6px 0; color: #33465f; }

/* Callouts */
.doc-note {
  border-radius: var(--radius-sm); padding: 14px 16px; margin: 18px 0;
  font-size: 0.96rem; line-height: 1.58; border: 1px solid;
}
.doc-note .doc-note-h { display: block; font-weight: 700; margin-bottom: 3px; }
.doc-note p { margin: 0; color: inherit; }
.doc-note.info   { background: var(--accent-4); border-color: var(--accent-3); color: #14487e; }
.doc-note.warn   { background: #fff7ec; border-color: #f4c77a; color: #8a5800; }
.doc-note.danger { background: #fdeded; border-color: #f1b4b4; color: #b42318; }
.doc-note.ok     { background: #e9f7ef; border-color: #a9dec1; color: #0a7c42; }
.doc-note.todo   { background: #f4f1ff; border-color: #d6c9f5; color: #5b3ba6; }
.doc-note a { color: inherit; text-decoration: underline; }

/* Tables */
.doc-tablecard {
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  overflow-x: auto; margin: 18px 0; background: var(--surface-strong);
}
.doc-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; min-width: 460px; }
.doc-table caption.doc-tcap {
  caption-side: top; text-align: left; padding: 12px 14px 0;
  color: var(--muted-2); font-size: 0.85rem;
}
.doc-table thead th {
  background: var(--surface-soft); text-align: left; padding: 12px 14px;
  font-weight: 700; color: var(--text); border-bottom: 1px solid var(--line);
}
.doc-table tbody td {
  padding: 12px 14px; border-bottom: 1px solid var(--line);
  vertical-align: top; color: #3a5160;
}
.doc-table tbody tr:last-child td { border-bottom: 0; }
.doc-table tbody td:first-child { font-weight: 600; color: var(--text); }
.doc-table .adv { color: #0a7c42; font-weight: 600; }

/* Steps */
.doc-steps { margin: 8px 0 18px; }
.doc-step { position: relative; padding: 14px 0 6px 44px; }
.doc-step::before {
  content: attr(data-n); position: absolute; left: 0; top: 15px;
  width: 30px; height: 30px; border-radius: 9px; color: #fff; font-weight: 800;
  font-size: 0.85rem; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
.doc-step::after {
  content: ""; position: absolute; left: 14px; top: 46px; bottom: -2px;
  width: 2px; background: var(--line);
}
.doc-step:last-child::after { display: none; }
.doc-step h3 { margin: 4px 0 4px; font-size: 1.02rem; }
.doc-step p { margin: 0; color: var(--muted); font-size: 0.96rem; }

/* Card grid */
.doc-cardgrid {
  display: grid; grid-template-columns: 1fr; gap: 14px; margin: 8px 0 18px;
}
@media (min-width: 640px) { .doc-cardgrid { grid-template-columns: 1fr 1fr; } }
.doc-card {
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 16px 18px; background: var(--surface-strong); box-shadow: var(--shadow-sm);
}
.doc-card strong { display: block; margin-bottom: 6px; }
.doc-card p { margin: 0; color: var(--muted); font-size: 0.95rem; }

/* Related */
.doc-related { margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--line); }
.doc-rel-h {
  font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--muted-2); font-weight: 700;
}
.doc-rel-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.doc-rel {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px;
  border: 1px solid var(--line-strong); border-radius: 999px; color: var(--accent);
  font-weight: 600; font-size: 0.9rem; background: var(--surface-strong);
}
.doc-rel::after { content: "→"; }
.doc-rel:hover { border-color: var(--accent); }

/* FAQ */
.doc-faq .doc-container { padding-top: 0; }
.doc-faq-item {
  border: 1px solid var(--line); border-radius: 12px; margin-bottom: 11px;
  overflow: hidden; background: var(--surface-strong);
}
.doc-faq-item summary {
  cursor: pointer; list-style: none; padding: 15px 18px; font-weight: 600;
  color: var(--text); display: flex; justify-content: space-between;
  align-items: center; gap: 12px;
}
.doc-faq-item summary::-webkit-details-marker { display: none; }
.doc-faq-chev { flex: none; transition: transform 0.2s ease; color: var(--accent); }
.doc-faq-item[open] summary .doc-faq-chev { transform: rotate(180deg); }
.doc-faq-a { padding: 0 18px 16px; color: #3a5160; }
.doc-faq-a p { margin: 0; }

/* Updated + CTA */
.doc-updated { font-size: 0.82rem; color: var(--muted-2); margin: 4px 0 18px; }
.doc-cta { margin-top: 4px; }

/* Docs landing / index grid */
.doc-index-grid {
  display: grid; grid-template-columns: 1fr; gap: 18px; margin-top: 8px;
}
@media (min-width: 720px) { .doc-index-grid { grid-template-columns: 1fr 1fr; } }
.doc-index-card {
  display: flex; flex-direction: column; gap: 8px; padding: 22px;
  border: 1px solid var(--line); border-radius: var(--radius-md);
  background: var(--surface-strong); box-shadow: var(--shadow-sm);
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}
.doc-index-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.doc-index-card h3 { margin: 0; font-size: 1.15rem; }
.doc-index-card p { margin: 0; color: var(--muted); font-size: 0.96rem; }
.doc-index-card .doc-index-links { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.doc-index-card .doc-index-links a { color: var(--accent); font-weight: 600; font-size: 0.95rem; }
.doc-index-card .doc-index-links a:hover { text-decoration: underline; }

/* Screenshots inside steps + standalone */
.doc-shotrow { display: flex; flex-wrap: wrap; gap: 12px; margin: 12px 0 4px; }
.doc-shot-link { display: block; line-height: 0; }
.doc-shot {
  width: 190px; max-width: 46vw; border: 1px solid var(--line);
  border-radius: 18px; background: var(--surface-soft); box-shadow: var(--shadow-sm);
}
.doc-shotrow.multi .doc-shot { width: 150px; }

/* Figures / diagrams */
.doc-figure { margin: 18px 0 22px; }
.doc-figure figcaption {
  margin-top: 10px; text-align: center; color: var(--muted-2);
  font-size: 0.85rem;
}
.doc-fig-img {
  display: block; margin: 0 auto; border-radius: var(--radius-sm);
  border: 1px solid var(--line); box-shadow: var(--shadow-sm);
}
.doc-fig-img.phone { width: 220px; max-width: 60%; }

/* Diagram SVGs — light theme via docs tokens */
.dg {
  display: block; width: 100%; height: auto; max-width: 560px; margin: 0 auto;
  background: linear-gradient(180deg, var(--surface-soft), #fff);
  border: 1px solid var(--line); border-radius: var(--radius-md); padding: 12px;
}
.dg text { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.dg-dev { fill: #fff; stroke: var(--line-strong); stroke-width: 1.6; }
.dg-dev.dg-cold { stroke: var(--accent); }
.dg-screen { fill: #eef4fb; stroke: var(--line-strong); stroke-width: 1; }
.dg-screen-cold { fill: #e6f1ff; stroke: var(--accent); }
.dg-cap { fill: var(--muted); font-size: 11px; font-weight: 600; }
.dg-cap-cold { fill: var(--accent); }
.dg-mini { fill: var(--muted-2); font-size: 8.5px; letter-spacing: 0.08em; }
.dg-mini-cold { fill: var(--accent); }
.dg-gap { stroke: var(--warm); stroke-width: 1.5; stroke-dasharray: 4 6; }
.dg-gaptext { fill: #b06d16; font-size: 9px; letter-spacing: 0.06em; }
.dg-qr rect { fill: var(--accent); }
.dg-qr .dg-qr-p { fill: #fff; }
.dg-qr { animation: dgCross 4.6s ease-in-out infinite; }
@keyframes dgCross {
  0%,10% { transform: translateX(0); opacity: 0; }
  22% { opacity: 1; }
  50% { transform: translateX(96px); }
  78% { opacity: 1; }
  90%,100% { transform: translateX(192px); opacity: 0; }
}
/* Cold flow */
.dg-onchip { fill: var(--success); font-size: 8.5px; font-weight: 700; letter-spacing: 0.08em; }
.dg-offchip { fill: var(--accent); font-size: 8.5px; font-weight: 700; letter-spacing: 0.08em; }
.dg-flow { fill: var(--muted-2); font-size: 9.5px; }
.dg-arrow { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round;
  marker-end: url(#none); stroke-dasharray: 6 6; }
.dg-coldflow .dg-arrow { animation: dgDash 1.1s linear infinite; }
@keyframes dgDash { to { stroke-dashoffset: -24; } }
.dg-coldflow .a1 { marker-end: none; }
/* MultiSig */
.dg-signer circle { fill: #fff; stroke: var(--line-strong); stroke-width: 1.8; }
.dg-signer text { fill: var(--text); font-size: 15px; font-weight: 700; }
.dg-signer.s1 circle, .dg-signer.s3 circle { stroke: var(--accent); }
.dg-signer.s1 circle { animation: dgPulse 3.4s ease-in-out infinite; }
.dg-signer.s3 circle { animation: dgPulse 3.4s ease-in-out infinite 1.7s; }
@keyframes dgPulse {
  0%,40%,100% { fill: #fff; }
  15%,30% { fill: var(--accent-4); }
}
.dg-wire { fill: none; stroke: var(--line-strong); stroke-width: 1.6; }
.dg-wire.w1, .dg-wire.w3 { stroke: var(--accent); stroke-dasharray: 5 5;
  animation: dgDash 1.3s linear infinite; }
.dg-vault rect { fill: #eef7f0; stroke: var(--success); stroke-width: 1.8; }
.dg-lock { fill: none; stroke: var(--success); stroke-width: 2; }
.dg-vault-t { fill: #0a7c42; font-size: 15px; font-weight: 800; }

/* Person glyphs (team / family / inheritance) */
.dg-pc { fill: #fff; stroke: var(--accent); stroke-width: 1.8; }
.dg-ph, .dg-pb { fill: var(--accent); }
/* Vault coin / labels */
.dg-coin { fill: #fff7ea; stroke: var(--warm); stroke-width: 1.6; }
.dg-coin-t { fill: #b06d16; font-size: 15px; font-weight: 800; }
.dg-vault-lbl, .dg-prot-t { fill: #0a7c42; font-size: 11px; font-weight: 700; }
/* Enterprise role chips + weight badges */
.dg-chip rect { fill: var(--surface-soft); stroke: var(--line-strong); stroke-width: 1.4; }
.dg-chip-t { fill: var(--text); font-size: 13px; font-weight: 600; }
.dg-badge { stroke-width: 0; }
.dg-badge.b-own { fill: var(--accent); }
.dg-badge.b-sig { fill: var(--accent-2); }
.dg-badge.b-adm { fill: var(--warm); }
.dg-badge-t { fill: #fff; font-size: 10px; font-weight: 800; }
.dg-gear { fill: none; stroke: var(--success); stroke-width: 2.2; }
.dg-ea, .dg-ia { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round;
  stroke-dasharray: 6 6; animation: dgDash 1.2s linear infinite; }
/* Family home + shield */
.dg-home-roof { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; }
.dg-home-body { fill: #eef4fb; stroke: var(--accent); stroke-width: 1.6; }
.dg-shield { fill: #eef7f0; stroke: var(--success); stroke-width: 1.8; }
.dg-clock-o { fill: none; stroke: var(--success); stroke-width: 1.8; }
.dg-clock { fill: none; stroke: var(--success); stroke-width: 2; stroke-linecap: round; }
/* Inheritance timeline */
.dg-time { fill: none; stroke: var(--accent); stroke-width: 2; stroke-dasharray: 5 6;
  animation: dgDash 1.4s linear infinite; }
.dg-inheritance .dg-clock-o { stroke: var(--accent); }
.dg-inheritance .dg-clock { stroke: var(--accent); }

@media (prefers-reduced-motion: reduce) {
  .dg-qr { animation: none; transform: translateX(96px); opacity: 1; }
  .dg-coldflow .dg-arrow, .dg-wire.w1, .dg-wire.w3,
  .dg-ea, .dg-ia, .dg-time { animation: none; }
  .dg-signer.s1 circle, .dg-signer.s3 circle { animation: none; fill: var(--accent-4); }
}

/* Focus visibility (a11y floor) */
.doc-main a:focus-visible,
.doc-faq-item summary:focus-visible,
.doc-toc a:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .doc-index-card, .doc-faq-chev { transition: none; }
}
