/* ==========================================================================
   CG-75 — Terms & Conditions (desktop production section)

   Scoped entirely under `.tnc`, loaded only on `/terms-conditions` routes via
   the layout's `pageCss` local. Desktop-first: the base rules below are the
   1200px+ triad, and the "Responsive" section at the end of this file collapses
   it down through Bootstrap's lg/md/sm breakpoints.

   Authored as plain CSS rather than SCSS because this branch predates the
   dart-sass build migration. A follow-up can move these rules into
   public/css/scss/ and compile them with main.css.
   ========================================================================== */

.tnc {
    /* Brand + surface tokens. Purple matches the existing site accent. */
    --tnc-brand: #6737b0;
    --tnc-brand-soft: #f3eefb;
    --tnc-brand-border: #d9cbf0;

    --tnc-ink: #191922;
    --tnc-body: #33333b;
    --tnc-muted: #6c6c78;
    --tnc-faint: #8b8b96;

    --tnc-border: #e8e6ef;
    --tnc-border-soft: #f0eef5;
    --tnc-surface: #ffffff;
    --tnc-surface-hover: #f8f6fc;

    /* Fixed site navbar height, plus breathing room for sticky rails. */
    --tnc-header-offset: 67px;
    --tnc-sticky-top: 91px;

    /* The global layout adds body padding above every page; absorb it so the
       reading surface starts directly under the fixed site header. */
    margin-top: -42px;
    padding-top: 28px;

    background-color: var(--tnc-surface);
    color: var(--tnc-body);
    font-size: 16px;
    line-height: 1.7;
}

/* --------------------------------------------------------------------------
   Shell — documentation triad. Rails are fixed-width so the reading column
   keeps a stable measure; `minmax(0, 1fr)` stops long words forcing overflow.
   -------------------------------------------------------------------------- */

/* 1320px / 12px padding mirrors Bootstrap's xxl `.container`, so the section's
   outer edges line up with the rest of the site. The remaining 1296px splits
   into 232 + 720 + 232 with 56px gutters — a ~75-character reading measure. */
.tnc-shell {
    max-width: 1320px;
    margin: 0 auto;
    padding: 0 12px;
    display: grid;
    align-items: start;
    column-gap: 56px;
}

.tnc-shell--3col {
    grid-template-columns: 232px minmax(0, 1fr) 232px;
}

.tnc-shell--2col {
    grid-template-columns: 232px minmax(0, 1fr);
}

/* --------------------------------------------------------------------------
   Left policy navigation
   -------------------------------------------------------------------------- */

.tnc-sidebar {
    position: sticky;
    top: var(--tnc-sticky-top);
    max-height: calc(100vh - var(--tnc-sticky-top) - 24px);
    overflow-y: auto;
    padding: 48px 0 32px;
}

.tnc-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.tnc-nav-link {
    display: block;
    padding: 7px 12px;
    border-radius: 6px;
    color: #4a4a55;
    font-size: 14px;
    line-height: 1.45;
    text-decoration: none;
}

.tnc-nav-link:hover {
    background-color: var(--tnc-surface-hover);
    color: var(--tnc-ink);
}

.tnc-nav-link.is-active {
    background-color: var(--tnc-brand-soft);
    color: var(--tnc-brand);
    font-weight: 600;
}

.tnc-nav-link--top {
    font-weight: 600;
}

.tnc-nav-link--muted {
    color: var(--tnc-muted);
}

.tnc-nav-label {
    margin: 24px 0 6px;
    padding: 0 12px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--tnc-faint);
}

.tnc-nav-divider {
    height: 1px;
    margin: 20px 12px;
    background-color: var(--tnc-border-soft);
}

/* --------------------------------------------------------------------------
   Main reading column
   -------------------------------------------------------------------------- */

.tnc-main {
    min-width: 0;
    padding: 40px 0 96px;
}

/* Overview and short policies have no right rail; cap the measure so the
   reading width stays comfortable instead of filling the extra column. */
.tnc-main--wide {
    max-width: 840px;
}

.tnc-breadcrumb ol {
    list-style: none;
    margin: 0 0 24px;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    font-size: 13px;
    color: var(--tnc-faint);
}

.tnc-breadcrumb li + li::before {
    content: "/";
    margin: 0 8px;
    color: #c8c8d2;
}

.tnc-breadcrumb a {
    color: var(--tnc-muted);
    text-decoration: none;
}

.tnc-breadcrumb a:hover {
    color: var(--tnc-brand);
    text-decoration: underline;
}

.tnc-doc-header {
    padding-bottom: 28px;
    border-bottom: 1px solid var(--tnc-border-soft);
}

.tnc-doc-title {
    margin: 0 0 12px;
    font-size: 34px;
    line-height: 1.2;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--tnc-ink);
}

.tnc-doc-lead {
    margin: 0 0 14px;
    font-size: 17px;
    line-height: 1.6;
    color: #5b5b66;
}

.tnc-doc-meta {
    margin: 0;
    font-size: 13px;
    color: var(--tnc-faint);
}

/* --------------------------------------------------------------------------
   Legal content
   -------------------------------------------------------------------------- */

.tnc-section {
    /* Generous separation is the main scanning cue between numbered sections. */
    margin-top: 56px;
    scroll-margin-top: 104px;
}

.tnc-section h2 {
    margin: 0 0 20px;
    font-size: 21px;
    line-height: 1.35;
    font-weight: 700;
    color: var(--tnc-ink);
}

.tnc-section h3 {
    margin: 44px 0 18px;
    padding-top: 20px;
    border-top: 1px solid var(--tnc-border-soft);
    font-size: 17px;
    font-weight: 700;
    color: var(--tnc-ink);
    scroll-margin-top: 104px;
}

.tnc-section-intro {
    margin: 0 0 24px;
    color: var(--tnc-body);
}

.tnc-doc-body p {
    margin: 0 0 18px;
}

.tnc-doc-body p:last-child {
    margin-bottom: 0;
}

.tnc-doc-body a {
    color: var(--tnc-brand);
    text-decoration: underline;
    text-underline-offset: 2px;
    text-decoration-color: var(--tnc-brand-border);
}

.tnc-doc-body a:hover {
    text-decoration-color: var(--tnc-brand);
}

/* Clause numbers sit in their own gutter so they form a scannable left rail
   without changing the wording or the numbering. */
.tnc-clause {
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr);
    margin-bottom: 20px;
}

.tnc-clause-n {
    font-size: 14px;
    font-weight: 600;
    color: var(--tnc-faint);
    font-variant-numeric: tabular-nums;
    padding-top: 2px;
}

.tnc-sublist {
    list-style: none;
    margin: 0 0 18px;
    padding: 0;
}

.tnc-sublist li {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr);
    margin-bottom: 12px;
}

.tnc-sublist-n {
    color: var(--tnc-faint);
    font-weight: 600;
}

.tnc-bullets {
    margin: 0 0 20px 56px;
    padding-left: 1.2em;
    color: var(--tnc-body);
}

.tnc-bullets li {
    margin-bottom: 8px;
}

/* Definitions — stacked treatment (default). Term on its own line, meaning
   beneath, so long definitions keep the full reading measure. */
.tnc-defs {
    margin: 0;
}

.tnc-def {
    margin-bottom: 22px;
}

.tnc-defs--stacked .tnc-def dt {
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr);
    margin-bottom: 4px;
}

.tnc-defs--stacked .tnc-def dd {
    margin: 0 0 0 56px;
}

/* Definitions — two-column treatment (?defs=two-col), for comparison. */
.tnc-defs--two-col .tnc-def {
    display: grid;
    grid-template-columns: 56px 172px minmax(0, 1fr);
    column-gap: 12px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--tnc-border-soft);
}

.tnc-defs--two-col .tnc-def dt {
    display: contents;
}

.tnc-defs--two-col .tnc-def dd {
    margin: 0;
}

.tnc-def-n {
    font-size: 14px;
    font-weight: 600;
    color: var(--tnc-faint);
    font-variant-numeric: tabular-nums;
}

.tnc-def-term {
    font-weight: 600;
    color: var(--tnc-ink);
}

/* Inset treatment for worked examples (e.g. the Compensation Policy currency
   example). Deliberately quiet: it must not read as a warning. */
.tnc-example {
    margin: 0 0 20px 56px;
    padding: 16px 20px;
    border-left: 3px solid var(--tnc-brand-border);
    background-color: #faf8fd;
    border-radius: 0 8px 8px 0;
    color: var(--tnc-muted);
}

.tnc-example p:last-child {
    margin-bottom: 0;
}

.tnc-placeholder-note {
    margin: 8px 0 20px 56px;
    padding: 20px 24px;
    border: 1px solid var(--tnc-border);
    border-radius: 10px;
    background-color: #faf9fc;
    color: var(--tnc-muted);
}

/* --------------------------------------------------------------------------
   Right rail — On this page
   -------------------------------------------------------------------------- */

.tnc-toc {
    position: sticky;
    top: var(--tnc-sticky-top);
    max-height: calc(100vh - var(--tnc-sticky-top) - 24px);
    overflow-y: auto;
    padding: 48px 0 32px;
}

.tnc-toc-title {
    margin: 0 0 10px;
    padding-left: 14px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--tnc-faint);
}

.tnc-toc-link {
    display: block;
    padding: 6px 0 6px 14px;
    border-left: 2px solid var(--tnc-border-soft);
    color: var(--tnc-muted);
    font-size: 13px;
    line-height: 1.45;
    text-decoration: none;
}

.tnc-toc-link:hover {
    border-left-color: var(--tnc-brand-border);
    color: var(--tnc-ink);
}

.tnc-toc-link.is-active {
    border-left-color: var(--tnc-brand);
    color: var(--tnc-brand);
    font-weight: 600;
}

.tnc-toc-link--lvl2 {
    padding-left: 28px;
}

/* --------------------------------------------------------------------------
   Overview blocks
   -------------------------------------------------------------------------- */

.tnc-block-heading {
    margin: 0 0 20px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--tnc-faint);
}

.tnc-cards-section {
    margin-top: 48px;
}

.tnc-card-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.tnc-policy-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 20px;
    border: 1px solid var(--tnc-border);
    border-radius: 10px;
    background-color: var(--tnc-surface);
    text-decoration: none;
    color: inherit;
}

.tnc-policy-card:hover {
    border-color: var(--tnc-brand-border);
    background-color: var(--tnc-surface-hover);
}

.tnc-policy-card-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--tnc-ink);
}

.tnc-policy-card-summary {
    font-size: 14px;
    line-height: 1.6;
    color: var(--tnc-muted);
}

.tnc-policy-card-action {
    margin-top: auto;
    padding-top: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--tnc-brand);
}

.tnc-policy-card-action i {
    font-size: 11px;
    margin-left: 4px;
}

.tnc-directory-section {
    margin-top: 56px;
}

.tnc-directory {
    list-style: none;
    margin: 0;
    padding: 0;
    border-top: 1px solid var(--tnc-border-soft);
}

.tnc-directory-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 24px;
    padding: 14px 0;
    border-bottom: 1px solid var(--tnc-border-soft);
}

.tnc-directory-link {
    font-size: 15px;
    font-weight: 600;
    color: var(--tnc-ink);
    text-decoration: none;
}

.tnc-directory-link:hover {
    color: var(--tnc-brand);
    text-decoration: underline;
}

.tnc-directory-meta {
    flex: none;
    font-size: 13px;
    color: var(--tnc-faint);
}

.tnc-support {
    margin-top: 56px;
    padding-top: 32px;
    border-top: 1px solid var(--tnc-border-soft);
}

.tnc-support-text {
    margin: 0;
    color: var(--tnc-muted);
}

.tnc-support-text a {
    color: var(--tnc-brand);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* --------------------------------------------------------------------------
   Related policies + contact
   -------------------------------------------------------------------------- */

.tnc-related {
    margin-top: 72px;
    padding-top: 36px;
    border-top: 1px solid var(--tnc-border-soft);
}

.tnc-related-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.tnc-related-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 18px;
    border: 1px solid var(--tnc-border);
    border-radius: 10px;
    text-decoration: none;
    color: inherit;
}

.tnc-related-card:hover {
    border-color: var(--tnc-brand-border);
    background-color: var(--tnc-surface-hover);
}

.tnc-related-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--tnc-ink);
}

.tnc-related-summary {
    font-size: 13px;
    line-height: 1.55;
    color: var(--tnc-muted);
}

.tnc-related-meta {
    /* Pin dates to the card floor so they line up across uneven summaries. */
    margin-top: auto;
    padding-top: 6px;
    font-size: 12px;
    color: var(--tnc-faint);
}

.tnc-contact {
    margin-top: 56px;
    padding-top: 32px;
    border-top: 1px solid var(--tnc-border-soft);
}

.tnc-contact-list {
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: 14px;
    line-height: 1.9;
    color: var(--tnc-muted);
}

.tnc-contact-name {
    font-weight: 700;
    color: var(--tnc-ink);
}

.tnc-contact-list a {
    color: var(--tnc-muted);
    text-decoration: none;
}

.tnc-contact-list a:hover {
    color: var(--tnc-brand);
    text-decoration: underline;
}

.tnc-contact-list i {
    width: 16px;
    margin-right: 6px;
    color: var(--tnc-faint);
}

/* --------------------------------------------------------------------------
   Responsive — breakpoints mirror Bootstrap's so the section collapses in step
   with the rest of the site chrome.

   xl (<1200px)  drop the right rail; the reading measure matters more than
                 the on-this-page index once the triad no longer fits.
   lg (<992px)   single column; the policy rail becomes a horizontal chip nav
                 above the document (CSS-only, no markup or JS change).
   sm (<576px)   phone tightening: narrower clause gutters, stacked grids.
   -------------------------------------------------------------------------- */

@media (max-width: 1199.98px) {
    .tnc-shell {
        column-gap: 40px;
    }

    .tnc-shell--3col {
        grid-template-columns: 232px minmax(0, 1fr);
    }

    .tnc-toc {
        display: none;
    }
}

@media (max-width: 991.98px) {
    .tnc {
        padding-top: 16px;
    }

    .tnc-shell--3col,
    .tnc-shell--2col {
        grid-template-columns: minmax(0, 1fr);
    }

    /* The rail stops being a rail: static, full-width, scrolled sideways. */
    .tnc-sidebar {
        position: static;
        min-width: 0;
        max-height: none;
        overflow: visible;
        margin-bottom: 4px;
        padding: 4px 0 0;
        border-bottom: 1px solid var(--tnc-border-soft);
    }

    .tnc-nav {
        flex-direction: row;
        gap: 6px;
        padding-bottom: 14px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .tnc-nav::-webkit-scrollbar {
        display: none;
    }

    .tnc-nav-link {
        flex: none;
        padding: 8px 14px;
        border: 1px solid var(--tnc-border);
        border-radius: 999px;
        white-space: nowrap;
    }

    .tnc-nav-link.is-active {
        border-color: var(--tnc-brand-border);
    }

    /* The section label and divider only make sense in a vertical list. */
    .tnc-nav-label,
    .tnc-nav-divider {
        display: none;
    }

    .tnc-main {
        padding: 24px 0 72px;
    }

    .tnc-main--wide {
        max-width: none;
    }

    .tnc-doc-title {
        font-size: 28px;
    }

    .tnc-doc-lead {
        font-size: 16px;
    }

    .tnc-card-grid,
    .tnc-related-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    /* Two-column definitions have no room for a third track; stack them. */
    .tnc-defs--two-col .tnc-def {
        grid-template-columns: 56px minmax(0, 1fr);
        row-gap: 4px;
    }

    .tnc-defs--two-col .tnc-def dt {
        display: grid;
        grid-template-columns: 56px minmax(0, 1fr);
    }

    .tnc-defs--two-col .tnc-def dd {
        grid-column: 1 / -1;
        margin-left: 56px;
    }
}

@media (max-width: 575.98px) {
    .tnc {
        font-size: 15.5px;
    }

    .tnc-main {
        padding: 20px 0 56px;
    }

    .tnc-doc-title {
        font-size: 25px;
    }

    .tnc-doc-header {
        padding-bottom: 20px;
    }

    .tnc-section {
        margin-top: 40px;
        scroll-margin-top: 88px;
    }

    .tnc-section h2 {
        font-size: 19px;
    }

    .tnc-section h3 {
        margin-top: 32px;
        scroll-margin-top: 88px;
    }

    /* Narrower number gutters: 56px is a third of a phone's measure. */
    .tnc-clause,
    .tnc-defs--stacked .tnc-def dt,
    .tnc-defs--two-col .tnc-def,
    .tnc-defs--two-col .tnc-def dt {
        grid-template-columns: 42px minmax(0, 1fr);
    }

    .tnc-sublist li {
        grid-template-columns: 24px minmax(0, 1fr);
    }

    .tnc-defs--stacked .tnc-def dd,
    .tnc-defs--two-col .tnc-def dd,
    .tnc-bullets {
        margin-left: 42px;
    }

    .tnc-bullets {
        padding-left: 1em;
    }

    /* Insets keep their own emphasis but reclaim the gutter for text. */
    .tnc-example,
    .tnc-placeholder-note {
        margin-left: 0;
        padding: 14px 16px;
    }

    .tnc-card-grid,
    .tnc-related-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .tnc-directory-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
    }

    .tnc-related,
    .tnc-contact,
    .tnc-support {
        margin-top: 48px;
    }
}
