/* =============================================================================
   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(4, 1fr);
    gap: var(--me-photo-tile-gap);
}


/* ---- Column-count modifiers ---- */
.me-photo-tiles--2 { grid-template-columns: repeat(2, 1fr); }
.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-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-tile-content {
    position: relative;
    z-index: 2;
    padding: 0 24px 24px;
}

.me-photo-tile-title {
    font-size: 1.375rem;
    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: 0.8125rem;
    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 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1875rem;
    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 {
    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);
}
/* 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 */
#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);
}


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

/* Tablet (<992px)
   default/--4 → 2 cols
   --3         → stays 3
   --5/--6     → drop to 3
   --2         → stays 2 (no change) */
@media (max-width: 991.98px) {
    .me-photo-tiles                             { grid-template-columns: repeat(2, 1fr); }
    .me-photo-tiles--3                          { grid-template-columns: repeat(3, 1fr); }
    .me-photo-tiles--5,
    .me-photo-tiles--6                          { grid-template-columns: repeat(3, 1fr); }
}

/* Mobile (<768px): all collapse to 2 cols, tiles taller, content always visible */
@media (max-width: 767.98px) {
    .me-photo-tiles,
    .me-photo-tiles--3,
    .me-photo-tiles--5,
    .me-photo-tiles--6                          { grid-template-columns: repeat(2, 1fr); }
    .me-photo-tile                              { min-height: 420px; }
    .me-photo-tile-bullets                      { max-height: 160px; opacity: 1; }
    /* Constrained shell: default 4-col tile grid becomes 2x2 */
#ecPageShell .me-photo-tiles {
    grid-template-columns: repeat(1, 1fr);
}
}

/* XS (<576px): all collapse to 1 col */
@media (max-width: 575.98px) {
    .me-photo-tiles,
    .me-photo-tiles--2,
    .me-photo-tiles--3,
    .me-photo-tiles--5,
    .me-photo-tiles--6                          { grid-template-columns: 1fr; }
}
