/* =======================================================================
   Color Discovery — Editorial Tile Grid (warm brown, v2)
   Loaded by inc/footer.php via its own <link> tag, no header.php changes.
   All selectors are cd2-prefixed to avoid collision with legacy rules.
   ======================================================================= */

.cd2 {
    position: relative;
    isolation: isolate;
    padding: 4.5rem 1.5rem 4rem;
    /* Warm espresso brown with a soft radial highlight at the top */
    background:
        radial-gradient(1400px 500px at 50% -10%, #4a3624 0%, #2b1c11 60%, #1f1309 100%),
        #1f1309;
    color: #f2e7d1;
    overflow: hidden;
}
.cd2::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0.05;
    mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.7 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
    z-index: 0;
}
.cd2::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    width: min(260px, 45%);
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(210,175,110,0.6), transparent);
    z-index: 1;
}

.cd2-inner {
    position: relative;
    z-index: 2;
    max-width: 960px;
    margin: 0 auto;
    text-align: center;
}

/* --- Eyebrow --- */
.cd2-eyebrow {
    margin: 0 0 0.9rem;
    font-family: 'Heebo', system-ui, -apple-system, sans-serif;
    font-size: 0.74rem;
    font-weight: 600;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: #d2af6e; /* warmer, brighter gold on brown */
}
html[dir="rtl"] .cd2-eyebrow { text-transform: none; letter-spacing: 0.16em; }

/* --- Heading — bright white, modern sans.
       Double-class selector beats the site's `body[data-skin] h2` rule. --- */
.cd2 .cd2-heading {
    margin: 0;
    font-family: 'Heebo', 'Assistant', 'Rubik', system-ui, -apple-system, sans-serif;
    font-weight: 800;
    font-size: clamp(1.9rem, 3vw, 2.5rem);
    line-height: 1.15;
    letter-spacing: 0.01em;
    color: #ffffff;
}
html[dir="rtl"] .cd2 .cd2-heading { letter-spacing: 0; font-weight: 800; }

/* --- Gold hairline rule --- */
.cd2-rule {
    display: block;
    width: 64px;
    height: 1px;
    margin: 1.2rem auto 1.2rem;
    background: #d2af6e;
    opacity: 0.9;
}

/* --- Subtitle --- */
.cd2-sub {
    margin: 0 auto 2.2rem;
    max-width: 520px;
    font-family: 'Heebo', system-ui, -apple-system, sans-serif;
    font-size: 0.92rem;
    font-weight: 400;
    line-height: 1.6;
    color: #c4b693;
    letter-spacing: 0.04em;
}

/* --- Single row of 12 on desktop --- */
.cd2-list {
    list-style: none;
    margin: 0 auto;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 10px;
    max-width: 1200px;
}
.cd2-item { margin: 0; padding: 0; }

/* --- Tile (each color): vertical, color block on top, label below --- */
.cd2-pill {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0;
    background: rgba(255, 230, 195, 0.035);
    border: 1px solid rgba(210, 175, 110, 0.18);
    border-radius: 4px;
    overflow: hidden;
    color: #f2e7d1;
    text-decoration: none;
    font-family: 'Heebo', 'Assistant', 'Rubik', system-ui, -apple-system, sans-serif;
    font-weight: 500;
    text-align: center;
    transition: transform 260ms ease, border-color 260ms ease, background 260ms ease, box-shadow 260ms ease;
    position: relative;
}

/* --- Color block — the HERO, but refined --- */
.cd2-swatch {
    display: block;
    width: 100%;
    height: 48px;
    border-radius: 0;
    background: var(--sw, #888);
    box-shadow:
        inset 0 -1px 0 rgba(0,0,0,0.25),
        inset 0 1px 0 rgba(255,255,255,0.12);
    flex-shrink: 0;
    transition: filter 260ms ease;
}
.cd2-pill.is-white .cd2-swatch {
    box-shadow:
        inset 0 0 0 1px rgba(0,0,0,0.15),
        inset 0 -1px 0 rgba(0,0,0,0.08);
}
.cd2-pill.is-black .cd2-swatch {
    box-shadow:
        inset 0 -1px 0 rgba(255,255,255,0.08),
        inset 0 1px 0 rgba(255,255,255,0.18);
}

/* --- Label below the color block --- */
.cd2-label {
    display: block;
    padding: 7px 4px 8px;
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1;
    letter-spacing: 0.02em;
    color: #f2e7d1;
    position: relative;
    white-space: nowrap;
}
html[dir="rtl"] .cd2-label { letter-spacing: 0; font-size: 0.84rem; }

/* --- Hover --- */
@media (hover: hover) {
    .cd2-pill:hover {
        transform: translateY(-3px);
        border-color: rgba(210, 175, 110, 0.55);
        background: rgba(255, 230, 195, 0.07);
        box-shadow: 0 8px 20px rgba(0,0,0,0.35), 0 2px 6px rgba(0,0,0,0.2);
    }
    .cd2-pill:hover .cd2-swatch { filter: brightness(1.08) saturate(1.08); }
    .cd2-pill:hover .cd2-label { color: #fff; }
}

/* --- Keyboard focus --- */
.cd2-pill:focus-visible {
    outline: 2px solid #d2af6e;
    outline-offset: 3px;
    border-color: rgba(210, 175, 110, 0.55);
    background: rgba(255, 230, 195, 0.07);
}

/* --- Active press --- */
.cd2-pill:active { transform: translateY(-1px); }
.cd2-pill:active .cd2-swatch { filter: brightness(0.94); }

/* --- Tablet: 6×2 --- */
@media (max-width: 900px) {
    .cd2 { padding: 3.5rem 1.25rem 3rem; }
    .cd2 .cd2-heading { font-size: clamp(1.6rem, 4vw, 2.1rem); }
    .cd2-sub { margin-bottom: 1.6rem; font-size: 0.88rem; }
    .cd2-list { grid-template-columns: repeat(6, 1fr); gap: 10px; max-width: 680px; }
    .cd2-swatch { height: 46px; }
}

/* --- Mobile: 4×3 --- */
@media (max-width: 600px) {
    .cd2 { padding: 2.75rem 1rem 2.5rem; }
    .cd2-eyebrow { font-size: 0.68rem; letter-spacing: 0.18em; }
    .cd2 .cd2-heading { font-size: 1.6rem; }
    .cd2-rule { width: 48px; margin: 0.85rem auto; }
    .cd2-sub { font-size: 0.84rem; margin-bottom: 1.3rem; }
    .cd2-list { grid-template-columns: repeat(4, 1fr); gap: 8px; max-width: 420px; }
    .cd2-swatch { height: 44px; }
    .cd2-label { font-size: 0.8rem; padding: 6px 3px 8px; }
    html[dir="rtl"] .cd2-label { font-size: 0.82rem; }
}

/* --- Small phone: 3×4 --- */
@media (max-width: 380px) {
    .cd2-list { grid-template-columns: repeat(3, 1fr); gap: 6px; }
    .cd2-swatch { height: 42px; }
    .cd2-label { font-size: 0.78rem; }
    html[dir="rtl"] .cd2-label { font-size: 0.8rem; }
}

/* --- Reduced motion --- */
@media (prefers-reduced-motion: reduce) {
    .cd2-pill,
    .cd2-swatch { transition: none; }
    .cd2-pill:hover { transform: none; }
}

/* --- Print --- */
@media print {
    .cd2 { background: #fff; color: #111; padding: 1rem 0; }
    .cd2::before, .cd2::after { display: none; }
    .cd2 .cd2-heading, .cd2 .cd2-eyebrow, .cd2 .cd2-sub { color: #111; }
    .cd2-pill { background: #fff; border-color: #bbb; color: #111; }
}
