/* ==========================================================
   CDS Journey — Public Terms & Conditions
   Namespace: .rd-terms-*
   Route: /terms-conditions/ (account:terms_conditions)
   Mobile-first · Editorial legal document
   ========================================================== */

/* ---- 1. Page shell ---- */

.rd-terms-page {
    background: var(--rd-surface-canvas, #FFFFFF);
    color: var(--rd-text-primary, #212529);
    font-family: var(--rd-font-body, "Inter", Arial, sans-serif);
}

@media (prefers-reduced-motion: no-preference) {
    html:has(.rd-terms-page) {
        scroll-behavior: smooth;
    }
}

.rd-terms-page a:link,
.rd-terms-page a:visited {
    color: inherit;
}

.rd-terms-page a:hover {
    color: inherit;
}

/* ---- 2. Hero ---- */

.rd-terms-intro {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    min-height: 0;
    padding-block: 24px 20px;
    background: linear-gradient(180deg, #F4F6F8 0%, #EEF1F4 70%, #FFFFFF 100%);
}

.rd-terms-intro__bg {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background-color: #EEF1F4;
    background-image: url("../../images/banner-bg.png");
    background-repeat: no-repeat;
    background-position: right center;
    background-size: cover;
    opacity: 0.58;
}

.rd-terms-intro__bg::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.96) 0%,
        rgba(255, 255, 255, 0.88) 34%,
        rgba(255, 255, 255, 0.45) 58%,
        rgba(255, 255, 255, 0.12) 78%,
        transparent 100%
    );
}

.rd-terms-intro__layout {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.rd-terms-intro__copy {
    max-width: 34rem;
}

.rd-terms-breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 0 0 14px;
    font-size: 13px;
    color: var(--rd-text-secondary, #6C757D);
}

.rd-terms-breadcrumb a {
    color: var(--rd-text-secondary, #6C757D);
    text-decoration: none;
}

.rd-terms-breadcrumb a:hover {
    color: var(--rd-color-navy, #1A2B4C);
}

.rd-terms-breadcrumb a:focus-visible {
    outline: 2px solid var(--rd-color-navy, #1A2B4C);
    outline-offset: 2px;
    border-radius: 2px;
}

.rd-terms-breadcrumb__sep {
    color: var(--rd-border-subtle, #DDE2E6);
}

.rd-terms-intro__eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 12px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--rd-color-gold, #D4AF37);
}

.rd-terms-intro__eyebrow::before {
    content: "";
    display: block;
    width: 28px;
    height: 2px;
    background: var(--rd-color-gold, #D4AF37);
}

.rd-terms-intro__title {
    margin: 0;
    font-family: var(--rd-font-display, "Fraunces", Georgia, serif);
    font-size: clamp(32px, 6.5vw, 48px);
    font-weight: 600;
    line-height: 1.12;
    letter-spacing: -0.02em;
    color: var(--rd-color-navy, #1A2B4C);
}

.rd-terms-intro__lead {
    margin: 12px 0 0;
    max-width: 34rem;
    font-size: 15px;
    line-height: 1.6;
    color: var(--rd-text-secondary, #6C757D);
}

.rd-terms-intro__meta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 14px 0 0;
    font-size: 13px;
    color: var(--rd-text-secondary, #6C757D);
}

.rd-terms-intro__meta-icon {
    display: inline-flex;
    color: var(--rd-color-olive, #4B5320);
}

.rd-terms-intro__motto {
    display: none;
}

.rd-terms-intro__pillars {
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.16em;
    line-height: 1.55;
    text-transform: uppercase;
    color: var(--rd-color-navy, #1A2B4C);
}

.rd-terms-intro__tagline {
    margin: 8px 0 0;
    font-size: 12px;
    color: var(--rd-text-secondary, #6C757D);
}

/* ---- 3. Legal layout ---- */
/* Mobile/tablet: TOC → document → help → quote */

.rd-terms-body {
    position: relative;
    padding-block: 28px 48px;
    background: var(--rd-color-white, #FFFFFF);
}

.rd-terms-page .rd-terms-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
        "toc"
        "doc"
        "help"
        "quote";
    gap: 24px;
    align-items: start;
}

.rd-terms-page .rd-terms-rail {
    display: contents;
}

.rd-terms-page .rd-terms-rail__sticky {
    display: contents;
}

.rd-terms-page .rd-terms-toc {
    grid-area: toc;
    width: 100%;
    max-width: none;
}

.rd-terms-page .rd-terms-doc {
    grid-area: doc;
    width: 100%;
    max-width: none;
    min-width: 0;
}

.rd-terms-page .rd-terms-help {
    grid-area: help;
    width: 100%;
    max-width: none;
}

.rd-terms-page .rd-terms-quote {
    grid-area: quote;
    width: 100%;
    max-width: none;
}

.rd-terms-card {
    padding: 18px 16px;
    background: var(--rd-color-white, #FFFFFF);
    border: 1px solid var(--rd-border-subtle, #DDE2E6);
    border-radius: 12px;
}

/* ---- 4. Section structure ---- */

.rd-terms-section {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    column-gap: 14px;
    row-gap: 0;
    align-items: start;
    padding-block: 32px;
    border-bottom: 1px solid var(--rd-border-subtle, #DDE2E6);
    scroll-margin-top: 120px;
}

.rd-terms-section:first-child {
    padding-top: 8px;
}

.rd-terms-section:last-child {
    border-bottom: none;
}

.rd-terms-section__meta {
    grid-column: 1;
    grid-row: 1;
    flex-shrink: 0;
    width: 48px;
}

.rd-terms-section__content {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
}

.rd-terms-section__num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--rd-surface-default, #F8F9FB);
    border: 1px solid var(--rd-border-subtle, #DDE2E6);
    font-family: var(--rd-font-mono, "IBM Plex Mono", monospace);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--rd-text-secondary, #6C757D);
}

.rd-terms-section__title {
    position: relative;
    margin: 0 0 14px;
    padding-top: 12px;
    font-family: var(--rd-font-display, "Fraunces", Georgia, serif);
    font-size: clamp(22px, 4vw, 28px);
    font-weight: 600;
    line-height: 1.25;
    color: var(--rd-color-navy, #1A2B4C);
}

.rd-terms-section__title::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    width: 28px;
    height: 2px;
    background: var(--rd-color-gold, #D4AF37);
}

.rd-terms-section__content p {
    margin: 0 0 14px;
    font-size: 16px;
    line-height: 1.7;
    color: var(--rd-color-navy, #1A2B4C);
    text-align: left;
}

.rd-terms-section__content p:last-child {
    margin-bottom: 0;
}

.rd-terms-section__content ul {
    margin: 0 0 14px;
    padding-left: 1.15rem;
    list-style: none;
}

.rd-terms-section__content ul li {
    position: relative;
    margin-bottom: 10px;
    padding-left: 0.35rem;
    font-size: 16px;
    line-height: 1.6;
    color: var(--rd-color-navy, #1A2B4C);
}

.rd-terms-section__content ul li::before {
    content: "";
    position: absolute;
    left: -1rem;
    top: 0.55em;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--rd-color-gold, #D4AF37);
}

.rd-terms-section__content ul li:last-child {
    margin-bottom: 0;
}

.rd-terms-section--contact {
    margin-top: 8px;
    padding: 24px 18px;
    background: var(--rd-surface-default, #F8F9FB);
    border: 1px solid var(--rd-border-subtle, #E8ECF0);
    border-radius: 12px;
}

.rd-terms-contact-list {
    list-style: none;
    margin: 8px 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.rd-terms-contact-list li {
    margin: 0;
    padding: 0;
}

.rd-terms-section__content .rd-terms-contact-list li::before {
    display: none;
}

.rd-terms-link {
    color: var(--rd-color-navy, #1A2B4C);
    font-weight: 500;
    text-decoration: underline;
    text-underline-offset: 2px;
    word-break: break-word;
}

.rd-terms-link:link,
.rd-terms-link:visited {
    color: var(--rd-color-navy, #1A2B4C);
}

.rd-terms-link:hover {
    color: var(--rd-color-olive, #4B5320);
}

.rd-terms-link:focus {
    outline: none;
}

.rd-terms-link:focus-visible {
    outline: 2px solid var(--rd-color-navy, #1A2B4C);
    outline-offset: 3px;
    border-radius: 2px;
}

.rd-terms-section.is-active .rd-terms-section__num,
.rd-terms-section:target .rd-terms-section__num {
    border-color: var(--rd-color-gold, #D4AF37);
    color: var(--rd-color-navy, #1A2B4C);
}

/* ---- 5. Contents navigation ---- */

.rd-terms-toc {
    background: var(--rd-surface-default, #F8F9FB);
    border: 1px solid var(--rd-border-subtle, #E8ECF0);
    padding: 18px 14px 16px;
}

.rd-terms-toc__title {
    position: relative;
    margin: 0 0 12px;
    padding: 10px 4px 0;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    line-height: 1.3;
    color: var(--rd-color-navy, #1A2B4C);
}

.rd-terms-toc__title::before {
    content: "";
    position: absolute;
    left: 4px;
    top: 0;
    width: 28px;
    height: 2px;
    background: var(--rd-color-gold, #D4AF37);
}

.rd-terms-toc__list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.rd-terms-toc__list li + li {
    margin-top: 4px;
}

.rd-terms-toc__list a {
    display: grid;
    grid-template-columns: 1.6rem minmax(0, 1fr);
    align-items: start;
    column-gap: 8px;
    padding: 8px 10px;
    border-left: 2px solid transparent;
    border-radius: 0 6px 6px 0;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.35;
    color: var(--rd-text-secondary, #6C757D);
    text-decoration: none;
}

.rd-terms-toc__num {
    font-family: var(--rd-font-mono, "IBM Plex Mono", monospace);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
    line-height: 1.45;
    color: #ADB5BD;
}

.rd-terms-toc__label {
    min-width: 0;
}

.rd-terms-toc__list a:hover {
    color: var(--rd-color-navy, #1A2B4C);
    background: rgba(255, 255, 255, 0.7);
    border-left-color: rgba(212, 175, 55, 0.55);
}

.rd-terms-toc__list a:focus {
    outline: none;
}

.rd-terms-toc__list a:focus-visible {
    outline: 2px solid var(--rd-color-navy, #1A2B4C);
    outline-offset: 2px;
}

.rd-terms-toc__list a.is-active,
.rd-terms-toc__list a[aria-current="location"] {
    color: var(--rd-color-navy, #1A2B4C);
    font-weight: 600;
    background: rgba(255, 255, 255, 0.9);
    border-left-color: var(--rd-color-olive, #4B5320);
}

.rd-terms-toc__list a.is-active .rd-terms-toc__num,
.rd-terms-toc__list a[aria-current="location"] .rd-terms-toc__num {
    color: var(--rd-color-olive, #4B5320);
}

/* ---- 6. Support / quote ---- */

.rd-terms-help {
    background: #F5F1E8;
    border-color: rgba(75, 83, 32, 0.12);
}

.rd-terms-help__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    margin-bottom: 10px;
    border-radius: 50%;
    background: rgba(212, 175, 55, 0.18);
    color: var(--rd-color-olive, #4B5320);
}

.rd-terms-help__title {
    position: relative;
    margin: 0 0 8px;
    padding-top: 10px;
    font-family: var(--rd-font-body, "Inter", Arial, sans-serif);
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--rd-color-navy, #1A2B4C);
}

.rd-terms-help__title::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    width: 28px;
    height: 2px;
    background: var(--rd-color-gold, #D4AF37);
}

.rd-terms-help__text {
    margin: 0 0 14px;
    font-size: 13px;
    line-height: 1.45;
    color: var(--rd-text-secondary, #6C757D);
}

.rd-terms-help__cta {
    width: 100%;
    min-height: 44px;
    border-radius: 10px;
}

.rd-terms-quote {
    position: relative;
    background: var(--rd-surface-default, #F8F9FB);
    border: none;
    margin: 0;
}

.rd-terms-quote__mark {
    display: block;
    margin-bottom: 2px;
    font-family: var(--rd-font-display, "Fraunces", Georgia, serif);
    font-size: 40px;
    line-height: 0.8;
    color: rgba(26, 43, 76, 0.18);
}

.rd-terms-quote__text {
    margin: 0 0 10px;
    font-family: var(--rd-font-display, "Fraunces", Georgia, serif);
    font-size: 16px;
    font-style: italic;
    font-weight: 500;
    line-height: 1.4;
    color: var(--rd-color-navy, #1A2B4C);
}

.rd-terms-quote__attr {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--rd-text-secondary, #6C757D);
}

/* ---- 7. Responsive ---- */

@media (min-width: 768px) {
    .rd-terms-intro {
        min-height: 240px;
        padding-block: 32px 28px;
    }

    .rd-terms-intro__bg {
        opacity: 0.68;
        background-position: 70% center;
    }

    .rd-terms-intro__layout {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        gap: 40px;
        min-height: 180px;
    }

    .rd-terms-intro__lead {
        font-size: 16px;
    }

    .rd-terms-intro__motto {
        display: block;
        padding-top: 0;
        text-align: right;
        align-self: center;
        flex-shrink: 0;
        max-width: 11rem;
    }

    .rd-terms-intro__pillars {
        text-align: right;
    }

    .rd-terms-body {
        padding-block: 36px 64px;
    }

    .rd-terms-page .rd-terms-layout {
        gap: 28px;
    }

    .rd-terms-section {
        column-gap: 20px;
        padding-block: 36px;
    }

    .rd-terms-section__meta {
        width: 56px;
    }

    .rd-terms-section__num {
        width: 56px;
        height: 56px;
        font-size: 14px;
    }

    .rd-terms-section--contact {
        padding: 28px 24px;
    }

    .rd-terms-toc__list {
        max-height: none;
        overflow: visible;
    }
}

@media (min-width: 1024px) {
    .rd-terms-intro {
        min-height: 260px;
        padding-block: 36px 28px;
    }

    .rd-terms-body {
        padding-block: 40px 72px;
    }

    .rd-terms-page .rd-terms-layout {
        grid-template-columns: minmax(0, 1fr) 280px;
        grid-template-areas: "doc rail";
        column-gap: 48px;
        row-gap: 16px;
        align-items: start;
    }

    .rd-terms-page .rd-terms-doc {
        max-width: 760px;
    }

    .rd-terms-page .rd-terms-rail {
        display: flex;
        flex-direction: column;
        gap: 16px;
        grid-area: rail;
        /* Stretch with the doc so sticky stays active for the full page. */
        align-self: stretch;
        width: 280px;
        max-width: 280px;
        position: static;
    }

    .rd-terms-page .rd-terms-rail__sticky {
        display: flex;
        flex-direction: column;
        gap: 12px;
        /* Natural-height sticky stack: full TOC + help, no inner scrollbar. */
        position: sticky;
        top: 112px;
        z-index: 2;
        align-self: start;
        width: 100%;
    }

    .rd-terms-page .rd-terms-rail__sticky .rd-terms-card {
        padding: 12px 12px;
    }

    .rd-terms-page .rd-terms-toc {
        position: static;
        flex: 0 0 auto;
        width: 100%;
        max-width: none;
        max-height: none;
        overflow: visible;
    }

    .rd-terms-page .rd-terms-toc__title {
        margin-bottom: 6px;
        padding-top: 8px;
        font-size: 12px;
    }

    .rd-terms-toc__list a {
        padding: 3px 8px;
        font-size: 12px;
        line-height: 1.25;
    }

    .rd-terms-toc__list li + li {
        margin-top: 0;
    }

    .rd-terms-page .rd-terms-help {
        flex: 0 0 auto;
        position: static;
        width: 100%;
        max-width: none;
    }

    .rd-terms-page .rd-terms-help__icon {
        width: 28px;
        height: 28px;
        margin-bottom: 4px;
    }

    .rd-terms-page .rd-terms-help__title {
        margin-bottom: 4px;
        padding-top: 8px;
        font-size: 12px;
    }

    .rd-terms-page .rd-terms-help__text {
        margin-bottom: 8px;
        font-size: 12px;
        line-height: 1.35;
    }

    .rd-terms-page .rd-terms-help__cta {
        min-height: 36px;
        padding-block: 8px;
    }

    .rd-terms-page .rd-terms-quote {
        position: static;
        width: 100%;
        max-width: none;
    }

    .rd-terms-section {
        column-gap: 24px;
        padding-block: 44px;
    }
}

@media (min-width: 1280px) {
    .rd-terms-intro {
        min-height: 280px;
        max-height: none;
        padding-block: 40px 32px;
    }

    .rd-terms-page .rd-terms-layout {
        grid-template-columns: minmax(0, 1fr) 300px;
        column-gap: 56px;
    }

    .rd-terms-page .rd-terms-doc {
        max-width: 820px;
    }

    .rd-terms-page .rd-terms-rail {
        width: 300px;
        max-width: 300px;
    }

    .rd-terms-section__meta {
        width: 60px;
    }

    .rd-terms-section__num {
        width: 60px;
        height: 60px;
    }
}

@media (min-width: 1440px) {
    .rd-terms-intro {
        min-height: 300px;
        padding-block: 44px 32px;
    }

    .rd-terms-body {
        padding-block: 48px 72px;
    }
}
