/* BotPlaza site layer (v2). Loaded after Canvas's tokens.css, components.css and previews.css.
   UI chrome uses only the v2 UI tokens (--sa-bg/surface/text/line/accent). The print tokens
   (--sa-paper, --sa-ink*, --sa-rule*, --sa-print-*) appear only inside paper previews (.d-sheet). */

:root {
  /* Tokens the site needs that the v2 token file doesn't define (Canvas audit). */
  --sa-border-ink: 1px solid var(--sa-line-2);
  --sa-container-narrow: 760px;
  --sa-ls-h2: -0.01em;
  /* Site layout */
  --site-nav-h: 68px;
  --site-sticky-top: 92px;
  --site-bar-h: 72px;
}
html { scroll-padding-top: 84px; }
@media (max-width: 760px) { html { scroll-padding-top: 72px; } }

code { font-family: var(--sa-font-mono, ui-monospace, monospace); font-size: .9em; padding: 1px 5px; border-radius: var(--sa-radius-xs); background: var(--sa-surface-2); color: var(--sa-text); }

/* ---------- Nav: small-screen menu (links collapse at 760px) ---------- */
@media (max-width: 760px) {
  .sa-nav.is-open .sa-nav__links {
    display: flex; flex-direction: column; gap: 0; position: absolute; left: 0; right: 0; top: 100%;
    padding: 8px 16px 16px; background: var(--sa-bg); border-bottom: var(--sa-border);
  }
  .sa-nav.is-open .sa-nav__links a { display: flex; align-items: center; min-height: var(--sa-tap); }
}

/* ---------- Newspaper partial (class versions of the mockup's inline styles) ---------- */
.np__badge { font-size: 8px; height: 16px; }
.np__box-title--kicker { border: 0; padding: 0; margin-bottom: 4px; color: var(--sa-print-accent); }

/* ---------- Cards: PNG previews (already rendered on the dark stage) ---------- */
.sa-card__thumb img { display: block; width: 100%; height: auto; aspect-ratio: 3 / 2; object-fit: cover; background: var(--sa-bg-2); }
@media (min-width: 1101px) {
  .sa-card--wide .sa-card__thumb { display: flex; align-items: center; background: var(--sa-bg-2); }
}
.site-card__meta { display: flex; align-items: center; gap: 10px; }
.site-rating { display: inline-flex; align-items: center; gap: 4px; font-size: var(--sa-fs-xs); color: var(--sa-text-2); }
.site-rating svg { color: var(--sa-gold); }

/* ---------- Browse page ---------- */
.site-page { padding-top: clamp(28px, 4vw, 48px); }
.site-search { max-width: 640px; margin-bottom: 20px; }
.site-filter-row { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.site-filter-row__label { min-width: 72px; font-size: var(--sa-fs-xs); color: var(--sa-text-3); }
.site-filter-row .sa-filters { margin: 0; }
.site-page .sa-grid { margin-top: 24px; }
.sa-empty .sa-btn { margin-top: 12px; }

/* ---------- Loading skeleton ---------- */
.site-skeleton { height: 420px; margin: 40px 0; border-radius: var(--sa-radius-lg); background: linear-gradient(90deg, var(--sa-surface) 0%, var(--sa-surface-2) 50%, var(--sa-surface) 100%); background-size: 200% 100%; animation: site-shimmer 1.4s linear infinite; }
.site-skeleton--sheet { height: 560px; margin: 0; }
@keyframes site-shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .site-skeleton { animation: none; } }

/* ---------- Skill detail ---------- */
.d-page { padding-top: 20px; padding-bottom: clamp(40px, 6vw, 72px); }
.d-crumbs ol { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0 0 20px; padding: 0; font-size: var(--sa-fs-xs); color: var(--sa-text-3); }
.d-crumbs li + li::before { content: "/"; margin-right: 6px; color: var(--sa-text-3); }
.d-crumbs a { color: var(--sa-text-2); text-decoration: none; display: inline-flex; align-items: center; min-height: var(--sa-tap); }
.d-crumbs a:hover { color: var(--sa-text); text-decoration: underline; }
.d-crumbs [aria-current] { display: inline-flex; align-items: center; color: var(--sa-text-2); }

.d-grid {
  display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); column-gap: clamp(28px, 4vw, 56px);
  grid-template-areas: "head aside" "output aside" "rest aside"; grid-template-rows: auto auto 1fr; align-items: start;
}
.d-head { grid-area: head; margin-bottom: 20px; }
.d-output { grid-area: output; }
.d-rest { grid-area: rest; }
.d-aside { grid-area: aside; position: sticky; top: var(--aside-top, var(--site-sticky-top)); display: grid; gap: 16px; }

.d-title { color: var(--sa-text); letter-spacing: var(--sa-ls-h2); font-size: clamp(40px, 5vw, 60px); }
.d-tagline { margin-top: 10px; font-family: var(--sa-font-text); font-size: clamp(18px, 2vw, 21px); line-height: 1.4; color: var(--sa-text-2); max-width: 34em; }
.d-head__meta { display: flex; align-items: center; gap: 12px; margin-top: 16px; }

/* The output: a light sheet glowing on the dark page */
.d-output { position: relative; }
.d-output::before { content: ""; position: absolute; inset: -40px -20px; background: var(--sa-glow); pointer-events: none; z-index: 0; }
.d-output > * { position: relative; z-index: 1; }
.d-output__bar { display: flex; margin-bottom: 12px; }
.d-output__sub { margin: 36px 0 12px; color: var(--sa-text); }
.d-np { border-radius: var(--sa-radius-sm); background: var(--sa-surface-2); }
.d-np__fallback { display: block; width: 100%; height: auto; border-radius: var(--sa-radius-sm); }
.d-preview { margin: 0; }
.d-preview img { display: block; width: 100%; height: auto; border-radius: var(--sa-radius-md); }
.d-preview figcaption { margin-top: 8px; font-size: var(--sa-fs-xs); color: var(--sa-text-3); }

/* Paper sheet: the only place print tokens are used */
.d-sheet {
  position: relative; background: var(--sa-sheet); color: var(--sa-ink); border-radius: var(--sa-radius-xs);
  box-shadow: var(--sa-shadow-paper); padding: clamp(22px, 4vw, 48px) clamp(20px, 4.5vw, 56px);
  font-family: var(--sa-font-text); font-size: 16.5px; line-height: 1.6;
}
.d-sheet.is-clamped { max-height: 520px; overflow: hidden; }
.d-sheet.is-clamped::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 140px; background: linear-gradient(rgba(255,253,249,0), var(--sa-sheet) 85%); }
.d-sheet__toggle { display: flex; justify-content: center; margin-top: 16px; }
.sa-prose h1, .sa-prose h2, .sa-prose h3 { font-family: var(--sa-font-text); color: var(--sa-ink); line-height: 1.2; margin: 1.3em 0 .45em; }
.sa-prose > :first-child { margin-top: 0; }
.sa-prose h1 { font-size: 30px; font-weight: 700; }
.sa-prose h2 { font-size: 22px; font-weight: 600; padding-bottom: 6px; border-bottom: 1px solid var(--sa-rule); }
.sa-prose h3 { font-size: 18px; font-weight: 600; }
.sa-prose p, .sa-prose ul, .sa-prose ol, .sa-prose blockquote, .sa-prose table { margin: 0 0 .9em; }
.sa-prose ul, .sa-prose ol { padding-left: 1.3em; }
.sa-prose li { margin: .25em 0; }
.sa-prose a { color: var(--sa-print-accent); }
.sa-prose strong { color: var(--sa-ink); }
.sa-prose em { color: var(--sa-ink-2); }
.sa-prose blockquote { padding-left: 14px; border-left: 3px solid var(--sa-rule-ink); color: var(--sa-ink-2); }
.sa-prose hr { border: 0; border-top: 1px solid var(--sa-rule); margin: 1.5em 0; }
.sa-prose table { border-collapse: collapse; width: 100%; font-size: 15px; }
.sa-prose th, .sa-prose td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--sa-rule); }
.sa-prose code { background: var(--sa-paper-2); color: var(--sa-ink); }

/* Left column sections */
.d-get { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.d-get li { display: grid; grid-template-columns: 18px 1fr; gap: 10px; color: var(--sa-text-2); line-height: 1.45; }
.d-get svg { margin-top: 4px; color: var(--sa-accent); }
.d-custom { display: grid; gap: 14px; }
.d-custom__row { display: grid; gap: 8px; }
.d-custom__label { font-size: var(--sa-fs-sm); color: var(--sa-text); font-weight: 500; }
.d-opts { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0; padding: 0; }
.d-opt { display: inline-flex; align-items: center; height: 30px; padding: 0 12px; border-radius: var(--sa-radius-pill); border: var(--sa-border); color: var(--sa-text-3); font-size: 13.5px; }
.d-opt.is-on { border-color: var(--sa-line-2); background: var(--sa-surface-2); color: var(--sa-text); }
.d-note { margin-top: 12px; }
.d-tags { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 0; padding: 0; }
.d-about p { color: var(--sa-text-2); line-height: 1.6; max-width: var(--sa-container-narrow); }
.d-about p + p { margin-top: .8em; }
.d-full summary { display: inline-flex; align-items: center; min-height: var(--sa-tap); cursor: pointer; color: var(--sa-accent); font-size: var(--sa-fs-sm); font-weight: 500; }

/* Right column: inline install panel (same component as the dialog) */
.d-install { padding: 24px; background: var(--sa-surface); border: var(--sa-border-strong); border-radius: var(--sa-radius-xl); color: var(--sa-text-2); box-shadow: var(--sa-highlight); }
.d-install .sa-seg { margin-top: 18px; }
.d-full { margin-top: 14px; border-top: var(--sa-border); padding-top: 4px; }
.d-full summary { width: 100%; }
.d-steps { margin: 8px 0 0; padding-left: 1.4em; display: grid; gap: 8px; color: var(--sa-text-2); font-size: var(--sa-fs-sm); line-height: 1.5; }
.d-steps li::marker { color: var(--sa-text-3); }
.d-full__note { margin-top: 10px; }
.copyblock { margin-top: 16px; border: var(--sa-border-ink); border-radius: var(--sa-radius-md); background: var(--sa-bg); overflow: hidden; }
.copyblock__bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 6px 6px 14px; border-bottom: var(--sa-border); font-size: var(--sa-fs-xs); color: var(--sa-text-3); }
.copyblock pre { margin: 0; padding: 14px; max-height: 220px; overflow: auto; white-space: pre-wrap; word-break: break-word; font: 13px/1.55 var(--sa-font-mono, ui-monospace, monospace); color: var(--sa-text-2); }
.copyblock > .sa-meta { padding: 8px 14px 12px; border-top: var(--sa-border); }
.copyblock__btn { min-height: var(--sa-tap); }

/* "Steps being verified" (any agent whose steps aren't fully verified) */
.site-verifying { display: flex; gap: 10px; align-items: flex-start; margin: 8px 0 0; padding: 10px 12px; border-radius: 12px; background: var(--sa-bg-2); border: var(--sa-border); font-size: var(--sa-fs-xs); line-height: 1.45; color: var(--sa-text-2); }
.site-verifying strong { color: var(--sa-text); font-weight: 600; }
.site-verifying__dot { flex: none; width: 8px; height: 8px; margin-top: 5px; border-radius: 50%; background: var(--sa-gold); }

/* Trust block */
.d-trust { padding: 22px 24px; background: var(--sa-surface); border: var(--sa-border); border-radius: var(--sa-radius-lg); }
.d-trust .sa-h3 { color: var(--sa-text); margin-bottom: 4px; font-size: 22px; }
.d-trust__item { padding: 12px 0; border-bottom: var(--sa-border); }
.d-trust__item:last-child { border-bottom: 0; padding-bottom: 0; }
.d-trust__item h3 { font: 600 11.5px/1 var(--sa-font-ui); letter-spacing: .1em; text-transform: uppercase; color: var(--sa-text-3); margin-bottom: 8px; }
.d-trust__item p, .d-trust__item li { font-size: var(--sa-fs-sm); line-height: 1.5; color: var(--sa-text-2); }
.d-trust__item ul { margin: 0; padding-left: 1.1em; display: grid; gap: 4px; }
.d-trust__warn li::marker { color: var(--sa-gold); }
.d-cost__text { margin-top: 8px; }
.site-cost { display: inline-flex; align-items: center; gap: 8px; height: 28px; padding: 0 12px 0 10px; border-radius: var(--sa-radius-pill); background: var(--sa-surface-2); border: var(--sa-border-strong); color: var(--sa-text); font: 600 13px/1 var(--sa-font-ui); }
.site-cost__bars { display: inline-flex; align-items: flex-end; gap: 2px; height: 12px; }
.site-cost__bars i { width: 3px; border-radius: 1px; background: var(--sa-text-4); }
.site-cost__bars i:nth-child(1) { height: 5px; } .site-cost__bars i:nth-child(2) { height: 8px; } .site-cost__bars i:nth-child(3) { height: 12px; }
.site-cost--light .site-cost__bars i:nth-child(-n+1),
.site-cost--medium .site-cost__bars i:nth-child(-n+2),
.site-cost--heavy .site-cost__bars i { background: var(--sa-accent); }
.site-cost--varies .site-cost__bars i { background: var(--sa-gold); opacity: .8; }

.d-related { border-top: var(--sa-border); }
.d-bar { display: none; }
.d-notfound { padding: 80px 0; text-align: center; display: grid; gap: 14px; justify-items: center; color: var(--sa-text-2); }
.d-notfound .sa-h2 { color: var(--sa-text); }

@media (max-width: 1000px) {
  .d-grid { grid-template-columns: minmax(0, 1fr); grid-template-areas: "head" "output" "aside" "rest"; grid-template-rows: auto; }
  .d-aside { position: static; margin-top: 32px; }
  .d-bar {
    display: flex; align-items: center; justify-content: space-between; gap: 12px; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: rgba(18,17,16,.92); backdrop-filter: blur(10px); border-top: var(--sa-border);
  }
  .d-bar__name { font-family: var(--sa-font-display); font-size: 22px; color: var(--sa-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .d-bar .sa-btn { flex: none; }
  body:has(.d-bar) .sa-footer { padding-bottom: calc(var(--site-bar-h) + 24px); }
}
@media (max-width: 640px) {
  .d-install, .d-trust { padding: 20px 16px; }
  .d-sheet { font-size: 15.5px; }
  .d-sheet.is-clamped { max-height: 620px; }
}
.d-full summary::after { content: "+"; margin-left: auto; font-size: 18px; color: var(--sa-text-3); }
.d-full[open] summary::after { content: "–"; }
.d-full summary::-webkit-details-marker { display: none; }
[hidden] { display: none !important; }

/* ---------- Detail accordions (What you get, Make it yours, Data sources, About, full edition) ---------- */
.d-rest { margin-top: 28px; border-top: var(--sa-border); }
.d-edition { margin-top: 20px; border-top: var(--sa-border); }
.d-acc { border-bottom: var(--sa-border); }
.d-acc__head {
  display: flex; align-items: center; gap: 16px; min-height: 64px; padding: 12px 4px; cursor: pointer;
  list-style: none; border-radius: var(--sa-radius-sm);
}
.d-acc__head::-webkit-details-marker { display: none; }
.d-acc__head:hover .d-acc__title { color: var(--sa-accent); }
.d-acc__head:focus-visible { outline: 2px solid var(--sa-accent); outline-offset: 2px; }
.d-acc__text { flex: 1; min-width: 0; display: grid; gap: 4px; }
.d-acc__title { font: 400 24px/1.1 var(--sa-font-display); color: var(--sa-text); margin: 0; transition: color var(--sa-dur) var(--sa-ease); }
.d-acc__sum { font-size: var(--sa-fs-sm); color: var(--sa-text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.d-acc[open] .d-acc__sum { color: var(--sa-text-3); }
.d-acc__chev {
  flex: none; width: 36px; height: 36px; border-radius: 50%; border: var(--sa-border-strong); background: var(--sa-surface);
  display: grid; place-items: center; transition: transform var(--sa-dur) var(--sa-ease), border-color var(--sa-dur) var(--sa-ease);
}
.d-acc__chev::before { content: ""; width: 8px; height: 8px; border-right: 1.75px solid var(--sa-text-2); border-bottom: 1.75px solid var(--sa-text-2); transform: translateY(-2px) rotate(45deg); }
.d-acc__head:hover .d-acc__chev { border-color: var(--sa-text-3); }
.d-acc[open] .d-acc__chev { transform: rotate(180deg); }
.d-acc__body { padding: 4px 4px 28px; }
.d-edition .d-acc__body { padding-inline: 0; }
@media (prefers-reduced-motion: reduce) { .d-acc__chev, .d-acc__title { transition: none; } }
@media (max-width: 640px) { .d-acc__title { font-size: 22px; } .d-acc__head { min-height: 60px; } }

/* Download: secondary to the install steps */
.d-dl { margin-top: 16px; padding-top: 14px; border-top: var(--sa-border); }
.d-dl__btn { width: 100%; justify-content: center; gap: 8px; }
.d-dl__hint { margin: 8px 0 0; font-size: var(--sa-fs-xs); color: var(--sa-text-3); text-align: center; }
.site-head-meta { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; justify-content: flex-end; }
.site-dl-all { display: inline-flex; align-items: center; gap: 6px; min-height: var(--sa-tap); font-size: var(--sa-fs-xs); color: var(--sa-accent); text-decoration: none; }
.site-dl-all:hover { text-decoration: underline; }
.site-dl-all svg { flex: none; }

.d-full__title { display: inline; margin: 0; font: inherit; color: inherit; }
/* Long data-source names wrap instead of widening the column on phones. */
.d-grid > * { min-width: 0; }
.d-page .sa-tag { white-space: normal; max-width: 100%; overflow-wrap: anywhere; }
.d-aside { grid-template-columns: minmax(0, 1fr); }
.d-aside > * { min-width: 0; }
.d-trust li, .d-trust p { overflow-wrap: anywhere; }
