/* Shared concept gallery. All rules stay within cg-* components. */
.cg-section { background:#f5f8fd; }
.cg-gallery,
.cg-dialog {
    --cg-ink: #102e50;
    --cg-blue: #1765d9;
    --cg-muted: #52677e;
    --cg-line: #d5e0ec;
    color: var(--cg-ink);
}

.cg-gallery *,
.cg-dialog * {
    box-sizing: border-box;
}

.cg-gallery [hidden],
.cg-dialog [hidden] {
    display: none !important;
}

.cg-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 18px;
    margin-bottom: 24px;
}

.cg-filters,
.cg-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cg-filters {
    flex-wrap: wrap;
}

.cg-controls {
    margin-left: auto;
}

.cg-filter,
.cg-arrow,
.cg-close,
.cg-device-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    border: 1px solid var(--cg-line);
    border-radius: 8px;
    background: #fff;
    color: var(--cg-ink);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.35;
    cursor: pointer;
}

.cg-filter {
    gap: 8px;
    padding: 11px 17px;
}

.cg-filter > span {
    min-width: 20px;
    padding: 1px 5px;
    border-radius: 5px;
    background: #dfeaf6;
    color: #244e79;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

.cg-filter[aria-pressed="true"] > span {
    background: #ffffff26;
    color: #fff;
}

.cg-filter[aria-pressed="true"],
.cg-filter[aria-selected="true"],
.cg-filter.is-active {
    border-color: var(--cg-ink);
    background: var(--cg-ink);
    color: #fff;
}

.cg-filter:hover,
.cg-arrow:hover:not(:disabled),
.cg-close:hover {
    border-color: #7398c3;
    background: #edf4fc;
    color: var(--cg-ink);
}

.cg-filter[aria-pressed="true"]:hover,
.cg-filter[aria-selected="true"]:hover,
.cg-filter.is-active:hover {
    border-color: #17497e;
    background: #17497e;
    color: #fff;
}

.cg-arrow {
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    padding: 9px;
    font-size: 22px;
}

.cg-arrow svg,
.cg-close svg {
    width: 20px;
    height: 20px;
    flex: none;
}

.cg-arrow:disabled {
    opacity: .36;
    cursor: default;
}

/* The partial next card makes the horizontal browsing direction visible. */
.cg-track {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: calc((100% - 48px) / 2.15);
    gap: 24px;
    align-items: stretch;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 3px 2px 20px;
    margin-inline: -2px;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: 2px;
    overscroll-behavior-inline: contain;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.cg-track::-webkit-scrollbar {
    display: none;
}

.cg-track.is-dragging,
.cg-track.is-repositioning,
.cg-track[data-dragging="true"] {
    scroll-snap-type: none;
    scroll-behavior: auto;
    cursor: grabbing;
    user-select: none;
}

.cg-card {
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--cg-line);
    border-radius: 15px;
    background: #fff;
    scroll-snap-align: start;
    box-shadow: 0 4px 12px #17375a05;
}

.cg-preview {
    position: relative;
    display: block;
    isolation: isolate;
    overflow: hidden;
    border-bottom: 1px solid var(--cg-line);
    background: linear-gradient(145deg, #f6f9fc 0%, #e8f0fa 72%, #d9e6f6 100%);
    color: var(--cg-ink);
    text-decoration: none;
}

.cg-device-composition {
    position: relative;
    width: 100%;
    aspect-ratio: 1.24;
}

.cg-desktop {
    position: absolute;
    top: 7%;
    left: 5%;
    width: 88%;
    overflow: hidden;
    border: 1px solid #bacad9;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 10px 28px #142f5426;
    transition: transform .2s ease;
}

.cg-browser-bar {
    display: flex;
    align-items: center;
    gap: 5px;
    min-height: 28px;
    padding: 6px 9px;
    border-bottom: 1px solid #dce4ed;
    background: #fff;
}

.cg-browser-bar > span:not(.cg-browser-address) {
    flex: 0 0 6px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #c2cfdb;
}

.cg-browser-address {
    display: block;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    margin-left: 8px;
    color: #51647a;
    font-size: 12px;
    line-height: 1.25;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cg-desktop-image {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 1.44;
    object-fit: cover;
    object-position: center top;
    -webkit-user-drag: none;
}

.cg-phone {
    position: absolute;
    box-sizing: content-box;
    z-index: 1;
    right: 4%;
    bottom: 7%;
    width: 25%;
    aspect-ratio: 390 / 844;
    overflow: hidden;
    border: 5px solid #142c46;
    border-radius: 21px;
    background: #fff;
    box-shadow: 0 10px 25px #132e5140;
    transition: transform .2s ease;
}

.cg-phone-camera {
    position: absolute;
    z-index: 2;
    top: 5px;
    left: 33%;
    width: 34%;
    height: 8px;
    border-radius: 8px;
    background: #142c46;
}

.cg-phone-image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    -webkit-user-drag: none;
}

.cg-preview-action {
    position: absolute;
    bottom: 5%;
    left: 5%;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    max-width: 62%;
    padding: 10px 14px;
    border: 1px solid var(--cg-blue);
    border-radius: 7px;
    background: var(--cg-blue);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
    box-shadow: 0 4px 12px #142f5410;
}

.cg-preview:hover .cg-desktop {
    transform: translateY(-3px);
}

.cg-preview:hover .cg-phone {
    transform: translateY(-5px);
}

.cg-preview:hover .cg-preview-action {
    border-color: #124eab;
    background: #124eab;
    color: #fff;
}

.cg-card-copy {
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: flex-start;
    padding: 24px;
}

.cg-card-label {
    margin: 0 0 10px;
    color: var(--cg-muted);
    font-size: 12px;
    font-weight: 650;
    line-height: 1.5;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.cg-card-title {
    margin: 0 0 13px;
    color: var(--cg-ink);
    font-size: 28px;
    font-weight: 650;
    line-height: 1.15;
    letter-spacing: -.65px;
}

.cg-card-description {
    margin: 0 0 15px;
    color: var(--cg-muted);
    font-size: 16px;
    line-height: 1.65;
}

.cg-card-task {
    margin: 0 0 20px;
    color: #425b75;
    font-size: 14px;
    line-height: 1.65;
}

.cg-task-link {
    color: #1459b1;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

.cg-task-link:hover {
    color: var(--cg-ink);
}

.cg-card-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px 17px;
    width: 100%;
    margin-top: auto;
}

.cg-open,
.cg-choose {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 11px 15px;
    border: 1px solid var(--cg-line);
    border-radius: 7px;
    background: #fff;
    color: var(--cg-ink);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
}

.cg-choose {
    padding-inline: 0;
    border-color: transparent;
    color: #1459b1;
    text-decoration: underline;
    text-underline-offset: 4px;
}

.cg-choose:hover {
    color: var(--cg-ink);
}

.cg-pagination,
.cg-dots {
    display: flex;
    align-items: center;
    justify-content: center;
}

.cg-pagination {
    gap: 10px;
    min-height: 44px;
    margin-top: 1px;
}

.cg-dots {
    flex-wrap: wrap;
    max-width: 100%;
}

.cg-dots button {
    position: relative;
    display: block;
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    overflow: hidden;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--cg-ink);
    font: inherit;
    font-size: 12px;
    cursor: pointer;
}

.cg-dots button::before {
    content: "";
    position: absolute;
    top: 19px;
    left: 19px;
    width: 6px;
    height: 6px;
    border-radius: 9px;
    background: #8b9fb5;
}

.cg-dots button[aria-current="true"]::before,
.cg-dots button[aria-selected="true"]::before,
.cg-dots button[aria-pressed="true"]::before,
.cg-dots button.is-active::before {
    left: 11px;
    width: 22px;
    background: var(--cg-blue);
}

.cg-disclosure {
    max-width: 880px;
    margin: 12px auto 0;
    color: var(--cg-muted);
    font-size: 12px;
    line-height: 1.65;
    text-align: center;
}

/* A compact preview shell keeps the concept itself in view. */
.cg-dialog {
    position: fixed;
    inset: 0;
    width: min(1200px, calc(100vw - 48px));
    max-width: none;
    height: 86vh;
    height: 86dvh;
    max-height: calc(100vh - 48px);
    max-height: calc(100dvh - 48px);
    overflow: hidden;
    margin: auto;
    padding: 0;
    border: 0;
    border-radius: 20px;
    background: #fbf6e8;
    color: #292720;
    font: inherit;
    line-height: 1.5;
    box-shadow: 0 28px 100px #161b2440;
}

.cg-dialog[open] {
    display: flex;
    flex-direction: column;
}

.cg-dialog:not([open]) {
    display: none;
}

.cg-dialog::backdrop {
    background: #18222a99;
    backdrop-filter: blur(7px);
}

.cg-dialog-header {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    flex: none;
    align-items: center;
    gap: 20px;
    min-height: 73px;
    padding: 14px 24px;
    border-bottom: 1px solid #ddd6c6;
    background: #fbf6e8;
}

.cg-grabber {
    display: none;
}

.cg-dialog-heading {
    display: flex;
    align-items: baseline;
    gap: 14px;
    min-width: 0;
}

.cg-dialog-title {
    min-width: 0;
    overflow: hidden;
    margin: 0;
    color: #292720;
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 22px;
    font-weight: 400;
    line-height: 1.2;
    letter-spacing: -.4px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cg-dialog-category {
    flex: none;
    margin: 0;
    color: #787267;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.4;
    letter-spacing: 1.3px;
    text-transform: uppercase;
    white-space: nowrap;
}

.cg-switch-wrap,
.cg-close-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
}

.cg-device-switch {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    min-height: 36px;
    padding: 3px;
    border: 1px solid #ddd6c6;
    border-radius: 24px;
    background: #f0eadc;
}

.cg-device-button {
    gap: 7px;
    min-width: 86px;
    min-height: 28px;
    padding: 5px 12px;
    border: 0;
    border-radius: 20px;
    background: transparent;
    color: #655f54;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.5;
}

.cg-device-button svg {
    width: 15px;
    height: 15px;
    flex: none;
}

.cg-device-button svg,
.cg-close svg {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.4;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.cg-device-button[aria-checked="true"] {
    background: #161511;
    color: #fff;
    box-shadow: 0 1px 4px #352e1d1a;
}

.cg-device-button:not([aria-checked="true"]):hover {
    color: #292720;
}

.cg-close-wrap {
    gap: 10px;
}

.cg-escape {
    padding: 2px 5px;
    border: 1px solid #ded7c9;
    border-radius: 4px;
    color: #8b8377;
    font-family: inherit;
    font-size: 11px;
    line-height: 1.3;
}

.cg-close {
    flex: none;
    width: 44px;
    min-width: 44px;
    height: 44px;
    padding: 12px;
    border: 1px solid #ddd6c6;
    border-radius: 50%;
    background: #fbf6e8;
    color: #514c43;
}

.cg-close:hover {
    border-color: #b8ae99;
    background: #f0eadc;
    color: #292720;
}

.cg-close svg {
    stroke-width: 1.5;
}

.cg-dialog-toolbar {
    display: none;
}

.cg-dialog-hint {
    margin: 0;
    color: #6c6559;
    font-size: 12px;
    line-height: 1.5;
}

.cg-zoom {
    display: inline-flex;
    flex: none;
    gap: 0;
    padding: 0;
    border: 1px solid #161511;
    background: transparent;
}

.cg-zoom button {
    min-width: 38px;
    min-height: 37px;
    padding: 4px 8px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #6c6559;
    font: inherit;
    font-size: 12px;
    line-height: 1.5;
    cursor: pointer;
}

.cg-zoom button[aria-pressed="true"] {
    background: #161511;
    color: #fff;
}

.cg-stage {
    position: relative;
    display: flex;
    flex: 1 1 0;
    align-items: flex-start;
    width: 100%;
    min-height: 0;
    overflow: auto;
    overscroll-behavior: contain;
    padding: 24px;
    background: #f1eada;
}

/* JS sizes the screen; its chrome is outside that exact viewport. */
.cg-preview-window {
    position: relative;
    box-sizing: content-box;
    flex: none;
    margin: auto;
    overflow: hidden;
    border: 0;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 0 0 1px #cfc7b7, 0 12px 36px #332b1921;
}

.cg-preview-browser-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 36px;
    overflow: hidden;
    padding: 0 12px;
    border-bottom: 1px solid #d9d6ce;
    background: #efede7;
}

.cg-preview-browser-bar > span:not(.cg-preview-address) {
    flex: 0 0 7px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #c5c1b8;
}

.cg-preview-address {
    flex: 1;
    overflow: hidden;
    padding-right: 33px;
    color: #8b857a;
    font-size: 11px;
    line-height: 1.4;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cg-viewport {
    position: relative;
    display: block;
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    margin: 0;
    padding: 0;
    border: 0;
    background: #fff;
}

.cg-frame {
    position: absolute;
    top: 0;
    left: 0;
    display: block;
    width: 1440px;
    max-width: none;
    height: 900px;
    margin: 0;
    padding: 0;
    border: 0;
    background: #fff;
    transform: scale(var(--preview-scale, 1));
    transform-origin: 0 0;
}

.cg-dialog[data-device="mobile"] .cg-preview-window {
    border: 8px solid #242725;
    border-radius: 44px;
    background: #242725;
    box-shadow: 0 14px 35px #332b1933;
}

.cg-dialog[data-device="mobile"] .cg-preview-browser-bar {
    display: none;
}

.cg-dialog[data-device="mobile"] .cg-viewport {
    border-radius: 35px;
}

.cg-dialog[data-device="mobile"] .cg-frame {
    width: 375px;
}

.cg-loading,
.cg-preview-error,
.cg-notice {
    position: absolute;
    z-index: 2;
    left: 50%;
    width: max-content;
    max-width: calc(100% - 32px);
    margin: 0;
    padding: 14px 18px;
    border: 1px solid #d4cbb8;
    border-radius: 10px;
    background: #fffcf5;
    color: #39342b;
    font-size: 14px;
    line-height: 1.5;
    text-align: center;
    box-shadow: 0 6px 25px #332b1924;
}

.cg-loading,
.cg-preview-error {
    top: 50%;
    transform: translate(-50%, -50%);
}

.cg-loading {
    pointer-events: none;
}

.cg-preview-error {
    width: min(460px, calc(100% - 32px));
    max-height: calc(100% - 30px);
    overflow: auto;
    padding: 24px;
}

.cg-preview-error p {
    margin: 0 0 12px;
    font-size: 14px;
    line-height: 1.5;
}

.cg-error-link {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    color: #39342b;
    font-size: 14px;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.cg-notice {
    bottom: max(16px, env(safe-area-inset-bottom));
    font-size: 13px;
    transform: translateX(-50%);
    pointer-events: none;
}
.cg-gallery :is(a, button):focus-visible,
.cg-dialog :is(a, button, iframe):focus-visible {
    outline: 3px solid #1267df;
    outline-offset: 3px;
}

.cg-preview:focus-visible {
    outline-offset: -5px;
}

@media (max-width: 1000px) {
    .cg-track {
        grid-auto-columns: calc((100% - 24px) / 1.5);
    }

    .cg-card-copy {
        padding: 22px;
    }

    .cg-card-title {
        font-size: 27px;
    }

}

@media (max-width: 600px) {
    .cg-toolbar {
        gap: 14px;
        margin-bottom: 18px;
    }

    .cg-filters {
        gap: 7px;
    }

    .cg-filter {
        padding-inline: 12px;
        font-size: 13px;
    }

    .cg-controls {
        margin-left: auto;
    }

    .cg-track {
        grid-auto-columns: calc((100% - 18px) / 1.08);
        gap: 18px;
        padding-bottom: 14px;
    }

    .cg-card {
        border-radius: 12px;
    }

    .cg-device-composition {
        aspect-ratio: 1.17;
    }

    .cg-desktop {
        top: 7%;
        left: 4%;
        width: 90%;
        border-radius: 6px;
    }

    .cg-browser-bar {
        min-height: 26px;
        gap: 4px;
        padding: 5px 7px;
    }

    .cg-browser-bar > span:not(.cg-browser-address) {
        flex-basis: 5px;
        width: 5px;
        height: 5px;
    }

    .cg-phone {
        right: 4%;
        bottom: 6%;
        width: 28%;
        border-width: 4px;
        border-radius: 16px;
    }

    .cg-phone-camera {
        top: 4px;
        height: 6px;
    }

    .cg-preview-action {
        left: 4%;
        bottom: 5%;
        max-width: 61%;
        padding-inline: 10px;
        font-size: 12px;
    }

    .cg-card-copy {
        padding: 21px 19px 23px;
    }

    .cg-card-title {
        font-size: 26px;
    }

    .cg-card-description {
        font-size: 15px;
    }

    .cg-card-actions {
        gap: 6px 13px;
    }

    .cg-open,
    .cg-choose {
        font-size: 13px;
    }

    .cg-disclosure {
        margin-top: 9px;
        text-align: left;
    }

}

@media (max-width: 700px) {
    .cg-dialog {
        inset: 24px 0 0;
        width: 100%;
        height: calc(100vh - 24px);
        height: calc(100dvh - 24px);
        max-height: none;
        margin: 0;
        border-radius: 22px 22px 0 0;
    }

    .cg-dialog-header {
        grid-template-columns: minmax(0, 1fr) 44px;
        grid-template-rows: 44px auto;
        gap: 12px 8px;
        min-height: 113px;
        padding: 20px 16px 10px;
    }

    .cg-grabber {
        position: absolute;
        top: 8px;
        left: calc(50% - 18px);
        display: block;
        width: 36px;
        height: 4px;
        border-radius: 4px;
        background: #d3cbbc;
    }

    .cg-switch-wrap {
        grid-column: 1;
        grid-row: 1;
    }

    .cg-close-wrap {
        grid-column: 2;
        grid-row: 1;
    }

    .cg-escape {
        display: none;
    }

    .cg-dialog-heading {
        grid-column: 1 / -1;
        grid-row: 2;
        gap: 12px;
    }

    .cg-dialog-category {
        font-size: 11px;
        letter-spacing: 1px;
    }

    .cg-dialog[data-device="desktop"] .cg-dialog-toolbar {
        display: flex;
        flex: none;
        align-items: center;
        justify-content: space-between;
        gap: 16px;
        padding: 10px 16px;
        border-bottom: 1px solid #ddd6c6;
        background: #fbf6e8;
    }

    .cg-stage {
        padding: 12px;
    }

    .cg-dialog[data-device="desktop"] .cg-preview-window {
        margin: 0 auto;
    }

    .cg-dialog[data-device="mobile"] .cg-stage {
        overflow: hidden;
        padding: 0;
        background: #fff;
    }

    .cg-dialog[data-device="mobile"] .cg-preview-window {
        margin: 0;
        border: 0;
        border-radius: 0;
        background: #fff;
        box-shadow: none;
    }

    .cg-dialog[data-device="mobile"] .cg-viewport {
        border-radius: 0;
    }

    .cg-preview-error {
        padding: 18px;
    }
}

@media (max-width: 360px) {
    .cg-dialog-heading {
        gap: 8px;
    }

    .cg-dialog-category {
        font-size: 11px;
        letter-spacing: .5px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .cg-track {
        scroll-behavior: auto;
    }

    .cg-desktop,
    .cg-phone {
        transition: none;
    }

    .cg-preview:hover .cg-desktop,
    .cg-preview:hover .cg-phone {
        transform: none;
    }
}
