/* Responsive Exhibition Stand Styles */
/* Desktop-first approach with viewport-relative units */

/* CSS Reset and Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Responsive font sizes using clamp - smaller */
    --title-font-size: clamp(1.5rem, 4vw, 3rem);
    --title-small-font-size: clamp(1.2rem, 2.5vw, 2rem);
    --work-title-font-size: clamp(1.4rem, 3vw, 2.5rem);
    --intro-font-size: clamp(0.9rem, 1.5vw, 1.4rem);
    --dialog-font-size: clamp(0.85rem, 1.2vw, 1.3rem);
    --explication-font-size: clamp(0.9rem, 1.4vw, 1.5rem);

    /* Responsive spacing */
    --screen-padding: clamp(15px, 3vw, 60px);
    --content-gap: clamp(15px, 2vw, 30px);

    /* Image sizes - responsive (set by JS) */
    --image-stack-size: clamp(300px, 60vmin, 700px);
    --gallery-image-size: clamp(200px, 35vmin, 500px);
}

body {
    background-color: #000;
    font-family: 'Inter', sans-serif;
    color: #fff;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

/* Viewport */
.viewport {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    position: relative;
    overflow: hidden;
}

/* Screens */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    pointer-events: none;
    transform: translateX(100%);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.screen.active {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(0);
}

.screen.exiting {
    opacity: 0;
    transform: translateX(-100%);
}

.screen-content {
    width: 100%;
    height: 100%;
    padding: var(--screen-padding);
    display: flex;
}

/* Gallery Layout */
.gallery-layout {
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.gallery-title {
    font-family: "Unbounded", sans-serif;
    font-optical-sizing: auto;
    font-weight: 600;
    font-style: normal;
    font-size: var(--title-small-font-size);
    color: #ff9f43;
    margin-bottom: clamp(20px, 3vh, 40px);
    text-align: center;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(var(--gallery-cols, 4), var(--gallery-image-size));
    grid-template-rows: repeat(var(--gallery-rows, 2), var(--gallery-image-size));
    column-gap: var(--gallery-h-gap, 20px);
    row-gap: var(--gallery-v-gap, 20px);
    justify-content: center;
    align-content: center;
}

.gallery-item {
    width: var(--gallery-image-size);
    height: var(--gallery-image-size);
    border-radius: clamp(8px, 1vw, 12px);
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.gallery-item-hidden {
    opacity: 0;
    transform: scale(0.8) translateY(20px);
}

.gallery-item-visible {
    animation: fadeInGallery 0.4s ease forwards;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

@keyframes fadeInGallery {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(20px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Typography */
.title-font {
    font-family: "Unbounded", sans-serif;
    font-optical-sizing: auto;
    font-weight: 600;
    font-style: normal;
}

.concept-title {
    font-family: "Unbounded", sans-serif;
    font-optical-sizing: auto;
    font-weight: 600;
    font-style: normal;
    font-size: var(--title-font-size);
    color: #ff9f43;
    margin-bottom: clamp(20px, 3vh, 40px);
    line-height: 1.2;
}

.concept-title-small {
    font-family: "Unbounded", sans-serif;
    font-optical-sizing: auto;
    font-weight: 600;
    font-style: normal;
    font-size: var(--title-small-font-size);
    color: #ff9f43;
    text-align: center;
    margin-bottom: clamp(10px, 1.5vh, 20px);
}

.work-title {
    font-family: "Unbounded", sans-serif;
    font-optical-sizing: auto;
    font-weight: 600;
    font-style: normal;
    font-size: var(--work-title-font-size);
    color: #ff9f43;
    margin-bottom: clamp(15px, 2vh, 30px);
    line-height: 1.3;
}

.instruction-text {
    font-size: var(--intro-font-size);
    line-height: 1.8;
    color: rgba(255, 255, 255, 0.85);
    max-width: 100%;
}

.explication-container {
    flex: 1;
    overflow: hidden;
    overflow-y: auto;
    position: relative;
    min-height: 0;
    margin-bottom: clamp(10px, 1.5vh, 20px);
}

.explication-container::-webkit-scrollbar {
    width: 6px;
}

.explication-container::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.explication-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.explication-text {
    font-size: var(--explication-font-size);
    line-height: 1.7;
    color: rgba(255, 255, 255, 0.8);
}

/* Image Containers */
.image-container {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 45%;
    max-width: 50vmin;
}

.image-container img {
    max-width: 100%;
    max-height: 75vh;
    object-fit: contain;
    border-radius: clamp(12px, 1.5vw, 24px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5),
        0 0 40px rgba(100, 100, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.text-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding-left: var(--content-gap);
}

/* Intro Layout */
.intro-layout {
    align-items: center;
    gap: var(--content-gap);
}

/* Dialog Layout */
.dialog-layout {
    flex-direction: column;
}

.dialog-main {
    flex: 1;
    display: flex;
    gap: var(--content-gap);
    min-height: 0;
}

/* Image Stack Container for Dialog - narrower to give dialog more space */
.image-stack-container {
    flex-shrink: 0;
    width: 40%;
    max-width: 650px;
    height: 100%;
    position: relative;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    overflow: visible;
    padding-top: 10px;
}

.dialog-image-stack {
    position: relative;
    width: var(--image-stack-size);
    height: var(--image-stack-size);
    display: flex;
    align-items: center;
    justify-content: center;
}

.stack-image {
    position: absolute;
    width: var(--image-stack-size);
    height: var(--image-stack-size);
    border-radius: clamp(8px, 1.5vw, 16px);
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6),
        0 0 20px rgba(100, 100, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.15);
    transition: transform 0.4s ease, opacity 0.4s ease;
}

.stack-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Dialog Container */
.dialog-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.dialog-messages {
    flex: 1;
    overflow-y: auto;
    padding-right: clamp(10px, 1vw, 20px);
}

.dialog-messages::-webkit-scrollbar {
    width: 6px;
}

.dialog-messages::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.dialog-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.dialog-message {
    margin-bottom: clamp(15px, 2vh, 25px);
    animation: messageAppear 0.3s ease forwards;
    opacity: 0;
}

@keyframes messageAppear {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dialog-role {
    font-weight: 600;
    font-size: clamp(0.8rem, 1vw, 1.1rem);
    margin-bottom: clamp(4px, 0.5vh, 8px);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.dialog-content {
    font-size: var(--dialog-font-size);
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.9);
}

/* Agent Color Coding */
.role-художник .dialog-role {
    color: #ffa726;
}

.role-промпт-инженер .dialog-role {
    color: #42a5f5;
}

.role-ИИ-генератор .dialog-role {
    color: #e040fb;
}

.role-критик .dialog-role {
    color: #ef5350;
}

/* ИИ-генератор message with colored background */
.role-ИИ-генератор {
    background: linear-gradient(135deg, rgba(171, 71, 188, 0.15) 0%, rgba(224, 64, 251, 0.1) 100%);
    border-radius: 12px;
    padding: 15px;
    border-left: 4px solid #e040fb;
}

/* Typing Cursor */
.typing-cursor {
    display: inline-block;
    width: 2px;
    height: 1em;
    background-color: currentColor;
    margin-left: 2px;
    animation: blink 0.7s infinite;
}

@keyframes blink {

    0%,
    50% {
        opacity: 1;
    }

    51%,
    100% {
        opacity: 0;
    }
}

/* Final Layout */
.final-layout {
    align-items: stretch;
    gap: var(--content-gap);
}

.final-layout .text-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    max-height: 100%;
}

.final-meta {
    display: flex;
    gap: clamp(10px, 1.5vw, 20px);
    flex-wrap: wrap;
}

.score-badge,
.concept-badge {
    background: rgba(255, 255, 255, 0.1);
    padding: clamp(8px, 1vw, 12px) clamp(15px, 2vw, 25px);
    border-radius: 50px;
    font-size: clamp(0.8rem, 1.2vw, 1.1rem);
    font-weight: 500;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.score-badge {
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.3), rgba(76, 175, 80, 0.1));
    border-color: rgba(76, 175, 80, 0.3);
    color: #81c784;
}

.concept-badge {
    color: rgba(255, 255, 255, 0.7);
}

/* Portrait orientation - stack layouts vertically */
@media (orientation: portrait) {

    .intro-layout,
    .final-layout {
        flex-direction: column;
    }

    .image-container {
        width: 100%;
        max-width: none;
        height: 40vh;
    }

    .image-container img {
        max-height: 35vh;
    }

    .text-container {
        padding-left: 0;
        padding-top: var(--content-gap);
    }

    .dialog-main {
        flex-direction: column;
    }

    .image-stack-container {
        width: 100%;
        height: auto;
        min-height: 35vh;
        flex-direction: row;
        align-items: center;
        justify-content: flex-start;
        padding-left: 20px;
        overflow-x: auto;
    }

    .dialog-image-stack {
        flex-direction: row;
    }

    .dialog-container {
        flex: 1;
    }
}

/* Small screens */
@media (max-width: 600px) {
    :root {
        --screen-padding: 15px;
    }

    .final-meta {
        flex-direction: column;
        align-items: flex-start;
    }
}