@import url("https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,600;9..144,700&family=Manrope:wght@400;500;600;700;800&display=swap");

/* -- Design tokens ---------------------------------------- */
:root {
    --guide-ink: #16233b;
    --guide-muted: #5b687d;
    --guide-surface: #fffaf3;
    --guide-card: rgba(255, 255, 255, 0.82);
    --guide-line: rgba(22, 35, 59, 0.12);
    --guide-primary: #ef6d58;
    --guide-primary-strong: #d65543;
    --guide-accent: #1d6a78;
    --guide-accent-soft: #d8edf0;
    --guide-sand: #f2e5d2;
    --guide-shadow: 0 28px 60px rgba(22, 35, 59, 0.12);
    --site-shell: rgba(255, 255, 255, 0.72);
    --site-shell-strong: rgba(255, 255, 255, 0.9);
}

html {
    scroll-behavior: smooth;
}

/* -- Typography ------------------------------------------- */
body,
.md-typeset {
    font-family: "Manrope", "Segoe UI", sans-serif;
}

body {
    background:
        radial-gradient(circle at top left, rgba(239, 109, 88, 0.08), transparent 24%),
        radial-gradient(circle at right top, rgba(29, 106, 120, 0.1), transparent 22%),
        linear-gradient(180deg, #fffaf5 0%, #f7f8fb 100%);
}

.md-grid {
    max-width: 1420px;
}

/* -- Logo -------------------------------------------------- */
/* Material force-fits the logo into a 1.2rem square; the Cartium mark is
   ~1.5:1, so let it keep its own width and give it a readable height. */
.md-logo :is(img, svg) {
    width: auto;
    height: 1.6rem;
}

/* The header is light in the default scheme (see below), so the dark-ink
   mark is the default and the light one is swapped in for slate. */
[data-md-color-scheme="slate"] .md-logo img {
    content: url("../assets/logo-dark.svg");
}

/* -- Header ----------------------------------------------- */
.md-header {
    background: rgba(255, 250, 244, 0.78);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(22, 35, 59, 0.08);
    box-shadow: none;
}

[data-md-color-scheme="default"] .md-header,
[data-md-color-scheme="default"] .md-tabs {
    color: var(--guide-ink);
}

[data-md-color-scheme="default"] .md-header__button,
[data-md-color-scheme="default"] .md-header__title,
[data-md-color-scheme="default"] .md-header__topic,
[data-md-color-scheme="default"] .md-search__icon,
[data-md-color-scheme="default"] .md-header__source {
    color: var(--guide-ink);
}

[data-md-color-scheme="default"] .md-search__form {
    background: rgba(255, 255, 255, 0.78);
}

.md-header__topic,
.md-header__title,
.md-nav__title {
    font-family: "Fraunces", Georgia, serif;
}

/* -- Main area -------------------------------------------- */
.md-main {
    background: transparent;
}

.md-footer,
.md-footer-meta {
    display: none;
}

.md-main__inner {
    margin-top: 0;
}

.md-content__inner {
    margin: 0;
    padding-top: 0.8rem;
}

/* -- Headings --------------------------------------------- */
.md-typeset h1,
.md-typeset h2,
.md-typeset h3,
.md-typeset h4 {
    font-family: "Fraunces", Georgia, serif;
    letter-spacing: -0.03em;
    color: var(--guide-ink);
}

.md-typeset h1 {
    margin-bottom: 1.2rem;
    font-size: clamp(2rem, 3.6vw, 3rem);
}

.md-typeset h2 {
    margin-top: 2.6rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid rgba(29, 106, 120, 0.12);
    font-size: clamp(1.5rem, 2.2vw, 2rem);
}

.md-typeset h3 {
    margin-top: 1.8rem;
    font-size: clamp(1.12rem, 1.5vw, 1.35rem);
}

.md-typeset h4 {
    margin-top: 1.4rem;
    font-size: 1.05rem;
    font-weight: 700;
}

/* -- Body text -------------------------------------------- */
.md-typeset p,
.md-typeset li {
    color: var(--guide-ink);
    line-height: 1.8;
}

.md-typeset a {
    color: var(--guide-accent);
    text-decoration-color: rgba(29, 106, 120, 0.3);
    transition: text-decoration-color 0.2s;
}

.md-typeset a:hover {
    text-decoration-color: var(--guide-accent);
}

.md-typeset ul,
.md-typeset ol {
    line-height: 1.7;
}

.md-typeset hr {
    border-bottom-color: rgba(22, 35, 59, 0.08);
    margin: 2rem 0;
}

.md-typeset blockquote {
    border-inline-start-color: var(--guide-primary);
    background: rgba(239, 109, 88, 0.04);
    border-radius: 0 12px 12px 0;
    padding: 0.8rem 1.2rem;
}

/* -- Code blocks ------------------------------------------ */
.md-typeset code {
    background: rgba(29, 106, 120, 0.06);
    border: 1px solid rgba(29, 106, 120, 0.1);
    border-radius: 6px;
    padding: 0.1em 0.35em;
    color: var(--guide-accent);
    font-size: 0.88em;
}

.md-typeset pre code {
    background: none;
    border: none;
    padding: 0;
    color: inherit;
    border-radius: 12px;
}

/* -- Left sidebar (navigation) ---------------------------- */
.md-sidebar__scrollwrap {
    margin: 0;
}

.md-sidebar--primary .md-sidebar__inner {
    padding-top: 0.85rem;
}

.md-sidebar--primary .md-nav {
    padding: 0.45rem;
    border: 1px solid rgba(22, 35, 59, 0.08);
    border-radius: 16px;
    background: var(--site-shell);
    backdrop-filter: blur(18px);
    box-shadow: 0 12px 28px rgba(22, 35, 59, 0.06);
}

.md-nav--primary > .md-nav__title {
    margin: 0 0 0.3rem;
    padding: 0.65rem 0.8rem;
    border-radius: 12px;
    background: rgba(29, 106, 120, 0.08);
    color: var(--guide-ink);
    box-shadow: none;
}

.md-nav__item {
    margin-top: 0.08rem;
}

.md-nav--primary > .md-nav__list > .md-nav__item:first-child {
    display: none;
}

.md-nav__link {
    margin-top: 0;
    padding: 0.48rem 0.78rem;
    border-radius: 10px;
    transition: background 0.2s ease, color 0.2s ease;
}

.md-nav__link:is(:hover, :focus-visible) {
    background: rgba(29, 106, 120, 0.08);
    color: var(--guide-ink);
}

.md-nav__link--active,
.md-nav__item .md-nav__link--active {
    background: rgba(29, 106, 120, 0.12);
    color: var(--guide-ink);
    font-weight: 700;
}

/* -- Right sidebar (TOC) ---------------------------------- */
.md-sidebar--secondary {
    display: block;
}

.md-sidebar--secondary .md-sidebar__inner {
    padding-top: 0.85rem;
}

.md-sidebar--secondary .md-nav {
    padding: 0.45rem;
    border: 1px solid rgba(22, 35, 59, 0.08);
    border-radius: 16px;
    background: var(--site-shell);
    backdrop-filter: blur(18px);
    box-shadow: 0 12px 28px rgba(22, 35, 59, 0.06);
    font-size: 0.76rem;
}

.md-sidebar--secondary .md-nav__title {
    margin: 0 0 0.25rem;
    padding: 0.62rem 0.74rem;
    border-radius: 12px;
    background: rgba(29, 106, 120, 0.08);
    color: var(--guide-ink);
}

.md-sidebar--secondary .md-nav__link {
    padding: 0.32rem 0.58rem;
    border-radius: 9px;
    line-height: 1.35;
}

.md-sidebar--secondary .md-nav__item .md-nav {
    display: none;
}

@media screen and (min-width: 76.25em) {
    .md-sidebar--secondary {
        width: 10.6rem;
    }
}

.md-nav__source {
    display: none;
}

/* -- Content card ----------------------------------------- */
.md-content article {
    border: 1px solid rgba(22, 35, 59, 0.08);
    border-radius: 28px;
    background: var(--site-shell-strong);
    box-shadow: 0 22px 50px rgba(22, 35, 59, 0.06);
    backdrop-filter: blur(18px);
    padding: 2rem 2.4rem;
}

/* -- Admonitions (tips, warnings, info) ------------------- */
.md-typeset .admonition,
.md-typeset details {
    border-radius: 16px;
    border: 1px solid rgba(22, 35, 59, 0.08);
    box-shadow: 0 4px 16px rgba(22, 35, 59, 0.04);
    overflow: hidden;
}

.md-typeset .admonition-title,
.md-typeset details summary {
    border-radius: 16px 16px 0 0;
    font-family: "Manrope", sans-serif;
    font-weight: 700;
}

.md-typeset .admonition-title,
.md-typeset details summary,
.md-typeset .admonition-title::before,
.md-typeset details summary::before,
.md-typeset .admonition p,
.md-typeset .admonition li,
.md-typeset details p,
.md-typeset details li {
    color: var(--guide-ink);
}

.md-typeset .admonition.tip,
.md-typeset details.tip {
    border-color: rgba(29, 106, 120, 0.2);
    background: rgba(216, 237, 240, 0.72);
}

.md-typeset .admonition.warning,
.md-typeset details.warning {
    border-color: rgba(239, 109, 88, 0.25);
    background: rgba(255, 237, 231, 0.78);
}

.md-typeset .admonition.info,
.md-typeset details.info {
    border-color: rgba(29, 106, 120, 0.15);
    background: rgba(235, 245, 247, 0.78);
}

.md-typeset .admonition.example,
.md-typeset details.example {
    border-color: rgba(107, 76, 154, 0.15);
    background: rgba(242, 237, 250, 0.82);
}

[data-md-color-scheme="slate"] .md-typeset .admonition.tip,
[data-md-color-scheme="slate"] .md-typeset details.tip {
    background: rgba(71, 115, 122, 0.3);
}

[data-md-color-scheme="slate"] .md-typeset .admonition.warning,
[data-md-color-scheme="slate"] .md-typeset details.warning {
    background: rgba(123, 77, 69, 0.3);
}

[data-md-color-scheme="slate"] .md-typeset .admonition.info,
[data-md-color-scheme="slate"] .md-typeset details.info {
    background: rgba(57, 91, 96, 0.3);
}

[data-md-color-scheme="slate"] .md-typeset .admonition.example,
[data-md-color-scheme="slate"] .md-typeset details.example {
    background: rgba(84, 71, 117, 0.34);
}

[data-md-color-scheme="slate"] .md-typeset .admonition-title,
[data-md-color-scheme="slate"] .md-typeset details summary,
[data-md-color-scheme="slate"] .md-typeset .admonition-title::before,
[data-md-color-scheme="slate"] .md-typeset details summary::before,
[data-md-color-scheme="slate"] .md-typeset .admonition p,
[data-md-color-scheme="slate"] .md-typeset .admonition li,
[data-md-color-scheme="slate"] .md-typeset details p,
[data-md-color-scheme="slate"] .md-typeset details li {
    color: #eef4ff;
}

/* -- Tables ----------------------------------------------- */
.md-typeset table:not([class]) {
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(22, 35, 59, 0.08);
    box-shadow: 0 2px 8px rgba(22, 35, 59, 0.04);
}

.md-typeset table:not([class]) th {
    background: rgba(29, 106, 120, 0.08);
    font-weight: 700;
    color: var(--guide-ink);
}

.md-typeset table:not([class]) td,
.md-typeset table:not([class]) th {
    padding: 0.7rem 1rem;
    border-color: rgba(22, 35, 59, 0.06);
}

/* -- Images inside guide ---------------------------------- */
.md-typeset img {
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(22, 35, 59, 0.08);
    border: 1px solid rgba(22, 35, 59, 0.06);
}

/* -- Numbered steps styling ------------------------------- */
.md-typeset ol > li::marker {
    color: var(--guide-accent);
    font-weight: 700;
}

/* -- Desktop layout --------------------------------------- */
@media screen and (min-width: 76.25em) {
    .md-sidebar--primary {
        width: 13.6rem;
    }

    .md-content {
        margin-inline: 0;
    }
}

/* -- Mobile ----------------------------------------------- */
@media screen and (max-width: 76.234375em) {
    .md-sidebar--primary,
    .md-sidebar--primary .md-sidebar__scrollwrap,
    .md-sidebar--primary .md-sidebar__inner {
        background: #fffaf5;
    }

    [data-md-color-scheme="slate"] .md-sidebar--primary,
    [data-md-color-scheme="slate"] .md-sidebar--primary .md-sidebar__scrollwrap,
    [data-md-color-scheme="slate"] .md-sidebar--primary .md-sidebar__inner {
        background: #1e2430;
    }

    .md-sidebar--primary .md-nav {
        margin: 0;
        padding: 0.35rem 0.2rem 0.8rem;
        border-radius: 0;
        box-shadow: none;
        border: 0;
        background: transparent;
        backdrop-filter: none;
    }

    .md-nav--primary > .md-nav__title {
        margin: 0 0 0.15rem;
        padding: 0.65rem 0.8rem 0.45rem;
        border-radius: 0;
        background: transparent;
    }

    .md-sidebar--primary .md-nav__link {
        border-radius: 8px;
    }

    .md-sidebar--primary .md-sidebar__scrollwrap,
    .md-sidebar--primary .md-sidebar__inner {
        width: 100%;
        height: 100%;
    }

    .md-sidebar--secondary {
        display: none;
    }

    .md-content article {
        padding: 1.2rem;
        border-radius: 24px;
    }
}

/* =========================================================
   Компоненти документації
   Додано разом з переробкою гайдів.
   ========================================================= */

/* -- Ліда (вступний абзац сторінки) ------------------------ */
.md-typeset .lede {
    font-size: 1.08rem;
    line-height: 1.75;
    color: var(--guide-muted);
    max-width: 62ch;
    margin: -0.4rem 0 1.6rem;
}

[data-md-color-scheme="slate"] .md-typeset .lede {
    color: #b6c0d2;
}

/* -- Сітка карток на головній ----------------------------- */
.md-typeset .cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
    gap: 1rem;
    margin: 1.6rem 0 2rem;
}

.md-typeset .card {
    display: flex;
    flex-direction: column;
    padding: 1.25rem 1.35rem 1.1rem;
    border: 1px solid var(--guide-line);
    border-radius: 18px;
    background: var(--guide-card);
    box-shadow: 0 6px 20px rgba(22, 35, 59, 0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.md-typeset .card:hover {
    transform: translateY(-3px);
    border-color: rgba(29, 106, 120, 0.28);
    box-shadow: 0 18px 36px rgba(22, 35, 59, 0.1);
}

.md-typeset .card h3 {
    margin: 0 0 0.5rem;
    font-size: 1.06rem;
    line-height: 1.35;
}

.md-typeset .card h3 .twemoji,
.md-typeset .card h3 svg {
    width: 1.15em;
    height: 1.15em;
    vertical-align: -0.2em;
    margin-inline-end: 0.35em;
    fill: var(--guide-accent);
}

.md-typeset .card p {
    margin: 0 0 0.9rem;
    font-size: 0.86rem;
    line-height: 1.62;
    color: var(--guide-muted);
}

[data-md-color-scheme="slate"] .md-typeset .card p {
    color: #b6c0d2;
}

.md-typeset .card-link {
    margin-top: auto;
    font-size: 0.84rem;
    font-weight: 700;
    text-decoration: none;
}

.md-typeset .card-link svg,
.md-typeset .btn-link svg {
    width: 1em;
    height: 1em;
    vertical-align: -0.14em;
    margin-inline-start: 0.3em;
    fill: currentcolor;
}

[data-md-color-scheme="slate"] .md-typeset .card {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.1);
}

/* -- Кнопка-посилання в кінці розділу --------------------- */
.md-typeset .btn-link {
    display: inline-block;
    margin-top: 0.4rem;
    padding: 0.55rem 1.1rem;
    border: 1px solid rgba(29, 106, 120, 0.28);
    border-radius: 999px;
    background: rgba(29, 106, 120, 0.07);
    font-size: 0.86rem;
    font-weight: 700;
    text-decoration: none;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.md-typeset .btn-link:hover {
    background: rgba(29, 106, 120, 0.14);
    border-color: var(--guide-accent);
}

/* -- Дві колонки ------------------------------------------ */
.md-typeset .split {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
    gap: 0.9rem;
    margin: 1.3rem 0 1.8rem;
}

.md-typeset .split-item {
    padding: 1.05rem 1.2rem;
    border: 1px solid var(--guide-line);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.55);
}

[data-md-color-scheme="slate"] .md-typeset .split-item {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.1);
}

.md-typeset .split-item h4 {
    margin: 0 0 0.4rem;
    font-size: 0.98rem;
}

.md-typeset .split-item p {
    margin: 0;
    font-size: 0.86rem;
    line-height: 1.6;
    color: var(--guide-muted);
}

[data-md-color-scheme="slate"] .md-typeset .split-item p {
    color: #b6c0d2;
}

/* -- Блок покрокових інструкцій --------------------------- */
.md-typeset .steps {
    position: relative;
    margin: 1.3rem 0 1.8rem;
    padding: 1.2rem 1.4rem 1.2rem 1.5rem;
    border: 1px solid var(--guide-line);
    border-inline-start: 3px solid var(--guide-accent);
    border-radius: 4px 16px 16px 4px;
    background: rgba(216, 237, 240, 0.28);
}

[data-md-color-scheme="slate"] .md-typeset .steps {
    background: rgba(57, 91, 96, 0.24);
    border-color: rgba(255, 255, 255, 0.1);
    border-inline-start-color: var(--guide-accent);
}

.md-typeset .steps > p {
    margin: 0 0 0.85rem;
    line-height: 1.7;
}

.md-typeset .steps > p:last-child {
    margin-bottom: 0;
}

.md-typeset .steps strong:first-child {
    color: var(--guide-accent);
}

[data-md-color-scheme="slate"] .md-typeset .steps strong:first-child {
    color: #7fd3e0;
}

/* -- Місце під скріншот ----------------------------------- */
.md-typeset .shot {
    margin: 1.4rem 0;
    padding: 1.1rem 1.3rem;
    border: 2px dashed rgba(239, 109, 88, 0.4);
    border-radius: 16px;
    background: rgba(239, 109, 88, 0.05);
}

.md-typeset .shot::before {
    content: "🖼 Місце під скріншот";
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--guide-primary-strong);
}

.md-typeset .shot p {
    margin: 0 0 0.3rem;
    font-size: 0.87rem;
    line-height: 1.6;
}

.md-typeset .shot p:last-child {
    margin-bottom: 0;
}

[data-md-color-scheme="slate"] .md-typeset .shot {
    background: rgba(123, 77, 69, 0.22);
    border-color: rgba(239, 109, 88, 0.45);
}

[data-md-color-scheme="slate"] .md-typeset .shot::before {
    color: #ffab97;
}

/* -- Чеклісти --------------------------------------------- */
.md-typeset .task-list-item {
    margin-bottom: 0.35rem;
}

.md-typeset .task-list-control .task-list-indicator::before {
    background-color: rgba(29, 106, 120, 0.2);
}

.md-typeset .task-list-control [type="checkbox"]:checked + .task-list-indicator::before {
    background-color: var(--guide-accent);
}

/* -- Згорнуті питання (??? question) ---------------------- */
.md-typeset details.question {
    border-color: rgba(29, 106, 120, 0.2);
    background: rgba(235, 245, 247, 0.62);
}

[data-md-color-scheme="slate"] .md-typeset details.question {
    background: rgba(57, 91, 96, 0.3);
}

.md-typeset details.question summary {
    font-size: 0.94rem;
}

/* -- Мобільні уточнення ----------------------------------- */
@media screen and (max-width: 44.98em) {
    .md-typeset .cards {
        grid-template-columns: 1fr;
    }

    .md-typeset .steps {
        padding: 1rem 1rem 1rem 1.1rem;
    }

    .md-typeset .shot {
        padding: 0.9rem 1rem;
    }
}

/* -- Мобільні скріншоти (Mini App) -------------------------- */
.md-typeset img.phone {
    display: block;
    width: min(100%, 300px);
    height: auto;
    margin: 1.2rem auto;
    border-radius: 28px;
    border: 1px solid var(--guide-line);
    box-shadow: 0 18px 40px rgba(22, 35, 59, 0.14);
    background: #fff;
}

.md-typeset .phones {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.2rem;
    margin: 1.2rem 0;
}

.md-typeset .phones img.phone {
    width: min(100%, 250px);
    margin: 0;
}

.md-typeset .phones figure,
.md-typeset figure.phone-fig {
    margin: 0;
    text-align: center;
}

.md-typeset .phones figcaption,
.md-typeset figure.phone-fig figcaption {
    margin-top: 0.5rem;
    font-size: 0.78rem;
    color: var(--guide-muted);
}

/* текст зліва, скріншот справа; на вузьких екранах - друком один під одним */
.md-typeset .with-shot {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 1.6rem;
    align-items: start;
    margin: 1.2rem 0;
}

.md-typeset .with-shot img.phone {
    margin: 0;
    width: 100%;
}

@media (max-width: 760px) {
    .md-typeset .with-shot {
        grid-template-columns: minmax(0, 1fr);
    }

    .md-typeset .with-shot img.phone {
        width: min(100%, 280px);
        margin: 0 auto;
    }
}

[data-md-color-scheme="slate"] .md-typeset img.phone {
    border-color: rgba(255, 255, 255, 0.14);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5);
}

/* "Перевірено": дата актуальності зовнішніх інструкцій */
.md-typeset .verified {
    display: inline-block;
    margin: 0 0 1rem;
    padding: 0.2rem 0.7rem;
    border-radius: 999px;
    background: var(--guide-accent-soft);
    color: var(--guide-accent);
    font-size: 0.78rem;
    font-weight: 600;
}

/* -- Таблиці на телефоні: без переносів посеред слова -------- */
.md-typeset table:not([class]) td,
.md-typeset table:not([class]) th {
    word-break: normal;
    overflow-wrap: normal;
    hyphens: none;
}

.md-typeset table:not([class]) code {
    white-space: normal;
    word-break: normal;
    overflow-wrap: break-word;
    hyphens: none;
}

@media screen and (max-width: 600px) {
    .md-typeset table:not([class]) td,
    .md-typeset table:not([class]) th {
        /* html у Material = 125%, тож 1rem = 20px: розміри тут підібрані під це */
        padding: 0.4rem 0.4rem;
        font-size: 0.7rem;
    }

    .md-typeset table:not([class]) code {
        font-size: 0.85em;
        padding: 0 0.2em;
    }
}

@media screen and (max-width: 600px) {
    .md-typeset table:not([class]) th,
    .md-typeset table:not([class]) td {
        min-width: 0;
    }
}
