.family-shell {
    max-width: 1080px;
    margin: 0 auto;
    padding: 48px 20px 72px;
}

.family-header {
    margin-bottom: 36px;
}

.family-title {
    margin: 0 0 10px;
    font-size: 36px;
    font-weight: 700;
    color: #242424;
}

.family-subtitle {
    margin: 0;
    font-size: 17px;
    line-height: 1.6;
    color: #6b6b6b;
}

.family-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    gap: 22px;
}

.family-card {
    display: block;
    background: #fff;
    border: 1px solid #e6e6e6;
    border-radius: 12px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.family-card:hover,
.family-card:focus {
    text-decoration: none;
    color: inherit;
    border-color: #8e9eab;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.12);
    transform: translateY(-3px);
}

.family-cover-wrap {
    aspect-ratio: 16 / 10;
    background: #f5f5f5;
    overflow: hidden;
}

.family-cover {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.family-card-body {
    padding: 16px 16px 18px;
}

.family-card-title {
    margin: 0 0 8px;
    font-size: 20px;
    font-weight: 600;
    line-height: 1.35;
    color: #242424;
}

.family-card-meta {
    margin: 0 0 10px;
    font-size: 13px;
    color: #8b8b8b;
}

.family-card-summary {
    margin: 0;
    font-size: 14px;
    line-height: 1.6;
    color: #4a4a4a;
}

.family-empty {
    margin-top: 8px;
    padding: 30px 18px;
    border: 1px dashed #d5d5d5;
    border-radius: 10px;
    background: #fafafa;
    color: #6b6b6b;
    font-size: 15px;
}

.family-back-link {
    margin-bottom: 18px;
}

.family-back-link a {
    display: inline-block;
    font-size: 14px;
    color: #2d5f8b;
    text-decoration: none;
}

.family-back-link a:hover,
.family-back-link a:focus {
    text-decoration: underline;
}

.trip-header-card {
    background: #fff;
    border: 1px solid #e6e6e6;
    border-radius: 12px;
    padding: 18px 20px;
    margin-bottom: 26px;
}

.trip-header-card h2 {
    margin: 0 0 8px;
    font-size: 28px;
    font-weight: 700;
    color: #242424;
}

.trip-header-meta {
    margin: 0 0 10px;
    font-size: 14px;
    color: #8b8b8b;
}

.trip-header-summary {
    margin: 0;
    font-size: 15px;
    line-height: 1.7;
    color: #4a4a4a;
}

.family-timeline {
    position: relative;
    padding: 10px 0;
}

.family-timeline::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 8px;
    bottom: 8px;
    width: 3px;
    background: linear-gradient(to bottom, #8e9eab, rgba(142, 158, 171, 0.3));
    transform: translateX(-50%);
}

.family-step {
    position: relative;
    margin-bottom: 30px;
    min-height: 140px;
}

.family-step:last-child {
    margin-bottom: 0;
}

.family-step-dot {
    position: absolute;
    left: 50%;
    top: 54px;
    width: 18px;
    height: 18px;
    margin-left: -9px;
    background: linear-gradient(to right, #8e9eab, #eef2f3);
    border: 3px solid #fff;
    border-radius: 50%;
    box-shadow: 0 2px 10px rgba(142, 158, 171, 0.45);
    z-index: 2;
}

.family-step-card {
    width: calc(50% - 28px);
    background: #fff;
    border: 1px solid #e6e6e6;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 8px rgba(0, 0, 0, 0.05);
}

.family-step.left .family-step-card {
    margin-right: auto;
}

.family-step.right .family-step-card {
    margin-left: auto;
}

.family-step-gallery {
    padding: 12px 12px 0;
    display: grid;
    gap: 8px;
}

.family-step-gallery.is-one {
    grid-template-columns: 1fr;
}

.family-step-gallery.is-two,
.family-step-gallery.is-four {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.family-step-gallery.is-many {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    max-height: 250px;
    overflow-y: auto;
    padding-right: 10px;
}

.family-step-photo-trigger {
    border: 0;
    padding: 0;
    border-radius: 8px;
    overflow: hidden;
    background: #f5f5f5;
    cursor: pointer;
    display: block;
    width: 100%;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.family-step-photo-trigger:hover,
.family-step-photo-trigger:focus {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
}

.family-step-photo {
    width: 100%;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    display: block;
    background: #f5f5f5;
}

.family-step-body {
    padding: 14px 15px 15px;
}

.family-step-date {
    display: inline-block;
    margin-bottom: 8px;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    background: linear-gradient(to right, #8e9eab, #b8c4ce);
}

.family-step-title {
    margin: 0 0 6px;
    font-size: 18px;
    font-weight: 600;
    line-height: 1.35;
    color: #242424;
}

.family-step-location {
    margin: 0 0 8px;
    font-size: 13px;
    color: #2d5f8b;
}

.family-step-note {
    margin: 0;
    font-size: 14px;
    line-height: 1.7;
    color: #4a4a4a;
}

.trip-not-found {
    padding: 22px 18px;
    border: 1px dashed #d2d2d2;
    border-radius: 10px;
    background: #fafafa;
    color: #575757;
}

body.family-modal-open {
    overflow: hidden;
}

.family-photo-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    z-index: 1200;
}

.family-photo-modal-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 62px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.74) 0%, rgba(0, 0, 0, 0) 100%);
}

.family-photo-modal-title {
    margin: 0;
    color: #fff;
    font-size: 18px;
    font-weight: 600;
}

.family-photo-modal-close {
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 50%;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 22px;
    line-height: 1;
}

.family-photo-modal-content {
    position: absolute;
    inset: 66px 76px 160px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.family-photo-modal-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 10px;
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
}

.family-photo-modal-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    border: 0;
    border-radius: 50%;
    cursor: pointer;
    color: #fff;
    font-size: 28px;
    background: rgba(0, 0, 0, 0.55);
}

.family-photo-modal-nav:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.family-photo-modal-prev {
    left: -56px;
}

.family-photo-modal-next {
    right: -56px;
}

.family-photo-modal-thumbs {
    position: absolute;
    left: 50%;
    bottom: 76px;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    max-width: min(88vw, 1000px);
    overflow-x: auto;
    padding: 10px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.52);
}

.family-photo-thumb {
    border: 2px solid transparent;
    border-radius: 6px;
    padding: 0;
    overflow: hidden;
    cursor: pointer;
    background: #111;
    flex: 0 0 auto;
}

.family-photo-thumb img {
    width: 64px;
    height: 44px;
    object-fit: cover;
    display: block;
    opacity: 0.68;
}

.family-photo-thumb.active {
    border-color: #fff;
}

.family-photo-thumb.active img {
    opacity: 1;
}

.family-photo-modal-footer {
    position: absolute;
    bottom: 26px;
    left: 0;
    right: 0;
    text-align: center;
}

.family-photo-modal-counter {
    display: inline-block;
    background: rgba(0, 0, 0, 0.58);
    color: #fff;
    border-radius: 999px;
    padding: 7px 12px;
    font-size: 13px;
}

@media (max-width: 900px) {
    .family-timeline::before {
        left: 14px;
        transform: none;
    }

    .family-step {
        padding-left: 38px;
    }

    .family-step-dot {
        left: 14px;
        margin-left: -9px;
    }

    .family-step-card {
        width: 100%;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    .family-step-gallery.is-many {
        max-height: 220px;
    }

    .family-photo-modal-content {
        inset: 66px 20px 170px;
    }

    .family-photo-modal-prev {
        left: 6px;
    }

    .family-photo-modal-next {
        right: 6px;
    }

    .family-photo-modal-nav {
        width: 42px;
        height: 42px;
        font-size: 24px;
    }
}

@media (max-width: 600px) {
    .family-title {
        font-size: 30px;
    }

    .trip-header-card h2 {
        font-size: 24px;
    }

    .family-shell {
        padding-top: 36px;
        padding-bottom: 56px;
    }
}
