/* ═══════════════════════════════════════════════
   Chancery Gallery Widget — Styles
   Berry Crimson #A62461 / Teal Mint #7ABFB8
   Raleway / Open Sans
   ═══════════════════════════════════════════════ */

.cdg-gallery {
    --berry: #A62461;
    --berry-dark: #8a1e51;
    --berry-light: rgba(166,36,97,0.08);
    --teal: #7ABFB8;
    --teal-dark: #5fa9a1;
    --teal-light: rgba(122,191,184,0.12);
    --bg: #fcfbfa;
    --bg-card: #ffffff;
    --text-primary: #2a2a2f;
    --text-secondary: #6e6e7a;
    --pill-border: #d8d4cf;
    --shadow-soft: 0 4px 24px rgba(42,42,47,0.06);
    --shadow-card: 0 8px 40px rgba(42,42,47,0.10);
    --shadow-elevated: 0 20px 60px rgba(166,36,97,0.12);
    --radius-pill: 100px;
    --radius-card: 16px;
    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 80px 24px 60px;
    font-family: 'Open Sans', sans-serif;
    color: var(--text-primary);
    position: relative;
}

/* ─── HEADER ─── */
.cdg-gallery__header {
    text-align: center;
    margin-bottom: 48px;
    animation: cdgFadeUp 0.8s var(--ease-out) both;
}

.cdg-gallery__label {
    font-family: 'Raleway', sans-serif;
    font-weight: 600;
    font-size: 0.75rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--teal-dark);
    margin-bottom: 16px;
    display: block;
}

.cdg-gallery__title {
    font-family: 'Raleway', sans-serif;
    font-weight: 700;
    font-size: clamp(2rem, 5vw, 3.25rem);
    line-height: 1.15;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.cdg-gallery__subtitle {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-secondary);
    max-width: 440px;
    margin: 0 auto;
}

/* ─── FILTER PILLS ─── */
.cdg-gallery__filters {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 56px;
    animation: cdgFadeUp 0.8s 0.15s var(--ease-out) both;
}

.cdg-pill {
    appearance: none;
    border: 1.5px solid var(--pill-border);
    background: transparent;
    color: var(--text-primary);
    font-family: 'Raleway', sans-serif;
    font-weight: 500;
    font-size: 0.875rem;
    padding: 10px 22px;
    border-radius: var(--radius-pill);
    cursor: pointer;
    transition: all 0.35s var(--ease-out);
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}

.cdg-pill::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--berry);
    border-radius: inherit;
    transform: scale(0);
    transition: transform 0.4s var(--ease-spring);
    z-index: 0;
}

.cdg-pill span {
    position: relative;
    z-index: 1;
    transition: color 0.3s var(--ease-out);
}

.cdg-pill:hover {
    border-color: var(--berry);
    transform: translateY(-1px);
    box-shadow: var(--shadow-soft);
}

.cdg-pill.active {
    border-color: var(--berry);
    color: #fff;
}

.cdg-pill.active::before {
    transform: scale(1);
}

.cdg-pill.active span {
    color: #fff;
}

.cdg-pill--vm {
    border-style: dashed;
    border-color: var(--teal);
    gap: 6px;
    display: inline-flex;
    align-items: center;
    color: var(--teal-dark);
    text-decoration: none;
}

.cdg-pill--vm span { color: var(--teal-dark); }

.cdg-pill--vm svg {
    transition: transform 0.3s var(--ease-out);
    stroke: var(--teal-dark);
}

.cdg-pill--vm:hover {
    border-color: var(--teal-dark);
    transform: translateY(-1px);
}

.cdg-pill--vm:hover svg {
    transform: translateX(3px);
}

/* ─── CAROUSEL ─── */
.cdg-gallery__carousel {
    position: relative;
    width: 100%;
    overflow: hidden;
    animation: cdgFadeUp 0.8s 0.3s var(--ease-out) both;
}

.cdg-gallery__track {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    height: 480px;
    perspective: 1200px;
}

/* ─── CARDS ─── */
.cdg-card {
    position: absolute;
    width: 340px;
    height: 440px;
    border-radius: var(--radius-card);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.6s var(--ease-out);
    will-change: transform, opacity;
    box-shadow: var(--shadow-card);
}

.cdg-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.6s var(--ease-out);
}

.cdg-card:hover img {
    transform: scale(1.05);
}

/* Overlay gradient */
.cdg-card::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(166,36,97,0.55) 0%, transparent 55%);
    opacity: 0;
    transition: opacity 0.4s var(--ease-out);
    pointer-events: none;
    border-radius: inherit;
}

.cdg-card:hover::after {
    opacity: 1;
}

/* Teal accent line on centre card */
.cdg-card[data-pos="center"]::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--teal);
    z-index: 10;
    transform: scaleX(0);
    transition: transform 0.5s var(--ease-out);
}

.cdg-card[data-pos="center"]:hover::before {
    transform: scaleX(1);
}

/* Meta overlay */
.cdg-card__meta {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 24px;
    z-index: 2;
    transform: translateY(10px);
    opacity: 0;
    transition: all 0.4s var(--ease-out);
}

.cdg-card:hover .cdg-card__meta {
    transform: translateY(0);
    opacity: 1;
}

.cdg-card__meta-title {
    font-family: 'Raleway', sans-serif;
    font-weight: 600;
    font-size: 0.9rem;
    color: #fff;
}

.cdg-card__meta-desc {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.8);
    margin-top: 4px;
}

/* Video badge */
.cdg-card__video {
    position: absolute;
    bottom: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(8px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3;
    box-shadow: 0 2px 12px rgba(0,0,0,0.15);
    transition: transform 0.3s var(--ease-spring);
    border: none;
    cursor: pointer;
}

.cdg-card__video:hover { transform: scale(1.1); }

.cdg-card__video svg {
    width: 14px;
    height: 14px;
    fill: var(--berry);
    margin-left: 2px;
}

/* ─── CARD POSITIONS ─── */
.cdg-card[data-pos="center"] {
    z-index: 5;
    transform: translateX(-50%) scale(1);
    left: 50%;
    box-shadow: var(--shadow-elevated);
}

.cdg-card[data-pos="left-1"] {
    z-index: 4;
    transform: translateX(calc(-50% - 280px)) scale(0.88) rotateY(6deg);
    left: 50%;
    opacity: 0.85;
}

.cdg-card[data-pos="right-1"] {
    z-index: 4;
    transform: translateX(calc(-50% + 280px)) scale(0.88) rotateY(-6deg);
    left: 50%;
    opacity: 0.85;
}

.cdg-card[data-pos="left-2"] {
    z-index: 3;
    transform: translateX(calc(-50% - 500px)) scale(0.75) rotateY(10deg);
    left: 50%;
    opacity: 0.5;
}

.cdg-card[data-pos="right-2"] {
    z-index: 3;
    transform: translateX(calc(-50% + 500px)) scale(0.75) rotateY(-10deg);
    left: 50%;
    opacity: 0.5;
}

.cdg-card[data-pos="hidden"] {
    z-index: 0;
    transform: translateX(-50%) scale(0.6);
    left: 50%;
    opacity: 0;
    pointer-events: none;
}

/* ─── NAV ─── */
.cdg-gallery__nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 40px;
    animation: cdgFadeUp 0.8s 0.45s var(--ease-out) both;
}

.cdg-gallery__nav-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 1.5px solid var(--pill-border);
    background: var(--bg-card);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s var(--ease-out);
    color: var(--text-primary);
}

.cdg-gallery__nav-btn:hover {
    background: var(--berry);
    border-color: var(--berry);
    color: #fff;
    transform: scale(1.08);
    box-shadow: 0 4px 16px rgba(166,36,97,0.25);
}

.cdg-gallery__nav-btn:active { transform: scale(0.95); }

.cdg-gallery__nav-btn svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.cdg-gallery__counter {
    font-family: 'Raleway', sans-serif;
    font-weight: 500;
    font-size: 0.85rem;
    color: var(--text-secondary);
    min-width: 50px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

/* ─── EMPTY STATE ─── */
.cdg-gallery__empty {
    text-align: center;
    padding: 80px 24px;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* ─── ANIMATIONS ─── */
@keyframes cdgFadeUp {
    from { opacity: 0; transform: translateY(24px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ─── RESPONSIVE ─── */
@media (max-width: 1024px) {
    .cdg-card { width: 280px; height: 380px; }
    .cdg-card[data-pos="left-1"]  { transform: translateX(calc(-50% - 220px)) scale(0.88) rotateY(6deg); }
    .cdg-card[data-pos="right-1"] { transform: translateX(calc(-50% + 220px)) scale(0.88) rotateY(-6deg); }
    .cdg-card[data-pos="left-2"],
    .cdg-card[data-pos="right-2"] { opacity: 0; pointer-events: none; }
    .cdg-gallery__track { height: 420px; }
}

@media (max-width: 768px) {
    .cdg-gallery { padding: 56px 16px 48px; }
    .cdg-gallery__header { margin-bottom: 32px; }
    .cdg-gallery__filters { gap: 8px; margin-bottom: 40px; }
    .cdg-pill { font-size: 0.8rem; padding: 8px 16px; }
    .cdg-card { width: 240px; height: 340px; border-radius: 14px; }
    .cdg-card[data-pos="left-1"]  { transform: translateX(calc(-50% - 170px)) scale(0.85) rotateY(8deg); }
    .cdg-card[data-pos="right-1"] { transform: translateX(calc(-50% + 170px)) scale(0.85) rotateY(-8deg); }
    .cdg-gallery__track { height: 380px; }
}

@media (max-width: 520px) {
    .cdg-gallery { padding: 40px 12px 36px; }
    .cdg-gallery__filters { gap: 6px; margin-bottom: 32px; padding: 0 4px; }
    .cdg-pill { font-size: 0.75rem; padding: 7px 14px; }
    .cdg-card { width: 220px; height: 300px; border-radius: 12px; }
    .cdg-card[data-pos="left-1"]  { transform: translateX(calc(-50% - 140px)) scale(0.82) rotateY(10deg); opacity: 0.7; }
    .cdg-card[data-pos="right-1"] { transform: translateX(calc(-50% + 140px)) scale(0.82) rotateY(-10deg); opacity: 0.7; }
    .cdg-gallery__track { height: 340px; }
    .cdg-gallery__nav { margin-top: 28px; }
    .cdg-gallery__nav-btn { width: 42px; height: 42px; }
}

@media (max-width: 380px) {
    .cdg-card { width: 190px; height: 270px; }
    .cdg-card[data-pos="left-1"]  { transform: translateX(calc(-50% - 115px)) scale(0.8) rotateY(10deg); }
    .cdg-card[data-pos="right-1"] { transform: translateX(calc(-50% + 115px)) scale(0.8) rotateY(-10deg); }
    .cdg-gallery__track { height: 300px; }
}
