{
    box-sizing: border-box;
}

:root {
    --background: #f3f1ec;
    --white: #faf9f6;
    --gold: #b69a72;
    --dark: #292722;
    --muted: #89847a;
    --border: rgba(90, 80, 65, .16);
}

html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
    overflow: hidden;
    font-family: Vazirmatn, sans-serif;
    background: var(--background);
    color: var(--dark);
}

button,
a {
    font-family: inherit;
}

button {
    cursor: pointer;
}

button:focus-visible,
a:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 3px;
}

#app {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    isolation: isolate;
}

/* فضای سه‌بعدی */

#scene {
    position: absolute;
    inset: 0;
    z-index: 0;
    background: var(--background);
    touch-action: none;
}

#scene canvas {
    display: block;
    width: 100%;
    height: 100%;
    touch-action: none;
}

/* هدر */

.topbar {
    position: absolute;
    z-index: 4;
    top: 0;
    right: 0;
    left: 0;
    height: 80px;
    padding: 0 5.5%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(250,249,246,.88);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(14px);
}

.logo {
    color: #282722;
    font: 600 20px Arial;
    letter-spacing: .17em;
    text-decoration: none;
}

.logo span {
    color: var(--gold);
}

.logo small {
    display: block;
    margin-top: 5px;
    font: 8px Arial;
    color: #999;
    letter-spacing: .2em;
}

.top-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font: 9px Arial;
    color: #827b70;
    letter-spacing: .12em;
}

.status-dot {
    width: 7px;
    height: 7px;
    display: inline-block;
    border-radius: 50%;
    background: var(--gold);
    box-shadow: 0 0 0 4px #b69a7220;
}

.top-actions {
    display: flex;
    gap: 9px;
}

.top-actions button {
    background: transparent;
    border: 1px solid var(--border);
    padding: 10px 14px;
    color: #777;
    font-size: 10px;
    transition: .25s;
}

.top-actions button:hover {
    border-color: var(--gold);
    color: var(--gold);
}

/* صفحه ورود - کاملاً وسط صفحه */

.welcome {
    position: absolute;
    z-index: 3;

    top: 50%;
    left: 50%;
    right: auto;

    transform: translate(-50%, -50%);

    width: min(390px, calc(100% - 36px));
    padding: 36px;

    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;

    background: rgba(250,249,246,.94);
    border: 1px solid #b69a7245;
    box-shadow: 0 25px 80px #00000012;
    backdrop-filter: blur(15px);

    transition: opacity .45s, visibility .45s, transform .45s;
}

.welcome.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translate(-50%, -45%);
}

.welcome > small,
.art-info > small,
.modal-details > small,
.about-modal small {
    color: var(--gold);
    font: 9px Arial;
    letter-spacing: .16em;
}

.welcome h1 {
    font-size: clamp(40px,5vw,62px);
    font-weight: 300;
    line-height: 1.35;
    margin: 20px 0;
}

.welcome h1 em,
.about-modal h2 em {
    font-family: Georgia,serif;
    font-weight: 400;
    color: var(--gold);
}

.welcome p {
    color: #827d73;
    font-size: 12px;
    line-height: 2.3;
    margin-bottom: 25px;
}

.gold-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 25px;
    padding: 13px 20px;
    background: var(--gold);
    color: white;
    border: 1px solid var(--gold);
    font-size: 11px;
    transition: .25s;
}

.gold-button:hover {
    background: #94764f;
    border-color: #94764f;
}

.welcome-hint {
    color: #aaa398;
    font-size: 9px;
    margin-top: 20px;
}

/* HUD */

.hud {
    position: absolute;
    z-index: 4;
    top: 100px;
    left: 5.5%;
    right: 5.5%;
    display: none;
    align-items: center;
    justify-content: space-between;
}

.hud.visible {
    display: flex;
}

.hud-status {
    padding: 10px 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    background: #faf9f6e8;
    border: 1px solid var(--border);
    font-size: 10px;
}

.hud-help {
    font-size: 10px;
    color: #777;
    text-shadow: 0 1px 8px white;
}

.hud-help span {
    color: var(--gold);
    margin: 0 9px;
}

#exit-gallery {
    padding: 9px 14px;
    background: #faf9f6e8;
    border: 1px solid var(--border);
    color: #777;
    font-size: 10px;
}

/* کنترل موبایل */

.touch-controls {
    position: absolute;
    z-index: 5;
    bottom: 65px;
    right: 18px;
    display: none;
    flex-direction: column;
    gap: 7px;
    touch-action: none;
}

.touch-controls.visible {
    display: flex;
}

.touch-row {
    display: flex;
    gap: 7px;
}

.touch-controls button {
    width: 43px;
    height: 43px;
    border-radius: 9px;
    border: 1px solid #b69a72aa;
    color: #806b4c;
    background: #faf9f6df;
    font-size: 18px;
    touch-action: none;
    user-select: none;
}

/* اطلاعات اثر */

.art-info {
    position: absolute;
    z-index: 6;
    left: 5.5%;
    bottom: 70px;
    width: 280px;
    padding: 24px;
    background: #faf9f6f2;
    border: 1px solid var(--border);
    box-shadow: 0 15px 45px #00000012;
    backdrop-filter: blur(12px);
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px);
    transition: .3s;
}

.art-info.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.close-info {
    position: absolute;
    top: 7px;
    left: 12px;
    border: 0;
    background: none;
    font-size: 25px;
    color: #777;
}

#art-number {
    margin-top: 15px;
    color: #aaa;
    font: 10px Arial;
}

.art-info h2 {
    font-size: 20px;
    font-weight: 400;
}

.art-info p {
    color: #858078;
    font-size: 11px;
    line-height: 2;
}

#view-art {
    border: 0;
    padding: 0;
    color: #9b805b;
    background: transparent;
    font-size: 10px;
}

/* فوتر */

.bottom-bar {
    position: absolute;
    z-index: 3;
    bottom: 0;
    left: 0;
    right: 0;
    height: 43px;
    padding: 0 5.5%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #faf9f6dd;
    border-top: 1px solid var(--border);
    color: #8c867c;
    font: 9px Arial;
    letter-spacing: .1em;
    pointer-events: none;
}

/* مودال */

.modal,
.about-modal {
    position: absolute;
    z-index: 12;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.open,
.about-modal.open {
    display: flex;
}

.modal-shade,
.about-shade {
    position: absolute;
    inset: 0;
    border: 0;
    background: #0009;
    backdrop-filter: blur(9px);
}

.modal-content {
    position: relative;
    z-index: 1;
    width: min(850px,100%);
    max-height: 90vh;
    display: grid;
    grid-template-columns: 1.1fr .9fr;
    background: #faf9f6;
    overflow: auto;
}

#modal-close,
#about-close {
    position: absolute;
    z-index: 3;
    top: 7px;
    left: 13px;
    border: 0;
    background: none;
    color: #777;
    font-size: 29px;
}

.modal-image {
    min-height: 350px;
    padding: 25px;
    display: grid;
    place-items: center;
    background: #e9e6df;
}

.modal-image img {
    max-width: 100%;
    max-height: 65vh;
    width: auto;
    height: auto;
    object-fit: contain;
}

.modal-details {
    padding: 50px 35px;
    align-self: center;
}

#modal-number {
    display: block;
    margin-top: 20px;
    color: #aaa;
    font: 10px Arial;
}

.modal-details h2 {
    font-weight: 400;
}

.modal-details p {
    font-size: 12px;
    line-height: 2.2;
    color: #827d73;
}

/* درباره ما */

.about-modal section {
    position: relative;
    z-index: 1;
    width: min(550px,100%);
    padding: 55px;
    background: #faf9f6;
}

.about-modal h2 {
    font-size: 38px;
    font-weight: 300;
    line-height: 1.6;
}

.about-modal p {
    color: #827d73;
    font-size: 12px;
    line-height: 2.3;
}

.about-modal a {
    display: inline-block;
    color: #9b805b;
    font-size: 11px;
    margin-top: 15px;
}

/* لودینگ */

.loading {
    position: absolute;
    z-index: 20;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--background);
    color: #827d73;
    transition: opacity .6s, visibility .6s;
}

.loading.done {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loading-logo {
    color: var(--gold);
    font: italic 55px Georgia;
}

.loading p {
    font-size: 11px;
}

/* کنترل عمودی دوربین */

.vertical-controls {
    position: absolute;
    left: 18px;
    bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 20;
}

.vertical-control {
    width: 55px;
    height: 55px;
    border: 1px solid rgba(182,154,114,.8);
    border-radius: 50%;
    background: rgba(35,33,29,.82);
    color: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    font-size: 17px;
    font-family: inherit;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

.vertical-control span {
    font-size: 10px;
}

.vertical-control:active {
    background: #b69a72;
}

/* تبلت و موبایل */

@media(max-width:800px) {

    .topbar {
        height: 70px;
        padding: 0 18px;
    }

    .top-title {
        display: none;
    }

    .welcome {
        left: 50%;
        right: auto;
        top: 50%;
        transform: translate(-50%, -50%);
        width: min(90%, 430px);
        padding: 27px;
    }

    .welcome.hidden {
        transform: translate(-50%, -45%);
    }

    .hud {
        top: 85px;
        left: 15px;
        right: 15px;
    }

    .hud-help {
        display: none;
    }

    .art-info {
        left: 15px;
        bottom: 65px;
        width: min(270px,75%);
    }

    .bottom-bar {
        padding: 0 18px;
    }

    .vertical-controls {
        left: 15px;
        bottom: 65px;
    }
}

/* موبایل کوچک */

@media(max-width:560px) {

    .logo {
        font-size: 16px;
    }

    .top-actions button {
        padding: 8px 9px;
        font-size: 9px;
    }

    .welcome {
        top: 50%;
        left: 50%;
        right: auto;
        transform: translate(-50%, -50%);
        width: calc(100% - 30px);
        max-width: 390px;
        padding: 25px 20px;
    }

    .welcome.hidden {
        transform: translate(-50%, -45%);
    }

    .welcome h1 {
        font-size: 45px;
    }

    .touch-controls button {
        width: 39px;
        height: 39px;
    }

    .bottom-bar {
        height: 38px;
        font-size: 8px;
    }

    .modal-content {
        grid-template-columns: 1fr;
    }

    .modal-image {
        min-height: 220px;
        max-height: 42vh;
    }

    .modal-image img {
        max-height: 38vh;
    }

    .modal-details {
        padding: 25px;
    }

    .about-modal section {
        padding: 40px 25px;
    }

    .about-modal h2 {
        font-size: 30px;
    }
}

/* کاهش انیمیشن */

@media(prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
    }
}