/* AR Stereofoto Viewer */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: #0a0a1a;
    color: #fff;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

.hidden {
    display: none !important;
}

/* Landing */
.landing {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(ellipse at 50% 30%, #1a1a3e 0%, #0a0a1a 70%);
    z-index: 1000;
}

.landing-content {
    text-align: center;
    padding: 2rem;
    max-width: 520px;
}

.landing-icon {
    margin-bottom: 1.5rem;
}

.landing-content h1 {
    font-size: 2.1rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    line-height: 1.2;
    letter-spacing: 0.3px;
}

.landing-content p {
    color: #e4e4f0;
    font-size: 1.35rem;
    line-height: 1.5;
    margin-bottom: 1.25rem;
}

.photo-count {
    font-size: 1.05rem;
    color: #b0b0c0;
    margin-bottom: 1.75rem !important;
}

.btn-start {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 1.25rem 3rem;
    border: none;
    border-radius: 50px;
    font-size: 1.4rem;
    font-weight: 700;
    color: #1a1a2e;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    min-height: 60px;
}

.btn-start:hover {
    transform: scale(1.05);
    box-shadow: 0 0 30px rgba(232, 168, 56, 0.3);
}

.btn-icon {
    font-size: 1.3rem;
}

.hint {
    font-size: 1rem;
    color: #9090a0;
    margin-top: 1.25rem;
}

.landing-empty {
    background: rgba(255,255,255,0.05);
    padding: 1.5rem;
    border-radius: 12px;
    margin-top: 1rem;
}

.landing-footer {
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255,255,255,0.08);
    font-size: 0.8rem;
    color: #555;
}
.landing-footer a {
    color: #888;
    text-decoration: none;
}
.landing-footer a:hover {
    color: #E8A838;
}
.landing-footer span {
    display: block;
    margin-top: 2px;
    font-size: 0.75rem;
}

/* AR Container */
.ar-container {
    position: fixed;
    inset: 0;
    z-index: 500;
}

.ar-container a-scene {
    position: fixed;
    inset: 0;
}

/* Mask black flash during scene rebuild */
.ar-container.ar-reloading {
    background: #111;
}
.ar-container.ar-reloading::after {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 550;
    animation: fadeReload 0.8s ease;
}
@keyframes fadeReload {
    0% { opacity: 0; }
    30% { opacity: 1; }
    80% { opacity: 1; }
    100% { opacity: 0; }
}

/* AR Status overlay */
.ar-status {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 600;
    pointer-events: none;
}

.scanning-indicator {
    display: flex;
    align-items: center;
    gap: 14px;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(10px);
    padding: 14px 28px;
    border-radius: 50px;
    font-size: 1.1rem;
    color: #f0f0f5;
    white-space: nowrap;
}

.scan-ring {
    width: 20px;
    height: 20px;
    border: 3px solid;
    border-right-color: transparent !important;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ============================
   PHOTO OVERLAY — fullscreen
   ============================ */
.photo-overlay {
    position: fixed;
    inset: 0;
    z-index: 650;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    perspective: 1000px;
    touch-action: none;
    overflow: hidden;
}

.photo-overlay-card {
    max-width: 90vw;
    max-height: 65vh;
    position: relative;
    transform-origin: center center;
    will-change: transform;
    touch-action: none;
}

.photo-overlay-card img {
    display: block;
    max-width: 90vw;
    max-height: 65vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    user-select: none;
    -webkit-user-drag: none;
    pointer-events: none;
}

.overlay-label {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(6px);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    color: #ccc;
    font-weight: 500;
}

/* Flip animation — forward (to back) */
.photo-overlay-card.flip-animate {
    animation: flipForward 0.6s ease-in-out;
}

/* Flip animation — backward (to front) */
.photo-overlay-card.flip-animate-back {
    animation: flipBackward 0.6s ease-in-out;
}

@keyframes flipForward {
    0%   { transform: rotateY(0deg); }
    50%  { transform: rotateY(90deg); }
    100% { transform: rotateY(0deg); }
}

@keyframes flipBackward {
    0%   { transform: rotateY(0deg); }
    50%  { transform: rotateY(-90deg); }
    100% { transform: rotateY(0deg); }
}

/* Swipe hint */
.swipe-hint {
    position: fixed;
    bottom: 70px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 700;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(10px);
    padding: 8px 20px;
    border-radius: 50px;
    font-size: 0.8rem;
    color: #aab;
    pointer-events: none;
    animation: fadeHint 4s ease forwards;
    white-space: nowrap;
}
@keyframes fadeHint {
    0%, 70% { opacity: 1; }
    100% { opacity: 0; pointer-events: none; }
}

/* ============================
   INFO PANEL — portrait default
   ============================ */
.info-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    width: auto;
    background: rgba(10, 10, 26, 0.95);
    backdrop-filter: blur(20px);
    border-top: 1px solid rgba(255,255,255,0.1);
    border-left: none;
    border-radius: 20px 20px 0 0;
    padding: 1.5rem;
    z-index: 700;
    max-height: 40vh;
    overflow-y: auto;
}

.info-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}

.info-header h3 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    line-height: 1.2;
}

.btn-close-info {
    background: none;
    border: none;
    color: #ccc;
    font-size: 2rem;
    cursor: pointer;
    padding: 0 0.25rem;
    line-height: 1;
    min-width: 44px;
    min-height: 44px;
}

.info-body {
    color: #dcdce8;
    font-size: 1.15rem;
    line-height: 1.55;
    margin-bottom: 1.25rem;
}

.info-body p {
    margin-bottom: 0.6rem;
}

.info-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.btn-flip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem 1.5rem;
    border: none;
    border-radius: 50px;
    font-size: 0.95rem;
    font-weight: 600;
    color: #1a1a2e;
    cursor: pointer;
    transition: transform 0.2s;
}

.btn-flip:hover {
    transform: scale(1.05);
}

.btn-flip span {
    font-size: 1.2rem;
}

.btn-dismiss {
    display: inline-flex;
    align-items: center;
    padding: 0.6rem 1.5rem;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 50px;
    font-size: 0.95rem;
    font-weight: 500;
    color: #aab;
    background: transparent;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-dismiss:hover {
    background: rgba(255,255,255,0.1);
}

/* Back button */
.btn-back {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 800;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.15);
    color: #fff;
    padding: 8px 16px;
    border-radius: 50px;
    font-size: 0.9rem;
    cursor: pointer;
}

.btn-back:hover {
    background: rgba(0, 0, 0, 0.8);
}

/* ============================
   PORTRAIT small screens
   ============================ */
@media (max-width: 480px) and (orientation: portrait) {
    .landing-content h1 {
        font-size: 1.4rem;
    }
    .btn-start {
        padding: 0.8rem 2rem;
        font-size: 1rem;
    }
    .info-panel {
        padding: 1rem;
    }
}

/* ============================
   LANDSCAPE
   ============================ */
@media (orientation: landscape) {
    .ar-status {
        bottom: auto;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
    }

    .btn-back {
        top: 10px;
        left: 10px;
        padding: 6px 12px;
        font-size: 0.8rem;
    }

    .swipe-hint {
        bottom: auto;
        top: 10px;
    }

    /* Photo overlay fills nicely in landscape */
    .photo-overlay-card img {
        max-width: 85vw;
        max-height: 80vh;
    }

    /* Info panel as right side panel */
    .info-panel {
        top: 0;
        bottom: 0;
        left: auto;
        right: 0;
        width: 40vw;
        max-width: 340px;
        max-height: none;
        border-radius: 0;
        border-top: none;
        border-left: 1px solid rgba(255,255,255,0.1);
        padding: 1rem;
        overflow-y: auto;
    }

    .info-header h3 {
        font-size: 1rem;
    }

    .info-body {
        font-size: 0.85rem;
        margin-bottom: 0.5rem;
    }

    .btn-flip {
        padding: 0.5rem 1.2rem;
        font-size: 0.85rem;
    }

    .btn-dismiss {
        padding: 0.5rem 1.2rem;
        font-size: 0.85rem;
    }
}
