/* =============================================================================
   me-photo-tiles.css — Photo tile grid component
   Version: 1.0

   USAGE
   -----
   Container:  <div class="me-photo-tiles [me-photo-tiles--N]">
   Item:       <div class="me-photo-tile">  (or <a> for linked tiles)
   Elements:   me-photo-tile-photo      — <img> background photo
               me-photo-tile-overlay    — gradient overlay <div>
               me-photo-tile-content    — content wrapper
               me-photo-tile-title      — heading text
               me-photo-tile-desc       — short description (optional)
               me-photo-tile-bullets    — <ul> reveal-on-hover bullet list (optional)
               me-photo-tile-link       — "Explore →" link line (optional)

   COLUMN MODIFIERS  (add alongside me-photo-tiles)
   -----------------
   me-photo-tiles--2   2 columns
   me-photo-tiles--3   3 columns
   me-photo-tiles--4   4 columns  (same as default — explicit is fine)
   me-photo-tiles--5   5 columns
   me-photo-tiles--6   6 columns

   THEMING
   -------
   Override --me-photo-tile-accent on the container (or any ancestor) to change
   the accent colour used for the hover bar, bullet dots, and link text:

       .my-section { --me-photo-tile-accent: #E47D22; }

   Override --me-photo-tile-height to change the minimum tile height.

   RESPONSIVE BEHAVIOUR
   --------------------
   Modifier     ≥992px   768–991px   <768px   <576px
   (default/4)    4         2           2        1
   --2            2         2           2        1
   --3            3         3           2        1
   --5            5         3           2        1
   --6            6         3           2        1

   ============================================================================= */


/* ============================================
   Variables
   ============================================ */
:root {
    --me-photo-tile-accent:  #CC1F1F;   /* ME brand red — override per section */
    --me-photo-tile-gap:     4px;
    --me-photo-tile-height:  320px;
}


/* ============================================
   Grid container
   ============================================ */
.me-photo-tiles {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--me-photo-tile-gap);
    margin-top: clamp(2.5rem, 5vw, 4.5rem);
    margin-bottom: clamp(2.5rem, 5vw, 4.5rem);
}


/* ---- Column-count modifiers ---- */
.me-photo-tiles-3 { grid-template-columns: repeat(3, 1fr); }
.me-photo-tiles-4 { grid-template-columns: repeat(4, 1fr); }
.me-photo-tiles-5 { grid-template-columns: repeat(5, 1fr); }
.me-photo-tiles-6 { grid-template-columns: repeat(6, 1fr); }


/* ============================================
   Tile
   ============================================ */
.me-photo-tile {
    position: relative;
    min-height: var(--me-photo-tile-height);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

/* Accent bar — slides in from left on hover */
.me-photo-tile::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--me-photo-tile-accent);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.22s ease;
    z-index: 2;
}
.me-photo-tile:hover::before {
    transform: scaleX(1);
}


/* ---- Photo ---- */
.me-photo-tile > picture {
    position: absolute;
    inset: 0;
    overflow: hidden;
}
.me-photo-tile-photo {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.35s ease;
}
.me-photo-tile:hover .me-photo-tile-photo {
    transform: scale(1.04);
}


/* ---- Overlay ---- */
.me-photo-tile-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.82) 0%, rgba(0,0,0,0.28) 52%, rgba(0,0,0,0) 100%);
    pointer-events: none;
    z-index: 1;
}


/* ---- Content ---- */
/* .me-photo-tiles parent scope wins specificity over the embedded copy in me-keylink.css */
.me-photo-tiles .me-photo-tile-content {
    position: relative;
    z-index: 2;
    padding: 0 18px 18px;
    height: auto;
}

.me-photo-tile-title {
    font-size: calc(var(--legacy-rem) * 1.305px);
    font-weight: 500;
    letter-spacing: -0.02em;
    color: #fff;
    line-height: 1.25;
    margin-bottom: 10px;
}

.me-photo-tile-desc {
    color: rgba(255,255,255,0.90);
    line-height: 1.6;
    margin-bottom: 8px;
    transition: color 0.16s;
}


/* ---- Bullets (revealed on hover) ---- */
.me-photo-tile-bullets {
    list-style: none;
    margin: 0 0 16px;
    padding: 0;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.3s ease, opacity 0.25s ease;
}
.me-photo-tile:hover .me-photo-tile-bullets {
    max-height: 160px;
    opacity: 1;
}
.me-photo-tile-bullets li {
    color: rgba(255,255,255,0.65);
    font-size: calc(var(--legacy-rem) * 0.7425px);
    line-height: 1.5;
    padding: 2px 0 2px 16px;
    position: relative;
}
.me-photo-tile-bullets li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 9px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--me-photo-tile-accent);
}


/* ---- Link ---- */
.me-photo-tile-link,
#m_main .me-photo-tile-link {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: calc(var(--legacy-rem) * 1.1175px);
    font-weight: 500;
    letter-spacing: 0.02em;
    color: var(--me-photo-tile-accent);
    transition: color 0.16s;
}
.me-photo-tile:hover .me-photo-tile-link,
#m_main .me-photo-tile:hover .me-photo-tile-link {
    color: #fff;
}
.me-photo-tile-link svg {
    width: 19px; height: 19px;
    stroke: currentColor; fill: none;
    stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round;
    transition: transform 0.16s;
}
.me-photo-tile:hover .me-photo-tile-link svg {
    transform: translateX(3px);
}
/* ============================================
   Section wrapper — owns the vertical breathing room
   so the header and grid share one unified block.
   ============================================ */
section:has(.me-photo-tiles) {
    margin-top: 2rem;
    margin-bottom: 2rem;
}

/* Grid no longer needs its own top/bottom margin when inside the section */
section:has(.me-photo-tiles) .me-photo-tiles {
    margin-top: 0;
    margin-bottom: 0;
}


/* ============================================
   Section header (title + Browse All link)
   ============================================ */
.me-photo-tiles-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 10px;
    margin-bottom: 10px;
    border-bottom: 1px solid rgba(0,0,0,0.12);
}
.me-photo-tiles-heading,
#m_main .me-photo-tiles-heading {
    font-size: calc(var(--legacy-rem) * 1.125px);
    font-weight: 600;
    letter-spacing: -0.01em;
    color: #222;
    margin: 0;
    line-height: 1.2;
}
.me-photo-tiles-browse-all {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: calc(var(--legacy-rem) * 0.875px);
    font-weight: 500;
    color: var(--me-photo-tile-accent);
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
    transition: color 0.16s;
}
.me-photo-tiles-browse-all:hover {
    color: #111;
}
.me-photo-tiles-browse-all svg {
    width: 14px; height: 14px;
    stroke: currentColor; fill: none;
    stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round;
    transition: transform 0.16s;
}
.me-photo-tiles-browse-all:hover svg {
    transform: translateX(3px);
}
html.me-sv-4 .me-photo-tiles-heading,
html.me-sv-4 #m_main .me-photo-tiles-heading { font-size: 20px; }
html.me-sv-4 .me-photo-tiles-browse-all      { font-size: 14px; }


/* ============================================
   Temporary override while lifestyle photos are pending.
   Identical to standard tiles but uses object-fit: contain
   so product PNGs don't crop. Swap back to cover when
   full-bleed photos are in place.
   ============================================ */
.me-photo-tiles-cards .me-photo-tile {
    background: #111;
}
.me-photo-tiles-cards .me-photo-tile-photo {
    object-fit: cover;
}


/* Constrained shell: taller tiles are too large at reduced width */
#ecPageShell.constrained .me-photo-tile {
    min-height: 320px;
}
/* Constrained shell: default 4-col tile grid becomes 2x2 — only above mobile */
@media (min-width: 768px) {
    #ecPageShell .me-photo-tiles {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Constrained shell: default 4-col tile grid becomes 2x2 */
#ecPageShell.constrained .me-photo-tiles--3 {
    grid-template-columns: repeat(3, 1fr);
}

.me-sv-4 .me-photo-tiles {
    grid-template-columns: repeat(1fr);
}

/* ============================================
   Responsive
   ============================================ */

/* Tablet (<992px): wider grids drop down */
@media (max-width: 991.98px) {
    .me-photo-tiles-3                           { grid-template-columns: repeat(2, 1fr); }
    .me-photo-tiles-4                           { grid-template-columns: repeat(2, 1fr); }
    .me-photo-tiles-5,
    .me-photo-tiles-6                           { grid-template-columns: repeat(3, 1fr); }
}

/* Mobile (<768px): all collapse to 1 col, bullets always visible */
@media (max-width: 767.98px) {
    .me-photo-tiles,
    .me-photo-tiles-3,
    .me-photo-tiles-4,
    .me-photo-tiles-5,
    .me-photo-tiles-6                           { grid-template-columns: 1fr; }
    .me-photo-tile                              { min-height: 380px; }
    .me-photo-tile-bullets                      { max-height: 160px; opacity: 1; }
}
