/* MK Timeline — Vertical timeline with alternating image + description blocks. */

.mk-tl-section {
    padding: 80px 30px;
    background-color: #fff;
    text-align: center;
}

.mk-tl-section h2 {
    font-family: 'Playfair Display', serif;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--mk-dark, #1a1a1a);
    margin-bottom: 10px;
    text-align: center;
}

.mk-tl-subtitle {
    font-family: 'Open Sans', sans-serif;
    font-size: 1.1rem;
    color: #666;
    margin-bottom: 60px;
    text-align: center;
}

/* ── Timeline Container ──────────────────────────────── */

.mk-tl-timeline {
    position: relative;
    max-width: 1100px;
    margin: 0 auto;
    padding: 20px 0;
}

/* ── Vertical Line ───────────────────────────────────── */

.mk-tl-line {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 1px;
    background-color: var(--mk-border, #e0e0e0);
    /* Hard z-index 1 above the page background but below the entries.
       The piano-key dots get z-index:20 from inside .mk-tl-entry, but
       siblings of the line (entries) need their OWN stacking context
       above the line — see .mk-tl-entry rule below.                  */
    z-index: 1;
}

.mk-tl-layout--alternating .mk-tl-line {
    left: 50%;
    transform: translateX(-50%);
}

.mk-tl-layout--all-left .mk-tl-line {
    left: 30px;
}

.mk-tl-layout--all-right .mk-tl-line {
    right: 30px;
}

/* ── Entry ───────────────────────────────────────────── */

.mk-tl-entry {
    position: relative;
    /* z-index:2 establishes a stacking context above the timeline line
       (z-index:1) so that the dot/piano-key inside the entry — at
       z-index:20 RELATIVE to this entry's context — paints over the line.
       Without this, the dot's z-index is compared to the line's z-index
       in the parent (.mk-tl-timeline) context, and the line wins because
       it's later in the DOM order at the same effective level.        */
    z-index: 2;
    margin-bottom: 60px;
    display: flex;
    align-items: flex-start;
}

.mk-tl-entry:last-child {
    margin-bottom: 0;
}

/* Alternating layout positioning
 *
 * Each .mk-tl-entry now spans the full width of the timeline as a 2-column
 * grid. The center timeline line sits between the two columns, and inside
 * each entry the IMAGE and TEXT are placed in OPPOSITE columns:
 *
 *      ┌─── left half ───┬─── right half ───┐
 *      │     IMAGE       │      TEXT        │  ← entry--left
 *      ├─────────────────┼──────────────────┤
 *      │     TEXT        │      IMAGE       │  ← entry--right
 *      └─────────────────┴──────────────────┘
 *
 * The .mk-tl-content wrapper is laid out as a CSS Grid spanning columns
 * 1 / 3, and image/text are placed into grid-column 1 or 2 based on the
 * entry side.
 */
.mk-tl-layout--alternating .mk-tl-entry {
    width: 100%;
    display: block;          /* override the default flex on .mk-tl-entry */
    padding: 0;
}

.mk-tl-layout--alternating .mk-tl-entry--left {
    text-align: left;
}

.mk-tl-layout--alternating .mk-tl-entry--right {
    text-align: left;
}

/* All-left layout */
.mk-tl-layout--all-left .mk-tl-entry {
    padding-left: 70px;
    text-align: left;
}

/* All-right layout */
.mk-tl-layout--all-right .mk-tl-entry {
    padding-right: 70px;
    text-align: right;
    justify-content: flex-end;
}

/* ── Dot ─────────────────────────────────────────────── */

/* ── Dot / Year medallion ────────────────────────────── */
/*
 * In alternating mode the dot becomes a "piano key" — a glossy black
 * rectangular key, taller than it is wide, with a soft highlight on top
 * and a denser shadow underneath (the felt resting on the keybed).
 * In all-left / all-right modes it stays a small circular punctuation
 * dot.
 */
.mk-tl-dot {
    /* `!important` defends against the per-post Elementor sheet, which
       can emit higher-specificity rules from the widget's style controls
       that reset position to static and drop the stacking order. */
    position: absolute !important;
    width: 16px;
    height: 16px;
    background-color: var(--mk-dark, #1a1a1a);
    border: 3px solid var(--mk-dark, #1a1a1a);
    border-radius: 50%;
    /* Sit ABOVE the timeline line (z-index:1) AND above any sibling
       content (text/image) so the key visually pops in front of
       everything else in the timeline column. */
    z-index: 20 !important;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Alternating: dot becomes a 56×80px black piano key containing the year. */
.mk-tl-layout--alternating .mk-tl-dot {
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 56px;
    height: 80px;
    /* Rounded bottom edges only — top edges stay square like a real piano key.
       A subtle gradient from #2a2a2a (top, slightly lit) down to #0a0a0a
       (bottom, where the felt sits) gives the lacquer impression. */
    border-radius: 0 0 6px 6px;
    border: none;
    background: linear-gradient(
        to bottom,
        #2c2c2c 0%,
        #1a1a1a 35%,
        #0d0d0d 92%,
        #050505 100%
    );
    /* Outer drop shadow for depth, plus an inner highlight on the very
       top edge to mimic the polished lacquer of a real key. */
    box-shadow:
        0 6px 16px rgba(0, 0, 0, 0.35),
        inset 0 2px 0 rgba(255, 255, 255, 0.08),
        inset 0 -3px 0 rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

/* Soft horizontal highlight across the TOP of the key, suggesting the
   light catching on the polished surface. Horizontal — not vertical —
   so it doesn't visually echo the timeline line passing behind. */
.mk-tl-layout--alternating .mk-tl-dot::before {
    content: '';
    position: absolute;
    top: 4px;
    left: 6px;
    right: 6px;
    height: 12px;
    background: linear-gradient(
        to bottom,
        rgba(255, 255, 255, 0.18) 0%,
        rgba(255, 255, 255, 0.04) 80%,
        transparent 100%
    );
    border-radius: 3px;
    /* Background gloss should sit BEHIND the year text. */
    z-index: 0;
    pointer-events: none;
}

.mk-tl-layout--all-left .mk-tl-dot {
    left: 23px;
    top: 8px;
}

.mk-tl-layout--all-right .mk-tl-dot {
    right: 23px;
    top: 8px;
}

/* ── Year Label ──────────────────────────────────────── */
/*
 * In alternating mode the year sits INSIDE the dot medallion (a flexbox
 * child centred by the dot's display:flex). In all-left / all-right
 * modes the dot stays small and the year floats beside it.
 */
.mk-tl-year {
    white-space: nowrap;
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    color: var(--mk-dark, #1a1a1a);
}

/* Alternating: year is rendered inside the piano key in solid white,
   horizontally, big enough to read cleanly.
   `!important` is needed because Elementor's per-post generated CSS
   (post-44.css) emits a higher-specificity rule from the "Year Color"
   style control that would otherwise force #1a1a1a. */
.mk-tl-layout--alternating .mk-tl-year {
    color: #ffffff !important;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 1px;
    /* Sit ABOVE the key's gradient background and the gloss highlight. */
    position: relative;
    z-index: 2;
    transform: none;
    left: auto;
    right: auto;
    top: auto;
    /* Strong halo so the text reads cleanly against the dark gradient
       and the gloss highlight on top. */
    text-shadow:
        0 1px 2px rgba(0, 0, 0, 0.95),
        0 0 6px rgba(0, 0, 0, 0.6);
    /* Keep the year on a single line — "1910" / "1950s" should never wrap. */
    white-space: nowrap;
}

/* All-left / all-right: dot stays small, year floats below it. */
.mk-tl-layout--all-left .mk-tl-year,
.mk-tl-layout--all-right .mk-tl-year {
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.8rem;
}

/* ── Content wrapper (image + text on opposite sides of the timeline) ── */

.mk-tl-content {
    width: 100%;
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}

/*
 * For alternating layout we use CSS Grid: 2 equal columns with a gutter
 * around the timeline line. Image and text get placed into opposite
 * columns based on the entry side, so the timeline literally separates
 * them rather than running alongside the card.
 *
 * `align-items: center` vertically centres the text relative to the
 * paired image, so a short title sits at the visual mid-height of a
 * tall photograph instead of clinging to the top edge.
 */
.mk-tl-layout--alternating .mk-tl-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    /* Wide gap leaves clear breathing space around the 64px central year
       medallion — narrower than this and the medallion overlaps content. */
    column-gap: 120px;
    /* `stretch` makes both grid cells fill the row height. The text then
       centres itself within that full-height cell via the flex rule
       below — this is more reliable than `align-items: center` which can
       leave the text item small-sized and stacked at the bottom of the
       row when Elementor's per-post styles inject align-self overrides. */
    align-items: stretch;
    /* `!important` defeats Elementor's per-post generated CSS, which
       emits `background-color: #fff` from the widget's "Card Background"
       style control at a higher specificity than our base rule. */
    background: transparent !important;
    background-color: transparent !important;
    border-radius: 0;
    box-shadow: none;
}

/* Text item fills its grid cell and centres its lines vertically so it
   reads opposite the IMAGE's vertical midpoint on every row. */
.mk-tl-layout--alternating .mk-tl-text {
    align-self: stretch;
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: 100%;
    padding: 0;
}

/* For all-left / all-right layouts the card behaviour is unchanged. */
.mk-tl-layout--all-left .mk-tl-content,
.mk-tl-layout--all-right .mk-tl-content {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    overflow: hidden;
    display: flex;
    align-items: stretch;
}

.mk-tl-layout--all-left .mk-tl-content:hover,
.mk-tl-layout--all-right .mk-tl-content:hover {
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

/* ── Image ───────────────────────────────────────────── */

.mk-tl-image {
    overflow: hidden;
}

.mk-tl-image img {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 220px;
    object-fit: cover;
    object-position: 50% 50%;
    transition: transform 0.5s ease;
}

.mk-tl-image:hover img {
    transform: scale(1.03);
}

/* In alternating mode, force every image to the same 4:3 box so a tall
   portrait and a wide architectural shot occupy the same row height —
   otherwise `align-items: center` on the grid would still vertically
   centre the text against vastly different image heights, making it
   appear "too far down" on rows with very tall photographs.            */
.mk-tl-layout--alternating .mk-tl-image {
    aspect-ratio: 4 / 3;
    border-radius: 8px;
    /* Centre the image vertically within its (stretched) grid cell so
       it aligns with the text card's midpoint rather than hugging the
       top of the row. */
    align-self: center !important;
    justify-self: stretch;
    width: 100%;
}

.mk-tl-layout--alternating .mk-tl-image img {
    height: 100%;
    min-height: 0;
    border-radius: 8px;
}

/* All-left/all-right layouts keep the original card behaviour where
   image sits flush in the left/right side of the card. */
.mk-tl-layout--all-left .mk-tl-image,
.mk-tl-layout--all-right .mk-tl-image {
    flex: 0 0 45%;
    max-width: 45%;
    align-self: stretch;
}
.mk-tl-layout--all-left .mk-tl-image img,
.mk-tl-layout--all-right .mk-tl-image img {
    border-radius: 0;
    box-shadow: none;
}

/* ── Text ────────────────────────────────────────────── */

.mk-tl-text {
    padding: 25px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: left;
}

/* In alternating mode the text sits naked (no card chrome) so it reads
   as a clean editorial block alongside its image counterpart. */
.mk-tl-layout--alternating .mk-tl-text {
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
}

/* All-left / all-right keep the existing flex-fill behaviour inside the
   shared card. */
.mk-tl-layout--all-left .mk-tl-text,
.mk-tl-layout--all-right .mk-tl-text {
    flex: 1 1 auto;
}

/* ── Alternating: place image and text on opposite sides ── */

/* Entry on the LEFT side of the timeline: image goes in col 1 (left),
   text goes in col 2 (right). */
/*
 * IMPORTANT: place both items in `grid-row: 1` as well as their
 * respective columns. Without an explicit row, CSS Grid's auto-placement
 * algorithm sometimes spawns a second row to satisfy the column
 * constraints — which is what was causing the image and text to end up
 * stacked in two separate rows (image taking up row 1, text dropping
 * to row 2) instead of sitting opposite each other in the same row.
 */
.mk-tl-layout--alternating .mk-tl-entry--left .mk-tl-image {
    grid-column: 1;
    grid-row: 1;
}
.mk-tl-layout--alternating .mk-tl-entry--left .mk-tl-text {
    grid-column: 2;
    grid-row: 1;
}

/* Entry on the RIGHT side: text goes in col 1 (left), image in col 2. */
.mk-tl-layout--alternating .mk-tl-entry--right .mk-tl-image {
    grid-column: 2;
    grid-row: 1;
}
.mk-tl-layout--alternating .mk-tl-entry--right .mk-tl-text {
    grid-column: 1;
    grid-row: 1;
}

.mk-tl-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--mk-dark, #1a1a1a);
    margin-bottom: 10px;
    margin-top: 0;
}

.mk-tl-description {
    font-family: 'Open Sans', sans-serif;
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--mk-gray, #555);
}

.mk-tl-description p {
    margin-top: 0;
    margin-bottom: 10px;
}

.mk-tl-description p:last-child {
    margin-bottom: 0;
}

/* ── Responsive ──────────────────────────────────────── */

@media (max-width: 1024px) {
    .mk-tl-section h2 {
        font-size: 2rem;
    }

    .mk-tl-entry {
        margin-bottom: 40px;
    }
}

@media (max-width: 768px) {
    .mk-tl-section {
        padding: 50px 20px;
    }

    .mk-tl-section h2 {
        font-size: 1.8rem;
    }

    .mk-tl-subtitle {
        font-size: 1rem;
        margin-bottom: 40px;
    }

    /* Collapse all layouts to single column with line on left */
    .mk-tl-timeline {
        padding-left: 0;
    }

    .mk-tl-line {
        left: 30px !important;
        right: auto !important;
        transform: none !important;
    }

    .mk-tl-dot {
        left: 23px !important;
        right: auto !important;
        transform: none !important;
    }

    .mk-tl-entry {
        padding-left: 70px !important;
        padding-right: 0 !important;
        text-align: left !important;
        justify-content: flex-start !important;
    }

    .mk-tl-year {
        position: relative !important;
        top: auto !important;
        left: auto !important;
        right: auto !important;
        transform: none !important;
        display: block;
        font-size: 0.85rem;
        margin-bottom: 8px;
        color: var(--mk-light-gray, #999);
    }

    .mk-tl-dot {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Mobile: stack image above text again (no side-by-side) */
    .mk-tl-content {
        flex-direction: column !important;
    }

    .mk-tl-image {
        flex: 1 1 auto !important;
        max-width: 100% !important;
    }

    .mk-tl-image img {
        height: 220px;
        min-height: 0;
    }

    .mk-tl-text {
        padding: 20px;
    }

    .mk-tl-title {
        font-size: 1.15rem;
    }

    .mk-tl-description {
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .mk-tl-entry {
        padding-left: 50px !important;
    }

    .mk-tl-line {
        left: 15px !important;
    }

    .mk-tl-dot {
        left: 8px !important;
        width: 14px;
        height: 14px;
    }

    .mk-tl-image img {
        height: 180px;
    }

    .mk-tl-text {
        padding: 15px;
    }

    .mk-tl-title {
        font-size: 1.05rem;
    }
}
