/* Public-site timeline styling (from IMatch app lightbox.css) */

.thumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-start;
}

.thumb {
    display: inline-block;
    width: auto;
    vertical-align: top;
}

.thumb img {
    height: 200px;
    width: auto;
    border-radius: 4px;
    margin-bottom: 5px;
    display: block;
}

.thumb-title {
    font-size: 12px;
    text-align: center;
}

.thumb-persons,
.slide-persons {
    font-size: 12px;
    text-align: center;
    margin-top: 4px;
}

.person-link {
    color: #0066cc;
    text-decoration: underline;
}

.person-link-pending {
    font-style: italic;
    opacity: 0.85;
}

.slide-event-group {
    font-size: 13px;
    padding: 4px 8px;
    margin: 8px 0;
    background: #f5f5f5;
}

.event-span-detail {
    font-size: 12px;
    color: #666;
}

.event-span-count {
    font-size: 12px;
    color: #444;
    margin: 6px 0 8px;
}

.slide-description {
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 8px;
}

/* Side-by-side photo + text (same as IMatch timeline tab) */
#timeline .tl-slide .tl-slide-content-container .tl-slide-content {
    display: table !important;
    flex-direction: row !important;
}

#timeline .tl-skinny .tl-slide .tl-slide-content-container .tl-slide-content {
    display: table !important;
    flex-direction: row !important;
}

#timeline .tl-skinny .tl-slide .tl-slide-content-container .tl-slide-content .tl-media {
    width: 50%;
    float: left;
    border-top: none;
    padding-top: 0;
}

#timeline .tl-skinny .tl-slide .tl-slide-content-container .tl-slide-content .tl-text {
    width: 50%;
    display: table-cell;
    padding: 0 20px;
}

#timeline .tl-timeline {
    touch-action: manipulation;
}

#timeline .tl-timenav .tl-timenav-slider-background {
    touch-action: pan-x;
}

#timeline {
    min-height: 70vh;
}

.view {
    display: none;
}

.view.active {
    display: block;
}

#timelineTab.view.active {
    overflow: hidden;
    height: calc(100vh - 120px);
}

#lifespanTab.view.active {
    overflow: hidden;
    height: calc(100vh - 120px);
}

#gridTab.view.active,
#verticalTab.view.active {
    overflow: hidden;
    height: calc(100vh - 120px);
}

#grid-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

#grid-filter {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: #eee;
    border-bottom: 1px solid #ccc;
    font-size: 13px;
}

#grid-filter:empty {
    display: none;
}

#grid {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px;
    align-content: flex-start;
}

.grid-item {
    width: 200px;
}

.grid-item img {
    height: 180px;
    width: 100%;
    object-fit: cover;
    border-radius: 4px;
    display: block;
}

.grid-empty {
    width: 100%;
    padding: 24px;
    color: #666;
    font-size: 14px;
}

#vertical {
    height: 100%;
    overflow: auto;
    padding: 10px;
    box-sizing: border-box;
}

.vertical-year-header {
    background: #222;
    color: #fff;
    padding: 6px 8px;
    font-size: 18px;
    margin-top: 15px;
    position: sticky;
    top: 0;
    z-index: 1;
}

.vertical-photo-row {
    display: flex;
    align-items: center;
    margin: 6px 0;
    gap: 10px;
}

.vertical-photo-row img {
    height: 120px;
    width: auto;
    object-fit: cover;
    border-radius: 4px;
}

.vertical-photo-title {
    font-size: 13px;
    font-weight: bold;
}

.vertical-photo-date {
    font-size: 11px;
    color: #666;
}

.grid-item[data-file-id],
.vertical-photo-row[data-file-id] {
    cursor: pointer;
}

.grid-item[data-file-id]:hover img,
.vertical-photo-row[data-file-id]:hover img {
    outline: 2px solid #0066cc;
    outline-offset: 2px;
}

#lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 16px;
    box-sizing: border-box;
}

#lightbox.is-open {
    display: flex;
}

.lightbox-close {
    position: absolute;
    top: 10px;
    right: 14px;
    z-index: 10001;
    width: 40px;
    height: 40px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.22);
}

#lightbox-inner {
    display: flex;
    flex-direction: row;
    width: min(1200px, 96vw);
    max-height: 92vh;
    background: #111;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
}

.lightbox-media {
    flex: 1 1 62%;
    min-width: 0;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    padding: 12px;
}

#lightbox-img {
    max-width: 100%;
    max-height: calc(92vh - 24px);
    width: auto;
    height: auto;
    object-fit: contain;
    background: #000;
}

#lightbox-text {
    flex: 0 0 38%;
    min-width: 220px;
    max-width: 420px;
    padding: 20px;
    color: #fff;
    overflow-y: auto;
    box-sizing: border-box;
}

#lightbox-title {
    font-size: 22px;
    font-weight: bold;
    margin-bottom: 12px;
}

.lightbox-date {
    font-size: 14px;
    color: #bbb;
    margin-bottom: 10px;
}

.lightbox-people {
    font-size: 13px;
    color: #9cf;
    margin-bottom: 12px;
    line-height: 1.45;
}

#lightbox-caption {
    font-size: 15px;
    line-height: 1.6;
    white-space: pre-wrap;
}

.lightbox-actions {
    margin-top: 18px;
}

.lightbox-suggest-btn {
    background: #0066cc;
    color: #fff;
    border: none;
    padding: 8px 14px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
}

.lightbox-suggest-btn:hover {
    background: #004499;
}

@media (max-width: 760px) {
    #lightbox-inner {
        flex-direction: column;
        width: 96vw;
        max-height: 94vh;
    }

    .lightbox-media {
        flex: 1 1 auto;
        min-height: 40vh;
    }

    #lightbox-img {
        max-height: 50vh;
    }

    #lightbox-text {
        flex: 0 0 auto;
        max-width: none;
        max-height: 40vh;
    }
}

#timeline-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

#group-tabs,
#subgroup-tabs {
    flex: 0 0 auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: #f0f0f0;
    border-bottom: 1px solid #ccc;
}

#subgroup-tabs {
    background: #f7f7f7;
    padding-left: 20px;
}

#subgroup-tabs:empty {
    display: none !important;
}

.group-tab-label {
    font-weight: bold;
    font-size: 12px;
    margin-right: 4px;
    color: #444;
}

.group-tab {
    border: 2px solid var(--tab-color, #888);
    background: color-mix(in srgb, var(--tab-color, #888) 18%, white);
    color: #222;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.group-tab.active {
    background: var(--tab-color, #888);
    color: #fff;
    font-weight: bold;
}

#timeline-wrap {
    flex: 1 1 auto;
    min-height: 0;
    position: relative;
}

.suggest-edit-trigger {
    position: absolute;
    right: 12px;
    bottom: 12px;
    z-index: 20;
}

.suggest-edit-trigger button {
    background: #fff;
    border: 1px solid #bbb;
    border-radius: 4px;
    padding: 6px 12px;
    font-size: 12px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.suggest-edit-trigger button:hover {
    background: #f0f0f0;
}

#timeline-wrap #timeline {
    height: 100%;
}

#lifespans-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

#person-index {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: #eee;
    border-bottom: 1px solid #ccc;
    font-size: 13px;
}

#person-index:empty {
    display: none;
}

.person-index-label {
    font-weight: bold;
    flex: 0 0 auto;
    margin: 0;
}

.person-select {
    flex: 1 1 auto;
    min-width: 0;
    max-width: 480px;
    padding: 4px 8px;
    font-size: 13px;
    border: 1px solid #bbb;
    border-radius: 4px;
    background: #fff;
}

#lifespans-timeline {
    flex: 1 1 auto;
    min-height: 0;
    position: relative;
}

#lifespans-timeline #lifespans {
    height: 100%;
}

#lifespans-empty {
    display: none;
    flex: 1 1 auto;
    padding: 24px;
    color: #666;
    font-size: 14px;
}

#lifespanTab .tl-timegroup {
    display: none;
}

#lifespanTab .tl-slide .tl-slide-content-container .tl-slide-content {
    display: table !important;
}

#lifespanTab .tl-skinny .tl-slide .tl-slide-content-container .tl-slide-content {
    display: table !important;
}

#lifespanTab .tl-slide .tl-slide-content .tl-media,
#lifespanTab .tl-skinny .tl-slide .tl-slide-content-container .tl-slide-content .tl-media {
    width: 50%;
    float: left;
    border-top: none;
    padding-top: 0;
}

#lifespanTab .tl-slide .tl-slide-content .tl-text,
#lifespanTab .tl-skinny .tl-slide .tl-slide-content-container .tl-slide-content .tl-text {
    width: 50%;
    display: table-cell;
    padding: 0 20px;
}

.thumb-navigable {
    cursor: pointer;
}

.thumb-navigable:hover {
    outline: 2px solid #0066cc;
    outline-offset: 2px;
    border-radius: 4px;
}

.person-link {
    cursor: pointer;
}
