/* ==========================================================
   Cabinet Door Styles & Colors — Royal Kitchen & Bathroom
   File: /css/cabinet-doors.css
   All classes are prefixed "cd-" so they never clash with
   styles.css or cabinets.css.
   ========================================================== */

:root {
    --cd-gold: #d4a72c;
    --cd-gold-hover: #e8bd3f;
    --cd-card-bg: #e6e6e4;      /* light gray label area (was black) */
    --cd-card-border: #d4d4d2;
    --cd-text: #f2f2f2;
    --cd-muted: #aaa;
    --cd-door-bg: #ffffff;      /* clean white behind the door, like the USCD flyer */
    --cd-name: #1a1a1a;         /* color name: black */
    --cd-style-pill: #8a8a88;   /* gray pill behind the white style name */
}

/* Smooth scrolling for the jump buttons */
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
}

/* Leaves a little breathing room above the section title when jumping */
#cabinet-styles,
#cabinet-projects { scroll-margin-top: 20px; }

/* ---------- Jump buttons ---------- */
.cd-jump-btn {
    display: inline-block;
    margin-top: 18px;
    padding: 12px 28px;
    background: var(--cd-gold);
    color: #111 !important;
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: .3px;
    border-radius: 6px;
    text-decoration: none !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .35);
    transition: background .2s, transform .2s;
}
.cd-jump-btn:hover,
.cd-jump-btn:focus-visible {
    background: var(--cd-gold-hover);
    transform: translateY(-2px);
}
.cd-jump-wrap {
    text-align: center;
    margin: 34px 0 10px;
}

/* ---------- Section ---------- */
.cd-section { padding: 50px 0 30px; }
.cd-projects { padding-top: 40px; }

.cd-section-title {
    color: var(--cd-gold);
    text-align: center;
    font-size: 2rem;
    margin: 0 0 12px;
}
.cd-section-intro {
    color: #ddd;
    text-align: center;
    max-width: 760px;
    margin: 0 auto 28px;
    line-height: 1.6;
}

/* ---------- Brand filter (shows only when 2+ brands) ---------- */
.cd-filter {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-bottom: 30px;
}
.cd-filter-btn {
    background: #2a2a2a;
    color: var(--cd-text);
    border: 1px solid #555;
    border-radius: 4px;
    padding: 9px 20px;
    font-weight: 700;
    font-size: .85rem;
    cursor: pointer;
    transition: background .2s, color .2s, border-color .2s;
}
.cd-filter-btn:hover { border-color: var(--cd-gold); }
.cd-filter-btn.active {
    background: var(--cd-gold);
    border-color: var(--cd-gold);
    color: #111;
}

.cd-filter[hidden],
.cd-brand[hidden] { display: none !important; }

/* ---------- Brand block ---------- */
.cd-brand { margin-bottom: 44px; }
.cd-brand-header {
    display: flex;
    align-items: center;
    gap: 14px;
    border-bottom: 2px solid var(--cd-gold);
    padding-bottom: 10px;
    margin-bottom: 8px;
}
.cd-brand-header img {
    height: 42px;
    width: auto;
    background: #fff;
    border-radius: 4px;
    padding: 4px 8px;
}
.cd-brand-name {
    color: var(--cd-text);
    font-size: 1.5rem;
    margin: 0;
}
.cd-brand-count {
    margin-left: auto;
    color: var(--cd-muted);
    font-size: .9rem;
}

/* ---------- Style family ---------- */
.cd-style-title {
    color: var(--cd-gold);
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 24px 0 12px;
}

/* ---------- Door grid & cards ---------- */
.cd-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);   /* 4 doors per row on desktop */
    gap: 20px;
}
.cd-card {
    display: flex;
    flex-direction: column;
    background: var(--cd-card-bg);
    border: 1px solid var(--cd-card-border);
    border-radius: 8px;
    padding: 0;
    overflow: hidden;
    cursor: pointer;
    text-align: center;
    font: inherit;
    color: inherit;
    transition: border-color .2s, transform .2s, box-shadow .2s;
}
.cd-card:hover,
.cd-card:focus-visible {
    border-color: var(--cd-gold);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, .30);
    outline: none;
}
.cd-img-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 3 / 4;
    background: var(--cd-door-bg);
    padding: 14px;
}
.cd-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: contain;   /* scales the door up to fill the card, no cropping */
    display: block;
    /* soft shadow under the door, like the USCD flyer */
    filter: drop-shadow(4px 8px 10px rgba(0, 0, 0, .22));
}
.cd-label { padding: 12px 8px 14px; }
.cd-color {
    display: block;
    color: var(--cd-name);
    font-weight: 600;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: .8px;
}
.cd-style {
    display: inline-block;
    margin-top: 6px;
    padding: 2px 10px;
    border-radius: 10px;
    background: var(--cd-style-pill);
    color: #fff;
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .8px;
}

/* Image not uploaded yet / wrong file name */
.cd-card.cd-missing { cursor: default; opacity: .6; }
.cd-card.cd-missing img { display: none; }
.cd-card.cd-missing .cd-img-wrap::after {
    content: "Image coming soon";
    color: #777;
    font-size: .8rem;
}

/* ---------- Lightbox ---------- */
.cd-lightbox {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0, 0, 0, .92);
}
.cd-lightbox.open { display: flex; }
.cd-lightbox img {
    /* Force the door to fill the screen height, even if the PNG is small */
    height: 78vh;
    width: auto;
    max-width: 88vw;
    object-fit: contain;
    background: var(--cd-door-bg);
    padding: 24px;
    border-radius: 8px;
}
.cd-lb-caption {
    color: var(--cd-gold);
    font-size: 1.3rem;
    font-weight: 700;
    margin-top: 16px;
    text-align: center;
}
.cd-lb-counter {
    color: var(--cd-muted);
    font-size: .85rem;
    margin-top: 4px;
}
.cd-lb-close,
.cd-lb-nav {
    position: absolute;
    background: rgba(255, 255, 255, .1);
    border: 1px solid rgba(255, 255, 255, .25);
    color: #fff;
    cursor: pointer;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    font-size: 1.5rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .2s, color .2s;
}
.cd-lb-close:hover,
.cd-lb-nav:hover { background: var(--cd-gold); color: #111; }
.cd-lb-close { top: 18px; right: 18px; font-size: 2rem; }
.cd-lb-prev  { left: 18px;  top: 50%; transform: translateY(-50%); }
.cd-lb-next  { right: 18px; top: 50%; transform: translateY(-50%); }

body.cd-lock { overflow: hidden; }

/* ---------- Tablet: 3 per row ---------- */
@media (max-width: 900px) {
    .cd-grid { grid-template-columns: repeat(3, 1fr); gap: 16px; }
}

/* ---------- Mobile: 2 per row ---------- */
@media (max-width: 600px) {
    .cd-section-title { font-size: 1.6rem; }
    .cd-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    .cd-brand-name { font-size: 1.25rem; }
    .cd-jump-btn { padding: 11px 20px; font-size: .95rem; }
    .cd-lb-prev,
    .cd-lb-next { top: auto; bottom: 22px; transform: none; }
    .cd-lightbox img { height: auto; width: 88vw; max-height: 68vh; }
}

/* ==========================================================
   CLEAN "FLYER" LOOK — overrides the card styles above.
   Each brand sits on one white panel; doors float with a
   soft shadow and plain text underneath (no boxes/outlines).
   ========================================================== */
.cd-brand {
    background: #ffffff;
    border-radius: 10px;
    padding: 26px 28px 34px;
}
.cd-brand-header { border-bottom-color: #d9d9d9; }
.cd-brand-name   { color: #1a1a1a; }
.cd-brand-count  { color: #777; }
.cd-style-title  { color: #9a7412; }   /* darker gold, readable on white */

.cd-grid { gap: 28px 24px; }

.cd-card {
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
}
.cd-card:hover,
.cd-card:focus-visible {
    border: none;
    box-shadow: none;
    transform: translateY(-4px);
}
.cd-card:focus-visible { outline: 2px solid var(--cd-gold); outline-offset: 4px; }

.cd-img-wrap {
    background: transparent;
    padding: 6px 10px 0;
}
.cd-card:hover .cd-img-wrap img {
    filter: drop-shadow(6px 12px 14px rgba(0, 0, 0, .30));
}

.cd-label { background: transparent; padding: 12px 4px 0; }

@media (max-width: 600px) {
    .cd-brand { padding: 18px 14px 24px; }
    .cd-grid  { gap: 20px 14px; }
}

/* Enlarged view: no white box, just the door with a shadow */
.cd-lightbox img {
    background: transparent;
    padding: 0;
    border-radius: 0;
    filter: drop-shadow(8px 14px 18px rgba(0, 0, 0, .55));
}

/* ==========================================================
   ONE CONTINUOUS GRID (CSS-only, works with the original JS)
   Hides the family headings (Shaker, Oxford...) and lets all
   doors of a brand flow together, 4 per row.
   ========================================================== */
.cd-brand {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 28px 24px;
}
.cd-brand[hidden] { display: none !important; }
.cd-brand-header  { grid-column: 1 / -1; }   /* brand name spans the full width */
.cd-style-group,
.cd-brand .cd-grid { display: contents; }     /* doors join the brand grid directly */
.cd-style-title   { display: none; }          /* remove Shaker / Oxford / ... titles */

@media (max-width: 900px) {
    .cd-brand { grid-template-columns: repeat(3, 1fr); gap: 20px 16px; }
}
@media (max-width: 600px) {
    .cd-brand { grid-template-columns: repeat(2, 1fr); gap: 20px 14px; }
}
