/* ALL document pages in the new look: the long text pages (roadmap, guide, security, privacy, terms, who-sees-what, is-it-safe, proof...). Loaded after kit.css
   and pages.css, so the tokens (paper, ink, gold, indigo; day and night), the bar, the buttons and the footer are the home page's. Only what the old
   legal pages had gets a new face here: no boxes, no grid paper, no monospace chips. The text column is open paper; the table of contents is a plain
   sticky list with a gold marker, never a card. Markup recipe: scripts/v7_doc_page.py. */

.doc-page { --doc-col: 720px; }

/* ---- hero: label, title, lead and small meta chips on the left, Robi on the right, the sibling-pages switch under it ---------------------------------------- */
.doc-hero { position: relative; padding: clamp(40px, 6vw, 80px) 0 0; }
.doc-hero-in { display: grid; grid-template-columns: minmax(0, 1fr) clamp(130px, 14vw, 200px); gap: clamp(20px, 5vw, 64px); align-items: end; }
.doc-hero-text { min-width: 0; }
.doc-hero h1 { font-size: clamp(38px, 5.2vw, 68px); max-width: 15em; }
.doc-hero .lede { max-width: 640px; }
.doc-meta { margin-top: 22px; }
.doc-meta li, .doc-meta li:first-child { padding: 6px 13px; background: var(--chip); color: var(--ink-2); font-size: 13.5px; font-weight: 500; }
.doc-meta li:first-child { background: var(--gold); color: #17140f; font-weight: 600; }
.doc-hero .robi-live.doc-robi { width: 100%; margin: 0; align-self: end; }

/* the switch between the sibling pages: soft pills on one row, the current one in ink */
.doc-switch { display: flex; flex-wrap: wrap; gap: 6px; margin-top: clamp(26px, 3.5vw, 40px); padding-top: 18px; border-top: 1px solid var(--line); }
.doc-switch a { padding: 7px 14px; border-radius: 999px; background: var(--chip); color: var(--ink-2); font-size: 14px; font-weight: 500; text-decoration: none; transition: background .15s; }
.doc-switch a:hover { background: var(--soft-2); color: var(--ink); }
.doc-switch a[aria-current="page"] { background: var(--pill); color: var(--pill-ink); font-weight: 600; }

/* ---- layout: sticky table of contents + reading column ---------------------------------------------------------------------------------------------------- */
.doc-layout { display: grid; grid-template-columns: 210px minmax(0, var(--doc-col)); gap: clamp(32px, 6vw, 88px); padding: clamp(36px, 5vw, 64px) 0 24px; align-items: start; }
.doc-layout:not(:has(.doc-toc)) { grid-template-columns: minmax(0, var(--doc-col)); justify-content: center; }
.doc-toc { position: sticky; top: 96px; max-height: calc(100dvh - 120px); overflow-y: auto; }
.doc-toc-h { margin: 0 0 10px; font-size: 13px; font-weight: 600; color: var(--muted); letter-spacing: .02em; text-transform: none; }
.doc-toc nav { display: flex; flex-direction: column; border-left: 2px solid var(--line); }
.doc-toc a { margin-left: -2px; padding: 6px 0 6px 14px; border-left: 2px solid transparent; color: var(--ink-2); font-size: 14.5px; line-height: 1.35; text-decoration: none; }
.doc-toc a:hover { color: var(--ink); border-left-color: var(--gold); }
.doc-toc a[aria-current], .doc-toc a.is-current { color: var(--ink); font-weight: 600; border-left-color: var(--gold); }

/* ---- prose: open paper, no boxes. Works for the old class names (legal-section, status-tag, already, ...) ---------------------------------------------------- */
.doc-prose { min-width: 0; color: var(--ink-2); font-size: 17px; line-height: 1.7; }
.doc-prose > section, .doc-prose .legal-section { margin: 0 0 clamp(36px, 5vw, 56px); scroll-margin-top: 96px; }
.doc-prose [id] { scroll-margin-top: 96px; }
.doc-prose h2 { margin: 0 0 14px; color: var(--ink); font-size: clamp(26px, 3vw, 36px); line-height: 1.15; font-weight: 560; letter-spacing: -.035em; text-wrap: balance; }
.doc-prose h3 { margin: 30px 0 8px; color: var(--ink); font-size: clamp(19px, 1.8vw, 22px); line-height: 1.25; font-weight: 600; letter-spacing: -.02em; text-wrap: balance; }
.doc-prose h4 { margin: 22px 0 6px; color: var(--ink); font-size: 17px; font-weight: 600; }
.doc-prose p { margin: 0 0 14px; text-wrap: pretty; }
.doc-prose ul, .doc-prose ol { margin: 0 0 16px; padding-left: 1.3em; }
.doc-prose li { margin: 0 0 6px; padding-left: 4px; }
.doc-prose li::marker { color: var(--orange); }
.doc-prose strong { color: var(--ink); font-weight: 600; }
.doc-prose a { color: var(--ink); text-decoration-color: var(--gold); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.doc-prose a:hover { background: var(--gold-soft); }
.doc-prose code { padding: 2px 7px; border-radius: 8px; background: var(--soft); color: var(--ink); font-family: var(--mono); font-size: .88em; overflow-wrap: anywhere; }
.doc-prose pre { margin: 0 0 18px; padding: 14px 16px; border-radius: 14px; background: var(--soft); overflow-x: auto; font-size: 13.5px; line-height: 1.55; }
.doc-prose pre code { padding: 0; background: none; }
.doc-prose hr { margin: 32px 0; border: 0; border-top: 1px solid var(--line); }
.doc-prose blockquote { margin: 0 0 18px; padding: 4px 0 4px 18px; border-left: 3px solid var(--gold); color: var(--ink); }
.doc-prose table { width: 100%; margin: 0 0 20px; border-collapse: collapse; font-size: 15px; line-height: 1.5; }
.doc-prose th, .doc-prose td { padding: 10px 14px 10px 0; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.doc-prose th { color: var(--ink); font-weight: 600; font-size: 13.5px; }
.doc-prose img { border-radius: 14px; }
.doc-prose details { margin: 0 0 6px; border-bottom: 1px solid var(--line); }
.doc-prose summary { padding: 14px 0; color: var(--ink); font-weight: 600; cursor: pointer; }
.doc-prose details > :not(summary) { padding-bottom: 6px; }

/* the "already available" line and the status tags: soft pills / one open band, not boxes */
.doc-prose p.already { padding: 14px 18px; border-radius: 16px; background: var(--gold-soft); color: var(--ink); }
.doc-prose .status-tag { display: inline-block; padding: 4px 11px; border-radius: 999px; background: var(--chip); color: var(--ink-2); font-size: 12.5px; font-weight: 600; letter-spacing: .01em; }
.doc-prose .status-available { background: var(--green-soft); color: var(--green); }
.doc-prose .status-soon, .doc-prose .status-planned { background: var(--amber-soft); color: var(--amber-ink); }

.doc-back-row { padding: 8px 0 0; }
.doc-back { display: inline-flex; padding: 9px 16px; border-radius: 999px; background: var(--chip); color: var(--ink); font-size: 14.5px; font-weight: 600; text-decoration: none; }
.doc-back:hover { background: var(--soft-2); }

/* ---- small screens: Robi sits next to the title's end, the contents become a plain wrapped row above the text ------------------------------------------------ */
@media (max-width: 900px) {
  .doc-layout { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .doc-toc { position: static; max-height: none; overflow: visible; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
  .doc-toc nav { flex-direction: row; flex-wrap: wrap; gap: 6px; border-left: 0; }
  .doc-toc a, .doc-toc a:hover { margin: 0; padding: 6px 12px; border: 0; border-radius: 999px; background: var(--chip); font-size: 14px; }
}
@media (max-width: 640px) {
  .doc-hero-in { grid-template-columns: minmax(0, 1fr) 96px; gap: 12px; }
  .doc-hero .robi-live.doc-robi { width: 96px; align-self: start; }
  .doc-hero h1 { font-size: clamp(32px, 9vw, 44px); }
  .doc-prose { font-size: 16.5px; }
  .doc-prose table { display: block; overflow-x: auto; }
}

/* ---- LEGAL CHAT (privacy pages only): Robi's privacy and security chat under the hero, and its docked form (bottom-right panel + tab). Added by r9/v7-legal. -------- */
.doc-chat { padding-top: clamp(26px, 3.5vw, 40px); }
.doc-chat-cta { display: inline-flex; align-items: center; min-height: 44px; margin-top: 18px; color: var(--ink); font-weight: 600; text-decoration-color: var(--gold); text-decoration-thickness: 2px; text-underline-offset: 4px; }
.doc-chat-cta:hover { background: var(--gold-soft); }
.legal-guide-host { display: flex; min-width: 0; max-width: 820px; min-height: 560px; scroll-margin-top: 96px; }
.live-guide { position: relative; flex: 1; display: flex; flex-direction: column; height: 560px; min-width: 0; overflow: hidden; border-radius: 24px; background: var(--soft); border: 1px solid var(--line); box-shadow: var(--shadow); }
.live-guide.is-docked:not(.is-dock-open) { visibility: hidden; }
.guide-top { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 12px 12px 18px; border-bottom: 1px solid var(--line); }
.guide-id { display: grid; gap: 2px; min-width: 0; }
.guide-brand { font-size: 16px; font-weight: 650; color: var(--ink); }
.guide-status { font-size: 13px; color: var(--muted); }
.guide-top-actions { display: flex; gap: 6px; }
.guide-reset, .guide-mobile-close { width: 44px; height: 44px; display: grid; place-items: center; border: 0; border-radius: 50%; background: var(--chip); color: var(--ink); font: inherit; font-size: 18px; cursor: pointer; }
.guide-reset:hover, .guide-mobile-close:hover { background: var(--soft-2); }
.guide-mobile-close { display: none; font-size: 22px; }
.guide-messages { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; padding: 18px clamp(14px, 2.4vw, 22px) 10px; }
.guide-suggestions { flex: none; display: flex; flex-wrap: wrap; gap: 8px; padding: 6px clamp(14px, 2.4vw, 22px) 12px; }
.guide-suggestions[hidden] { display: none !important; }
.guide-suggestions button { min-height: 44px; padding: 8px 14px; border: 0; border-radius: 999px; background: var(--chip); color: var(--ink-2); font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; }
.guide-suggestions button:hover:not(:disabled) { background: var(--gold-soft); color: var(--ink); }
.guide-suggestions button:disabled { opacity: .55; cursor: wait; }
.guide-form { flex: none; display: flex; align-items: flex-end; gap: 8px; margin: 0 12px; padding: 6px 6px 6px 16px; border-radius: 26px; background: var(--bg); border: 1px solid var(--line-2); }
.guide-form:focus-within { border-color: var(--gold-2); }
.guide-form textarea { flex: 1; min-width: 0; min-height: 40px; max-height: 100px; padding: 9px 0; border: 0; outline: 0; resize: none; background: transparent; color: var(--ink); font: inherit; font-size: 16px; line-height: 1.45; }
.guide-form textarea::placeholder { color: var(--muted); }
.guide-form button { flex: none; width: 44px; height: 44px; display: grid; place-items: center; border: 0; border-radius: 50%; background: var(--pill); color: var(--pill-ink); font-size: 18px; font-weight: 700; cursor: pointer; }
.guide-form button:disabled { opacity: .5; cursor: wait; }
.guide-feedback { flex: none; padding: 0 18px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.guide-feedback:not(:empty) { padding-block: 8px; }
.guide-foot { flex: none; padding: 12px 18px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.guide-foot a { color: var(--ink); text-decoration-color: var(--gold); text-underline-offset: 3px; }
.live-guide [role="alert"] .guide-bubble { border-left: 3px solid var(--orange); padding-left: 12px; }
.guide-thinking .guide-bubble i { animation: doc-think 1s ease-in-out infinite; }
@keyframes doc-think { 50% { opacity: .35; } }
.guide-dock-tab { position: fixed; z-index: 95; right: 22px; bottom: 22px; display: none; align-items: center; gap: 10px; min-height: 52px; padding: 6px 18px 6px 8px; border: 0; border-radius: 999px; background: var(--pill); color: var(--pill-ink); font: inherit; box-shadow: var(--shadow-lg); cursor: pointer; opacity: 0; transform: translateY(14px); pointer-events: none; transition: opacity .2s, transform .2s; }
.guide-dock-tab.is-visible { display: inline-flex; opacity: 1; transform: none; pointer-events: auto; }
.guide-dock-tab > b { font-size: 15px; font-weight: 600; }
.dock-icon { width: 38px; height: 38px; padding: 6px; border-radius: 50%; background: var(--gold); object-fit: contain; }
body > .live-guide.is-docked { position: fixed; z-index: 96; right: 22px; bottom: 22px; width: min(430px, calc(100vw - 44px)); height: min(640px, calc(100dvh - 120px)); margin: 0; background: var(--bg); box-shadow: var(--shadow-lg); opacity: 0; transform: translateY(18px); pointer-events: none; transition: opacity .2s, transform .22s; }
body > .live-guide.is-docked.is-dock-open { opacity: 1; transform: none; pointer-events: auto; }
body > .live-guide.is-docked .guide-mobile-close { display: grid; }
body > .live-guide.is-docked .guide-suggestions { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
body > .live-guide.is-docked .guide-suggestions button { flex: none; }
@media (max-width: 700px) {
  .legal-guide-host { min-height: 0; }
  .live-guide:not(.is-docked) { height: auto; min-height: 520px; }
  .live-guide:not(.is-docked) .guide-messages { flex: 0 0 auto; min-height: 220px; max-height: 70vh; }
  .live-guide.is-docked { height: 520px; }
  .guide-dock-tab { right: 14px; bottom: 14px; }
  body > .live-guide.is-docked { right: 8px; left: 8px; bottom: 8px; width: auto; height: calc(100dvh - 88px); transform: translateY(24px); }
  body > .live-guide.is-docked.is-dock-open { transform: none; }
  body.guide-mobile-composing { overflow: hidden; overscroll-behavior: none; }
  body.guide-mobile-composing > .live-guide.is-mobile-composing { top: calc(var(--all-guide-vv-top, 0px) + 80px); right: 8px; left: 8px; bottom: auto; width: auto; height: calc(var(--all-guide-vv-height, 100dvh) - 88px); opacity: 1; transform: none; pointer-events: auto; transition: none; }
  body.guide-mobile-composing > .live-guide .guide-suggestions, body.guide-mobile-composing > .live-guide .guide-foot { display: none; }
}
@media (prefers-reduced-motion: reduce) { .guide-thinking .guide-bubble i { animation: none; opacity: .6; } }

/* ---- plugin pages (/plugin/*): video and footnote (guide-help group) ---- */
.doc-prose .plugin-demo-video { display: block; width: 100%; max-width: 100%; height: auto; margin: 0 0 16px; border-radius: 16px; background: var(--soft); }
.doc-prose .doc-foot { margin: 0; font-size: 14px; color: var(--ink-2, var(--ink)); }

/* ---- copy buttons inside guide prose (guide-help group) ---- */
.doc-prose .idea-copy, .doc-prose [data-copy] { display: inline-block; padding: 3px 12px; border: 0; border-radius: 999px; background: var(--gold-soft); color: var(--ink); font: 600 12.5px/1.6 inherit; font-family: inherit; cursor: pointer; vertical-align: baseline; }
.doc-prose .idea-copy:hover, .doc-prose [data-copy]:hover { background: var(--gold); color: #17140f; }
.doc-prose .idea-copy:focus-visible, .doc-prose [data-copy]:focus-visible { outline: 2px solid var(--gold-2); outline-offset: 2px; }

/* ---- scroll cue: a wide code block or table that scrolls sideways shows a soft shadow on the edge that still has content (CSS only; the cover is the box's own colour, so the shadow
   disappears once the edge is reached). Code blocks at every width, tables where they scroll (small screens). ---- */
.doc-prose pre {
  background:
    linear-gradient(to right, var(--soft) 30%, transparent) left center / 36px 100% no-repeat local,
    linear-gradient(to left, var(--soft) 30%, transparent) right center / 36px 100% no-repeat local,
    radial-gradient(farthest-side at 0 50%, color-mix(in srgb, var(--ink) 28%, transparent), transparent) left center / 14px 100% no-repeat scroll,
    radial-gradient(farthest-side at 100% 50%, color-mix(in srgb, var(--ink) 28%, transparent), transparent) right center / 14px 100% no-repeat scroll,
    var(--soft);
}
@media (max-width: 640px) {
  .doc-prose table {
    background:
      linear-gradient(to right, var(--bg) 30%, transparent) left center / 36px 100% no-repeat local,
      linear-gradient(to left, var(--bg) 30%, transparent) right center / 36px 100% no-repeat local,
      radial-gradient(farthest-side at 0 50%, color-mix(in srgb, var(--ink) 28%, transparent), transparent) left center / 14px 100% no-repeat scroll,
      radial-gradient(farthest-side at 100% 50%, color-mix(in srgb, var(--ink) 28%, transparent), transparent) right center / 14px 100% no-repeat scroll,
      var(--bg);
  }
}
