/* index.css */

body {
    background:
        linear-gradient(180deg, #f6f7f8 0%, #eef1f3 100%);
    overflow-x: hidden;
}

.page-glow {
    position: fixed;
    width: 36vw;
    height: 36vw;
    border-radius: 50%;
    filter: blur(56px);
    opacity: 0.12;
    pointer-events: none;
    z-index: 0;
}

.page-glow-left {
    top: -8vw;
    left: -10vw;
    background: rgba(39, 83, 84, 0.10);
}

.page-glow-right {
    top: 18vh;
    right: -12vw;
    background: rgba(255, 255, 255, 0.88);
}

.main-content {
    padding-top: 30px;
    padding-bottom: 80px;
    position: relative;
    z-index: 1;
}

.hero-panel,
.toolbar-panel {
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid rgba(255, 255, 255, 0.78);
    border-radius: 18px;
    box-shadow: 0 14px 36px rgba(15, 23, 42, 0.05);
    backdrop-filter: saturate(140%) blur(14px);
}

.hero-panel {
    padding: 26px 26px 24px;
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
}

.hero-panel::before {
    content: none;
}

.hero-kicker {
    margin-bottom: 10px;
    font-size: 12px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--brand-color);
}

.hero-row {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
}

.hero-title {
    font-size: 34px;
    line-height: 1.05;
    font-weight: 750;
    letter-spacing: 0.02em;
}

.hero-subtitle {
    margin-top: 12px;
    max-width: 720px;
    color: #667085;
    font-size: 14px;
    line-height: 1.75;
}

.toolbar-panel {
    padding: 14px 16px 12px;
    margin-bottom: 30px;
}

.toolbar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.toolbar-title {
    font-size: 14px;
    font-weight: 600;
}

.toolbar-tip {
    font-size: 12px;
    color: var(--text-secondary);
}

.filter-section {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
    padding: 6px;
    border-radius: 14px;
    background: rgba(15, 23, 42, 0.035);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.filter-btn {
    border: 1px solid rgba(39, 83, 84, 0.08);
    background: rgba(255, 255, 255, 0.92);
    min-height: 44px;
    padding: 0 18px;
    font-size: 14px;
    color: #475467;
    cursor: pointer;
    border-radius: 12px;
    white-space: nowrap;
    transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.filter-btn:hover {
    color: var(--brand-color);
    border-color: rgba(39, 83, 84, 0.18);
    background: rgba(255, 255, 255, 0.98);
}

.filter-btn.active {
    background: linear-gradient(180deg, rgba(39, 83, 84, 0.96), rgba(29, 66, 67, 0.98));
    color: white;
    border-color: var(--brand-color);
    box-shadow: 0 8px 18px rgba(39, 83, 84, 0.22);
}

.filter-btn:focus-visible,
.nav-arrow:focus-visible,
.modal-close:focus-visible,
.stack-item:focus-visible,
.card-content:focus-visible {
    outline: 3px solid rgba(39, 83, 84, 0.22);
    outline-offset: 3px;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
}

.card {
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(255, 255, 255, 0.82);
    border-radius: 18px;
    overflow: hidden;
    transition: box-shadow 0.18s ease, border-color 0.18s ease;
    display: flex;
    flex-direction: column;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.06);
    content-visibility: auto;
    contain-intrinsic-size: 420px;
    opacity: 1;
    transform: none;
}

.card.is-visible {
    opacity: 1;
    transform: none;
}

.card:hover {
    box-shadow: 0 16px 36px rgba(15, 23, 42, 0.07);
    border-color: rgba(255, 255, 255, 0.92);
}

.card-image-wrapper {
    position: relative;
    aspect-ratio: 4 / 3;
    padding: 18px 32px 30px 18px;
    background:
        linear-gradient(180deg, #faf8f5 0%, #f1ede7 100%);
    border-bottom: 1px solid rgba(229, 231, 235, 0.7);
    overflow: hidden;
    contain: layout paint;
}

.card-image-wrapper::after {
    content: "";
    position: absolute;
    inset: auto 14px 12px 14px;
    height: 24px;
    border-radius: 12px;
    background: radial-gradient(circle, rgba(15, 23, 42, 0.12), transparent 68%);
    filter: blur(12px);
    opacity: 0.18;
    z-index: 0;
}

.stack-carousel {
    position: relative;
    width: 100%;
    height: 100%;
    isolation: isolate;
}

.stack-item {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.28s ease, opacity 0.2s ease, box-shadow 0.24s ease, filter 0.24s ease;
    opacity: 0;
    pointer-events: none;
    cursor: zoom-in;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.92);
    background: #ffffff;
    box-shadow:
        0 18px 34px rgba(15, 23, 42, 0.09),
        0 1px 0 rgba(255, 255, 255, 0.5) inset;
}

.stack-item.active {
    opacity: 1;
    transform: translate3d(0, 0, 0) rotate(0deg) scale(1);
    z-index: 50;
    pointer-events: auto;
    box-shadow:
        0 22px 42px rgba(15, 23, 42, 0.12),
        0 1px 0 rgba(255, 255, 255, 0.5) inset;
}

.stack-item.layered {
    opacity: var(--stack-opacity, 0.72);
    transform: translate3d(var(--stack-offset-x, 18px), var(--stack-offset-y, 10px), 0) rotate(var(--stack-rotation, 1.5deg)) scale(var(--stack-scale, 0.96));
    z-index: var(--stack-z-index, 1);
    filter: saturate(0.92) brightness(0.985);
}

.nav-arrow {
    position: absolute;
    top: calc(50% - 6px);
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 12;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.10);
    transition: background-color 0.18s ease, opacity 0.18s ease;
    opacity: 0.94;
}

.nav-arrow:hover {
    background: #ffffff;
}

.nav-arrow.prev {
    left: 10px;
}

.nav-arrow.next {
    right: 10px;
}

.nav-arrow svg {
    width: 16px;
    height: 16px;
    color: #344054;
}

.carousel-pagination {
    position: absolute;
    left: 18px;
    bottom: 12px;
    display: inline-flex;
    gap: 6px;
    padding: 8px 10px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.76);
    backdrop-filter: saturate(180%) blur(14px);
    z-index: 12;
}

.carousel-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(71, 84, 103, 0.35);
    transition: background-color 0.18s ease;
}

.carousel-dot.active {
    background: var(--brand-color);
}

.multi-image-badge {
    position: absolute;
    top: 14px;
    right: 12px;
    background: rgba(18, 18, 18, 0.62);
    color: #ffffff;
    font-size: 11px;
    padding: 5px 8px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 4px;
    z-index: 13;
    backdrop-filter: blur(8px);
}

.multi-image-badge svg {
    width: 12px;
    height: 12px;
}

.card-content {
    padding: 18px 18px 22px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    cursor: pointer;
    min-height: 132px;
}

.card-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.card-title {
    font-size: 18px;
    line-height: 1.3;
    font-weight: 680;
    color: var(--text-primary);
}

.card-image-count {
    flex-shrink: 0;
    font-size: 12px;
    color: var(--brand-color);
    background: rgba(39, 83, 84, 0.08);
    border-radius: 10px;
    padding: 4px 8px;
}

.card-desc {
    font-size: 13px;
    color: #667085;
    line-height: 1.72;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-content,
.hero-panel,
.toolbar-panel {
    will-change: auto;
}

.card-tags {
    margin-top: 2px;
}

.empty-state {
    text-align: center;
    padding: 72px 0;
    color: var(--text-secondary);
}

.empty-state svg {
    width: 48px;
    height: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal.active .modal-overlay {
    animation: none;
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(12, 16, 23, 0.96);
    backdrop-filter: blur(10px);
    transition: opacity 0.2s ease;
}

.modal-content {
    position: relative;
    width: 100%;
    height: 100%;
    z-index: 1001;
    transition: transform 0.2s ease;
}

.preview-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    transition: transform 0.18s ease;
}

.modal-carousel-wrapper {
    position: relative;
    flex: 1;
    padding: 76px 18px 132px;
    overflow: hidden;
}

.modal-stack-carousel {
    position: relative;
    width: 100%;
    height: 100%;
}

.modal-stack-item {
    position: absolute;
    top: 50%;
    left: 50%;
    width: min(92vw, 900px);
    height: min(68vh, 760px);
    transform: translate(-50%, -50%);
    object-fit: contain;
    transition: transform 0.24s ease, opacity 0.18s ease;
    opacity: 0;
    pointer-events: none;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.04);
}

.modal-stack-item.active {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    z-index: 50;
    pointer-events: auto;
    box-shadow: 0 26px 60px rgba(0, 0, 0, 0.24);
}

.modal-stack-item.layered {
    opacity: var(--stack-opacity, 0.68);
    transform: translate(calc(-50% + var(--stack-offset-x, 22px)), calc(-50% + var(--stack-offset-y, 10px))) rotate(var(--stack-rotation, 1.5deg)) scale(var(--stack-scale, 0.96));
    z-index: var(--stack-z-index, 1);
}

.preview-info {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 12;
    padding: 18px 20px calc(22px + env(safe-area-inset-bottom));
    background: linear-gradient(180deg, transparent 0%, rgba(10, 13, 18, 0.9) 28%, rgba(10, 13, 18, 0.98) 100%);
    color: #ffffff;
    animation: none;
}

.preview-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.preview-count {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 10px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.88);
    font-size: 12px;
}

.preview-info h3 {
    font-size: 20px;
    margin-bottom: 8px;
    color: #ffffff;
}

.preview-info p {
    max-width: 720px;
    color: rgba(255, 255, 255, 0.76);
    font-size: 14px;
    margin-bottom: 12px;
}

.preview-info .tag {
    background: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.88);
}

.modal-close {
    position: fixed;
    top: calc(14px + env(safe-area-inset-top));
    right: 16px;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #ffffff;
    z-index: 2000;
    backdrop-filter: blur(8px);
    transition: background-color 0.18s ease;
}

.modal-close svg {
    width: 18px;
    height: 18px;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

@media (prefers-reduced-motion: reduce) {
    .card,
    .stack-item,
    .modal-stack-item,
    .nav-arrow,
    .modal-close,
    .filter-btn {
        transition: none !important;
        animation: none !important;
    }

    .card {
        opacity: 1;
        transform: none;
    }
}

@media (hover: none) {
    .nav-arrow {
        opacity: 0.92;
    }
}

@media (max-width: 767px) {
    .hero-row,
    .toolbar-header,
    .card-title-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .hero-title {
        font-size: 28px;
    }

    .page-glow {
        width: 60vw;
        height: 60vw;
        opacity: 0.08;
    }

    .gallery-grid {
        grid-template-columns: 1fr;
        gap: 18px;
    }

    .card {
        border-radius: 16px;
    }

    .card-image-wrapper {
        padding: 14px 26px 24px 14px;
    }

    .stack-item {
        border-radius: 12px;
    }

    .nav-arrow {
        width: 44px;
        height: 44px;
    }

    .carousel-pagination {
        left: 14px;
        bottom: 10px;
    }

    .modal-carousel-wrapper {
        padding: 84px 14px 156px;
    }

    .modal-stack-item {
        width: calc(100vw - 28px);
        height: min(60vh, 520px);
        border-radius: 14px;
    }

    .preview-info {
        padding-left: 16px;
        padding-right: 16px;
    }

    .preview-info h3 {
        font-size: 18px;
    }

    .toolbar-tip {
        font-size: 11px;
    }
}

@media (min-width: 768px) {
    .modal-carousel-wrapper .nav-arrow.prev {
        left: 24px;
    }

    .modal-carousel-wrapper .nav-arrow.next {
        right: 24px;
    }
}
