@import url('https://fonts.googleapis.com/css2?family=Geist:wght@300;400;500;700&family=Geist+Mono:wght@300;400;500;700&display=swap');

.cstel-haunts-demo,
.cstel-haunts-demo * { box-sizing: border-box; }

.cstel-haunts-demo {
    --bg: #000;
    --ink: #fff;
    --muted: #999;
    --soft: #d8d8d8;
    --line: rgba(255,255,255,.22);
    --line-strong: rgba(255,255,255,.55);
    --panel: rgba(255,255,255,.045);
    --panel-strong: rgba(255,255,255,.09);
    width: 100%;
    padding: clamp(20px,4vw,56px);
    background:
        radial-gradient(circle at 42% 22%, rgba(255,255,255,.08), transparent 24rem),
        #000;
    color: var(--ink);
    font-family: "Geist", Inter, sans-serif;
}

.cstel-haunts-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin: 0 0 28px;
    font-family: "Geist Mono", monospace;
    font-size: 12px;
}

.cstel-haunts-toolbar button,
.cstel-haunts-toolbar select,
.cstel-haunts-toolbar .cstel-toolbar-link {
    min-height: 36px;
    border: 1px solid var(--line);
    border-radius: 0;
    background: #000;
    color: #fff;
    padding: 0 13px;
    font: inherit;
    cursor: pointer;
}

.cstel-haunts-toolbar button:hover,
.cstel-haunts-toolbar button.is-active,
.cstel-haunts-toolbar .cstel-toolbar-link {
    border-color: #fff;
    background: #fff;
    color: #000;
}

.cstel-haunts-toolbar .toolbar-spacer { flex: 1 1 auto; }
.cstel-haunts-toolbar .cstel-toolbar-link { display: inline-flex; align-items: center; justify-content: center; min-height: 36px; text-decoration: none; }
.cstel-haunts-toolbar .cstel-toolbar-link:hover { border-color: #fff; background: #000; color: #fff; }
.cstel-select-wrap { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); }

.cstel-haunts-demo__layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(360px, 41%);
    gap: 26px;
    align-items: start;
}

.cstel-haunts-demo__cards {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.cstel-haunt-demo-card {
    position: relative;
    display: flex;
    min-height: 270px;
    flex-direction: column;
    gap: 12px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--panel);
    color: #fff;
    text-align: left;
    cursor: pointer;
    transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.cstel-haunt-demo-card:hover,
.cstel-haunt-demo-card.is-active {
    border-color: var(--line-strong);
    background: var(--panel-strong);
    transform: translateY(-2px);
}

.cstel-haunt-demo-card[hidden],
.cstel-map-pin[hidden] { display: none !important; }

.card-topline {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    color: var(--muted);
    font-family: "Geist Mono", monospace;
    font-size: 12px;
    line-height: 1.35;
}

.card-topline i {
    width: 10px;
    height: 10px;
    margin-top: 2px;
    border-radius: 50%;
    background: var(--dot, #fff);
    box-shadow: 0 0 20px color-mix(in srgb, var(--dot, #fff) 55%, transparent);
}

.card-title {
    display: block;
    color: #fff;
    font-size: clamp(34px, 4vw, 54px);
    font-weight: 400;
    letter-spacing: -.045em;
    line-height: .95;
}

.card-meta,
.chip,
.card-note {
    font-family: "Geist Mono", monospace;
    font-size: 12px;
    line-height: 1.45;
}

.card-meta { min-height: 34px; color: var(--muted); }
.chip-row { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 2px; }
.chip { display: inline-flex; min-height: 25px; align-items: center; border: 1px solid var(--line); padding: 5px 8px; color: var(--soft); }
.chip.is-work { border-color: #74f0b0; color: #74f0b0; }
.chip.is-color { border-color: var(--dot, #fff); color: var(--dot, #fff); }
.card-note { margin-top: auto; color: #fff; font-family: "Geist", Inter, sans-serif; font-size: 16px; font-weight: 300; white-space: pre-line; }

.cstel-haunts-demo__map-panel {
    position: sticky;
    top: 96px;
    border: 1px solid var(--line);
    border-radius: 6px;
    overflow: hidden;
    background: #050505;
}

.cstel-map-shell { position: relative; min-height: 430px; border-bottom: 1px solid var(--line); }
.cstel-map-fallback,
.cstel-google-map {
    position: absolute;
    inset: 0;
    min-height: 430px;
}

.cstel-map-fallback {
    background:
        radial-gradient(circle at 38% 50%, color-mix(in srgb, var(--active-dot, #fff) 18%, transparent), transparent 20%),
        #090909;
}

.cstel-map-pin {
    position: absolute;
    left: var(--x);
    top: var(--y);
    z-index: 2;
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: #000;
    color: #fff;
    font-family: "Geist Mono", monospace;
    font-size: 11px;
    cursor: pointer;
    transform: translate(-50%, -50%);
    transition: transform 160ms ease, background 160ms ease, color 160ms ease, border-color 160ms ease;
}

.cstel-map-pin:hover,
.cstel-map-pin.is-active {
    border-color: var(--dot, #fff);
    background: var(--dot, #fff);
    color: #000;
    transform: translate(-50%, -50%) scale(1.18);
}

.cstel-map-caption { padding: 18px; }
.cstel-map-caption > span { color: var(--muted); font-family: "Geist Mono", monospace; font-size: 12px; }
.cstel-map-caption h2 { margin: 6px 0 10px; color: #fff; font-size: 36px; font-weight: 400; letter-spacing: -.04em; line-height: 1; }
.cstel-map-caption p { margin: 0; color: #fff; font-size: 16px; font-weight: 300; line-height: 1.45; }
.cstel-map-caption .chip-row { margin-top: 14px; }

.cstel-selected-media {
    display: block;
    width: 100%;
    padding: 0;
    border: 0;
    height: clamp(112px, 24vw, 180px);
    border-bottom: 1px solid var(--line);
    background: #0b0b0b;
    overflow: hidden;
    cursor: zoom-in;
    appearance: none;
}
.cstel-selected-media[hidden] { display: none !important; }
.cstel-selected-media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: saturate(.95) contrast(1.04);
    transition: transform 180ms ease, filter 180ms ease;
}
.cstel-selected-media:hover img,
.cstel-selected-media:focus-visible img {
    transform: scale(1.025);
    filter: saturate(1.06) contrast(1.06);
}
@media (max-width: 720px) {
    .cstel-selected-media { height: 136px; }
}

.cstel-catalog-empty { padding: 28px; border: 1px dashed rgba(255,255,255,.28); background: #000; color: #fff; font-family: "Geist Mono", monospace; }

@media (max-width: 1100px) {
    .cstel-haunts-demo__layout { grid-template-columns: 1fr; }
    .cstel-haunts-demo__map-panel { position: relative; top: auto; }
}

@media (max-width: 720px) {
    .cstel-haunts-demo { padding: 16px 14px 48px; }
    .cstel-haunts-toolbar {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
        margin: 0 0 18px;
        padding: 0;
        overflow: visible;
    }
    .cstel-haunts-toolbar .toolbar-spacer { display: none; }
    .cstel-haunts-toolbar button,
    .cstel-haunts-toolbar select,
    .cstel-haunts-toolbar .cstel-toolbar-link {
        width: 100%;
        min-width: 0;
        min-height: 46px;
        padding: 0 10px;
        text-align: center;
    }
    .cstel-select-wrap {
        order: -2;
        grid-column: 1 / -1;
        display: grid;
        grid-template-columns: auto minmax(0, 1fr);
        width: 100%;
        min-width: 0;
        min-height: 48px;
        align-items: center;
        gap: 10px;
        padding: 0 12px;
        border: 1px solid var(--line);
        color: var(--muted);
    }
    .cstel-select-wrap select {
        border: 0;
        padding: 0;
        text-align: left;
    }
    .cstel-haunts-toolbar [data-filter-work],
    .cstel-haunts-toolbar .cstel-toolbar-link { order: -1; grid-column: 1 / -1; }
    .cstel-haunts-demo__cards { grid-template-columns: 1fr; gap: 12px; }
    .cstel-haunt-demo-card { min-height: 0; padding: 18px; }
    .card-title { font-size: clamp(38px, 13vw, 58px); }
    .cstel-map-shell,
    .cstel-map-fallback,
    .cstel-google-map { min-height: 320px; }
}

.cstel-haunts-editor-placeholder {
    display: grid;
    gap: 8px;
    padding: 24px;
    border: 1px dashed rgba(255,255,255,.45);
    background: #000;
    color: #fff;
    font-family: "Geist Mono", monospace;
    font-size: 12px;
    line-height: 1.45;
}
.cstel-haunts-editor-placeholder strong {
    display: block;
    color: #fff;
    font-family: "Geist", Inter, sans-serif;
    font-size: 28px;
    font-weight: 400;
    letter-spacing: -.03em;
}
.cstel-haunts-editor-placeholder span { color: #bbb; }

.cstel-selected-gallery {
    column-count: 3;
    column-gap: 8px;
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid rgba(255,255,255,.16);
}
.cstel-selected-gallery button {
    display: block;
    width: 100%;
    padding: 0;
    border: 0;
    break-inside: avoid;
    margin: 0 0 8px;
    overflow: hidden;
    border-radius: 4px;
    background: #070707;
}
.cstel-selected-gallery img {
    display: block;
    width: 100%;
    height: auto;
    min-height: 82px;
    object-fit: cover;
    transition: transform 180ms ease, filter 180ms ease;
}
.cstel-selected-gallery button:nth-child(3n+1) img { aspect-ratio: 1 / 1.18; }
.cstel-selected-gallery button:nth-child(3n+2) img { aspect-ratio: 1 / .78; }
.cstel-selected-gallery button:nth-child(3n) img { aspect-ratio: 1 / 1; }
.cstel-selected-gallery button:hover img,
.cstel-selected-gallery button:focus-visible img { transform: scale(1.05); filter: saturate(1.12); }
@media (max-width: 720px) {
    .cstel-selected-gallery { column-count: 2; column-gap: 7px; margin-top: 16px; }
    .cstel-selected-gallery button { margin-bottom: 7px; }
}

.chip.is-wifi {
    position: relative;
    border-color: #83c7ff;
    color: #83c7ff;
    cursor: help;
}
.chip.is-wifi em {
    position: absolute;
    left: 50%;
    bottom: calc(100% + 8px);
    z-index: 20;
    min-width: max-content;
    max-width: 220px;
    padding: 7px 9px;
    border: 1px solid rgba(255,255,255,.24);
    background: #fff;
    color: #000;
    font-style: normal;
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 4px);
    transition: opacity 140ms ease, transform 140ms ease;
    white-space: nowrap;
}
.chip.is-wifi:hover em,
.chip.is-wifi:focus em,
.chip.is-wifi:focus-within em {
    opacity: 1;
    transform: translate(-50%, 0);
}


.cstel-lightbox-open { overflow: hidden; }
.cstel-image-lightbox {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: grid;
    place-items: center;
    padding: clamp(18px, 4vw, 48px);
}
.cstel-image-lightbox[hidden] { display: none !important; }
.cstel-image-lightbox__backdrop {
    position: absolute;
    inset: 0;
    border: 0;
    background: rgba(0,0,0,.82);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    cursor: zoom-out;
}
.cstel-image-lightbox__frame {
    position: relative;
    z-index: 1;
    width: min(94vw, 980px);
    max-height: 88vh;
    margin: 0;
    border: 1px solid rgba(255,255,255,.22);
    background: #050505;
    box-shadow: 0 28px 90px rgba(0,0,0,.65);
    overflow: hidden;
}
.cstel-image-lightbox__frame img {
    display: block;
    width: 100%;
    max-height: 88vh;
    object-fit: contain;
}
.cstel-image-lightbox__close {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 2;
    display: grid;
    width: 40px;
    height: 40px;
    place-items: center;
    border: 1px solid rgba(255,255,255,.32);
    border-radius: 999px;
    background: rgba(0,0,0,.72);
    color: #fff;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
}
@media (max-width: 720px) {
    .cstel-image-lightbox { padding: 14px; }
    .cstel-image-lightbox__frame { width: 100%; max-height: 84vh; }
    .cstel-image-lightbox__frame img { max-height: 84vh; }
}


/* Haunts selected card image/gallery cleanup: image tiles, not grey buttons. */
.cstel-haunts-demo .cstel-selected-media,
.cstel-haunts-demo .cstel-selected-gallery button {
    appearance: none !important;
    -webkit-appearance: none !important;
    display: block !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    color: inherit !important;
    line-height: 0 !important;
    box-shadow: none !important;
    text-shadow: none !important;
    outline: 0;
}
.cstel-haunts-demo .cstel-selected-media {
    width: 100% !important;
    height: clamp(132px, 28vw, 210px) !important;
    overflow: hidden !important;
    cursor: zoom-in;
}
.cstel-haunts-demo .cstel-selected-media img,
.cstel-haunts-demo .cstel-selected-gallery img {
    display: block !important;
    width: 100% !important;
    object-fit: cover !important;
    background: #000 !important;
}
.cstel-haunts-demo .cstel-selected-media img {
    height: 100% !important;
}
.cstel-haunts-demo .cstel-selected-gallery {
    column-count: 2 !important;
    column-gap: 8px !important;
    margin-top: 18px !important;
    padding-top: 16px !important;
    border-top: 1px solid rgba(255,255,255,.14) !important;
    background: transparent !important;
}
.cstel-haunts-demo .cstel-selected-gallery button {
    width: 100% !important;
    margin: 0 0 8px !important;
    overflow: hidden !important;
    break-inside: avoid !important;
    cursor: zoom-in;
}
.cstel-haunts-demo .cstel-selected-gallery button img {
    height: auto !important;
    min-height: 92px;
}
.cstel-haunts-demo .cstel-selected-gallery button:nth-child(3n+1) img { aspect-ratio: 1 / 1.18; }
.cstel-haunts-demo .cstel-selected-gallery button:nth-child(3n+2) img { aspect-ratio: 1 / .78; }
.cstel-haunts-demo .cstel-selected-gallery button:nth-child(3n) img { aspect-ratio: 1 / 1; }

/* Haunts lightbox cleanup: black overlay, no browser/default button flashes, single-close. */
html.cstel-lightbox-open,
html.cstel-lightbox-open body {
    overflow: hidden !important;
}
.cstel-image-lightbox {
    position: fixed !important;
    inset: 0 !important;
    z-index: 999999 !important;
    display: grid !important;
    place-items: center !important;
    padding: 14px !important;
    background: rgba(0,0,0,.9) !important;
    isolation: isolate;
}
.cstel-image-lightbox[hidden] { display: none !important; }
.cstel-image-lightbox__backdrop {
    position: absolute !important;
    inset: 0 !important;
    z-index: 0 !important;
    background: rgba(0,0,0,.9) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    cursor: zoom-out;
}
.cstel-image-lightbox__frame {
    position: relative !important;
    z-index: 1 !important;
    display: grid !important;
    place-items: center !important;
    width: min(94vw, 980px) !important;
    max-height: 86vh !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    overflow: visible !important;
}
.cstel-image-lightbox__frame img {
    display: block !important;
    width: auto !important;
    max-width: 100% !important;
    height: auto !important;
    max-height: 86vh !important;
    object-fit: contain !important;
    background: transparent !important;
    box-shadow: 0 24px 90px rgba(0,0,0,.72) !important;
}
.cstel-image-lightbox__close {
    appearance: none !important;
    -webkit-appearance: none !important;
    position: fixed !important;
    top: max(12px, env(safe-area-inset-top)) !important;
    right: max(12px, env(safe-area-inset-right)) !important;
    z-index: 2 !important;
    display: grid !important;
    width: 42px !important;
    height: 42px !important;
    place-items: center !important;
    padding: 0 !important;
    border: 1px solid rgba(255,255,255,.32) !important;
    border-radius: 999px !important;
    background: rgba(0,0,0,.72) !important;
    color: #fff !important;
    font-size: 30px !important;
    line-height: 1 !important;
    box-shadow: none !important;
    cursor: pointer;
}
.cstel-image-lightbox__close:hover,
.cstel-image-lightbox__close:focus-visible {
    background: #fff !important;
    color: #000 !important;
}


/* Top-aligned selected haunt gallery + lightbox navigation. */
.cstel-haunts-demo .cstel-selected-gallery {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, max-content)) !important;
    align-items: start !important;
    justify-content: start !important;
    gap: 12px !important;
    column-count: initial !important;
    column-gap: 12px !important;
}
.cstel-haunts-demo .cstel-selected-gallery button {
    width: min(42vw, 220px) !important;
    margin: 0 !important;
    align-self: start !important;
}
.cstel-haunts-demo .cstel-selected-gallery button img {
    min-height: 0 !important;
    height: auto !important;
    aspect-ratio: auto !important;
}
.cstel-haunts-demo .cstel-selected-gallery button:nth-child(3n+1) img,
.cstel-haunts-demo .cstel-selected-gallery button:nth-child(3n+2) img,
.cstel-haunts-demo .cstel-selected-gallery button:nth-child(3n) img {
    aspect-ratio: auto !important;
}
.cstel-image-lightbox__nav {
    appearance: none !important;
    -webkit-appearance: none !important;
    position: fixed !important;
    top: 50% !important;
    z-index: 2 !important;
    display: grid !important;
    width: 46px !important;
    height: 64px !important;
    place-items: center !important;
    padding: 0 !important;
    border: 1px solid rgba(255,255,255,.24) !important;
    border-radius: 999px !important;
    background: rgba(0,0,0,.58) !important;
    color: #fff !important;
    font-size: 42px !important;
    line-height: 1 !important;
    transform: translateY(-50%) !important;
    cursor: pointer;
    box-shadow: none !important;
}
.cstel-image-lightbox__nav[hidden] { display: none !important; }
.cstel-image-lightbox__nav--prev { left: max(12px, env(safe-area-inset-left)) !important; }
.cstel-image-lightbox__nav--next { right: max(12px, env(safe-area-inset-right)) !important; }
.cstel-image-lightbox__nav:hover,
.cstel-image-lightbox__nav:focus-visible {
    background: #fff !important;
    color: #000 !important;
}
@media (max-width: 720px) {
    .cstel-haunts-demo .cstel-selected-gallery { gap: 10px !important; }
    .cstel-haunts-demo .cstel-selected-gallery button { width: calc((100vw - 64px) / 2) !important; max-width: 170px !important; }
    .cstel-image-lightbox__nav { width: 42px !important; height: 54px !important; font-size: 34px !important; }
}

/* Preserve visible thumbnail boxes before lazy images load, while staying top-aligned. */
.cstel-haunts-demo .cstel-selected-gallery button img {
    min-height: 92px !important;
}
.cstel-haunts-demo .cstel-selected-gallery button:nth-child(3n+1) img { aspect-ratio: 1 / 1.18 !important; }
.cstel-haunts-demo .cstel-selected-gallery button:nth-child(3n+2) img { aspect-ratio: 1 / .78 !important; }
.cstel-haunts-demo .cstel-selected-gallery button:nth-child(3n) img { aspect-ratio: 1 / 1 !important; }


/* Use Conrad's custom arrow asset for lightbox navigation. */
.cstel-image-lightbox__nav {
    width: clamp(58px, 11vw, 86px) !important;
    height: clamp(42px, 8vw, 62px) !important;
    border: 0 !important;
    border-radius: 0 !important;
    background-color: #fff !important;
    background-image: none !important;
    -webkit-mask: url("data:image/svg+xml,%3Csvg%20width=%22262%22%20height=%22191%22%20viewBox=%220%200%20262%20191%22%20fill=%22none%22%20xmlns=%22http://www.w3.org/2000/svg%22%3E%0A%3Crect%20y=%2279%22%20width=%22236%22%20height=%2232%22%20fill=%22white%22/%3E%0A%3Crect%20x=%22165.627%22%20width=%22135%22%20height=%2232%22%20transform=%22rotate(45%20165.627%200)%22%20fill=%22white%22/%3E%0A%3Crect%20x=%22261.087%22%20y=%2295.459%22%20width=%22135%22%20height=%2232%22%20transform=%22rotate(135%20261.087%2095.459)%22%20fill=%22white%22/%3E%0A%3C/svg%3E") center / contain no-repeat !important;
    mask: url("data:image/svg+xml,%3Csvg%20width=%22262%22%20height=%22191%22%20viewBox=%220%200%20262%20191%22%20fill=%22none%22%20xmlns=%22http://www.w3.org/2000/svg%22%3E%0A%3Crect%20y=%2279%22%20width=%22236%22%20height=%2232%22%20fill=%22white%22/%3E%0A%3Crect%20x=%22165.627%22%20width=%22135%22%20height=%2232%22%20transform=%22rotate(45%20165.627%200)%22%20fill=%22white%22/%3E%0A%3Crect%20x=%22261.087%22%20y=%2295.459%22%20width=%22135%22%20height=%2232%22%20transform=%22rotate(135%20261.087%2095.459)%22%20fill=%22white%22/%3E%0A%3C/svg%3E") center / contain no-repeat !important;
    color: transparent !important;
    font-size: 0 !important;
    line-height: 0 !important;
    opacity: .94;
}
.cstel-image-lightbox__nav--prev { transform: translateY(-50%) scaleX(-1) !important; }
.cstel-image-lightbox__nav--next { transform: translateY(-50%) !important; }
.cstel-image-lightbox__nav:hover,
.cstel-image-lightbox__nav:focus-visible {
    background-color: #fff !important;
    color: transparent !important;
    opacity: 1;
}

/* Pull custom lightbox arrows closer to the image and scale them down. */
.cstel-image-lightbox__nav {
    width: clamp(20px, 3.6vw, 30px) !important;
    height: clamp(15px, 2.6vw, 22px) !important;
}
.cstel-image-lightbox__nav--prev { left: clamp(64px, 15vw, 25vw) !important; }
.cstel-image-lightbox__nav--next { right: clamp(64px, 15vw, 25vw) !important; }
@media (max-width: 720px) {
    .cstel-image-lightbox__nav {
        width: 20px !important;
        height: 15px !important;
    }
    .cstel-image-lightbox__nav--prev { left: 54px !important; }
    .cstel-image-lightbox__nav--next { right: 54px !important; }
}

/* Selected gallery refinement: preserve natural thumbnail proportions and remove bottom divider. */
.cstel-haunts-demo .cstel-map-caption:has(.cstel-selected-gallery:not([hidden])) {
    border-bottom: 0 !important;
}
.cstel-haunts-demo .cstel-selected-gallery {
    border-bottom: 0 !important;
    padding-bottom: 0 !important;
}
.cstel-haunts-demo .cstel-selected-gallery button {
    border-bottom: 0 !important;
}
.cstel-haunts-demo .cstel-selected-gallery button img,
.cstel-haunts-demo .cstel-selected-gallery button:nth-child(3n+1) img,
.cstel-haunts-demo .cstel-selected-gallery button:nth-child(3n+2) img,
.cstel-haunts-demo .cstel-selected-gallery button:nth-child(3n) img {
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    aspect-ratio: auto !important;
    object-fit: contain !important;
}

/* Hide selected-gallery dividers entirely when there are no gallery images. */
.cstel-haunts-demo .cstel-selected-gallery[hidden],
.cstel-haunts-demo .cstel-selected-gallery:empty {
    display: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
}
.cstel-haunts-demo .cstel-map-caption:has(.cstel-selected-gallery[hidden]),
.cstel-haunts-demo .cstel-map-caption:has(.cstel-selected-gallery:empty) {
    border-bottom: 0 !important;
}

/* Trip/single mobile gallery is phone-only. Keep desktop on the normal Trip masonry/gallery. */
.cstel-trip-mobile-gallery {
    display: none !important;
}

/* Trip/single mobile hardening: keep relationship cards, filters, map, and selected gallery inside the phone viewport. */
@media (max-width: 760px) {
    .cstel-trip-mobile-gallery {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 0 18px !important;
        padding: 0 !important;
        box-sizing: border-box !important;
    }
    .cstel-trip-mobile-gallery__label {
        display: block !important;
        margin: 0 0 12px !important;
        color: rgba(255,255,255,.76) !important;
        font-family: "Geist Mono", monospace !important;
        font-size: 11px !important;
        letter-spacing: .12em !important;
        line-height: 1.2 !important;
        text-transform: uppercase !important;
    }
    .cstel-trip-mobile-gallery__grid {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 10px !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    .cstel-trip-mobile-gallery__item {
        position: relative !important;
        display: block !important;
        width: 100% !important;
        min-width: 0 !important;
        aspect-ratio: 1 / 1.2 !important;
        padding: 0 !important;
        border: 0 !important;
        border-radius: 0 !important;
        overflow: hidden !important;
        background: #111 !important;
        color: #fff !important;
        appearance: none !important;
        -webkit-appearance: none !important;
        box-shadow: none !important;
    }
    .cstel-trip-mobile-gallery__item.is-wide {
        grid-column: span 2 !important;
        aspect-ratio: 1.55 / 1 !important;
    }
    .cstel-trip-mobile-gallery__item img {
        display: block !important;
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
        object-position: center !important;
    }
    .cstel-trip-mobile-gallery__item span {
        position: absolute !important;
        left: 0 !important;
        right: auto !important;
        bottom: 0 !important;
        z-index: 2 !important;
        display: inline-block !important;
        width: auto !important;
        max-width: calc(100% - 12px) !important;
        max-height: none !important;
        padding: 8px 10px !important;
        border: 0 !important;
        border-radius: 0 !important;
        background: #000 !important;
        color: #fff !important;
        font-family: "Geist Mono", monospace !important;
        font-size: 11px !important;
        line-height: 1.2 !important;
        text-align: left !important;
        overflow: hidden !important;
        -webkit-line-clamp: initial;
        -webkit-box-orient: initial;
    }
    .cstel-haunts-demo,
    .cstel-haunts-demo * {
        min-width: 0 !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }
    .cstel-haunts-demo {
        width: 100% !important;
        overflow: hidden !important;
        padding: 18px 14px 42px !important;
    }
    .cstel-haunts-toolbar {
        grid-template-columns: 1fr !important;
        width: 100% !important;
        overflow: hidden !important;
    }
    .cstel-haunts-toolbar button,
    .cstel-haunts-toolbar select,
    .cstel-haunts-toolbar .cstel-toolbar-link,
    .cstel-select-wrap {
        width: 100% !important;
        max-width: 100% !important;
        white-space: normal !important;
        overflow-wrap: anywhere !important;
    }
    .cstel-haunts-demo__layout,
    .cstel-haunts-demo__cards {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) !important;
        width: 100% !important;
        gap: 12px !important;
    }
    .cstel-haunt-demo-card {
        width: 100% !important;
        max-width: 100% !important;
        min-height: 0 !important;
        padding: 15px !important;
        gap: 10px !important;
        overflow: visible !important;
    }
    .card-topline,
    .card-meta,
    .chip-row,
    .card-note,
    .cstel-map-caption,
    .cstel-map-caption * {
        max-width: 100% !important;
        white-space: normal !important;
        overflow-wrap: anywhere !important;
        word-break: break-word !important;
    }
    .card-title,
    .cstel-map-caption h2 {
        max-width: 100% !important;
        font-size: clamp(26px, 8.8vw, 34px) !important;
        line-height: 1 !important;
        letter-spacing: -.05em !important;
        white-space: normal !important;
        overflow-wrap: anywhere !important;
        word-break: break-word !important;
        hyphens: auto !important;
    }
    .card-meta,
    .card-note {
        font-size: 12px !important;
        line-height: 1.38 !important;
    }
    .chip-row { gap: 6px !important; }
    .chip {
        min-width: 0 !important;
        max-width: 100% !important;
        white-space: normal !important;
        overflow-wrap: anywhere !important;
    }
    .cstel-haunts-demo__map-panel {
        width: 100% !important;
        max-width: 100% !important;
        overflow: hidden !important;
    }
    .cstel-map-shell,
    .cstel-map-fallback,
    .cstel-google-map {
        width: 100% !important;
        max-width: 100% !important;
        min-height: 280px !important;
    }
    .cstel-haunts-demo .cstel-selected-gallery {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        width: 100% !important;
        gap: 8px !important;
    }
    .cstel-haunts-demo .cstel-selected-gallery button {
        width: 100% !important;
        max-width: 100% !important;
    }
    .cstel-image-lightbox {
        width: 100vw !important;
        height: 100dvh !important;
        padding: max(12px, env(safe-area-inset-top)) 12px max(14px, env(safe-area-inset-bottom)) !important;
        overflow: hidden !important;
    }
    .cstel-image-lightbox__frame {
        width: 100% !important;
        max-width: calc(100vw - 24px) !important;
        max-height: calc(100dvh - 28px) !important;
    }
    .cstel-image-lightbox__frame img {
        max-width: 100% !important;
        max-height: calc(100dvh - 80px) !important;
    }
    .cstel-image-lightbox__close {
        width: 46px !important;
        height: 46px !important;
        top: max(10px, env(safe-area-inset-top)) !important;
        right: max(10px, env(safe-area-inset-right)) !important;
    }
    .cstel-image-lightbox__nav--prev { left: 16px !important; }
    .cstel-image-lightbox__nav--next { right: 16px !important; }
}

/* Conrad 2026-05-21: selected Haunt mini-gallery is a true 3-up grid across the container. */
.cstel-haunts-demo .cstel-selected-gallery,
.cstel-selected-gallery {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 12px !important;
    column-count: initial !important;
    column-gap: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    margin-top: 18px !important;
    padding-top: 16px !important;
}
.cstel-haunts-demo .cstel-selected-gallery button,
.cstel-selected-gallery button {
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    aspect-ratio: 1 / 1 !important;
    border-radius: 0 !important;
    overflow: hidden !important;
}
.cstel-haunts-demo .cstel-selected-gallery button img,
.cstel-haunts-demo .cstel-selected-gallery button:nth-child(3n+1) img,
.cstel-haunts-demo .cstel-selected-gallery button:nth-child(3n+2) img,
.cstel-haunts-demo .cstel-selected-gallery button:nth-child(3n) img,
.cstel-selected-gallery button img,
.cstel-selected-gallery button:nth-child(3n+1) img,
.cstel-selected-gallery button:nth-child(3n+2) img,
.cstel-selected-gallery button:nth-child(3n) img {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
    aspect-ratio: 1 / 1 !important;
    object-fit: cover !important;
}
@media (max-width: 520px) {
    .cstel-haunts-demo .cstel-selected-gallery,
    .cstel-selected-gallery {
        gap: 8px !important;
    }
}
