/* Sanctuary viewer — styled after viewer.neamh.uk */

.sanctuary-viewer {
    position: relative;
    border-radius: 24px;
    overflow: hidden;
    height: 214px;
    flex-shrink: 0;
    cursor: pointer;
    transition: box-shadow 0.25s ease;
}

.sanctuary-viewer:hover {
    box-shadow: 0 14px 30px rgba(var(--identity-accent-rgb), 0.14);
}

/* Background scene */
.sanctuary-bg {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 22% 18%, rgba(255, 238, 225, 0.28), transparent 24%),
        linear-gradient(135deg, rgba(92, 60, 74, 0.72), rgba(40, 28, 38, 0.88));
    background-size: cover;
    background-position: center;
    transition: filter 0.5s ease;
}

/* Time-of-day filters — automatic based on server time */
.sanctuary-bg.tod-morning {
    filter: brightness(1.05) saturate(0.9) sepia(0.08);
}

.sanctuary-bg.tod-afternoon {
    filter: brightness(1.0);
}

.sanctuary-bg.tod-evening {
    filter: brightness(0.75) saturate(0.85) sepia(0.15);
}

.sanctuary-bg.tod-night {
    filter: brightness(0.45) saturate(0.7) sepia(0.1);
}

/* Night mode override — always dim */
body.night-mode .sanctuary-bg {
    filter: brightness(0.4) saturate(0.6);
}

/* Gradient overlays for text readability */
.sanctuary-overlay {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(to top, rgba(22, 10, 14, 0.72) 0%, rgba(22, 10, 14, 0.18) 52%, transparent 78%),
        linear-gradient(to right, rgba(22, 10, 14, 0.34) 0%, transparent 42%);
}

/* Portrait — large, centered-right like the existing viewer */
.sanctuary-portrait {
    position: absolute;
    right: 20px;
    bottom: 0;
    height: 198px;
    width: auto;
    max-width: 180px;
    object-fit: contain;
    object-position: bottom;
    filter: drop-shadow(0 10px 22px rgba(0, 0, 0, 0.42));
    z-index: 2;
    border-radius: 0;
    border: none;
    transition: transform 0.4s ease, filter 0.4s ease;
}

.sanctuary-viewer:hover .sanctuary-portrait {
    transform: translateY(-4px);
    filter: drop-shadow(0 14px 28px rgba(0, 0, 0, 0.52));
}

/* Info overlay — bottom-left */
.sanctuary-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 200px;
    z-index: 3;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.sanctuary-identity-name {
    font-family: var(--font-display);
    font-size: 1.72rem;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.55);
}

.sanctuary-location {
    font-size: 0.86rem;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
    font-weight: 500;
}

.sanctuary-mood {
    font-size: 0.8rem;
    font-style: italic;
    color: rgba(255, 255, 255, 0.8);
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
    margin-top: 2px;
}

.sanctuary-thought {
    font-size: 0.74rem;
    color: rgba(255, 255, 255, 0.78);
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
    margin-top: 4px;
    max-width: 280px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
}

/* ── Expanded sanctuary view ── */
.sanctuary-expanded {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 40px;
    overflow-y: auto;
}

.sanctuary-expanded.visible {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.sanctuary-expanded-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
    color: white;
    cursor: pointer;
    transition: background 0.2s;
}

.sanctuary-expanded-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.sanctuary-expanded-title {
    font-family: var(--font-display);
    font-size: 2rem;
    color: #fff;
    margin-top: 20px;
}

.sanctuary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
    max-width: 900px;
    width: 100%;
}

.sanctuary-room-card {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.25s ease;
    position: relative;
}

.sanctuary-room-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.15);
}

.sanctuary-room-bg {
    height: 140px;
    background-size: cover;
    background-position: center;
    position: relative;
    transition: filter 0.5s ease;
}

.sanctuary-room-bg.tod-morning { filter: brightness(1.05) saturate(0.9) sepia(0.08); }
.sanctuary-room-bg.tod-evening { filter: brightness(0.75) saturate(0.85) sepia(0.15); }
.sanctuary-room-bg.tod-night { filter: brightness(0.45) saturate(0.7) sepia(0.1); }

.sanctuary-room-portrait {
    position: absolute;
    right: 10px;
    bottom: 0;
    height: 120px;
    width: auto;
    object-fit: contain;
    object-position: bottom;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.4));
    border: none;
    border-radius: 0;
}

.sanctuary-room-info {
    padding: 12px 16px;
    color: #fff;
}

.sanctuary-room-name {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 600;
}

.sanctuary-room-location {
    font-size: 0.75rem;
    opacity: 0.7;
    margin-top: 2px;
}

.sanctuary-room-mood {
    font-size: 0.75rem;
    font-style: italic;
    opacity: 0.6;
    margin-top: 4px;
}

.sanctuary-room-thought {
    font-size: 0.7rem;
    opacity: 0.55;
    margin-top: 6px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
