/*
 * Compass Attributes frontend styles.
 * Every selector is prefixed with .compass-attributes:not(#ca-no-id) to gain
 * ID-level specificity over theme styles without affecting anything outside the section.
 */

/* ==========================================================================
   Fonts
   ========================================================================== */

/* Trial file for local testing only: replace with the licensed webfont before going live. */
@font-face {
    font-family: "CA Teodor";
    src: url("../fonts/TeodorTRIAL-Regular.woff2") format("woff2"),
    url("../fonts/TeodorTRIAL-Regular.woff") format("woff");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "CA Instrument Sans";
    src: url("../fonts/InstrumentSans-Regular.woff2") format("woff2"),
    url("../fonts/InstrumentSans-Regular.woff") format("woff");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "CA Instrument Sans";
    src: url("../fonts/InstrumentSans-Italic.woff2") format("woff2"),
    url("../fonts/InstrumentSans-Italic.woff") format("woff");
    font-weight: 400;
    font-style: italic;
    font-display: swap;
}

@font-face {
    font-family: "CA Instrument Sans";
    src: url("../fonts/InstrumentSans-SemiBold.woff2") format("woff2"),
    url("../fonts/InstrumentSans-SemiBold.woff") format("woff");
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "CA Instrument Sans";
    src: url("../fonts/InstrumentSans-SemiBoldItalic.woff2") format("woff2"),
    url("../fonts/InstrumentSans-SemiBoldItalic.woff") format("woff");
    font-weight: 600;
    font-style: italic;
    font-display: swap;
}

/* ==========================================================================
   Base
   ========================================================================== */

.compass-attributes:not(#ca-no-id) {
    all: revert;

    --ca-bg: #F3EDE5;
    --ca-gold: #BD9B60;
    --ca-ink: #1D1D1E;
    --ca-white: #FFFFFF;
    --ca-sans: "CA Instrument Sans", "Helvetica Neue", Arial, sans-serif;
    --ca-serif: "CA Teodor", Georgia, "Times New Roman", serif;
    --ca-gutter: clamp(16px, 3.4cqi, 88px);

    display: block;
    box-sizing: border-box;
    container: ca-root / inline-size;
    width: 100%;
    max-width: none;
    margin-block: 0;
    padding: 0;
    border: 0;
    background: var(--ca-bg);
    color: var(--ca-ink);
    font-family: var(--ca-sans);
    font-size: 16px;
    font-style: normal;
    font-weight: 400;
    line-height: 1.3;
    letter-spacing: normal;
    word-spacing: normal;
    text-align: left;
    text-indent: 0;
    text-transform: none;
    text-decoration: none;
    text-shadow: none;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Reset theme styles on every descendant, including pseudo-elements. */
.compass-attributes:not(#ca-no-id) *,
.compass-attributes:not(#ca-no-id) *::before,
.compass-attributes:not(#ca-no-id) *::after {
    all: revert;
    box-sizing: border-box;
}

/* Default for --ca-vw; JS overrides it with the viewport width excluding the scrollbar. */
:root {
    --ca-vw: 100vw;
}

/* Fallback until JS measures the real offset: assumes a centred container. */
.compass-attributes:not(#ca-no-id).compass-attributes--full {
    position: relative;
    left: 50%;
    width: var(--ca-vw);
    max-width: none;
    transform: translateX(-50%);
}

/* --ca-offset is overridden by JS so the section starts at the viewport's left edge in any theme. */
.compass-attributes:not(#ca-no-id).compass-attributes--full.ca-bleed-ready {
    --ca-offset: 0px;
    left: var(--ca-offset);
    transform: none;
}

/* While JS measures the layout, keep dependent sections invisible (space is preserved) to avoid a broken first paint. */
.ca-js .compass-attributes:not(#ca-no-id).compass-attributes--full:not(.ca-bleed-ready),
.ca-js .compass-attributes:not(#ca-no-id)[data-ca-behind-header]:not(.ca-header-ready) {
    visibility: hidden;
}

/* ==========================================================================
   Attribute component
   ========================================================================== */

.compass-attributes:not(#ca-no-id) .compass-attribute {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr);
    column-gap: 14px;
    align-items: center;
    align-content: start;
    min-width: 0;
    margin: 0;
    padding: 0;
}

.compass-attributes:not(#ca-no-id) .compass-attribute__icon {
    grid-column: 1;
    grid-row: 1;
    width: 36px;
    height: 36px;
    margin: 0;
}

.compass-attributes:not(#ca-no-id) .compass-attribute__icon img {
    display: block;
    width: 100%;
    height: 100%;
    max-width: none;
    margin: 0;
    object-fit: contain;
    border: 0;
    box-shadow: none;
}

.compass-attributes:not(#ca-no-id) .compass-attribute__title {
    grid-column: 2;
    grid-row: 1;
    margin: 0;
    padding: 0;
    font-family: var(--ca-sans);
    font-size: clamp(16px, 2.6cqi, 20px);
    font-style: normal;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: -0.01em;
    text-transform: none;
    color: var(--ca-ink);
}

.compass-attributes:not(#ca-no-id) .compass-attribute__description {
    grid-column: 2;
    margin: 10px 0 0;
    padding: 0;
    font-size: clamp(15px, 2.5cqi, 19px);
    font-weight: 400;
    line-height: 1.22;
    color: var(--ca-gold);
}

.compass-attributes:not(#ca-no-id) .compass-attribute__description p {
    margin: 0 0 0.6em;
    padding: 0;
    font: inherit;
    color: inherit;
}

.compass-attributes:not(#ca-no-id) .compass-attribute__description p:last-child {
    margin-bottom: 0;
}

.compass-attributes:not(#ca-no-id) .compass-attribute__description a {
    color: inherit;
    text-decoration: underline;
}

.compass-attributes:not(#ca-no-id) .compass-attribute__description strong,
.compass-attributes:not(#ca-no-id) .compass-attribute__description b {
    font-weight: 600;
}

.compass-attributes:not(#ca-no-id) .compass-attribute__tags {
    grid-column: 2;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    margin: 10px 0 0;
    padding: 0;
    list-style: none;
}

.compass-attributes:not(#ca-no-id) .compass-attribute__tag {
    position: relative;
    margin: 0;
    padding: 5px 12px;
    border: 1px solid var(--ca-gold);
    border-radius: 999px;
    font-size: 15px;
    font-weight: 600;
    line-height: 1;
    color: var(--ca-gold);
    list-style: none;
}

/* Bracket connector drawn when an attribute has several tags. */
.compass-attributes:not(#ca-no-id) .compass-attribute__tags--tree {
    margin-left: 6px;
    padding-left: 18px;
}

.compass-attributes:not(#ca-no-id) .compass-attribute__tags--tree .compass-attribute__tag::before {
    content: "";
    position: absolute;
    top: 0;
    left: -19px;
    width: 18px;
    height: 50%;
    border-left: 1px solid var(--ca-gold);
    border-bottom: 1px solid var(--ca-gold);
}

.compass-attributes:not(#ca-no-id) .compass-attribute__tags--tree .compass-attribute__tag:first-child::before {
    top: 50%;
    height: 0;
    border-left: 0;
}

.compass-attributes:not(#ca-no-id) .compass-attribute__tags--tree .compass-attribute__tag:not(:last-child)::after {
    content: "";
    position: absolute;
    top: 50%;
    left: -19px;
    height: calc(50% + 7px);
    border-left: 1px solid var(--ca-gold);
}

/* ==========================================================================
   Compass Group section
   ========================================================================== */

.compass-attributes:not(#ca-no-id) .compass-attributes__layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    margin: 0;
    padding: 0;
}

.compass-attributes:not(#ca-no-id) .compass-attributes__column {
    min-width: 0;
}

.compass-attributes:not(#ca-no-id) .compass-attributes__column--attributes {
    display: flex;
    container: ca-panel / inline-size;
    padding: var(--ca-gutter);
    background: var(--ca-bg);
}

.compass-attributes:not(#ca-no-id) .compass-attributes__panel {
    flex: 1 1 auto;
    margin: 0;
    padding: clamp(24px, 7cqi, 56px) clamp(20px, 6cqi, 48px);
    border: 1px solid var(--ca-gold);
    border-radius: 20px;
    background: transparent;
}

.compass-attributes:not(#ca-no-id) .compass-attributes__panel-logo {
    margin: 0 0 clamp(36px, 8cqi, 72px);
}

.compass-attributes:not(#ca-no-id) .compass-attributes__panel-logo img {
    display: block;
    width: clamp(150px, 30cqi, 230px);
    max-width: 100%;
    height: auto;
    margin: 0;
    object-fit: contain;
    object-position: left center;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

.compass-attributes:not(#ca-no-id) .compass-attributes__grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    column-gap: clamp(24px, 6cqi, 56px);
    row-gap: clamp(32px, 8cqi, 72px);
    margin: 0;
    padding: 0;
}

@container ca-panel (min-width: 520px) {
    .compass-attributes:not(#ca-no-id) .compass-attributes__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.compass-attributes:not(#ca-no-id) .compass-attributes__column--banner {
    position: relative;
    isolation: isolate;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 48px;
    container: ca-banner / inline-size;
    min-height: clamp(440px, 120cqi, 760px);
    margin: 0;
    padding: var(--ca-gutter);
    overflow: hidden;
    background-color: #6B6B6B;
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
    color: var(--ca-white);
}

/* Keeps white text readable over any photo. */
.compass-attributes:not(#ca-no-id) .compass-attributes__column--banner::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(
            to bottom,
            rgba(0, 0, 0, 0.35) 0%,
            rgba(0, 0, 0, 0) 35%,
            rgba(0, 0, 0, 0) 65%,
            rgba(0, 0, 0, 0.45) 100%
    );
}

.compass-attributes:not(#ca-no-id) .compass-attributes__title {
    max-width: 6.5em;
    margin: 0;
    padding: 0;
    font-family: var(--ca-serif);
    font-size: clamp(36px, 10.5cqi, 96px);
    font-style: normal;
    font-weight: 400;
    line-height: 0.93;
    letter-spacing: 0;
    text-transform: none;
    overflow-wrap: break-word;
    color: var(--ca-white);
}

.compass-attributes:not(#ca-no-id) .compass-attributes__banner-footer {
    margin: 0;
    padding: 0;
}

.compass-attributes:not(#ca-no-id) .compass-attributes__banner-logo img {
    display: block;
    width: clamp(170px, 36cqi, 290px);
    max-width: 100%;
    height: auto;
    margin: 0;
    object-fit: contain;
    object-position: left center;
    border: 0;
    box-shadow: none;
    filter: brightness(0) invert(1); /* Renders the logo in white. */
}

.compass-attributes:not(#ca-no-id) .compass-attributes__brands {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 16px 20px;
    margin: 28px 0 0;
    padding: 24px 0 0;
    border-top: 1px solid rgba(255, 255, 255, 0.6);
    list-style: none;
}

.compass-attributes:not(#ca-no-id) .compass-attributes__brand {
    margin: 0;
    padding: 0;
    list-style: none;
}

.compass-attributes:not(#ca-no-id) .compass-attributes__brand img {
    display: block;
    width: auto;
    max-width: clamp(56px, 12cqi, 96px);
    height: auto;
    max-height: clamp(24px, 5cqi, 40px);
    margin: 0;
    object-fit: contain;
    border: 0;
    box-shadow: none;
    filter: brightness(0) invert(1); /* Renders brand logos in white. */
}

/*
 * Set by JS when [data-ca-behind-header] is present:
 * --ca-pull-up moves the section up behind the theme header,
 * --ca-header-clear pushes its content below that header.
 */
.compass-attributes:not(#ca-no-id).compass-attributes--group {
    --ca-pull-up: 0px;
    --ca-header-clear: 0px;
    margin-top: calc(-1 * var(--ca-pull-up));
}

.compass-attributes:not(#ca-no-id).compass-attributes--group .compass-attributes__column--banner {
    padding-top: calc(var(--ca-gutter) + var(--ca-header-clear));
}

@container ca-root (min-width: 1100px) {
    .compass-attributes:not(#ca-no-id) .compass-attributes__layout {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .compass-attributes:not(#ca-no-id) .compass-attributes__column--banner {
        min-height: 70cqi;
    }

    .compass-attributes:not(#ca-no-id).compass-attributes--group .compass-attributes__column--attributes {
        padding-top: calc(var(--ca-gutter) + var(--ca-header-clear));
    }
}

/* Tablet: the banner spans the full width, so scale it down to keep desktop proportions. */
@container ca-root (min-width: 640px) and (max-width: 1099.98px) {
    .compass-attributes:not(#ca-no-id) .compass-attributes__column--banner {
        min-height: clamp(360px, 55cqi, 540px);
    }

    .compass-attributes:not(#ca-no-id) .compass-attributes__title {
        font-size: clamp(40px, 6.5cqi, 64px);
    }

    .compass-attributes:not(#ca-no-id) .compass-attributes__banner-logo img {
        width: clamp(160px, 24cqi, 230px);
    }
}

/* ==========================================================================
   Areas section
   ========================================================================== */

.compass-attributes:not(#ca-no-id).compass-attributes--areas {
    background: var(--ca-white);
}

.compass-attributes:not(#ca-no-id) .compass-areas {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    row-gap: 16px;
    margin: 0;
    padding: var(--ca-gutter) 0;
}

.compass-attributes:not(#ca-no-id) .compass-areas__half {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
    align-content: start;
    min-width: 0;
    margin: 0;
    padding: 0 var(--ca-gutter);
}

.compass-attributes:not(#ca-no-id) .compass-area {
    container: ca-area / inline-size;
    display: flex;
    flex-direction: column;
    min-width: 0;
    margin: 0;
    padding: 24px 28px 40px;
    border: 1px solid var(--ca-gold);
    border-radius: 20px;
}

.compass-attributes:not(#ca-no-id) .compass-area__title {
    margin: 0 0 20px;
    padding: 0;
    font-family: var(--ca-serif);
    font-size: clamp(24px, 9cqi, 34px);
    font-weight: 400;
    line-height: 1.1;
    letter-spacing: -0.02em;
    text-align: center;
    color: var(--ca-ink);
}

.compass-attributes:not(#ca-no-id) .compass-area__attributes {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    column-gap: 32px;
    row-gap: 28px;
    align-items: start;
    margin: 0;
    padding: 0;
}

.compass-attributes:not(#ca-no-id) .compass-area .compass-attribute {
    grid-template-columns: 34px minmax(0, 1fr);
    column-gap: 12px;
}

.compass-attributes:not(#ca-no-id) .compass-area .compass-attribute__icon {
    width: 34px;
    height: 34px;
}

.compass-attributes:not(#ca-no-id) .compass-area .compass-attribute__title {
    font-size: 16px;
}

.compass-attributes:not(#ca-no-id) .compass-area .compass-attribute__description {
    margin-top: 10px;
    font-size: 15px;
    line-height: 1.25;
}

@container ca-area (min-width: 560px) {
    .compass-attributes:not(#ca-no-id) .compass-area--cols-2 .compass-area__attributes {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@container ca-root (min-width: 640px) {
    .compass-attributes:not(#ca-no-id) .compass-areas__half {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .compass-attributes:not(#ca-no-id) .compass-area--cols-2 {
        grid-column: span 2;
    }
}

@container ca-root (min-width: 1100px) {
    .compass-attributes:not(#ca-no-id) .compass-areas {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* ==========================================================================
   Accordion (mobile)
   ========================================================================== */

.compass-attributes:not(#ca-no-id) .compass-accordion__heading {
    display: none;
}

@container ca-root (max-width: 639.98px) {
    .compass-attributes:not(#ca-no-id) .compass-attributes__column--banner {
        min-height: 0;
        gap: 20px;
        padding-bottom: 0;
        background-color: var(--ca-white);
        background-image: none !important; /* Overrides the inline background image. */
        color: var(--ca-ink);
    }

    .compass-attributes:not(#ca-no-id) .compass-attributes__column--banner::before,
    .compass-attributes:not(#ca-no-id) .compass-attributes__brands {
        display: none;
    }

    .compass-attributes:not(#ca-no-id) .compass-attributes__banner-footer {
        order: -1;
    }

    .compass-attributes:not(#ca-no-id) .compass-attributes__banner-logo img {
        width: 140px;
        margin-inline: auto;
        filter: none;
    }

    .compass-attributes:not(#ca-no-id) .compass-attributes__title {
        max-width: none;
        margin-inline: auto;
        text-align: center;
        color: var(--ca-ink);
    }

    .compass-attributes:not(#ca-no-id) .compass-attributes__column--attributes {
        padding-bottom: 0;
        background: var(--ca-white);
    }

    .compass-attributes:not(#ca-no-id) .compass-attributes__panel,
    .compass-attributes:not(#ca-no-id) .compass-area {
        padding: 20px 24px;
    }

    .compass-attributes:not(#ca-no-id) .compass-attributes__panel-logo,
    .compass-attributes:not(#ca-no-id) .compass-area__title {
        display: none;
    }

    .compass-attributes:not(#ca-no-id) .compass-areas {
        padding-top: 16px;
        padding-bottom: 48px;
    }

    .compass-attributes:not(#ca-no-id) .compass-accordion__heading {
        display: block;
        margin: 0;
        padding: 0;
    }

    .compass-attributes:not(#ca-no-id) .compass-accordion__trigger {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 16px;
        width: 100%;
        margin: 0;
        padding: 0;
        border: 0;
        background: transparent;
        font: inherit;
        color: inherit;
        text-align: left;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }

    .compass-attributes:not(#ca-no-id) .compass-accordion__trigger:focus-visible {
        outline: 2px solid var(--ca-gold);
        outline-offset: 6px;
        border-radius: 8px;
    }

    .compass-attributes:not(#ca-no-id) .compass-accordion__label {
        font-family: var(--ca-serif);
        font-size: 26px;
        font-weight: 400;
        line-height: 1.05;
        color: var(--ca-ink);
    }

    .compass-attributes:not(#ca-no-id) .compass-accordion__icon {
        position: relative;
        flex: 0 0 auto;
        width: 32px;
        height: 32px;
        border: 1px solid var(--ca-gold);
        border-radius: 50%;
        background: var(--ca-bg);
    }

    .compass-attributes:not(#ca-no-id) .compass-accordion__icon::before,
    .compass-attributes:not(#ca-no-id) .compass-accordion__icon::after {
        content: "";
        position: absolute;
        top: 50%;
        left: 50%;
        width: 14px;
        height: 1px;
        background: var(--ca-gold);
        transform: translate(-50%, -50%);
    }

    /* The vertical bar rotates flat to turn "+" into "−". */
    .compass-attributes:not(#ca-no-id) .compass-accordion__icon::after {
        transform: translate(-50%, -50%) rotate(90deg);
        transition: transform 0.2s ease;
    }

    .compass-attributes:not(#ca-no-id) .compass-accordion.is-open .compass-accordion__icon::after {
        transform: translate(-50%, -50%) rotate(0deg);
    }

    .compass-attributes:not(#ca-no-id) .compass-accordion__panel {
        margin-top: 24px;
    }

    .compass-attributes:not(#ca-no-id) .compass-accordion.is-open {
        padding-bottom: 32px;
    }

    /* Panels start collapsed as soon as JS is flagged in <head>; without JS they stay open. */
    .ca-js .compass-attributes:not(#ca-no-id) .compass-accordion:not(.is-open) .compass-accordion__panel {
        display: none;
    }

    :root:not(.ca-js) .compass-attributes:not(#ca-no-id) .compass-accordion__icon {
        display: none;
    }
}

/* ==========================================================================
   Page wrapper (templates/canvas.php)
   ========================================================================== */

.compass-attributes-canvas:not(#ca-no-id) {
    display: block;
    margin: 0 !important;
    padding: 0 !important;
}

.compass-attributes-canvas:not(#ca-no-id) + * {
    margin-block-start: 0 !important;
}

.compass-attributes-canvas:not(#ca-no-id) > p:empty {
    display: none;
}