/* support.circa.ai: the help center. Built on the circa.ai tokens in site.css and the
   lesson prose in learn.css (both copied from circa-web-v2; keep them in sync). */

@layer pages {
  /* ── header ── */
  .sup-hdr .hdr-bar { grid-template-columns: auto minmax(0, 1fr) auto; }
  .sup-brand { display: flex; align-items: center; gap: 12px; }
  .sup-label { font: 500 13px/1 var(--f-mono); color: var(--text); padding-left: 12px; border-left: 1px solid var(--line-3); letter-spacing: -.01em;
    &:hover { color: var(--amber); } }
  .sup-search-btn { justify-self: center; display: flex; align-items: center; gap: 10px; width: min(100%, 420px); height: 36px; padding-inline: 12px;
    border-radius: var(--r-md); background: var(--bg); box-shadow: inset 0 0 0 1px var(--line-2); color: var(--text-3); font: 12.5px var(--f-mono); letter-spacing: -.01em;
    transition: box-shadow var(--dur);
    & .ic { width: 14px; height: 14px; }
    &:hover { box-shadow: inset 0 0 0 1px var(--line-3); color: var(--text-2); }
    & span { flex: 1; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } }
  kbd { font: 500 11px/1 var(--f-mono); color: var(--text-3); padding: 4px 6px; border-radius: var(--r-xs); box-shadow: inset 0 0 0 1px var(--line-2); }
  .home .sup-search-btn { visibility: hidden; }
  @media (max-width: 760px) {
    .sup-search-btn { width: 40px; padding: 0; justify-content: center; & span, & kbd { display: none; } }
    .hide-sm { display: none; }
    .sup-label { padding-left: 10px; }
    .home .sup-search-btn { visibility: visible; }
    .sup-hero-search kbd { display: none; }
  }

  /* ── hero ── */
  .sup-hero { padding-bottom: clamp(48px, 6vw, 72px); }
  .sup-hero .phero-inner { grid-template-columns: minmax(0, 1fr); width: 100%; }
  .sup-phero { padding-bottom: clamp(32px, 4vw, 48px); }
  /* the circa.ai docs search field (.doc-search), as a button that opens the dialog */
  .sup-hero-search { display: flex; align-items: center; gap: 12px; width: min(100%, 620px); height: 52px; margin-top: 8px; padding-inline: 18px;
    border-radius: var(--r-md); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-2);
    color: var(--text-3); font: 500 14.5px var(--f-mono); letter-spacing: -.02em; transition: box-shadow var(--dur);
    &:hover { box-shadow: inset 0 0 0 1px var(--line-3); }
    &:focus-visible { outline: 0; box-shadow: inset 0 0 0 1px var(--amber), 0 0 0 3px var(--amber-15); }
    & span { flex: 1; min-width: 0; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } }
  .sup-popular { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px; max-width: 680px;
    & .chip { display: inline-flex; align-items: center; } }
  .sup-popular-label { font: 500 10.5px var(--f-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--text-4); margin-right: 6px; }

  /* ── home: "New to Circa? Start here" ──
     The hero splits like the circa.ai product heroes (.phero-split): search on the left, a short
     numbered path on the right, styled as a surface card with .steps-style amber counters. */
  .sup-hero-split { grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); align-items: center;
    & .sup-popular { justify-content: flex-start; } }
  .sup-start { display: grid; gap: 16px; padding: 24px 24px 12px; border-radius: var(--r-lg); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-2); }
  .sup-start-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 16px; }
  .sup-start-time { display: inline-flex; align-items: center; gap: 6px; font: 500 10.5px/1 var(--f-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--text-3);
    & .ic { width: 13px; height: 13px; } }
  .sup-start-steps { display: grid; counter-reset: step; border-top: 1px solid var(--line); margin-inline: -8px;
    & li { counter-increment: step; }
    & li + li { border-top: 1px solid var(--line); }
    & a { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 14px 8px; border-radius: var(--r-sm);
      transition: background var(--dur); }
    & a::before { content: counter(step, decimal-leading-zero); align-self: start; padding-top: 3px; font: 500 11px/1 var(--f-mono); letter-spacing: .06em; color: var(--amber); }
    & b { display: block; font: 500 15px/1.35 var(--f-mono); letter-spacing: -.03em; color: var(--text); }
    & .sup-start-text span { display: block; margin-top: 3px; font-size: 13.5px; line-height: 1.45; color: var(--text-3); }
    & .ic { width: 15px; height: 15px; color: var(--text-4); transition: transform var(--dur) var(--ease), color var(--dur); }
    & a:hover { background: var(--surface-2); & .ic { color: var(--amber); transform: translateX(3px); } } }
  @media (max-width: 1080px) { .sup-hero-split { grid-template-columns: 1fr; } .sup-start { max-width: 620px; } }

  /* ── home: topic cards ──
     A three-column card grid. Each card lists its first three pages and links to the rest, and
     cards in a row stretch to the same height with "See all" pinned to the bottom edge. */
  .sup-index-head { margin-bottom: 18px; }
  .sup-topics { align-items: stretch; }
  .sup-topic { display: flex; flex-direction: column; gap: 12px;
    & h2 a:hover { color: var(--amber); }
    & ul { display: grid; margin-top: 4px; }
    & li a { display: block; padding: 8px 0; font-size: 14.5px; line-height: 1.45; color: var(--text-2); border-top: 1px solid var(--line); transition: color var(--dur); }
    & li:first-child a { border-top: 0; }
    & li a:hover { color: var(--text); } }
  .sup-topic-more { margin-top: auto; padding-top: 6px; align-self: flex-start; }
  @media (max-width: 980px) { .sup-topics.g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
  @media (max-width: 640px) { .sup-topics.g3 { grid-template-columns: minmax(0, 1fr); } }

  /* ── contact widget ──
     The circa.ai "How can we help?" panel, restyled with the v2 tokens: an amber round button in the
     bottom right opens a surface card with two routes (support, sales) and the v2 .form fields. */
  .sup-contact { position: fixed; right: max(20px, env(safe-area-inset-right)); bottom: max(20px, env(safe-area-inset-bottom)); z-index: 60;
    display: grid; justify-items: end; gap: 12px; }
  .sup-contact-fab { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; border: 0; cursor: pointer;
    background: var(--amber); color: var(--bg); box-shadow: 0 10px 30px hsl(0 0% 0% / .45); transition: transform var(--dur) var(--ease);
    & .ic { width: 22px; height: 22px; }
    &:hover { transform: scale(1.06); }
    &:focus-visible { outline: 2px solid var(--amber); outline-offset: 3px; } }
  .sup-contact.open .sup-contact-fab { display: none; }
  .sup-contact-panel { order: -1; width: min(380px, calc(100vw - 40px)); max-height: min(620px, calc(100dvh - 120px)); overflow: auto;
    padding: 18px 20px 20px; border-radius: var(--r-lg); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-2), 0 24px 60px hsl(0 0% 0% / .55); }
  .sup-contact-head { display: flex; align-items: center; gap: 8px; margin-bottom: 16px;
    & h2 { flex: 1; min-width: 0; }
    & button { display: grid; place-items: center; width: 30px; height: 30px; border: 0; border-radius: var(--r-sm); background: transparent; color: var(--text-3); cursor: pointer;
      &:hover { background: var(--surface-2); color: var(--text); } & .ic { width: 16px; height: 16px; } }
    & .sup-contact-back .ic { transform: rotate(180deg); } }
  .sup-contact-modes { display: grid; gap: 8px;
    & > button { display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px; border: 0; border-radius: var(--r-md); text-align: left; cursor: pointer;
      background: var(--bg); box-shadow: inset 0 0 0 1px var(--line); transition: box-shadow var(--dur), background var(--dur);
      & b { display: block; font: 500 14.5px/1.3 var(--f-mono); letter-spacing: -.03em; color: var(--text); }
      & span span { display: block; margin-top: 3px; font-size: 13.5px; color: var(--text-3); }
      &:hover { box-shadow: inset 0 0 0 1px var(--amber-25); & .tile { color: var(--amber); } } } }
  .sup-contact-alt { margin-top: 6px; font-size: 13px; color: var(--text-4); text-align: center; & a { color: var(--text-2); text-decoration: underline; text-underline-offset: 3px; } }
  .sup-contact-form { gap: 14px; & textarea { min-height: 120px; } & .btn { width: 100%; justify-content: center; } }
  .sup-contact-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
  .sup-contact-err { font-size: 13.5px; color: var(--text-2); & a { text-decoration: underline; } }
  .sup-contact-done { display: grid; justify-items: center; gap: 10px; padding: 24px 8px 12px; text-align: center;
    & .tile { color: var(--ok); } & b { font: 500 16px var(--f-mono); letter-spacing: -.03em; } & p { color: var(--text-3); font-size: 14px; } }

  /* ── topic list ── */
  .sup-list { display: grid; gap: 8px; max-width: 860px; }
  .sup-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 20px;
    & > span { display: grid; gap: 4px; min-width: 0; }
    & b { font: 500 15px/1.35 var(--f-mono); letter-spacing: -.03em; }
    & .muted { font-size: 14px; }
    & .ic { color: var(--text-3); transition: transform var(--dur) var(--ease), color var(--dur); }
    &:hover .ic { color: var(--amber); transform: translateX(3px); } }

  /* ── article ── */
  /* The text column is the Learn lesson column (.learn-wrap: 760px, centered); the TOC sits in the
     left margin, on the same left edge as the breadcrumb and title above it. */
  .sup-article { display: grid; grid-template-columns: minmax(0, 760px); gap: 40px; justify-content: center; }
  .sup-article.has-toc { grid-template-columns: minmax(0, 1fr) minmax(0, 760px) minmax(0, 1fr); justify-content: stretch; }
  .sup-main { min-width: 0; display: grid; gap: 20px; align-content: start; }
  @media (max-width: 1200px) { .sup-article.has-toc { grid-template-columns: minmax(0, 200px) minmax(0, 760px); justify-content: start; } }
  .sup-toc { position: sticky; top: calc(var(--header-h) + 24px); align-self: start; display: grid; gap: 12px; max-width: 220px; max-height: calc(100vh - var(--header-h) - 48px); overflow: auto;
    & ul { display: grid; gap: 2px; border-left: 1px solid var(--line); }
    & a { display: block; padding: 5px 0 5px 14px; margin-left: -1px; border-left: 1px solid transparent; font-size: 13.5px; line-height: 1.4; color: var(--text-3); }
    & .l3 a { padding-left: 26px; font-size: 13px; }
    & a:hover { color: var(--text); }
    & a[aria-current] { color: var(--amber); border-left-color: var(--amber); } }
  @media (max-width: 980px) {
    .sup-article.has-toc { grid-template-columns: minmax(0, 1fr); }
    .sup-toc { display: none; }
  }

  .sup-prose { & h2, & h3, & h4 { position: relative; scroll-margin-top: calc(var(--header-h) + 20px); }
    & .anchor { margin-left: 8px; color: var(--text-4); opacity: 0; text-decoration: none; font-weight: 400; transition: opacity var(--dur); }
    & :is(h2, h3, h4):hover .anchor, & .anchor:focus-visible { opacity: 1; }
    & em.i { font-style: italic; color: inherit; }
    & code { font: 500 .88em var(--f-mono); color: var(--text); padding: 1px 5px; border-radius: var(--r-xs); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); }
    & pre code { padding: 0; background: none; box-shadow: none; font-weight: 400; }
    & ul ul, & ol ol, & ul ol, & ol ul { margin-top: .35em; }
    & hr { border: 0; border-top: 1px solid var(--line-2); margin-block: 2em; }
    & blockquote p { margin: 0; } }

  .fig { display: grid; gap: 8px; margin-inline: auto;
    & img, & video { width: auto; max-width: 100%; height: auto; margin-inline: auto; border-radius: var(--r-md); box-shadow: 0 0 0 1px var(--line-2); background: var(--surface); }
    & .zoom { display: block; cursor: zoom-in; }
    & figcaption { font-size: 13px; color: var(--text-3); text-align: center; }
    &.size-medium { max-width: 520px; }
    &.size-small { max-width: 320px; }
    &.vid video { width: 100%; } }
  .embed-box { position: relative; aspect-ratio: 16 / 9; border-radius: var(--r-md); overflow: hidden; background: var(--surface); box-shadow: 0 0 0 1px var(--line-2);
    & iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; } }

  .callout { display: flex; gap: 12px; padding: 16px 18px; border-radius: var(--r-lg); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-2); font-size: 15px;
    & > div { min-width: 0; flex: 1; }
    & > div > * + * { margin-top: .6em; }
    & ul, & ol { padding-left: 1.2em; }
    &.tone-takeaways, &.tone-tip { background: var(--amber-08); box-shadow: inset 0 0 0 1px var(--amber-25); }
    &.tone-warning { box-shadow: inset 3px 0 0 var(--amber), inset 0 0 0 1px var(--line-2); } }
  .callout-icon { flex: none; display: grid; place-items: center; width: 22px; height: 22px; margin-top: 2px; border-radius: 50%;
    font: 600 12px/1 var(--f-mono); color: var(--bg); background: var(--text-3);
    .tone-takeaways &, .tone-tip &, .tone-warning & { background: var(--amber); } }
  .callout-title { font: 500 13px var(--f-mono); color: var(--text); letter-spacing: -.01em; }

  /* toggles: the circa.ai disclosure (.faq): hairlines, mono summary, + that turns into an amber x */
  .toggle { border-block: 1px solid var(--line);
    & + .toggle { border-top: 0; }
    & summary { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 16px 4px; cursor: pointer; list-style: none;
      font: 500 15px/1.4 var(--f-mono); letter-spacing: -.03em; color: var(--text); }
    & summary::-webkit-details-marker { display: none; }
    & summary::after { content: "+"; flex: none; font: 400 18px/1 var(--f-mono); color: var(--text-3); transition: transform var(--dur) var(--ease); }
    &[open] summary::after { transform: rotate(45deg); color: var(--amber); }
    & .toggle-body { padding: 0 4px 20px; display: grid; gap: 1em; }
    & .toggle-body > * { min-width: 0; } }

  .formula { overflow-x: auto; padding: 8px 0; color: var(--text); }

  .sup-related { display: grid; gap: 10px; margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--line);
    & ul { display: grid; gap: 6px; }
    & a { color: var(--text); text-decoration: underline; text-decoration-color: var(--amber-25); text-underline-offset: 3px; }
    & a:hover { text-decoration-color: var(--amber); } }

  /* ── help band + footer ──
     The help band is the circa.ai closing band (.cta-band / .cta-card). The footer is only the bottom
     row of the circa.ai footer, since this is a sub-site. */
  .sup-help .lede a { color: var(--text); text-decoration: underline; text-decoration-color: var(--amber-25); text-underline-offset: 3px;
    transition: text-decoration-color var(--dur); &:hover { text-decoration-color: var(--amber); } }
  .sup-ftr { padding-top: 0; & .ftr-bottom { margin-top: 0; border-top: 0; } }

  /* ── search dialog ── */
  .sup-search { width: min(100% - 32px, 640px); max-height: min(70vh, 640px); margin: 12vh auto auto; padding: 0; border: 0; border-radius: var(--r-xl);
    background: var(--surface); color: var(--text-2); box-shadow: inset 0 0 0 1px var(--line-3), 0 40px 80px -20px hsl(0 0% 0% / .9); overflow: hidden;
    &[open] { display: flex; flex-direction: column; }
    &::backdrop { background: hsl(0 0% 0% / .6); backdrop-filter: blur(4px); } }
  .sup-search-box { display: flex; align-items: center; gap: 12px; padding: 0 16px; height: 56px; border-bottom: 1px solid var(--line-2);
    & .ic { width: 20px; height: 20px; color: var(--text-3); }
    & input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: none; font-size: 16px; color: var(--text); }
    & input::-webkit-search-cancel-button { display: none; } }
  .sup-search-close { font: 500 11px/1 var(--f-mono); color: var(--text-3); padding: 5px 7px; border-radius: var(--r-xs); box-shadow: inset 0 0 0 1px var(--line-2); }
  .sup-results { overflow-y: auto; padding: 8px;
    & a { display: grid; gap: 3px; padding: 10px 12px; border-radius: var(--r-md); }
    & a b { font-weight: 550; color: var(--text); }
    & a span { font-size: 13px; color: var(--text-3); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
    & a .meta { font: 500 10.5px var(--f-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--text-4); }
    & a[aria-selected="true"], & a:hover { background: var(--surface-3); }
    & mark { background: none; color: var(--amber); } }
  .sup-search-empty { padding: 20px; color: var(--text-3); font-size: 14px; }
}

/* Unlayered, like learn.css, so these win over its .learn-prose rules (anything inside
   @layer pages loses to unlayered CSS whatever its specificity). */
.sup-prose .toggle + .toggle { margin-top: 0; }
.sup-prose ol ol { list-style: lower-alpha; }
