/*
 * User guide page. Layers on top of beginning_page.css, which owns the shared
 * portal shell (palette tokens, header, footer, buttons).
 */

/* ------------------------------------------------------------ page header */

.aj-page-head {
    background: linear-gradient(165deg, #F8F1E4 0%, #F1E6D1 100%);
    border-bottom: 1px solid var(--aj-border);
}

.aj-page-head__inner {
    padding-block: 56px;
    display: flex;
    align-items: flex-start;
    gap: 22px;
}

.aj-page-head__badge {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 999px;
    background: var(--aj-gold);
    color: #fff;
}

.aj-page-head h1 {
    margin: 0 0 8px;
    font-size: 40px;
    line-height: 1.25;
    font-weight: 700;
    color: var(--aj-gold-deep);
}

.aj-page-head p {
    margin: 0;
    max-width: 780px;
    font-size: 17px;
    line-height: 1.75;
    color: var(--aj-text-soft);
    text-wrap: pretty;
}

/* ---------------------------------------------------------------- layout */

.aj-guide {
    padding-block: 48px 72px;
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 48px;
    align-items: start;
}

/* ------------------------------------------------------------------- toc */

.aj-toc {
    position: sticky;
    top: 24px;
    background: var(--aj-surface);
    border: 1px solid var(--aj-border-soft);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 2px 10px rgba(126, 98, 49, .05);
}

.aj-toc__title {
    margin: 0 0 14px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--aj-muted);
}

.aj-toc ol {
    margin: 0;
    padding: 0;
    list-style: none;
    counter-reset: toc;
}

.aj-toc li {
    counter-increment: toc;
}

.aj-toc a {
    display: flex;
    gap: 10px;
    padding: 9px 0;
    font-size: 14.5px;
    line-height: 1.5;
    color: var(--aj-text-soft);
    border-bottom: 1px solid #F4EEE2;
}

.aj-toc li:last-child a {
    border-bottom: 0;
}

.aj-toc a::before {
    content: counter(toc);
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 999px;
    background: #F1E7D4;
    color: var(--aj-gold-icon);
    font-size: 12px;
    font-weight: 700;
}

.aj-toc a:hover {
    color: var(--aj-link);
}

/* -------------------------------------------------------------- sections */

.aj-guide__section {
    scroll-margin-top: 24px;
}

.aj-guide__section + .aj-guide__section {
    margin-top: 56px;
    padding-top: 56px;
    border-top: 1px solid var(--aj-border-soft);
}

.aj-guide__section > h2 {
    margin: 0 0 14px;
    font-size: 26px;
    font-weight: 700;
    color: var(--aj-gold-deep);
    display: flex;
    align-items: center;
    gap: 12px;
}

.aj-guide__num {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: var(--aj-gold);
    color: #fff;
    font-size: 16px;
}

.aj-guide__intro {
    margin: 0 0 28px;
    font-size: 16.5px;
    line-height: 1.8;
    color: var(--aj-text-soft);
    text-wrap: pretty;
}

/* ------------------------------------------------------------ tip blocks */

.aj-tip {
    background: var(--aj-surface);
    border: 1px solid var(--aj-border-soft);
    border-radius: 14px;
    padding: 22px 24px;
    margin-bottom: 16px;
    box-shadow: 0 1px 6px rgba(126, 98, 49, .04);
}

.aj-tip__head {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 10px;
}

.aj-tip__num {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 26px;
    height: 26px;
    border-radius: 999px;
    background: #F1E7D4;
    color: var(--aj-gold-icon);
    font-size: 13px;
    font-weight: 700;
}

.aj-tip__head h3 {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
    color: var(--aj-text);
    line-height: 1.5;
}

.aj-tip p {
    margin: 0;
    font-size: 15px;
    line-height: 1.85;
    color: var(--aj-text-soft);
    text-wrap: pretty;
}

.aj-tip p + p,
.aj-tip p + .aj-swap,
.aj-tip p + .aj-examples {
    margin-top: 16px;
}

/* ----------------------------------------------------------------- swaps */

/*
 * "Write this, not that" pairs. Replaces a two-column table: the arrow makes
 * the direction of the advice explicit, which a table header cannot.
 */
.aj-swap {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.aj-swap__row {
    display: grid;
    grid-template-columns: minmax(0, 0.85fr) auto minmax(0, 1.15fr);
    align-items: center;
    gap: 16px;
    padding: 13px 18px;
    background: #FAF7F0;
    border: 1px solid var(--aj-border-soft);
    border-radius: 12px;
}

.aj-swap__from {
    font-size: 14.5px;
    line-height: 1.6;
    color: var(--aj-muted);
    text-decoration: line-through;
    text-decoration-color: #D8BDBD;
    text-decoration-thickness: 1.5px;
}

.aj-swap__arrow {
    flex: 0 0 auto;
    display: flex;
    color: var(--aj-gold-icon);
}

[dir="rtl"] .aj-swap__arrow {
    transform: scaleX(-1);
}

.aj-swap__to {
    font-size: 15px;
    line-height: 1.65;
    font-weight: 500;
    color: var(--aj-text);
}


/* --------------------------------------------------------- example lines */

.aj-examples {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.aj-example {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 14.5px;
    line-height: 1.7;
    padding: 9px 13px;
    border-radius: 9px;
    background: #FAF7F0;
    border-inline-start: 3px solid #E0D0AE;
    color: var(--aj-text-soft);
}

.aj-example--do {
    border-inline-start-color: #8FA96B;
}

.aj-example--dont {
    border-inline-start-color: #C89191;
    color: var(--aj-muted);
}

.aj-example__mark {
    flex: 0 0 auto;
    font-weight: 700;
}

.aj-example--do .aj-example__mark {
    color: #5E7A3C;
}

.aj-example--dont .aj-example__mark {
    color: #A85E5E;
}

/* -------------------------------------------------------------- callouts */

.aj-callout {
    display: flex;
    gap: 14px;
    padding: 18px 20px;
    border-radius: 12px;
    margin-top: 20px;
    font-size: 15px;
    line-height: 1.8;
}

.aj-callout p {
    margin: 0;
    text-wrap: pretty;
}

.aj-callout__icon {
    flex: 0 0 auto;
    line-height: 1.6;
}

.aj-callout--warn {
    background: #FBF3E4;
    border: 1px solid #E8D5A8;
    color: #6B5320;
}

.aj-callout--info {
    background: #F3F5F0;
    border: 1px solid #DCE3D2;
    color: #4C5742;
}


/* ------------------------------------------------------------------- faq */

.aj-faq {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.aj-faq details {
    background: var(--aj-surface);
    border: 1px solid var(--aj-border-soft);
    border-radius: 12px;
    overflow: hidden;
}

.aj-faq details[open] {
    border-color: #D8C49C;
}

.aj-faq summary {
    padding: 16px 20px;
    font-size: 15.5px;
    font-weight: 600;
    color: var(--aj-text);
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 12px;
}

.aj-faq summary::-webkit-details-marker {
    display: none;
}

.aj-faq summary::after {
    content: "";
    flex: 0 0 auto;
    margin-inline-start: auto;
    width: 9px;
    height: 9px;
    border-inline-end: 2px solid var(--aj-gold-icon);
    border-block-end: 2px solid var(--aj-gold-icon);
    transform: rotate(45deg);
    transition: transform .18s;
}

.aj-faq details[open] summary::after {
    transform: rotate(-135deg);
}

.aj-faq summary:hover {
    color: var(--aj-link);
}

.aj-faq__body {
    padding: 0 20px 18px;
    font-size: 15px;
    line-height: 1.85;
    color: var(--aj-text-soft);
}

.aj-faq__body p {
    margin: 0;
    text-wrap: pretty;
}

/* ------------------------------------------------------------ responsive */

@media (max-width: 991.98px) {
    .aj-guide {
        grid-template-columns: 1fr;
        gap: 28px;
        padding-block: 32px 56px;
    }

    .aj-toc {
        position: static;
    }

    .aj-page-head__inner {
        padding-block: 36px;
        gap: 16px;
    }

    .aj-page-head h1 {
        font-size: 30px;
    }

    .aj-guide__section > h2 {
        font-size: 22px;
    }

    .aj-guide__section + .aj-guide__section {
        margin-top: 40px;
        padding-top: 40px;
    }
}

@media (max-width: 575.98px) {
    .aj-tip {
        padding: 18px 16px;
    }

    /* Stack the swap pairs and turn the arrow to point downwards. */
    .aj-swap__row {
        grid-template-columns: 1fr;
        justify-items: start;
        gap: 9px;
        padding: 14px 16px;
    }

    /*
     * Pointing straight down, so the RTL mirror is irrelevant here and must be
     * cancelled — combining it with a rotation flips the arrow upwards.
     */
    .aj-swap__arrow,
    [dir="rtl"] .aj-swap__arrow {
        transform: rotate(90deg);
    }

    .aj-page-head__badge {
        display: none;
    }
}

/* Arabic needs more leading at these sizes. */
[dir="rtl"] .aj-tip p,
[dir="rtl"] .aj-guide__intro,
[dir="rtl"] .aj-faq__body {
    line-height: 2;
}

[dir="rtl"] .aj-swap__to {
    line-height: 1.85;
}
