/* ============================================================
   Hallmark Timeline Gallery – Frontend Styles
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ── CSS Variables (global so lightbox works when moved to body) */
:root {
    --htg-navy:      #042a59;
    --htg-navy-deep: #021934;
    --htg-blue:      #0b6ea8;
    --htg-sky:       #75bfd9;
    --htg-ice:       #eef5fa;
    --htg-paper:     #ffffff;
    --htg-ink:       #071f45;
    --htg-muted:     #5c7089;
    --htg-line:      rgba(7, 31, 69, 0.14);
    --htg-shadow:    rgba(2, 25, 52, 0.22);
}

/* Alias for shorthand inside component classes */
.htg-page,
.htg-lightbox {
    --navy:      var(--htg-navy);
    --navy-deep: var(--htg-navy-deep);
    --blue:      var(--htg-blue);
    --sky:       var(--htg-sky);
    --ice:       var(--htg-ice);
    --paper:     var(--htg-paper);
    --ink:       var(--htg-ink);
    --muted:     var(--htg-muted);
    --line:      var(--htg-line);
    --shadow:    var(--htg-shadow);
}


/* ── Page Wrapper ──────────────────────────────────────────── */
.htg-page {
    position: relative;
    width: 100%;
    overflow: hidden;
    font-family: "Inter", sans-serif;
    -webkit-font-smoothing: antialiased;
    background:
        radial-gradient(circle at 16% 20%, rgba(117, 191, 217, 0.28), transparent 30%),
        radial-gradient(circle at 86% 22%, rgba(11, 110, 168, 0.16), transparent 28%),
        linear-gradient(135deg, #f9fcfe 0%, #eef5fa 58%, #e4eff7 100%);
    padding-bottom: 24px;
}

.htg-page::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(4,42,89,0.045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(4,42,89,0.045) 1px, transparent 1px);
    background-size: 42px 42px;
    pointer-events: none;
    z-index: 0;
}

/* ── Timeline Shell ────────────────────────────────────────── */
.htg-timeline-shell {
    position: relative;
    z-index: 5;
    min-height: 520px;
    padding-top: 42px;
    overflow: hidden;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
}

.htg-timeline-shell:active {
    cursor: grabbing;
}

/* ── Horizontal Rule ───────────────────────────────────────── */
.htg-timeline-line {
    position: absolute;
    left: 0;
    right: 0;
    top: 292px;
    height: 2px;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(4, 42, 89, 0.22) 8%,
        rgba(4, 42, 89, 0.22) 92%,
        transparent
    );
    pointer-events: none;
}

/* ── Track ─────────────────────────────────────────────────── */
.htg-timeline-track {
    display: flex;
    gap: 34px;
    width: max-content;
    padding: 0 8vw 28px 4vw;
    transition: transform 0.1s ease-out;
    will-change: transform;
}

.htg-timeline-track.htg-dragging {
    transition: none;
}

/* ── Individual Moment ─────────────────────────────────────── */
.htg-moment {
    position: relative;
    flex: 0 0 330px;
    display: grid;
    grid-template-rows: 220px 84px 150px;
}

.htg-moment:nth-child(even) {
    grid-template-rows: 150px 84px 220px;
}

/* ── Photo Card ────────────────────────────────────────────── */
.htg-photo {
    position: relative;
    overflow: hidden;
    border: 10px solid #fff;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 24px 54px var(--shadow);
    cursor: zoom-in;
    transition: box-shadow 0.3s ease;
}

.htg-photo::after {
    content: "Click to zoom";
    position: absolute;
    right: 12px;
    bottom: 12px;
    z-index: 2;
    padding: 8px 10px;
    border: 1px solid rgba(255,255,255,0.28);
    border-radius: 999px;
    background: rgba(2,25,52,0.55);
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 1.1px;
    text-transform: uppercase;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.25s ease, transform 0.25s ease;
    backdrop-filter: blur(12px);
    font-family: "Inter", sans-serif;
}

.htg-photo:hover::after {
    opacity: 1;
    transform: translateY(0);
}

.htg-photo:hover {
    box-shadow: 0 32px 70px rgba(2, 25, 52, 0.3);
}

.htg-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    filter: saturate(0.94) contrast(1.03);
    transition: transform 0.45s ease, filter 0.45s ease;
}

.htg-moment:hover .htg-photo img {
    transform: scale(1.06);
    filter: saturate(1.03) contrast(1.06);
}

/* No image placeholder */
.htg-no-image {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    background: var(--ice);
    color: var(--muted);
}

.htg-no-image .dashicons {
    font-size: 48px;
    width: 48px;
    height: 48px;
}

/* ── Photo positions: odd above line, even below ─────────── */
.htg-moment:nth-child(odd)  .htg-photo { grid-row: 1; transform: rotate(-2deg); }
.htg-moment:nth-child(even) .htg-photo { grid-row: 3; transform: rotate(2deg); }

/* ── Timeline Marker Dot ───────────────────────────────────── */
.htg-marker {
    position: relative;
    grid-row: 2;
    display: grid;
    place-items: center;
}

.htg-marker::before {
    content: "";
    width: 18px;
    height: 18px;
    border: 5px solid #fff;
    border-radius: 999px;
    background: var(--blue);
    box-shadow:
        0 0 0 8px rgba(11,110,168,0.13),
        0 10px 24px rgba(4,42,89,0.22);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.htg-moment:hover .htg-marker::before {
    transform: scale(1.2);
    box-shadow: 0 0 0 12px rgba(11,110,168,0.18), 0 12px 28px rgba(4,42,89,0.28);
}

/* ── Copy Card ─────────────────────────────────────────────── */
.htg-copy {
    position: relative;
    z-index: 2;
    padding: 18px;
    border: 1px solid rgba(255,255,255,0.72);
    border-radius: 10px;
    background: rgba(255,255,255,0.82);
    backdrop-filter: blur(18px);
    box-shadow: 0 18px 38px rgba(2,25,52,0.10);
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.htg-moment:hover .htg-copy {
    box-shadow: 0 24px 50px rgba(2,25,52,0.16);
    transform: translateY(-2px);
}

.htg-moment:nth-child(odd)  .htg-copy { grid-row: 3; }
.htg-moment:nth-child(even) .htg-copy { grid-row: 1; }

.htg-copy small {
    color: var(--blue);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1.4px;
    text-transform: uppercase;
    font-family: "Inter", sans-serif;
}

.htg-copy strong {
    display: block;
    margin-top: 8px;
    color: var(--ink);
    font-size: 19px;
    line-height: 1.24;
    font-family: "Inter", sans-serif;
}

.htg-copy span {
    display: block;
    margin-top: 10px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.55;
    font-family: "Inter", sans-serif;
}

/* ── Controls ──────────────────────────────────────────────── */
.htg-controls {
    position: relative;
    z-index: 8;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 4vw;
    margin-top: 10px;
}

.htg-progress {
    position: relative;
    flex: 1;
    height: 4px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(4,42,89,0.12);
}

.htg-progress-fill {
    position: absolute;
    left: 0;
    top: 0;
    width: 22%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--navy), var(--sky));
    transition: left 0.24s ease;
}

.htg-hint {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 6px;
    color: rgba(7,31,69,0.48);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1.8px;
    text-transform: uppercase;
    font-family: "Inter", sans-serif;
}

.htg-hint svg {
    opacity: 0.6;
}

/* ── Lightbox ──────────────────────────────────────────────── */
.htg-lightbox {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(16px, 3vw, 48px);
    background: rgba(2, 25, 52, 0.80);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    box-sizing: border-box;
}

.htg-lightbox.htg-open {
    opacity: 1;
    visibility: visible;
}

.htg-lightbox-panel {
    position: relative;
    /* Explicit height so grid children can stretch to fill it */
    width: min(1100px, 100%);
    height: min(680px, calc(100vh - 80px));
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    grid-template-rows: 1fr;        /* one row that fills the panel height */
    overflow: hidden;
    border: 10px solid #fff;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 40px 100px rgba(0,0,0,0.45);
    transform: scale(0.96);
    transition: transform 0.25s ease;
    flex-shrink: 0;
}

.htg-lightbox.htg-open .htg-lightbox-panel {
    transform: scale(1);
}

/* ── Image column ────────────────────────────────────────────── */
.htg-lightbox-image {
    grid-column: 1;
    grid-row: 1;
    background: #071f45;
    overflow: hidden;
    position: relative;
    min-height: 0;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
}

.htg-lightbox-image.htg-panning {
    cursor: grabbing;
}

/* Zoomable canvas — JS applies transform here */
.htg-zoom-canvas {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transform-origin: center center;
    transition: transform 0.18s ease;
    will-change: transform;
}

.htg-zoom-canvas.htg-no-transition {
    transition: none;
}

.htg-zoom-canvas img {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
}

/* ── Zoom toolbar ────────────────────────────────────────────── */
.htg-zoom-toolbar {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 6px 8px;
    background: rgba(2, 25, 52, 0.78);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(255,255,255,0.14);
    border-radius: 999px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.35);
}

.htg-zoom-btn {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: rgba(255,255,255,0.85);
    cursor: pointer;
    transition: background 0.18s ease, color 0.18s ease, transform 0.15s ease;
    text-decoration: none;
    flex-shrink: 0;
}

.htg-zoom-btn:hover {
    background: rgba(255,255,255,0.14);
    color: #fff;
    transform: scale(1.08);
}

.htg-zoom-btn:active {
    transform: scale(0.92);
}

.htg-zoom-level {
    font-family: "Inter", monospace, sans-serif;
    font-size: 11px;
    font-weight: 800;
    color: rgba(255,255,255,0.75);
    letter-spacing: 0.5px;
    min-width: 40px;
    text-align: center;
    padding: 0 4px;
}

.htg-zoom-reset {
    border-left: 1px solid rgba(255,255,255,0.12);
    border-right: 1px solid rgba(255,255,255,0.12);
    border-radius: 50%;
    margin: 0 2px;
}

/* ── Zoom hint badge ─────────────────────────────────────────── */
.htg-zoom-hint {
    position: absolute;
    top: 14px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: rgba(2, 25, 52, 0.65);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 999px;
    color: rgba(255,255,255,0.70);
    font-family: "Inter", sans-serif;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 1;
    transition: opacity 0.4s ease;
}

.htg-zoom-hint.htg-hint-hide {
    opacity: 0;
}


/* ── Copy column ─────────────────────────────────────────────── */
.htg-lightbox-copy {
    grid-column: 2;
    grid-row: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-end; /* push content to bottom like original design */
    padding: 28px 24px;
    overflow-y: auto;
    background:
        radial-gradient(circle at 30% 10%, rgba(117,191,217,0.20), transparent 40%),
        linear-gradient(180deg, #ffffff 0%, #eef5fa 100%);
    min-height: 0;             /* allow flex children to shrink in grid */
}

.htg-lightbox-copy small {
    color: #0b6ea8;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1.4px;
    text-transform: uppercase;
    font-family: "Inter", sans-serif;
    flex-shrink: 0;
}

.htg-lightbox-copy strong {
    display: block;
    margin-top: 10px;
    color: #021934;
    font-size: 24px;
    line-height: 1.15;
    font-family: "Inter", sans-serif;
    flex-shrink: 0;
}

.htg-lightbox-copy span {
    display: block;
    margin-top: 12px;
    color: #5c7089;
    font-size: 13px;
    line-height: 1.65;
    font-family: "Inter", sans-serif;
    flex-shrink: 0;
}


.htg-lightbox-close {
    position: absolute;
    top: 18px;
    right: 18px;
    z-index: 3;
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 999px;
    background: rgba(2,25,52,0.72);
    color: #fff;
    line-height: 1;
    cursor: pointer;
    backdrop-filter: blur(12px);
    display: grid;
    place-items: center;
    transition: background 0.2s ease, transform 0.2s ease;
}

.htg-lightbox-close:hover {
    background: rgba(2,25,52,0.92);
    transform: scale(1.08);
}

/* ── Empty state ───────────────────────────────────────────── */
.htg-no-items {
    text-align: center;
    padding: 40px 20px;
    color: var(--muted);
    font-family: "Inter", sans-serif;
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 900px) {
    .htg-timeline-shell {
        min-height: 500px;
    }

    /* Stack lightbox to single column on tablet/mobile */
    .htg-lightbox-panel {
        grid-template-columns: 1fr;
        grid-template-rows: 55vh auto;
        height: auto;
        max-height: calc(100vh - 48px);
        overflow-y: auto;
    }

    .htg-lightbox-image {
        grid-column: 1;
        grid-row: 1;
        min-height: 55vh;
    }

    .htg-lightbox-copy {
        grid-column: 1;
        grid-row: 2;
        justify-content: flex-start;
        min-height: 0;
    }
}

@media (max-width: 640px) {
    .htg-timeline-shell {
        padding-top: 18px;
    }
    .htg-timeline-line {
        top: 268px;
    }
    .htg-moment {
        flex-basis: 286px;
        grid-template-rows: 190px 84px 160px;
    }
    .htg-moment:nth-child(even) {
        grid-template-rows: 160px 84px 190px;
    }
    .htg-lightbox {
        padding: 12px;
    }
    .htg-lightbox-panel {
        border-width: 6px;
        grid-template-rows: 50vw auto;
    }
    .htg-lightbox-image {
        min-height: 50vw;
    }
    .htg-lightbox-copy {
        padding: 18px;
    }
    .htg-lightbox-copy strong {
        font-size: 18px;
    }
}
