/* ==========================================================================
   room.css - Hotel room detail page
   Mobile-first. Reuses design tokens from main.css (--color-*, --font-main,
   --space-*, --radius-*, --shadow-*, --header-height, --container-width).
   Only NEW, non-conflicting tokens are introduced here:
     --room-accent : warm brown used for pins / primary CTA
     --room-line   : hairline border color for room cards
   Typography uses the site's Inter stack (no new fonts introduced).
   ========================================================================== */
:root {
    --room-accent: #a9714c;
    --room-line: #e4dfd6;
}

/* Body offset so the sticky booking bar never covers page content */
body.room-page {
    padding-bottom: 88px;
}

/* ==========================================================================
   HERO
   ========================================================================== */
.room-hero {
    position: relative;
    height: 85vh;
    min-height: 420px;
    padding-top: var(--header-height);
    display: flex;
    align-items: flex-end;
    overflow: hidden;
    background-color: var(--color-primary);
}

.room-hero-media {
    position: absolute;
    inset: 0;
    display: block;
}

.room-hero-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: opacity 0.4s ease;
}

.room-hero::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.15), rgba(0, 0, 0, 0.55));
    z-index: 1;
}

.room-back {
    position: absolute;
    top: calc(var(--header-height) + var(--space-md));
    left: var(--space-md);
    z-index: 3;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 44px;
    padding: 8px 16px;
    color: #fff;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    background: rgba(0, 0, 0, 0.35);
    border-radius: var(--radius-sm);
    backdrop-filter: blur(4px);
}

.room-hero-content {
    position: relative;
    z-index: 2;
    padding: 0 var(--space-md) var(--space-xl);
    color: #fff;
    width: 100%;
}

.room-hero-content h1 {
    font-family: var(--font-main);
    font-weight: 600;
    font-size: clamp(2rem, 7vw, 3rem);
    margin: 0 0 8px;
    line-height: 1.1;
}

.room-hero-content p {
    font-size: 0.95rem;
    letter-spacing: 0.4px;
    opacity: 0.92;
    margin: 0;
}

/* ==========================================================================
   SECTION WRAPPER
   ========================================================================== */
.room-section {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: var(--space-xl) var(--space-md);
}

.room-section-title {
    font-family: var(--font-main);
    font-weight: 600;
    font-size: 1.6rem;
    margin: 0 0 8px;
    color: var(--color-primary);
}

.room-section-sub {
    color: #8a8378;
    font-size: 0.95rem;
    margin: 0 0 var(--space-lg);
}

/* ==========================================================================
   FLOOR PLAN + PHOTO PANEL
   ========================================================================== */
.floorplan-wrap {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-lg);
    align-items: start;
}

.floorplan-container {
    position: relative;
    background: var(--color-bg-card);
    border: 1px solid var(--room-line);
    padding: 20px;
    border-radius: var(--radius-md);
    color: var(--color-primary);
}

.floorplan-container svg {
    width: 100%;
    display: block;
}

/* Pins: touch-friendly (min 44x44), positioned by percentage over container */
.fp-pin {
    position: absolute;
    transform: translate(-50%, -50%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--room-accent);
    color: #fff;
    border: 3px solid #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.2s ease, background 0.2s ease;
    animation: fp-pulse 2.5s infinite;
}

.fp-pin.active,
.fp-pin:focus-visible {
    transform: translate(-50%, -50%) scale(1.12);
    background: var(--color-primary);
}

.fp-pin.active {
    animation: none;
}

@keyframes fp-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(169, 113, 76, 0.5), 0 2px 8px rgba(0, 0, 0, 0.25); }
    70%  { box-shadow: 0 0 0 12px rgba(169, 113, 76, 0),  0 2px 8px rgba(0, 0, 0, 0.25); }
    100% { box-shadow: 0 0 0 0 rgba(169, 113, 76, 0),     0 2px 8px rgba(0, 0, 0, 0.25); }
}

/* Photo panel: below floor plan on mobile, beside on desktop */
.photo-panel {
    scroll-margin-top: calc(var(--header-height) + 16px);
}

.photo-panel picture {
    display: block;
}

.photo-panel img {
    width: 100%;
    height: 280px;
    object-fit: cover;
    border-radius: var(--radius-md);
    margin-bottom: 14px;
    transition: opacity 0.3s ease;
}

.photo-panel .photo-caption {
    font-size: 0.85rem;
    color: var(--room-accent);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 4px;
    font-weight: 600;
}

.photo-panel .photo-desc {
    font-size: 0.95rem;
    color: #6b655a;
    line-height: 1.6;
}

/* ==========================================================================
   FEATURES GRID
   ========================================================================== */
.features-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
}

.feature-item {
    position: relative;
    overflow: hidden;
    text-align: center;
    padding: var(--space-md) 10px;
    border: 1px solid var(--room-line);
    border-radius: var(--radius-md);
    background: var(--color-bg-card);
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
    -webkit-tap-highlight-color: transparent;
}

/* Warm wash that fades in on hover, keyboard focus and tap. */
.feature-item::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(169, 113, 76, 0.14), transparent 70%);
    opacity: 0;
    transition: opacity 0.25s ease;
    pointer-events: none;
}

.feature-item:hover,
.feature-item.is-pressed {
    transform: translateY(-4px);
    border-color: rgba(169, 113, 76, 0.55);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.1);
}

.feature-item:focus-visible {
    outline: 2px solid var(--room-accent);
    outline-offset: 2px;
}

.feature-item:hover::after,
.feature-item:focus-visible::after,
.feature-item.is-pressed::after {
    opacity: 1;
}

.feature-item .icon {
    font-size: 1.7rem;
    margin-bottom: 8px;
    line-height: 1;
    transition: transform 0.25s ease, color 0.25s ease;
}

.feature-item:hover .icon,
.feature-item:focus-visible .icon,
.feature-item.is-pressed .icon {
    transform: scale(1.15) rotate(-4deg);
    color: var(--room-accent);
}

.feature-item .label {
    font-size: 0.88rem;
    color: var(--color-primary);
    letter-spacing: 0.3px;
}

/* ==========================================================================
   DESCRIPTION (pull-quote)
   ========================================================================== */
.room-description {
    font-size: 1.1rem;
    color: #444;
    max-width: 720px;
    font-style: italic;
    border-left: 3px solid var(--room-accent);
    padding-left: 20px;
    margin: var(--space-md) 0 0;
    line-height: 1.7;
}

/* ==========================================================================
   GALLERY (horizontal swipe on mobile, grid on desktop)
   ========================================================================== */
.room-gallery {
    position: relative;
}

.room-gallery-track {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 8px;
    scrollbar-width: none;
}
.room-gallery-track::-webkit-scrollbar { display: none; }

.room-gallery-track picture {
    flex: 0 0 80%;
    height: 240px;
    scroll-snap-align: center;
}

.room-gallery-track img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius-md);
}

/* Only advertise a click once room.js has wired the thumbnail to the viewer. */
.room-gallery-track img[data-lightbox-index] {
    cursor: pointer;
}

.room-gallery-nav {
    display: flex;
    gap: 10px;
    margin-top: 12px;
}

.gallery-arrow {
    width: 44px;
    height: 44px;
    min-width: 44px;
    border: 1px solid var(--room-line);
    background: var(--color-bg-card);
    border-radius: 50%;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-primary);
    -webkit-tap-highlight-color: transparent;
}
.gallery-arrow:hover { background: var(--room-accent); color: #fff; border-color: var(--room-accent); }

/* ==========================================================================
   FULL-SCREEN GALLERY LIGHTBOX
   ========================================================================== */
body.lightbox-open {
    overflow: hidden;
}

.lightbox {
    position: fixed;
    inset: 0;
    /* Above the fixed site header (1000) and its menu layers (2000). */
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(8px, 2vw, 24px);
    padding: 64px max(16px, 4vw) 32px;
    background: rgba(17, 14, 12, 0.94);
}

/* Author `display` would otherwise beat the UA rule for [hidden]. */
.lightbox[hidden] {
    display: none;
}

.lightbox-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    max-width: min(100%, 1200px);
    max-height: 100%;
    margin: 0;
}

.lightbox-content img {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: calc(100vh - 160px);
    object-fit: contain;
    border-radius: var(--radius-md);
}

.lightbox-content figcaption {
    color: #f7f2ea;
    font-size: 0.9rem;
    letter-spacing: 0.3px;
    text-align: center;
}

.lightbox-close,
.lightbox-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    min-width: 48px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.lightbox-close {
    position: absolute;
    top: 16px;
    right: 16px;
    font-size: 2rem;
}

.lightbox-close:hover,
.lightbox-nav:hover {
    background: var(--room-accent);
    border-color: var(--room-accent);
}

.lightbox-close:focus-visible,
.lightbox-nav:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 3px;
}

@media (max-width: 599px) {
    .lightbox {
        padding: 72px 12px 24px;
        gap: 8px;
    }
    .lightbox-nav {
        width: 44px;
        height: 44px;
        min-width: 44px;
    }
    .lightbox-content img {
        max-height: calc(100vh - 180px);
    }
}

/* ==========================================================================
   STICKY BOOKING BAR (thumb-reachable, bottom of viewport)
   ========================================================================== */
.room-booking-bar {
    position: fixed;
    left: 0;
    bottom: 0;
    width: 100%;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
    padding: 12px var(--space-md);
    background: var(--color-bg-card);
    border-top: 1px solid var(--room-line);
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.06);
}

.room-booking-text {
    font-size: 0.85rem;
    color: var(--color-primary);
    font-weight: 500;
    line-height: 1.3;
}

.room-booking-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 12px 24px;
    background: var(--room-accent);
    color: #fff;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    border-radius: var(--radius-sm);
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
}
.room-booking-btn:hover { background: var(--color-primary); }

/* ==========================================================================
   DESKTOP LAYOUT (>= 800px)
   ========================================================================== */
@media (min-width: 800px) {
    .room-back {
        left: var(--space-lg);
    }
    .room-hero-content {
        padding: 0 var(--space-lg) 60px;
    }
    .room-section {
        padding: 80px 40px;
    }
    .room-section-title { font-size: 1.8rem; }

    .floorplan-wrap {
        grid-template-columns: 1.3fr 1fr;
        gap: 50px;
    }
    .photo-panel {
        position: sticky;
        top: calc(var(--header-height) + 16px);
    }
    .photo-panel img { height: 320px; }

    .features-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 24px;
    }

    .room-gallery-track {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        overflow: visible;
    }
    .room-gallery-track picture {
        flex: auto;
        width: 100%;
        height: 200px;
    }
    .room-gallery-nav { display: none; }

    .room-booking-bar { padding: 18px 40px; }
    .room-booking-text { font-size: 0.95rem; }
}

/* ==========================================================================
   REDUCED MOTION
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
    .fp-pin { animation: none; }
    .photo-panel img,
    .room-hero-media img { transition: none; }
    .feature-item,
    .feature-item::after,
    .feature-item .icon { transition: none; }
}
