/* ═══════════════════════════════════════════════════
   SITE2SITE GALLERY — Premium Public Stylesheet
   ═══════════════════════════════════════════════════ */

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

:root {
    --s2s-blue: #2563eb;
    --s2s-blue-dark: #1d4ed8;
    --s2s-text: #0f172a;
    --s2s-text-2: #475569;
    --s2s-border: #e2e8f0;
    --s2s-bg: #f8fafc;
    --s2s-white: #ffffff;
    --s2s-radius: 20px;
    --s2s-shadow: 0 25px 60px -12px rgba(0,0,0,0.35);
}

.s2s-gallery-wrap * {
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

/* ─── FILTER BAR ──────────────────────────────────── */
.s2s-filter-bar {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 0 0 36px;
    flex-wrap: wrap;
}

.s2s-filter-btn {
    padding: 9px 22px;
    border: 1.5px solid var(--s2s-border);
    background: var(--s2s-white);
    border-radius: 9999px;
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--s2s-text-2);
}

.s2s-filter-btn.active,
.s2s-filter-btn:hover {
    background: var(--s2s-blue);
    color: #fff;
    border-color: var(--s2s-blue);
}

/* ─── PROJECT GRID ────────────────────────────────── */
.s2s-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    gap: 24px;
    transition: opacity 0.3s;
}

.s2s-no-results {
    grid-column: 1/-1;
    text-align: center;
    color: var(--s2s-text-2);
    padding: 60px 0;
}

/* ─── GRID CARD ───────────────────────────────────── */
.s2s-item {
    border-radius: var(--s2s-radius);
    overflow: hidden;
    cursor: pointer;
    background: var(--s2s-white);
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    border: 1px solid var(--s2s-border);
    transition: transform 0.35s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.35s;
    animation: s2sFadeUp 0.5s ease forwards;
    opacity: 0;
    display: flex;
    flex-direction: column;
}

.s2s-item:nth-child(1) { animation-delay: 0.05s; }
.s2s-item:nth-child(2) { animation-delay: 0.10s; }
.s2s-item:nth-child(3) { animation-delay: 0.15s; }
.s2s-item:nth-child(4) { animation-delay: 0.20s; }
.s2s-item:nth-child(5) { animation-delay: 0.25s; }
.s2s-item:nth-child(6) { animation-delay: 0.30s; }

@keyframes s2sFadeUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

.s2s-item:hover {
    transform: translateY(-6px);
    box-shadow: 0 16px 32px -8px rgba(0,0,0,0.14);
}

.s2s-item-img-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 4/3;
    overflow: hidden;
    background: #e2e8f0;
}

.s2s-item-img {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    transition: transform 0.55s ease;
}

.s2s-item:hover .s2s-item-img {
    transform: scale(1.07);
}

.s2s-ba-badge {
    position: absolute;
    bottom: 10px;
    left: 10px;
    background: rgba(0,0,0,0.65);
    color: #fff;
    backdrop-filter: blur(6px);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 4px 10px;
    border-radius: 6px;
}

.s2s-item-info {
    padding: 18px 20px 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.s2s-item-cat {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--s2s-blue);
}

.s2s-item-info h3 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--s2s-text);
    line-height: 1.3;
}

.s2s-item-town {
    margin: 0;
    font-size: 0.82rem;
    color: var(--s2s-text-2);
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ─── MODAL SHELL ─────────────────────────────────── */
.s2s-modal {
    display: flex;
    align-items: flex-end; /* sheet from bottom on mobile */
    justify-content: center;
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.8);
    backdrop-filter: blur(6px);
    z-index: 2147483647;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s;
}

.s2s-modal.is-open {
    opacity: 1;
    pointer-events: all;
}

html.s2s-modal-open {
    overflow: hidden;
}

.s2s-modal-content {
    position: relative;
    background: var(--s2s-white);
    width: 100%;
    max-width: 780px;
    max-height: 92vh;
    overflow-y: auto;
    border-radius: 24px 24px 0 0;
    box-shadow: var(--s2s-shadow);
    transform: translateY(30px);
    transition: transform 0.35s cubic-bezier(0.34,1.56,0.64,1);
    overscroll-behavior: contain;
}

.s2s-modal.is-open .s2s-modal-content {
    transform: translateY(0);
}

/* Drag handle pill on mobile */
.s2s-modal-content::before {
    content: '';
    display: block;
    width: 40px;
    height: 4px;
    background: #cbd5e1;
    border-radius: 9999px;
    margin: 14px auto 0;
}

@media (min-width: 640px) {
    .s2s-modal-content::before {
        display: none;
    }
}

/* Desktop: centered card */
@media (min-width: 640px) {
    .s2s-modal {
        align-items: center;
        padding: 24px;
    }
    .s2s-modal-content {
        border-radius: 24px;
        max-height: 90vh;
    }
    .s2s-modal-content::before {
        display: none;
    }
}

.s2s-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    border: none;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #0f172a;
    z-index: 10;
    transition: background 0.2s, transform 0.15s;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
}

.s2s-modal-close:hover {
    background: #fff;
    transform: scale(1.08);
}

/* ─── MODAL INNER ─────────────────────────────────── */
.s2s-modal-inner {
    display: flex;
    flex-direction: column;
}

/* ─── MEDIA HERO ──────────────────────────────────── */
.s2s-modal-hero {
    position: relative;
    width: 100%;
    background: #0f172a;
    overflow: hidden;
}

.s2s-hero-view {
    width: 100%;
    display: block;
}

/* Standard image */
#s2s-main-view {
    aspect-ratio: 4/3;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0f172a;
    overflow: hidden;
}

#s2s-main-view img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: opacity 0.2s;
}

/* ─── BEFORE/AFTER SLIDER ─────────────────────────── */
.s2s-ba-container {
    position: relative;
    width: 100%;
    aspect-ratio: 4/3;
    overflow: hidden;
    cursor: col-resize;
    user-select: none;
    -webkit-user-select: none;
}

.s2s-ba-img {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    pointer-events: none;
}

.s2s-ba-after {
    z-index: 2;
    overflow: hidden;
    right: auto; /* width is set dynamically */
}

/* White divider line */
.s2s-ba-divider {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: rgba(255,255,255,0.9);
    z-index: 3;
    pointer-events: none;
    transform: translateX(-50%);
}

/* Drag handle */
.s2s-ba-handle {
    position: absolute;
    top: 50%;
    z-index: 4;
    transform: translate(-50%, -50%);
    width: 48px;
    height: 48px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 4px 20px rgba(0,0,0,0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    pointer-events: none;
    transition: transform 0.15s;
}

.s2s-ba-container.dragging .s2s-ba-handle {
    transform: translate(-50%, -50%) scale(1.12);
    background: var(--s2s-blue);
    color: #fff;
}

.s2s-ba-handle svg {
    width: 18px;
    height: 18px;
    color: var(--s2s-blue);
    flex-shrink: 0;
}

.s2s-ba-container.dragging .s2s-ba-handle svg {
    color: #fff;
}

/* Before/After labels */
.s2s-ba-label {
    position: absolute;
    top: 14px;
    z-index: 5;
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(4px);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 4px 10px;
    border-radius: 6px;
    pointer-events: none;
}

.s2s-ba-label-before { left: 14px; }
.s2s-ba-label-after  { right: 14px; }

/* Hint text */
.s2s-ba-hint {
    position: absolute;
    bottom: 14px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    color: rgba(255,255,255,0.85);
    font-size: 0.7rem;
    font-weight: 600;
    padding: 5px 14px;
    border-radius: 9999px;
    pointer-events: none;
    z-index: 5;
    white-space: nowrap;
    transition: opacity 0.3s;
}

.s2s-ba-container.dragging .s2s-ba-hint {
    opacity: 0;
}

/* ─── THUMBNAIL STRIP ─────────────────────────────── */
.s2s-thumb-strip {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    overflow-x: auto;
    background: #0f172a;
    scrollbar-width: none;
}

.s2s-thumb-strip::-webkit-scrollbar {
    display: none;
}

.s2s-thumb {
    flex-shrink: 0;
    width: 62px;
    height: 62px;
    border-radius: 10px;
    border: 2px solid rgba(255,255,255,0.12);
    background-size: cover;
    background-position: center;
    cursor: pointer;
    transition: all 0.2s;
    padding: 0;
    overflow: hidden;
}

.s2s-thumb:hover {
    border-color: rgba(255,255,255,0.5);
    transform: scale(1.06);
}

.s2s-thumb.is-active {
    border-color: var(--s2s-blue);
    box-shadow: 0 0 0 2px rgba(37,99,235,0.5);
}

/* Slider icon thumb */
.s2s-thumb-slider {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.7);
    font-size: 0.55rem;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.s2s-thumb-slider svg {
    color: rgba(255,255,255,0.7);
}

.s2s-thumb-slider.is-active {
    background: rgba(37,99,235,0.3);
    color: #93c5fd;
}

.s2s-thumb-slider.is-active svg {
    color: #93c5fd;
}

/* ─── PROJECT INFO ────────────────────────────────── */
.s2s-modal-info {
    padding: 20px 24px 32px;
    background: var(--s2s-white);
}

.s2s-modal-cat-tag {
    display: inline-flex;
    align-items: center;
    background: #eff6ff;
    color: var(--s2s-blue);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    padding: 4px 10px;
    border-radius: 6px;
    margin-bottom: 10px;
}

.s2s-modal-title {
    margin: 0 0 8px;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--s2s-text);
    line-height: 1.25;
    letter-spacing: -0.02em;
}

/* Prominent location — sits directly under the title */
.s2s-modal-location {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--s2s-blue);
    margin-bottom: 18px;
}

.s2s-modal-location svg {
    flex-shrink: 0;
    color: var(--s2s-blue);
}

.s2s-modal-desc {
    color: var(--s2s-text-2);
    font-size: 0.95rem;
    line-height: 1.7;
    margin-bottom: 24px;
}

.s2s-modal-desc p { margin: 0 0 12px; }
.s2s-modal-desc p:last-child { margin: 0; }

.s2s-close-btn {
    display: inline-flex;
    align-items: center;
    padding: 12px 28px;
    background: var(--s2s-text);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.s2s-close-btn:hover {
    background: var(--s2s-blue);
    transform: translateY(-1px);
}

/* ─── LOADING ─────────────────────────────────────── */
.s2s-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 320px;
}

.s2s-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--s2s-border);
    border-top-color: var(--s2s-blue);
    border-radius: 50%;
    animation: s2sSpin 0.7s linear infinite;
}

@keyframes s2sSpin {
    to { transform: rotate(360deg); }
}

/* ─── RESPONSIVE ──────────────────────────────────── */
@media (max-width: 480px) {
    .s2s-modal-title { font-size: 1.25rem; }
    .s2s-modal-info  { padding: 20px 18px 28px; }
    .s2s-ba-container { aspect-ratio: 1/1; }
    #s2s-main-view    { aspect-ratio: 1/1; }
    .s2s-thumb { width: 54px; height: 54px; }
}
