/**
 * Elegant Timelines — frontend styles.
 *
 * The layout consumes CSS variables that the renderer writes into a scoped
 * style block per-instance. Nothing in here is timeline-specific colour-wise.
 *
 * Layouts:
 *   .et-layout-desktop-vertical / -horizontal apply on screens above breakpoint.
 *   .et-layout-mobile-vertical / -horizontal apply on screens below.
 *
 * We use container-style overrides via media queries written in the inline
 * style block (the renderer emits the breakpoint).
 */

/* ============================================================
   Base wrapper
   ============================================================ */
.et-timeline {
    position: relative;
    box-sizing: border-box;
    font-family: var(--et-font-body);
    color: var(--et-text);
    background: var(--et-bg);
    padding: 40px 20px;
    line-height: 1.4;
}
.et-timeline *,
.et-timeline *::before,
.et-timeline *::after {
    box-sizing: border-box;
}

/* Custom uploaded icon (image) — sized like the built-in SVGs.
   `object-fit: contain` ensures non-square uploads stay proportional. */
.et-item__icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

/* ============================================================
   Header
   ============================================================ */
.et-header {
    text-align: center;
    margin-bottom: 40px;
}
.et-header__title {
    margin: 0;
    font-size: var(--et-fs-header);
    color: var(--et-text);
    line-height: 1.1;
    font-weight: 400;
}
.et-header__subtitle {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    margin-top: 10px;
    color: var(--et-accent);
    font-size: var(--et-fs-subtitle);
    letter-spacing: 0.04em;
}
.et-header__rule {
    display: inline-block;
    width: 36px;
    height: 1px;
    background: var(--et-accent);
}

/* Header font variants — apply to any element with these classes. */
.et-font-script { font-family: var(--et-font-script); font-weight: 400; }
.et-font-serif  { font-family: var(--et-font-display); font-weight: 500; }
.et-font-sans   { font-family: var(--et-font-body); font-weight: 500; letter-spacing: 0.06em; text-transform: none; }

/* ============================================================
   Track + spine (the central line)
   ============================================================ */
/* ============================================================
   Track + spine (the central line)

   We render solid lines via `background-color` (cheap, exact pixel sizing).
   For dashed / dotted we have to use a real border because background-color
   can't be dashed. In both cases we ALWAYS specify the border-color
   explicitly so the user-chosen line colour is observed.
   ============================================================ */
.et-track {
    position: relative;
}

/* Vertical layout: spine is centred vertically. */
.et-layout-desktop-vertical .et-spine {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: var(--et-line-thickness);
    background-color: var(--et-line);
}

/* Dashed / dotted spine: zero out the solid fill and render a left border
   at the configured thickness/colour instead. */
.et-layout-desktop-vertical .et-spine[data-line-style="dashed"],
.et-layout-desktop-vertical .et-spine[data-line-style="dotted"] {
    background-color: transparent;
    width: 0;
    border-left-width: var(--et-line-thickness);
    border-left-color: var(--et-line);
}
.et-layout-desktop-vertical .et-spine[data-line-style="dashed"] { border-left-style: dashed; }
.et-layout-desktop-vertical .et-spine[data-line-style="dotted"] { border-left-style: dotted; }

.et-layout-desktop-vertical[class*="et-anim"] .et-spine {
    transform-origin: top center;
}

/* When alignment is forced to one side, push spine over. */
.et-layout-desktop-vertical.et-align-left .et-spine  { left: 80px; transform: none; }
.et-layout-desktop-vertical.et-align-right .et-spine { left: auto; right: 80px; transform: none; }

/* ============================================================
   Items - VERTICAL DESKTOP
   ============================================================ */
.et-layout-desktop-vertical .et-items {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: var(--et-item-spacing);
}

.et-layout-desktop-vertical .et-item {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
}

/* The connector tick. Absolutely positioned, anchored at the spine (left: 50%)
   and extending OUT toward the icon side only — never across the spine.
   Width matches the configured connector length. */
.et-layout-desktop-vertical .et-item__connector {
    position: absolute;
    top: 50%;
    width: var(--et-connector-length);
    height: var(--et-line-thickness);
    background-color: var(--et-line);
    transform: translateY(-50%);
    pointer-events: none;
}
.et-layout-desktop-vertical .et-item--right .et-item__connector {
    left: 50%;
}
.et-layout-desktop-vertical .et-item--left .et-item__connector {
    right: 50%;
}

/* Dashed / dotted connectors — same approach as the spine. */
.et-layout-desktop-vertical .et-item__connector[data-line-style="dashed"],
.et-layout-desktop-vertical .et-item__connector[data-line-style="dotted"] {
    background-color: transparent;
    height: 0;
    border-top-width: var(--et-line-thickness);
    border-top-color: var(--et-line);
}
.et-layout-desktop-vertical .et-item__connector[data-line-style="dashed"] { border-top-style: dashed; }
.et-layout-desktop-vertical .et-item__connector[data-line-style="dotted"] { border-top-style: dotted; }

/* Marker — sits exactly on the spine. */
.et-layout-desktop-vertical .et-item__marker {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
}

.et-layout-desktop-vertical .et-item__icon {
    width: var(--et-icon-size);
    height: var(--et-icon-size);
    color: var(--et-icon);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}
.et-layout-desktop-vertical .et-item__icon svg {
    width: 100%;
    height: 100%;
    display: block;
}

.et-layout-desktop-vertical .et-item__card {
    padding: var(--et-content-padding);
    border-radius: var(--et-card-radius);
    background: var(--et-card-bg);
    max-width: 360px;
}

/* RIGHT side: icon sits in the right column next to the spine; text follows
   after a uniform gap. The gap between the icon and the text is the same on
   both sides — controlled by a single value. */
.et-layout-desktop-vertical .et-item--right .et-item__icon {
    grid-column: 2;
    grid-row: 1;
    justify-self: start;
    margin-left: calc(var(--et-connector-length) + var(--et-line-gap));
}
.et-layout-desktop-vertical .et-item--right .et-item__card {
    grid-column: 2;
    grid-row: 1;
    justify-self: start;
    margin-left: calc(var(--et-connector-length) + var(--et-line-gap) + var(--et-icon-size) + var(--et-icon-gap));
    text-align: left;
}

/* LEFT side: mirror image. Identical gap values, just flipped. */
.et-layout-desktop-vertical .et-item--left .et-item__icon {
    grid-column: 1;
    grid-row: 1;
    justify-self: end;
    margin-right: calc(var(--et-connector-length) + var(--et-line-gap));
}
.et-layout-desktop-vertical .et-item--left .et-item__card {
    grid-column: 1;
    grid-row: 1;
    justify-self: end;
    margin-right: calc(var(--et-connector-length) + var(--et-line-gap) + var(--et-icon-size) + var(--et-icon-gap));
    text-align: right;
}

/* Section heading (script "Evening Reception" style) sits floated to the
   opposite side, beside the item. */
.et-layout-desktop-vertical .et-item__section {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-family: var(--et-font-script);
    color: var(--et-section-title);
    font-size: var(--et-fs-section);
    line-height: 1;
    white-space: nowrap;
    pointer-events: none;
}
.et-layout-desktop-vertical .et-item--right .et-item__section {
    right: 60%;
    text-align: right;
}
.et-layout-desktop-vertical .et-item--left .et-item__section {
    left: 60%;
    text-align: left;
}

/* ============================================================
   Item text
   ============================================================ */
.et-item__time {
    font-size: var(--et-fs-time);
    font-weight: var(--et-fw-time);
    color: var(--et-text);
    line-height: 1.2;
    margin-bottom: 2px;
}
.et-item__title {
    font-size: var(--et-fs-title);
    font-weight: var(--et-fw-title);
    color: var(--et-text);
    line-height: 1.25;
}
.et-item__desc {
    font-size: var(--et-fs-desc);
    font-weight: var(--et-fw-desc);
    color: var(--et-text-muted);
    line-height: 1.5;
    margin-top: 6px;
}

/* ============================================================
   Items - HORIZONTAL DESKTOP

   Each item is a 3-row vertical grid sharing a common middle row
   (the "spine row") with every other item. The spine itself is an
   absolutely positioned horizontal line on the track, sitting at
   exactly 50% — so it always lines up with the middle row of every
   item regardless of how tall the cards are.

       ┌──────────────┐                     <- row 1 (above)
       │  card-above  │   (only for --left items)
       └──────┬───────┘
              │  connector
   ───────●───┼───────●─────●─────●───      <- row 2: spine + icons
              │
       ┌──────┴───────┐
       │  card-below  │   (only for --right items)
       └──────────────┘                     <- row 3 (below)

   Card height is variable; the rows use minmax() so the spine row
   stays a fixed height (the icon) and the card rows absorb the
   leftover space.
   ============================================================ */
.et-layout-desktop-horizontal {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}
.et-layout-desktop-horizontal .et-track {
    min-height: 360px;
    padding: 40px 20px;
}
.et-layout-desktop-horizontal .et-spine {
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    height: var(--et-line-thickness);
    width: auto;
    background-color: var(--et-line);
    z-index: 0;
}
.et-layout-desktop-horizontal .et-spine[data-line-style="dashed"],
.et-layout-desktop-horizontal .et-spine[data-line-style="dotted"] {
    background-color: transparent;
    height: 0;
    border-top-width: var(--et-line-thickness);
    border-top-color: var(--et-line);
}
.et-layout-desktop-horizontal .et-spine[data-line-style="dashed"] { border-top-style: dashed; }
.et-layout-desktop-horizontal .et-spine[data-line-style="dotted"] { border-top-style: dotted; }

.et-layout-desktop-horizontal .et-items {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: var(--et-item-spacing);
    min-width: max-content;
    position: relative;
    z-index: 1;
}

/* Each item is itself a 3-row grid. The middle row is the icon's row
   (sized to the icon), the outer rows hold the card on whichever side
   the item belongs to. */
.et-layout-desktop-horizontal .et-item {
    position: relative;
    display: grid;
    grid-template-rows: 1fr var(--et-icon-size) 1fr;
    grid-template-columns: 1fr;
    justify-items: center;
    min-width: 180px;
    transform: none; /* Reset any old translate. */
}

/* The icon always lives in the middle row, centred on the spine. */
.et-layout-desktop-horizontal .et-item__icon {
    grid-row: 2;
    grid-column: 1;
    width: var(--et-icon-size);
    height: var(--et-icon-size);
    color: var(--et-icon);
    background: var(--et-bg);     /* cover the spine where it crosses */
    padding: 0 6px;
    box-sizing: content-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}
.et-layout-desktop-horizontal .et-item__icon svg,
.et-layout-desktop-horizontal .et-item__icon img {
    width: var(--et-icon-size);
    height: var(--et-icon-size);
    display: block;
}

/* The marker sits behind the icon, exactly on the spine. */
.et-layout-desktop-horizontal .et-item__marker {
    grid-row: 2;
    grid-column: 1;
    align-self: center;
    justify-self: center;
    z-index: 1;
}

/* Connector: a short vertical tick from the spine to the card.
   --right items have it below the spine, --left above. */
.et-layout-desktop-horizontal .et-item__connector {
    width: var(--et-line-thickness);
    height: var(--et-connector-length);
    background-color: var(--et-line);
    justify-self: center;
    z-index: 0;
}
.et-layout-desktop-horizontal .et-item__connector[data-line-style="dashed"],
.et-layout-desktop-horizontal .et-item__connector[data-line-style="dotted"] {
    background-color: transparent;
    width: 0;
    border-left-width: var(--et-line-thickness);
    border-left-color: var(--et-line);
}
.et-layout-desktop-horizontal .et-item__connector[data-line-style="dashed"] { border-left-style: dashed; }
.et-layout-desktop-horizontal .et-item__connector[data-line-style="dotted"] { border-left-style: dotted; }

/* --right items: connector in row 3 (below spine), card below it. */
.et-layout-desktop-horizontal .et-item--right .et-item__connector {
    grid-row: 3;
    grid-column: 1;
    align-self: start;
    margin-top: var(--et-line-gap);
}
.et-layout-desktop-horizontal .et-item--right .et-item__card {
    grid-row: 3;
    grid-column: 1;
    align-self: start;
    margin-top: calc(var(--et-line-gap) + var(--et-connector-length) + var(--et-icon-gap));
}

/* --left items: connector in row 1 (above spine), card above it. */
.et-layout-desktop-horizontal .et-item--left .et-item__connector {
    grid-row: 1;
    grid-column: 1;
    align-self: end;
    margin-bottom: var(--et-line-gap);
}
.et-layout-desktop-horizontal .et-item--left .et-item__card {
    grid-row: 1;
    grid-column: 1;
    align-self: end;
    margin-bottom: calc(var(--et-line-gap) + var(--et-connector-length) + var(--et-icon-gap));
}

.et-layout-desktop-horizontal .et-item__card {
    padding: var(--et-content-padding);
    border-radius: var(--et-card-radius);
    background: var(--et-card-bg);
    text-align: center;
    max-width: 220px;
    min-width: 140px;
}

/* Section heading: lives at the very top of the track, centred on its
   item's column. We reserve generous top padding on the track so left-side
   cards never collide with these labels. */
.et-layout-desktop-horizontal .et-track {
    padding-top: 60px;
}
.et-layout-desktop-horizontal .et-item__section {
    position: absolute;
    top: -50px;
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--et-font-script);
    color: var(--et-section-title);
    font-size: calc(var(--et-fs-section) * 0.6);
    line-height: 1;
    white-space: nowrap;
    z-index: 3;
    pointer-events: none;
}

/* ============================================================
   Responsive — mobile layout
   ============================================================ */
@media (max-width: 782px) {
    /* Vertical-mobile collapses everything to a single column with the spine
       pinned to the left. The desktop's absolute connector / marker rules
       are overridden so the icon column stays predictable. */
    .et-layout-mobile-vertical .et-spine {
        left: 32px;
        right: auto;
        transform: none;
    }
    .et-layout-mobile-vertical .et-items {
        gap: calc(var(--et-item-spacing) * 0.7);
    }
    .et-layout-mobile-vertical .et-item {
        grid-template-columns: 64px 1fr;
        column-gap: 14px;
        align-items: center;
    }
    /* Reset absolute positioning from desktop. */
    .et-layout-mobile-vertical .et-item__connector,
    .et-layout-mobile-vertical .et-item--left .et-item__connector,
    .et-layout-mobile-vertical .et-item--right .et-item__connector {
        position: static;
        transform: none;
        width: 28px;
        height: var(--et-line-thickness);
        background-color: var(--et-line);
        grid-column: 1;
        grid-row: 1;
        justify-self: end;
        left: auto;
        right: auto;
        top: auto;
    }
    .et-layout-mobile-vertical .et-item__connector[data-line-style="dashed"],
    .et-layout-mobile-vertical .et-item__connector[data-line-style="dotted"] {
        background-color: transparent;
        height: 0;
        border-top-width: var(--et-line-thickness);
        border-top-color: var(--et-line);
    }
    .et-layout-mobile-vertical .et-item__marker {
        position: static;
        transform: none;
        grid-column: 1;
        grid-row: 1;
        justify-self: end;
        margin-right: -6px;
        left: auto;
        top: auto;
    }
    .et-layout-mobile-vertical .et-item__icon,
    .et-layout-mobile-vertical .et-item--left .et-item__icon,
    .et-layout-mobile-vertical .et-item--right .et-item__icon {
        grid-column: 1;
        grid-row: 1;
        justify-self: end;
        width: calc(var(--et-icon-size) * 0.7);
        height: calc(var(--et-icon-size) * 0.7);
        margin: 0;
    }
    .et-layout-mobile-vertical .et-item__card,
    .et-layout-mobile-vertical .et-item--left .et-item__card,
    .et-layout-mobile-vertical .et-item--right .et-item__card {
        grid-column: 2;
        grid-row: 1;
        margin: 0;
        max-width: none;
        text-align: left;
        padding: 8px 0 8px 12px;
        justify-self: stretch;
    }
    .et-layout-mobile-vertical .et-item__section {
        position: static;
        transform: none;
        text-align: left;
        font-size: calc(var(--et-fs-section) * 0.5);
        margin-bottom: 8px;
        grid-column: 1 / -1;
        white-space: normal;
    }
    .et-layout-mobile-vertical .et-header__title {
        font-size: calc(var(--et-fs-header) * 0.55);
    }
    .et-layout-mobile-vertical .et-header__subtitle {
        font-size: calc(var(--et-fs-subtitle) * 0.85);
    }
}

/* ============================================================
   Animations
   ============================================================
   The wrapper has data-anim="<type>". Items start hidden and gain
   .et-in-view via the IntersectionObserver in the JS file.
   ============================================================ */
.et-anim .et-item,
.et-anim .et-header {
    opacity: 0;
    transition:
        opacity   var(--et-anim-duration) var(--et-anim-easing) var(--et-anim-delay, 0ms),
        transform var(--et-anim-duration) var(--et-anim-easing) var(--et-anim-delay, 0ms);
    will-change: opacity, transform;
}

/* Fade only. */
.et-anim-fade .et-item        { transform: none; }

/* Fade + slide in from the side. */
.et-anim-fade-slide .et-item--right { transform: translateX(40px); }
.et-anim-fade-slide .et-item--left  { transform: translateX(-40px); }
.et-anim-fade-slide.et-layout-desktop-horizontal .et-item--right { transform: translateY(40px); }
.et-anim-fade-slide.et-layout-desktop-horizontal .et-item--left  { transform: translateY(-40px); }

/* Scale up. */
.et-anim-scale .et-item { transform: scale(0.85); transform-origin: center; }

/* Draw line: spine starts collapsed. */
.et-anim-draw-line .et-spine {
    transform: scaleY(0);
    transform-origin: top center;
    transition: transform 1200ms var(--et-anim-easing);
}
.et-anim-draw-line.et-layout-desktop-horizontal .et-spine {
    transform: scaleX(0);
    transform-origin: left center;
}
.et-anim-draw-line.et-in-view .et-spine {
    transform: scaleY(1);
}
.et-anim-draw-line.et-layout-desktop-horizontal.et-in-view .et-spine {
    transform: scaleX(1);
}
.et-anim-draw-line .et-item { transform: translateY(20px); }

/* Stagger pop — items pop in from below with overshoot. */
.et-anim-stagger-pop .et-item {
    transform: translateY(30px) scale(0.96);
    transition:
        opacity   var(--et-anim-duration) cubic-bezier(0.34, 1.56, 0.64, 1) var(--et-anim-delay, 0ms),
        transform var(--et-anim-duration) cubic-bezier(0.34, 1.56, 0.64, 1) var(--et-anim-delay, 0ms);
}

/* Header animates in first. */
.et-anim .et-header { transform: translateY(-20px); }

/* In-view state — applied per-element by JS. */
.et-anim .et-item.et-in-view,
.et-anim .et-header.et-in-view {
    opacity: 1;
    transform: none;
}

/* Respect reduced motion. */
@media (prefers-reduced-motion: reduce) {
    .et-anim .et-item,
    .et-anim .et-header,
    .et-anim .et-spine {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }
}
