/* =========================================================================
   Suitiee — public guides.

   One stylesheet for every guide page and for the API reference chrome in the
   partner panel. Both used to carry their own inline <style> block with their
   own copy of the palette, which is why the two drifted into different type
   scales, different code-block colours and different link treatments.

   RTL-aware throughout: the guides are served in whichever locale the reader
   is using, but code, URLs and payloads always render LTR.
   ========================================================================= */

:root {
    --doc-ink:       #3B2A1E;
    --doc-ink-soft:  #6B5645;
    --doc-terra:     #C2703D;
    --doc-terra-dk:  #8A4727;
    --doc-cream:     #FCF7EF;
    --doc-paper:     #FFFFFF;
    --doc-line:      #F0DFCF;
    --doc-code-bg:   #1E1710;
    --doc-code-ink:  #E9C5AE;
    --doc-radius:    0.9rem;
    --doc-font:      'Thmanyah Sans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
    --doc-mono:      ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

body.doc-body {
    margin: 0;
    background: var(--doc-cream);
    color: var(--doc-ink);
    font-family: var(--doc-font);
    font-size: 1rem;
    line-height: 1.7;
}

/* ---- Top bar ------------------------------------------------------------ */
.doc-top {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.8rem clamp(1rem, 4vw, 3rem);
    background: rgba(252, 247, 239, 0.92);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--doc-line);
}
.doc-top img { height: 2rem; }
.doc-top .doc-spacer { flex: 1; }
.doc-top a.doc-btn {
    color: var(--doc-terra-dk);
    text-decoration: none;
    font-weight: 700;
    font-size: 0.85rem;
    border: 1px solid var(--doc-line);
    border-radius: 0.6rem;
    padding: 0.4rem 0.8rem;
    background: var(--doc-paper);
    white-space: nowrap;
}
.doc-top a.doc-btn:hover { background: #FBF3EE; }

/* ---- Shell -------------------------------------------------------------- */
.doc-shell {
    display: grid;
    grid-template-columns: 15rem minmax(0, 1fr) 13rem;
    gap: clamp(1.5rem, 3vw, 3rem);
    max-width: 82rem;
    margin: 0 auto;
    padding: 2.5rem clamp(1rem, 4vw, 3rem) 5rem;
    align-items: start;
}
@media (max-width: 68rem) {
    .doc-shell { grid-template-columns: 14rem minmax(0, 1fr); }
    .doc-toc { display: none; }
}
@media (max-width: 48rem) {
    /*
       One column on a phone, and the article FIRST.

       The sidebar was a sibling above the article, which was fine when it held
       three links and is not fine now that it holds thirty-one: a reader who
       opened a page from a search result met the whole table of contents and had
       to scroll past every section to reach the sentence they came for. Below
       the article it reads as a directory, which is what it is once you have
       finished reading.
    */
    .doc-shell { grid-template-columns: minmax(0, 1fr); }
    .doc-main { order: 1; }
    .doc-nav {
        order: 2;
        position: static;
        margin-top: 2.5rem;
        padding-top: 1.75rem;
        border-top: 1px solid var(--doc-line);
    }
}

/* ---- Guide nav (the thing three separate pages had none of) ------------- */
.doc-nav {
    position: sticky;
    top: 5rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}
.doc-nav-title {
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    color: #9A8473;
    margin: 0 0 0.35rem;
}
.doc-nav a {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.55rem 0.7rem;
    border-radius: 0.65rem;
    text-decoration: none;
    color: var(--doc-ink-soft);
    font-size: 0.88rem;
    font-weight: 600;
    border: 1px solid transparent;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.doc-nav a:hover { background: var(--doc-paper); color: var(--doc-terra-dk); }
.doc-nav a[aria-current='page'] {
    background: var(--doc-paper);
    color: var(--doc-terra-dk);
    border-color: var(--doc-line);
    box-shadow: 0 1px 2px rgba(59, 42, 30, 0.05);
}
.doc-nav svg { width: 1.05rem; height: 1.05rem; flex: 0 0 auto; }

/* ---- In-page contents --------------------------------------------------- */
.doc-toc { position: sticky; top: 5rem; font-size: 0.82rem; }
.doc-toc-title {
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    color: #9A8473;
    margin: 0 0 0.5rem;
}
.doc-toc ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.15rem; }
.doc-toc a {
    display: block;
    padding: 0.25rem 0.6rem;
    color: var(--doc-ink-soft);
    text-decoration: none;
    border-inline-start: 2px solid var(--doc-line);
    line-height: 1.5;
}
.doc-toc a:hover { color: var(--doc-terra-dk); border-inline-start-color: var(--doc-terra); }

/* ---- Article ------------------------------------------------------------ */
.doc-main { min-width: 0; }
.doc-main h1 {
    font-size: clamp(1.8rem, 3vw, 2.2rem);
    letter-spacing: -0.02em;
    color: var(--doc-terra-dk);
    margin: 0 0 1rem;
}
.doc-main h2 {
    font-size: 1.4rem;
    letter-spacing: -0.01em;
    color: var(--doc-terra-dk);
    margin: 2.5rem 0 0.75rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--doc-line);
    scroll-margin-top: 5.5rem;
}
.doc-main h3 { font-size: 1.08rem; color: var(--doc-ink); margin: 1.75rem 0 0.5rem; }
.doc-main a { color: var(--doc-terra); font-weight: 600; }
.doc-main blockquote {
    margin: 1rem 0;
    padding: 0.75rem 1.1rem;
    border-inline-start: 4px solid var(--doc-terra);
    background: var(--doc-paper);
    border-radius: 0.5rem;
    color: var(--doc-ink-soft);
}
.doc-main blockquote p { margin: 0.25rem 0; }
.doc-main code {
    font-family: var(--doc-mono);
    font-size: 0.85em;
    background: #F6E8DA;
    color: var(--doc-terra-dk);
    border-radius: 0.35rem;
    padding: 0.1rem 0.35rem;
    direction: ltr;
    unicode-bidi: embed;
    /* A file path or a URL in inline code has no spaces to wrap at. On a phone it
       otherwise runs 80px past the edge and the whole guide scrolls sideways. */
    overflow-wrap: anywhere;
}
.doc-main pre {
    position: relative;
    background: var(--doc-code-bg);
    color: var(--doc-code-ink);
    padding: 1rem 1.25rem;
    border-radius: var(--doc-radius);
    overflow-x: auto;
    direction: ltr;
    text-align: left;
}
.doc-main pre code { background: none; color: inherit; padding: 0; font-size: 0.82rem; line-height: 1.6; overflow-wrap: normal; white-space: pre; }
.doc-main table {
    /* As wide as its content up to the column, then it scrolls within itself --
       a comparison table with four columns cannot fit a phone and used to push
       the whole page 175px wider instead. */
    display: block;
    width: max-content;
    max-width: 100%;
    overflow-x: auto;
    border-collapse: collapse;
    margin: 1rem 0;
    background: var(--doc-paper);
    border-radius: 0.6rem;
    font-size: 0.9rem;
}
.doc-main th, .doc-main td {
    text-align: start;
    padding: 0.55rem 0.8rem;
    border-bottom: 1px solid var(--doc-line);
    vertical-align: top;
}
.doc-main th { background: #F9EEE2; color: var(--doc-terra-dk); font-weight: 800; }
.doc-main tr:last-child td { border-bottom: none; }
.doc-main hr { border: none; border-top: 1px solid var(--doc-line); margin: 2rem 0; }
.doc-main ul, .doc-main ol { padding-inline-start: 1.4rem; }
.doc-main li { margin: 0.3rem 0; }
.doc-main img { max-width: 100%; height: auto; }

/* ---- Copy button on code blocks ---------------------------------------- */
.doc-copy {
    position: absolute;
    top: 0.5rem;
    inset-inline-end: 0.5rem;
    border: 1px solid rgba(233, 197, 174, 0.25);
    background: rgba(255, 255, 255, 0.08);
    color: var(--doc-code-ink);
    border-radius: 0.45rem;
    padding: 0.2rem 0.5rem;
    font: 600 0.7rem/1.4 var(--doc-font);
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s, background 0.15s;
}
.doc-main pre:hover .doc-copy, .doc-copy:focus-visible { opacity: 1; }
.doc-copy:hover { background: rgba(255, 255, 255, 0.16); }

/* ---- Index cards -------------------------------------------------------- */
.doc-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}
.doc-card {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding: 1.15rem;
    border: 1px solid var(--doc-line);
    border-radius: var(--doc-radius);
    background: var(--doc-paper);
    text-decoration: none;
    color: inherit;
    transition: transform 0.16s, box-shadow 0.16s, border-color 0.16s;
}
.doc-card:hover {
    transform: translateY(-2px);
    border-color: var(--doc-terra);
    box-shadow: 0 12px 28px -16px rgba(138, 71, 39, 0.55);
}
.doc-card-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 800;
    color: var(--doc-terra-dk);
}
.doc-card-title svg { width: 1.15rem; height: 1.15rem; }
.doc-card-summary { font-size: 0.86rem; color: var(--doc-ink-soft); line-height: 1.6; }

@media (prefers-reduced-motion: reduce) {
    .doc-card:hover { transform: none; }
}

/* =========================================================================
   The documentation site proper: search, sections, breadcrumbs, "what you
   need" boxes, screenshots and the helpful vote.

   Added when /docs stopped being three markdown files at the repository root
   and became a thirty-two page site in two languages.
   ========================================================================= */

.doc-sr {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.doc-skip {
    position: absolute;
    inset-inline-start: -100vw;
    top: 0;
    z-index: 40;
    background: var(--doc-paper);
    color: var(--doc-terra-dk);
    padding: 0.6rem 1rem;
    border-radius: 0 0 0.6rem 0;
    font-weight: 700;
}
.doc-skip:focus { inset-inline-start: 0; }

.doc-top .doc-logo { border: none; background: none; padding: 0; }
.doc-top a.doc-btn--solid {
    background: var(--doc-terra);
    border-color: var(--doc-terra);
    color: #fff;
}
.doc-top a.doc-btn--solid:hover { background: var(--doc-terra-dk); }

/* ---- Search ------------------------------------------------------------- */
.doc-search { position: relative; flex: 0 1 22rem; min-width: 8rem; }
.doc-search input {
    width: 100%;
    font: 600 0.85rem/1.4 var(--doc-font);
    color: var(--doc-ink);
    background: var(--doc-paper);
    border: 1px solid var(--doc-line);
    border-radius: 0.6rem;
    padding: 0.45rem 0.8rem;
}
.doc-search input:focus-visible { outline: 2px solid var(--doc-terra); outline-offset: 1px; }
.doc-search-results {
    position: absolute;
    inset-inline-start: 0;
    inset-inline-end: 0;
    top: calc(100% + 0.35rem);
    background: var(--doc-paper);
    border: 1px solid var(--doc-line);
    border-radius: 0.7rem;
    box-shadow: 0 18px 40px -22px rgba(59, 42, 30, 0.6);
    overflow: hidden;
    z-index: 30;
}
.doc-search-results a {
    display: block;
    padding: 0.5rem 0.8rem;
    text-decoration: none;
    color: var(--doc-ink);
    border-bottom: 1px solid var(--doc-line);
}
.doc-search-results a:last-child { border-bottom: none; }
.doc-search-results a:hover { background: #FBF3EE; }
.doc-search-results strong { display: block; font-size: 0.85rem; color: var(--doc-terra-dk); }
.doc-search-results span {
    display: block;
    font-size: 0.75rem;
    color: var(--doc-ink-soft);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.doc-search-none { margin: 0; padding: 0.6rem 0.8rem; font-size: 0.8rem; color: var(--doc-ink-soft); }

@media (max-width: 48rem) {
    .doc-search { flex-basis: 100%; order: 3; }
    .doc-top { flex-wrap: wrap; }
}

/* ---- Sidebar, now grouped by section ----------------------------------- */
.doc-nav .doc-nav-title { margin-top: 1.1rem; }
.doc-nav .doc-nav-title:first-child { margin-top: 0; }

/* ---- Index -------------------------------------------------------------- */
.doc-lede { font-size: 1.05rem; color: var(--doc-ink-soft); max-width: 46rem; }
.doc-section h2 { display: flex; align-items: center; gap: 0.55rem; }
.doc-section h2 svg { width: 1.2rem; height: 1.2rem; }
.doc-section-summary { color: var(--doc-ink-soft); margin: 0; font-size: 0.92rem; }
.doc-chip {
    align-self: flex-start;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--doc-terra-dk);
    background: #F6E8DA;
    border-radius: 999px;
    padding: 0.15rem 0.55rem;
}

/* ---- Breadcrumbs -------------------------------------------------------- */
.doc-crumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    font-size: 0.78rem;
    color: var(--doc-ink-soft);
    margin-bottom: 0.9rem;
}
.doc-crumbs a { color: var(--doc-ink-soft); text-decoration: none; font-weight: 600; }
.doc-crumbs a:hover { color: var(--doc-terra-dk); text-decoration: underline; }

/* ---- "What you need" and "When it goes wrong" --------------------------- */
.doc-main blockquote.doc-need,
.doc-main .doc-need {
    border-inline-start: 4px solid var(--doc-terra);
    background: var(--doc-paper);
}

/* Markdown cannot carry a class, so the two standing boxes are marked by the
   heading that opens them: a definition list would have been prettier and
   would not survive a translator moving a line. */
.doc-main h2 + ul { margin-top: 0.5rem; }

/* ---- Screenshots -------------------------------------------------------- */
.doc-main p > img {
    display: block;
    border: 1px solid var(--doc-line);
    border-radius: var(--doc-radius);
    background: var(--doc-paper);
    box-shadow: 0 12px 30px -20px rgba(59, 42, 30, 0.55);
    margin: 0.9rem 0;
}
/* A phone screenshot is 390px wide and must not be blown up to the column. */
.doc-main p > img[src*="-phone"] { max-width: 20rem; }

/* ---- Page footer: updated stamp and the helpful vote -------------------- */
.doc-foot { margin-top: 3rem; border-top: 1px solid var(--doc-line); padding-top: 1.25rem; }
.doc-updated { font-size: 0.78rem; color: #9A8473; margin: 0 0 1rem; }
.doc-helpful {
    background: var(--doc-paper);
    border: 1px solid var(--doc-line);
    border-radius: var(--doc-radius);
    padding: 1rem 1.15rem;
}
.doc-helpful-question, .doc-helpful-thanks { margin: 0 0 0.6rem; font-weight: 700; color: var(--doc-terra-dk); }
.doc-helpful-thanks { margin-bottom: 0; }
.doc-helpful-actions { display: flex; gap: 0.5rem; }
.doc-helpful-actions button {
    font: 700 0.82rem/1.4 var(--doc-font);
    color: var(--doc-terra-dk);
    background: var(--doc-cream);
    border: 1px solid var(--doc-line);
    border-radius: 0.6rem;
    padding: 0.4rem 1.1rem;
    cursor: pointer;
}
.doc-helpful-actions button:hover { background: #F6E8DA; }
