/* --- Global Reset & Basics --- */
body {
    margin: 0;
    overflow: hidden;
    font-family: Arial, Helvetica, sans-serif;
    background-color: rgba(0, 0, 0, 0.774);
}

/* Remove rounded corners across UI */
body * {
    border-radius: 0 !important;
}

.hidden {
    display: none !important;
}

/* Loading overlay */
.loading-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.65);
    z-index: 10001;
    padding: 16px;
    box-sizing: border-box;
}
.loading-card {
    width: min(420px, 92vw);
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.35);
    padding: 18px 18px 16px;
    text-align: center;
}
.welcome-loading {
    margin: 14px 0 8px;
}
.loading-image {
    width: 100%;
    max-height: 180px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 12px;
    display: block;
}
.loading-title {
    font-size: 16px;
    font-weight: 700;
    color: #222;
    margin-bottom: 12px;
}
.loading-bar {
    width: 100%;
    height: 10px;
    background: #e6e6e6;
    border-radius: 999px;
    overflow: hidden;
}
.loading-bar-fill {
    height: 100%;
    width: 0%;
    background: #e77500;
    transition: width 0.2s ease;
}
.loading-status {
    margin-top: 10px;
    font-size: 12px;
    color: #555;
    min-height: 16px;
}

/* Accordion: Options menu, top right – light grey like building card */
.cam-accordion {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 9000;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    min-width: 160px;
}

/* Second accordion (Contact Us) beside the settings button */
.cam-contact-accordion {
    right: 70px; /* move left from #cam-accordion */
    min-width: 180px;
}

.cam-contact-header {
    width: auto;
    min-width: 180px;
    padding: 0 12px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 36px;
}

/* Override the shared circular header sizing (36x36) */
.cam-contact-header {
    width: 100% !important;
    min-width: 180px !important;
    height: 36px !important;
    border-radius: 999px !important;
    white-space: nowrap;
}

.contact-share-btn {
    margin-top: 10px;
    width: 100%;
    display: none; /* only show on mobile */
    background: #222;
    color: #fff;
    border: none;
    padding: 10px 12px;
    font-size: 12px;
    cursor: pointer;
    border-radius: 4px;
}

.contact-share-btn:hover {
    background: #e77500;
}

@media screen and (max-width: 768px), screen and (max-height: 768px) {
    .contact-share-btn {
        display: block;
    }
}

.cam-accordion-header {
    background-color: #e8e8e8;
    color: #000;
    font-weight: bold;
    border: none;
    border-radius: 50%;
    padding: 0;
    font-size: 12px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    transition: transform 0.1s, background 0.2s;
    width: 36px;
    height: 36px;
    text-align: center;
    min-width: 36px;
    min-height: 36px;
}
.cam-accordion-icon {
    width: 20px;
    height: 20px;
    fill: currentColor;
    display: block;
    margin: 0 auto;
}

.cam-accordion-header:hover {
    background-color: #ddd;
}

.cam-accordion-header:active {
    transform: scale(0.98);
}

.cam-accordion-header::after {
    content: "";
    display: none;
}

.cam-accordion.collapsed .cam-accordion-header::after {
    content: "";
    display: none;
}

.cam-accordion-panel {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    width: 100%;
    max-width: 220px;
    margin-top: 8px;
    padding: 12px;
    background: rgba(248, 248, 248, 0.96);
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    border: 1px solid #e0e0e0;
    transition: opacity 0.2s ease, transform 0.2s ease;
    overflow: hidden;
}

.cam-accordion.collapsed .cam-accordion-panel {
    display: none;
}

/* Camera toggle: Plan | 3D segmented switch */
.cam-camera-toggle,
.cam-map-toggle {
    display: flex;
    width: 100%;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #bbb;
    background: #ddd;
}
.cam-toggle-option {
    flex: 1;
    padding: 10px 16px;
    border: none;
    background: transparent;
    color: #000;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}
.cam-toggle-option:hover {
    background: rgba(0,0,0,0.05);
}
.cam-toggle-option.is-active {
    background: #fff;
    color: #000;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.cam-volume-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 4px;
}

.cam-volume-row label {
    color: #000;
    font-size: 12px;
    font-weight: 600;
    min-width: 52px;
}

/* Silence/mute icon button next to each volume bar */
.cam-mute-icon {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    padding: 0;
    border: none;
    border-radius: 4px;
    background: transparent;
    cursor: pointer;
    color: #000;
    font-size: 14px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, opacity 0.2s;
}
.cam-mute-icon:hover {
    background: rgba(0,0,0,0.08);
}
.cam-mute-icon::before {
    content: "\1F50A";
}
.cam-mute-icon.is-muted::before {
    content: "\1F507";
}
.cam-mute-icon.is-muted {
    opacity: 0.7;
}

.cam-volume-row input[type="range"] {
    flex: 1;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255,255,255,0.25);
    border-radius: 3px;
    outline: none;
}

.cam-volume-row input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #888;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.cam-volume-row input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #888;
    cursor: pointer;
    border: none;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

/* --- Bottom Bar & Timeline --- */
#bottom-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 120px;
    --timeline-height: 120px;
    background-color: #ff9900;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 24px;
    padding: 0 24px;
    box-sizing: border-box;
    z-index: 1000;
}

.logo {
    height: 60px;
    width: auto;
}

/* Left current-project summary */
#timeline-current {
    flex: 0 0 auto;
    color: #ffffff;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    min-width: 220px;
}

#timeline-current-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    opacity: 0.9;
}

#timeline-current-year {
    font-size: 32px;
    font-weight: 900;
    line-height: 1;
}

#timeline-current-name {
    font-size: 12px;
    font-weight: 600;
    max-width: 260px;
}

#timeline-current-desc {
    display: none;
    font-size: 11px;
    font-weight: normal;
    line-height: 1.35;
    max-width: 280px;
    max-height: 4.5em;
    overflow-y: auto;
    margin-top: 4px;
    opacity: 0.95;
}

#timeline-current-desc.visible {
    display: block;
}

/* Wrapper so fade overlays sit on top of scroll area (not inside it) */
.timeline-scroll-wrap {
    position: relative;
    flex: 1 1 auto;
    height: 100%;
    min-width: 0;
}

/* Fade overlays on top of the scrollable area */
.timeline-scroll-wrap::before,
.timeline-scroll-wrap::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    width: 60px;
    pointer-events: none;
    z-index: 2;
}

.timeline-scroll-wrap::before {
    left: 0;
    background: linear-gradient(to right, #ff9900, rgba(255, 153, 0, 0));
}

.timeline-scroll-wrap::after {
    right: 0;
    background: linear-gradient(to left, #ff9900, rgba(255, 153, 0, 0));
}

/* Container for the scrollable area */
.timeline-container {
    position: relative;
    height: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    scrollbar-width: none; /* Firefox: hide scrollbar */
    -ms-overflow-style: none;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    scroll-padding: 50%;
    cursor: grab;
}
.timeline-container.is-dragging {
    cursor: grabbing;
}

.timeline-container::-webkit-scrollbar {
    display: none; /* Chrome/Safari: hide scrollbar */
}

/* Scrollable track holding timeline items */
.timeline-track {
    position: relative;
    height: 100%;
    display: flex;
    align-items: center;
    padding: 0 24px;
}

/* One project "slide" */
.timeline-item {
    position: relative;
    flex: 0 0 220px;
    width: 220px;
    height: 100%;
    scroll-snap-align: center;
    scroll-snap-stop: always;
    cursor: pointer;
    user-select: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px 10px;
    box-sizing: border-box;
    transition: opacity 0.2s ease, color 0.2s ease;
}

.timeline-item:hover {
    opacity: 1;
}

.timeline-item .timeline-year,
.timeline-item .timeline-name {
    color: rgba(255, 255, 255, 0.5);
    transition: color 0.2s ease;
}

.timeline-item.is-active .timeline-year,
.timeline-item.is-active .timeline-name {
    color: #ffffff;
}

.timeline-item:hover .timeline-year,
.timeline-item:hover .timeline-name {
    color: #ffffff;
}

.timeline-year {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: 0.5px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
    white-space: nowrap;
    margin-bottom: 4px;
}

.timeline-name {
    width: 100%;
    max-width: 100%;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    line-height: 1.2;
    white-space: normal;
    word-wrap: break-word;
}
.timeline-item .timeline-year { position: static; transform: none; }
.timeline-item .timeline-name { position: static; transform: none; bottom: auto; left: auto; }

/* Play / Skip to the right of timeline */
.timeline-controls {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 8px;
    height: 100%;
}

.timeline-btn {
    padding: 0;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.85);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
    height: 100%;
    width: var(--timeline-height);
    min-width: var(--timeline-height);
    display: flex;
    align-items: center;
    justify-content: center;
}

.timeline-skip {
    display: flex;
    align-items: center;
    gap: 6px;
}
/* Only show Next when autoplay is active */
.timeline-skip {
    display: none;
}
.timeline-play.is-playing + .timeline-skip {
    display: flex;
}

.timeline-skip .next-icon {
    width: 16px;
    height: 16px;
    fill: currentColor;
    display: block;
}

.timeline-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    color: #ffffff;
}

.timeline-dot {
    display: none;
}

/* Play: icon + optional "Autoplaying" label below */
.timeline-play {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.timeline-play::before {
    content: "";
    display: inline-block;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 8px 0 8px 14px;
    border-color: transparent transparent transparent currentColor;
    margin-left: 2px;
    vertical-align: middle;
}

.timeline-autoplay-label {
    display: none;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #fff;
    animation: timeline-autoplay-flash 1s ease-in-out infinite;
}

.timeline-play.ios-continue .timeline-autoplay-label {
    animation: timeline-autoplay-flash 0.45s ease-in-out infinite;
    font-size: 11px;
    letter-spacing: 0.02em;
    text-transform: none;
}
.timeline-play.is-playing .timeline-autoplay-label {
    display: block;
}

@keyframes timeline-autoplay-flash {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.35; }
}

/* Pause state: two vertical bars */
.timeline-play.is-playing::before {
    width: 4px;
    height: 14px;
    border: none;
    border-width: 0;
    background: currentColor;
    box-shadow: 6px 0 0 currentColor;
    margin-left: 0;
    vertical-align: middle;
}

.timeline-skip::before {
    content: "";
    display: none;
}

/* --- Info Card --- */
.info-card {
    position: fixed;
    top: max(12px, env(safe-area-inset-top));
    left: 20px;
    right: auto;
    width: 350px;
    max-height: calc(100vh - 24px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
    background: white;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    z-index: 9999;
    border-radius: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
    transform: translateX(-120%);
    transition: transform 0.35s ease-out, width 0.35s ease-out, height 0.35s ease-out, top 0.35s ease-out, left 0.35s ease-out;
}

/* Slide in from left when visible */
.info-card.card-visible {
    transform: translateX(0);
}

/* Expanded: whole card grows, gallery prioritized – animated from small card */
.info-card.expanded {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(90vw, 1200px);
    height: min(90vh, 900px);
    max-height: 90vh;
    z-index: 10001;
    border-radius: 0;
}
.info-card.expanded .card-gallery {
    height: min(55vh, 500px);
    min-height: 320px;
    flex-shrink: 0;
}
.info-card.expanded .card-tab-content {
    overflow: hidden;
}
.info-card.expanded .card-tab-panel.is-active {
    overflow-y: auto;
}

.card-header-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    padding: 8px 10px;
    background: #f8f8f8;
    border-bottom: 1px solid #e8e8e8;
    flex-shrink: 0;
}

/* Actions bar: all buttons same size (match close button) */
.card-action-btn,
.close-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #666;
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: color 0.2s;
    flex-shrink: 0;
}
.card-action-btn:hover,
.close-btn:hover {
    color: #333;
}
.close-btn {
    font-size: 22px;
}

/* Play button: 32x32 box with a proper triangle (zero-size + borders) centered via ::before */
.card-action-btn.card-audio-btn {
    border: none;
    background: none;
    margin: 0;
}
.card-action-btn.card-audio-btn::before {
    content: "";
    display: block;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 6px 0 6px 10px;
    border-color: transparent transparent transparent #666;
}
.card-action-btn.card-audio-btn:hover::before {
    border-left-color: #333;
}
.card-action-btn.card-audio-btn.is-playing::before {
    display: none;
}
.card-action-btn.card-audio-btn.is-playing {
    width: 12px;
    height: 12px;
    min-width: 12px;
    border: none;
    background: #666;
    margin: 0 10px;
}

.card-header {
    background: #fff;
    padding: 15px 15px 12px;
    border-bottom: 4px solid #ff9900;
    text-align: center;
    flex-shrink: 0;
}

.card-header h2 {
    margin: 0;
    font-size: 18px;
    text-transform: uppercase;
    padding-right: 0;
}

.card-header h4 {
    margin: 5px 0 0 0;
    font-size: 12px;
    color: #555;
    font-weight: normal;
}

/* Large screens only (width and height ≥ 769px): no tabs, show gallery + stats + description stacked */
@media screen and (min-width: 769px) and (min-height: 769px) {
    .card-tabs {
        display: none !important;
    }
    .card-tab-content {
        display: flex;
        flex-direction: column;
    }
    .card-tab-panel {
        display: flex !important;
        flex-direction: column;
    }
    #card-panel-gallery { order: 1; }
    #card-panel-stats { order: 2; }
    #card-panel-description { order: 3; }
}

/* Tabs: yellow line for active (mobile only when visible) */
.card-tabs {
    display: flex;
    gap: 0;
    background: #f8f8f8;
    border-bottom: 2px solid #e0e0e0;
    flex-shrink: 0;
    padding: 0 4px 0 0;
}
.card-tab {
    flex: 1;
    padding: 10px 8px;
    border: none;
    background: none;
    font-size: 12px;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    position: relative;
    bottom: -2px;
    margin-bottom: -2px;
    border-bottom: 3px solid transparent;
    transition: color 0.2s, border-color 0.2s;
}
.card-tab:hover {
    color: #333;
}
.card-tab.is-active {
    color: #333;
    border-bottom-color: #ff9900;
}
.card-tab-content {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: #fdfdfd;
}
.card-tab-panel {
    display: none;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    flex-direction: column;
}
.card-tab-panel.is-active {
    display: flex;
}
.card-panel-inner {
    padding: 15px;
    flex: 1 1 auto;
}
.card-panel-inner p {
    margin: 0;
    line-height: 1.6;
    color: #333;
    font-size: 13px;
}

.stat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 0;
}

.stat-item {
    display: flex;
    flex-direction: column;
}

.stat-item .label {
    color: #ff9900;
    font-size: 10px;
    font-weight: bold;
}

.stat-item .value {
    font-size: 12px;
    color: #333;
    font-weight: bold;
}

/* Card gallery: one image + prev/next */
.card-gallery {
    position: relative;
    width: 100%;
    height: 200px;
    background: #eee;
    display: flex;
    align-items: center;
    justify-content: center;
}
.card-gallery img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: opacity 0.4s ease;
}
.card-gallery-prev,
.card-gallery-next {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 36px;
    background: rgba(0, 0, 0, 0.35);
    border: none;
    color: #fff;
    font-size: 28px;
    cursor: pointer;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
.card-gallery-prev:hover,
.card-gallery-next:hover {
    background: rgba(0, 0, 0, 0.55);
}
.card-gallery-prev {
    left: 0;
}
.card-gallery-next {
    right: 0;
}
.card-gallery-prev.hidden,
.card-gallery-next.hidden {
    display: none !important;
}
.card-gallery-dots {
    display: flex;
    justify-content: center;
    gap: 6px;
    padding: 6px 0;
    background: #f5f5f5;
}
.card-gallery-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: none;
    background: #ccc;
    cursor: pointer;
    padding: 0;
}
.card-gallery-dot.is-active {
    background: #ff9900;
}

/* Backdrop when card is expanded */
.card-expanded-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 10000;
}
.card-expanded-backdrop.hidden {
    display: none !important;
}

/* ========================================= */
/* MOBILE (Max Width 768px) */
/* ========================================= */
@media screen and (max-width: 768px), screen and (max-height: 768px) {
    #disclaimer-overlay {
        top: 10px;
        left: 10px;
        padding: 5px 10px;
    }
    #disclaimer-overlay img { height: 30px; }
    #disclaimer-overlay .disclaimer-text p { font-size: 12px; }

    #camera-controls {
        top: auto;
        bottom: 110px;
        right: 10px;
        flex-direction: column;
        gap: 10px;
    }
    .cam-btn {
        padding: 10px 15px;
        font-size: 12px;
    }

    #bottom-bar {
        height: 54px;
        --timeline-height: 54px;
        padding: 0 8px;
    }

    .timeline-container { margin: 0; }
    #timeline-current { min-width: 140px; }
    #timeline-current-year { font-size: 20px; }
    #timeline-current-name { font-size: 10px; max-width: 160px; }
    .timeline-item { flex: 0 0 150px; width: 150px; padding: 4px 4px; }
    .timeline-year { font-size: 14px; }
    .timeline-name { font-size: 11px; }
    .timeline-btn { padding: 4px 6px; font-size: 11px; }

    /* Card on mobile: tabs visible (narrow), smaller gallery */
    .info-card .card-gallery {
        height: 150px;
        flex-shrink: 0;
    }
    .info-card .card-tab {
        font-size: 11px;
        padding: 8px 4px;
    }
    .info-card.description-card {
        align-items: flex-start;
        justify-content: flex-start;
        top: 2px;
        left: 2px;
        right: auto;
        bottom: auto;
        width: 40vw;
        max-width: 500px;
        max-height: calc(100dvh - 2px - 54px - 2px);
        padding: 0;
    }
    .info-card.description-card .description-overlay-content {
        max-height: 100%;
        width: 100%;
        height: auto;
        margin: 0;
        max-width: none;
    }
}

/* Mobile portrait only: split card – header at top, content above timeline, empty middle for 3D */
@media screen and (max-width: 768px) and (orientation: portrait) {
    /* 5. Split card – header at top, content above timeline, empty middle for 3D */
    .info-card {
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        max-height: none;
        background: transparent;
        overflow: visible;
        pointer-events: none;
    }
    .info-card.description-card {
        top: 2px;
        left: 2px;
        right: auto;
        bottom: auto;
        width: calc(100% - 4px);
        max-height: calc(100dvh - 2px - 54px - 2px);
    }
    .info-card .card-top,
    .info-card .card-bottom {
        pointer-events: auto;
    }
    .info-card .card-top {
        position: fixed;
        top: 2px;
        left: 2px;
        width: calc(100% - 4px);
        background: rgba(255, 255, 255, 0.88);
        backdrop-filter: blur(8px);
        border-radius: 0;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
        z-index: 9999;
    }
    .info-card .card-bottom {
        position: fixed;
        bottom: calc(54px + 2px);
        left: 2px;
        width: calc(100% - 4px);
        max-height: 38vh;
        background: rgba(255, 255, 255, 0.88);
        backdrop-filter: blur(8px);
        border-radius: 0;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
        z-index: 9999;
        overflow: hidden;
        display: flex;
        flex-direction: column;
        -webkit-overflow-scrolling: touch;
    }
    .info-card .card-header-actions {
        background: rgba(248, 248, 248, 0.9);
    }
    .info-card .card-header {
        background: rgba(255, 255, 255, 0.92);
    }
    .info-card .card-tab-content {
        background: rgba(253, 253, 253, 0.9);
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
    }
    .info-card .card-tabs {
        background: rgba(248, 248, 248, 0.95);
        flex-shrink: 0;
    }
    .info-card .card-gallery {
        height: 180px;
        flex-shrink: 0;
    }
    /* When expanded on mobile portrait, show single card (cancel split) and fit container */
    .info-card.expanded .card-top,
    .info-card.expanded .card-bottom {
        position: static;
    }
    .info-card.expanded {
        background: rgba(255, 255, 255, 0.95);
        pointer-events: auto;
        top: 2px;
        left: 2px;
        right: auto;
        width: calc(100% - 4px);
        height: auto;
        max-height: calc(100dvh - 2px - 54px - 2px);
        transform: translate(0, 0);
        overflow: hidden;
        display: flex;
        flex-direction: column;
    }
    .info-card.expanded .card-tab-content {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
    }
    .info-card.expanded .card-gallery {
        height: min(40vh, 280px);
        min-height: 200px;
    }
}

/* Mobile landscape: anchor cards to left edge, no padding */
@media screen and (max-width: 768px) and (orientation: landscape),
screen and (max-height: 768px) and (orientation: landscape) {
    .welcome-content {
        max-width: none;
        width: calc(100% - 4px);
    }
    .info-card {
        left: 2px;
        right: auto;
        top: 2px;
        bottom: calc(54px + 2px);
        width: min(90vw, 360px);
    }
    .info-card .card-bottom {
        flex: 1 1 auto;
        min-height: 0;
        display: flex;
        flex-direction: column;
    }
    .info-card.description-card {
        justify-content: flex-start;
        align-items: flex-start;
        padding: 2px;
    }
    .info-card.description-card .description-overlay-content {
        margin: 0;
        width: calc(100% - 4px);
        max-width: none;
    }
    .info-card .card-tab-content {
        flex: 1 1 auto;
        min-height: 0;
    }
    #card-panel-gallery {
        --gallery-dots-height: 20px;
        position: relative;
        display: flex;
        flex-direction: column;
        flex: 1 1 auto;
        min-height: 0;
        padding-bottom: var(--gallery-dots-height);
    }
    .info-card .card-gallery {
        height: calc(100% - var(--gallery-dots-height));
        min-height: 0;
        flex: 1 1 auto;
        align-items: center;
        justify-content: center;
    }
    .card-gallery-dots {
        position: absolute;
        left: 0;
        right: 0;
        bottom: 0;
        flex: 0 0 auto;
        z-index: 3;
    }
    .card-gallery img {
        object-fit: contain !important;
        width: 100%;
        height: 100%;
        max-width: 100%;
        max-height: 100%;
    }
}


    .welcome-screen {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        width: 100vw;
        height: 100%;
        height: 100dvh;
        height: 100vh;
        min-height: -webkit-fill-available;
        max-height: 100dvh;
        background: rgba(0, 0, 0, 0.9);
        display: flex;
        justify-content: center;
        align-items: center;
        z-index: 10000;
        transition: opacity 0.5s ease;
        padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
        box-sizing: border-box;
        overflow: hidden;
    }

    .welcome-content {
        background: #fff;
        padding: 40px;
        max-width: 600px;
        width: 100%;
        max-height: calc(100dvh - 32px);
        max-height: calc(100vh - 32px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        text-align: center;
        border-radius: 8px;
        box-shadow: 0 10px 30px rgba(0,0,0,0.5);
        margin: 16px;
        box-sizing: border-box;
        flex-shrink: 1;
        min-height: 0;
    }

    .logo-row {
        display: flex;
        justify-content: center;
        align-items: center;
        gap: 40px;
        margin-bottom: 20px;
    }

    .welcome-logo {
        height: 60px;
        object-fit: contain;
    }

    .welcome-divider {
        border: 0;
        height: 1px;
        background: #ddd;
        margin: 20px 0;
    }

    .welcome-content h1 {
        font-family: 'Georgia', serif;
        color: #333;
        margin-bottom: 15px;
    }

    .welcome-content p {
        font-family: 'Arial', sans-serif;
        line-height: 1.6;
        color: #555;
        margin-bottom: 20px;
    }

    .welcome-buttons {
        display: flex;
        gap: 12px;
        justify-content: center;
        flex-wrap: wrap;
    }
.contact-info {
    margin-top: 14px;
    font-size: 12px;
    line-height: 1.4;
    color: #555;
    text-align: center;
}
.contact-info-compact {
    margin-top: 10px;
    font-size: 11px;
    line-height: 1.35;
    color: #333;
    text-align: left;
}
    .welcome-legal-btn {
        background: transparent;
        color: #555;
        border: 2px solid #888;
        padding: 10px 24px;
        font-size: 14px;
        cursor: pointer;
        border-radius: 4px;
        transition: background 0.2s, border-color 0.2s;
    }
    .welcome-legal-btn:hover {
        background: #f0f0f0;
        border-color: #666;
    }

    .enter-btn {
        background: #222;
        color: #fff;
        border: none;
        padding: 12px 30px;
        font-size: 16px;
        cursor: pointer;
        border-radius: 4px;
        transition: background 0.3s;
    }

    .enter-btn:hover {
        background: #e77500; /* Princeton Orange hint */
    }

    /* Initial overlay: fit mobile screen and small viewports */
    @media screen and (max-width: 768px), screen and (max-height: 600px) {
        .welcome-screen {
            align-items: center;
            padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
            overflow: auto;
            -webkit-overflow-scrolling: touch;
        }
        .welcome-content {
            padding: 16px 14px 20px;
            max-height: calc(100dvh - 16px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
            max-height: calc(100vh - 16px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
            margin: 0 auto 12px;
            flex-shrink: 0;
        }
        .logo-row {
            gap: 16px;
            margin-bottom: 10px;
        }
        .welcome-logo {
            height: 40px;
            max-height: 10vw;
        }
        .welcome-divider {
            margin: 10px 0;
        }
        .welcome-content h1 {
            font-size: 1.15rem;
            margin-bottom: 8px;
            line-height: 1.3;
        }
        .welcome-content p {
            font-size: 13px;
            margin-bottom: 14px;
            line-height: 1.5;
        }
        .welcome-buttons {
            gap: 8px;
            flex-wrap: wrap;
            justify-content: center;
        }
        .enter-btn {
            padding: 10px 18px;
            font-size: 14px;
        }
        .welcome-legal-btn {
            padding: 8px 16px;
            font-size: 12px;
        }
    }

    .fade-out {
        opacity: 0;
        pointer-events: none;
    }

/* Description card (Beginning/Ending) */
.info-card.description-card {
    pointer-events: auto;
}
.info-card.description-card .description-overlay-content {
    position: relative;
    background: rgba(255, 255, 255, 0.96);
    padding: 16px 20px;
    padding-top: 36px;
    border-radius: 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    width: 100%;
    max-width: 100%;
    max-height: 100%;
    overflow-y: auto;
    pointer-events: auto;
    box-sizing: border-box;
}
.description-overlay-close {
    position: absolute;
    top: 8px;
    right: 12px;
    width: 28px;
    height: 28px;
    padding: 0;
    border: none;
    background: transparent;
    color: #555;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    border-radius: 4px;
    transition: color 0.2s, background 0.2s;
}
.description-overlay-close:hover {
    color: #222;
    background: rgba(0, 0, 0, 0.06);
}
.description-overlay-title {
    font-family: Georgia, serif;
    color: #333;
    margin: 0 0 10px 0;
    font-size: 1.1rem;
}
.description-overlay-text {
    font-family: Arial, sans-serif;
    line-height: 1.5;
    color: #555;
    margin: 0;
    font-size: 13px;
    text-align: justify;
    text-align-last: left;
    overflow-wrap: break-word;
}
.description-replay-btn {
    margin-top: 12px;
    width: 100%;
    background: #222;
    color: #fff;
    border: none;
    padding: 10px 12px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s ease;
}
.description-replay-btn:hover {
    background: #e77500;
}
.info-card.description-card.hidden {
    display: none !important;
}
.info-card.description-card:not(.hidden) {
    display: flex;
}

/* Legal / Disclaimer overlay – scrollable text from data.json */
.legal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 10001;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 24px;
    box-sizing: border-box;
}
.legal-overlay.hidden {
    display: none !important;
}
.legal-overlay:not(.hidden) {
    display: flex;
}
.legal-overlay-content {
    background: #fff;
    max-width: 560px;
    width: 100%;
    max-height: 85vh;
    border-radius: 0;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    padding: 24px;
    display: flex;
    flex-direction: column;
}
.legal-overlay-title {
    margin: 0 0 16px 0;
    font-size: 1.25rem;
    color: #222;
    flex-shrink: 0;
}
.legal-overlay-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 16px;
}
.legal-overlay-text {
    font-family: Arial, sans-serif;
    font-size: 13px;
    line-height: 1.5;
    color: #333;
    margin: 0;
    white-space: pre-wrap;
}
.legal-overlay-footer {
    flex-shrink: 0;
    margin-bottom: 16px;
    padding-top: 12px;
    border-top: 1px solid #e0e0e0;
}
.legal-overlay-copyright {
    margin: 0 0 4px 0;
    font-size: 13px;
    color: #333;
}
.legal-overlay-powered {
    margin: 0;
    font-size: 11px;
    color: #888;
}
.legal-overlay-powered a {
    color: #888;
    text-decoration: none;
}
.legal-overlay-powered a:hover {
    text-decoration: underline;
    color: #666;
}
.legal-overlay-close {
    flex-shrink: 0;
}
.cam-copyright-btn {
    margin-top: 4px;
}
