/**
 * Alami Theme - Terms Page
 */

.alami-terms {
    background-color: var(--background);
}

/* ── Intro ── */
.alami-terms-intro {
    padding: 2rem 0 3rem;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(180deg, var(--card) 0%, var(--background) 100%);
}

.alami-terms-intro-main {
    max-width: 40rem;
}

.alami-terms-kicker {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding: 0.375rem 0.875rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    border: 1px solid var(--border);
    background-color: var(--secondary);
    color: var(--primary);
}

.alami-terms-title {
    margin: 0 0 0.875rem;
    font-size: clamp(1.875rem, 4vw, 2.625rem);
    font-weight: 700;
    line-height: 1.25;
    color: var(--foreground);
}

.alami-terms-lead {
    margin: 0;
    max-width: 38rem;
    font-size: 1.0625rem;
    line-height: 1.9;
    color: var(--muted-foreground);
}

/* ── Layout ── */
.alami-terms-main {
    padding: 4.5rem 0 6rem;
}

.alami-terms-layout {
    display: grid;
    gap: 2rem;
    align-items: start;
}

@media (min-width: 1024px) {
    .alami-terms-layout {
        grid-template-columns: minmax(0, 15rem) minmax(0, 1fr);
        gap: 2.5rem;
    }
}

.alami-terms-toc-wrap {
    padding: 1.25rem;
    border-radius: 1.25rem;
    border: 1px solid var(--border);
    background-color: var(--card);
}

@media (max-width: 1023px) {
    .alami-terms-main {
        padding-top: 0;
    }

    .alami-terms-toc-wrap {
        position: sticky;
        top: 5rem;
        z-index: 30;
        margin-inline: calc(-1 * var(--alami-page-gutter));
        padding: 0.75rem var(--alami-page-gutter);
        width: auto;
        border: none;
        border-radius: 0;
        border-bottom: 1px solid var(--border);
        background-color: #fff;
        box-shadow: 0 1px 0 rgba(47, 58, 52, 0.04);
    }

    .alami-terms-toc-wrap .terms-toc-title {
        display: none;
    }

    .alami-terms-toc-wrap .terms-toc-list {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.5rem;
        flex-wrap: unset;
    }

    .alami-terms-toc-wrap .terms-toc-list > li {
        min-width: 0;
    }

    .alami-terms-toc-wrap .terms-toc-link {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100%;
        min-height: 2.625rem;
        padding: 0.5rem 0.625rem;
        border-radius: 0.75rem;
        border: 1px solid var(--border);
        background: var(--card);
        text-align: center;
        font-size: 0.8125rem;
        line-height: 1.35;
    }

    .alami-terms-toc-wrap .terms-toc-link.active {
        background: var(--accent);
        border-color: var(--accent);
        color: var(--accent-foreground);
    }

    .alami-terms-sections .terms-section {
        scroll-margin-top: 12.5rem;
    }
}

@media (min-width: 1024px) {
    .alami-terms-toc-wrap {
        position: sticky;
        top: 9.25rem;
    }
}

.alami-terms-toc-wrap .terms-toc-title {
    margin: 0 0 0.875rem;
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--foreground);
}

.alami-terms-toc-wrap .terms-toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

@media (min-width: 1024px) {
    .alami-terms-toc-wrap .terms-toc-list {
        flex-direction: column;
        flex-wrap: nowrap;
        gap: 0.375rem;
    }
}

.alami-terms-toc-wrap .terms-toc-link {
    display: block;
    padding: 0.5rem 0.875rem;
    border-radius: 0.75rem;
    border: 1px solid transparent;
    background: transparent;
    color: var(--muted-foreground);
    text-decoration: none;
    font-size: 0.8125rem;
    font-weight: 600;
    transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}

@media (min-width: 1024px) {
    .alami-terms-toc-wrap .terms-toc-link {
        font-size: 0.875rem;
    }
}

.alami-terms-toc-wrap .terms-toc-link:hover,
.alami-terms-toc-wrap .terms-toc-link.active {
    background: var(--secondary);
    border-color: var(--border);
    color: var(--primary);
}

@media (min-width: 1024px) {
    .alami-terms-toc-wrap .terms-toc-link.active {
        background: color-mix(in srgb, var(--accent) 12%, var(--secondary));
        border-color: color-mix(in srgb, var(--accent) 30%, var(--border));
        color: var(--accent);
    }
}

/* ── Sections ── */
.alami-terms-body {
    padding: clamp(1.5rem, 4vw, 2.25rem);
    border-radius: 1.5rem;
    border: 1px solid var(--border);
    background-color: var(--card);
}

.alami-terms-sections .terms-sections {
    display: flex;
    flex-direction: column;
    gap: 3rem;
}

.alami-terms-sections .terms-section {
    scroll-margin-top: 9.25rem;
}

.alami-terms-sections .terms-section:not(:last-child) {
    padding-bottom: 3rem;
    border-bottom: 1px solid var(--border);
}

.alami-terms-sections .terms-section-title {
    margin: 0 0 1.25rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--foreground);
}

.alami-terms-sections .terms-section-content {
    border: none !important;
    padding: 0 !important;
    min-height: auto !important;
    color: color-mix(in srgb, var(--foreground) 90%, transparent);
    line-height: 1.95;
    direction: rtl;
    text-align: right;
}

/* Quill snow defaults to LTR; force RTL for Persian content on the storefront */
.alami-terms-sections .terms-section-content.ql-editor {
    text-align: right;
}

.alami-terms-sections .terms-section-content.ql-editor ol,
.alami-terms-sections .terms-section-content.ql-editor ul {
    padding-right: 1.5em;
    padding-left: 0;
}

.alami-terms-sections .terms-section-content.ql-editor ol li:not(.ql-direction-rtl),
.alami-terms-sections .terms-section-content.ql-editor ul li:not(.ql-direction-rtl) {
    padding-right: 1.5em;
    padding-left: 0;
}

.alami-terms-sections .terms-section-content.ql-editor li:not(.ql-direction-rtl)::before {
    margin-right: -1.5em;
    margin-left: 0.3em;
}

.alami-terms-sections .terms-section-content h2,
.alami-terms-sections .terms-section-content h3 {
    color: var(--foreground);
    font-weight: 700;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}

.alami-terms-sections .terms-section-content p {
    margin-bottom: 1rem;
}

.alami-terms-sections .terms-section-content p:last-child {
    margin-bottom: 0;
}

.alami-terms-sections .terms-section-empty {
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 16rem;
    padding: 4rem 2.5rem;
    text-align: center;
    font-size: 1.125rem;
    line-height: 1.85;
    color: var(--muted-foreground);
}

.alami-terms-layout--no-toc {
    grid-template-columns: minmax(0, 1fr);
}

.alami-terms-layout--no-toc .alami-terms-body {
    max-width: 48rem;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
}
