/* assets/css/style.css */

/*///////// Пульт управления размерами шрифтов /////////*/

:root {

  /* Базовый размер текста для всего сайта (16px) */
  --font-size-base: 1rem; 

  /* Размеры для заголовков */
  --font-size-h1: 2.8rem;  /* для <h1 class="hero-title"> */
  --font-size-h2: 1.8rem; /* для <h2 class="text-center"> (напр. "Галерея") */
  --font-size-h3: 1.5rem;  /* для названий в модальном окне */
  --font-size-h5: 0.95rem; /* для названий в карточке галереи */

  /* Размеры для параграфов и другого текста */
  --font-size-1: 1.4rem; 
  --font-size-2: 1.1rem;
  --font-size-3: 0.9rem; 
  --font-size-4: 0.85rem;
}

/*///////// 1. Общие стили и базовые настройки /////////*/

body {
	padding-top: 56px;
	box-sizing: border-box;
    font-family: "Sofia Sans", sans-serif;
    font-optical-sizing: auto;
    font-weight: 400;
    font-style: normal;
    font-size: var(--font-size-base); 
}
*, *::before, *::after {
    box-sizing: inherit;
}
footer { 
    font-size: var(--font-size-3); 
}

/* ///// ПОДКЛЮЧЕНИЕ ЛОКАЛЬНЫХ ШРИФТОВ ///// */


@font-face {
  font-family: 'Sofia Sans';
  src: url('/assets/fonts/SofiaSans-Regular.ttf') format('truetype');
  font-weight: 400; /* Обычный вес */
  font-style: normal;
  font-display: swap; /* Оставляем swap для быстрой отрисовки текста */
}

@font-face {
  font-family: 'Sofia Sans';
  src: url('/assets/fonts/SofiaSans-SemiBold.ttf') format('truetype');
  font-weight: 600; /* Жирный вес */
  font-style: normal;
  font-display: swap;
}


/*///////// 2. Шапка сайта (Hero Section) /////////*/

.hero {
    background-image: url('../images/your-hero-image2.jpg');
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    height: 70vh;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 20px;
    position: relative;
}
.hero > div {
    background-color: rgba(0, 0, 0, 0.3);
    padding: 20px 30px;
    border-radius: 8px;
}
.hero h1 {
    font-size: var(--font-size-h1);
    margin-bottom: 0.5em;
}
.hero p.lead {
    font-size: var(--font-size-1);
}


/*///////// 3. Галерея (Сетка, карточки, фильтры) /////////*/

/* --- ИЗМЕНЕНИЯ ДЛЯ ПРЕДОТВРАЩЕНИЯ "МЕЛЬКАНИЯ" MASONRY --- */
.gallery-grid {
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.4s ease-in-out, visibility 0s linear 0.4s;
}
.gallery-grid.masonry-loaded {
    visibility: visible;
    opacity: 1;
    transition-delay: 0s;
}

/* Сетка Masonry */
	.grid-sizer, .gallery-item { width: 48%; margin-bottom: 10px; }
	@media (min-width: 576px) { .grid-sizer, .gallery-item { width: 48%; } }
	@media (min-width: 768px) { .grid-sizer, .gallery-item { width: 32%; } }
	@media (min-width: 992px) { .grid-sizer, .gallery-item { width: 32%; } }
	@media (min-width: 1200px) { .grid-sizer, .gallery-item { width: 24%; } }

/* Карточка галереи */
.gallery-item {
    border: 0 solid #fff;
    border-radius: 0rem;
    overflow: hidden;
    display: flex;
    flex-direction: column;
	padding: 6px 6px 10px 6px;
    cursor: pointer;
    opacity: 0;
    transform: scale(0.95);
    transition: opacity 0.4s ease-in-out, transform 0.4s ease-in-out;	
}

.gallery-item.is-visible {
  opacity: 1;
  transform: scale(1);
}

.gallery-item:hover img {
    transform: scale(1.02);
}
.gallery-item img {
    width: 100%;
    height: auto;
    transition: transform 0.3s ease;
    display: block;
	border-radius: 8px!important;
	margin-bottom: 6px;
}

/* Подпись под карточкой */
.gallery-item-info {
    padding: 4px 15px 4px 0;
    text-align: left;
    background-color: #fff;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}
.gallery-item-info h5 {
    margin-bottom: 4px;
    line-height: 1.4;
    font-size: var(--font-size-h5);
    font-weight: 600;
    color: #212529;
}
.gallery-item-info p {
    margin-bottom: 4px;
    line-height: 1.4;
}
.gallery-item-info .gallery-item-dimensions {
    margin-bottom: 6px;
    font-size: var(--font-size-4); 
    color: #6c757d;
}
.gallery-item-info .gallery-item-price {
    margin-bottom: 0;
    font-size: var(--font-size-3);
    font-weight: bold;
    color: #000;
    margin-top: auto;
    padding-top: 2px;
}
.gallery-item-price.sold {
    color: #dc3545;
    font-weight: normal;
}

/* Кнопки фильтров */
.filter-btns {
    display: flex; 
	justify-content: center; 
	gap: 10px;
    padding: 15px 0; 
	flex-wrap: wrap; 
	margin-bottom: 2rem;
}
.filter-btns button {
    background-color: transparent; 
    border: 2px solid #dfdfdf; 
	border-bottom: none;
    color: #333;
    border-radius: 14px 14px 0px 0px!important; 
    padding: 6px 16px; 
    font-size: var(--font-size-2); 
    line-height: 1.5; 
    cursor: pointer;
    transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out, border-color 0.2s ease-in-out;
}
.filter-btns button:hover,
.filter-btns button.active { 
    background-color: #333 !important; 
    color: white !important; 
    border-color: #333 !important; 
}


/*///////// 4. Модальное окно //////////*/

/* Общая структура модального окна */
.modal-dialog {
	max-width: none; 
	margin: 1.75rem auto; 
	display: flex;
	justify-content: center; 
	align-items: center;
	min-height: calc(100vh - (1.75rem * 2));
	}
.modal-content {
	display: flex; 
	flex-direction: column; 
	width: auto;
	max-width: 95vw; 
	max-height: calc(100vh - (1.75rem * 2) - 2px);
	overflow: hidden; 
	border: none; 
	background-color: #fff;
	border-radius: 20px;
	}
.modal-header { 
	flex-shrink: 0; 
	padding: 0.75rem 0.75rem 0 0.75rem; 
	border-bottom: 0 solid #dee2e6; 
	}	
.modal-footer {
	flex-shrink: 0;
	padding: 0.75rem;
	border-top: 0 solid #dee2e6;
	display: flex;
	justify-content: space-between;
	align-items: center;
	}
.modal-body { 
    display: flex; 
    gap: 25px; 
	padding: 2px 20px;
}
.left-column { 
    display: flex; 
    flex-direction: column; 
    flex-shrink: 0; 
}
.text-container { 
    flex-grow: 1; 
	margin: 10px 0 0 0;
}

/* Карусель миниатюр в модальном окне */
.child-thumbnails-container { 
    display: flex; 
    gap: 10px; 
	padding: 5px; 
    overflow-x: auto; 
	max-width: 100%; 
    scrollbar-width: thin; 
	scrollbar-color: #888 #f1f1f1; 
}
.child-thumbnails-container::-webkit-scrollbar { 
	height: 8px; 
}
.child-thumbnails-container::-webkit-scrollbar-track { 
	background: #f1f1f1; border-radius: 10px; 	
}
.child-thumbnails-container::-webkit-scrollbar-thumb { 
	background: #888; border-radius: 10px; 
}
.modal-thumbnail { 
    width: 80px; 
	height: 80px; 
	object-fit: cover; 
    cursor: pointer; 
	border: 2px solid transparent; 
    border-radius: 4px; 
    transition: border-color 0.2s ease, transform 0.2s ease; 
    flex-shrink: 0; 
}
.modal-thumbnail:hover { 
	transform: scale(1.05); 
}
.modal-thumbnail.active { 
	border-color: #0d6efd; 
}

/* Контейнер изображения с заглушкой и спиннером в модальном окне */
.image-container {
    position: relative;
    width: 100%;
    background-color: #ffffff;
    display: flex;
    justify-content: center;
    align-items: center;	
}
.placeholder-wrapper {
    position: relative; 
	top: 0; 
	left: 0; 
	width: 100%; 
	height: 100%;	
    overflow: hidden; 
	z-index: 1; 
	transform: translateZ(0);
}
.placeholder-image {
    width: 100%; 
	height: 100%; 
	object-fit: cover;
    filter: blur(3px); 
	transform: scale(1.02);
    transition: opacity 0.3s ease-out;
}
.spinner-wrapper {
    position: absolute; 
	top: 0; 
	left: 0; 
	width: 100%; 
	height: 100%;
    display: flex; 
	align-items: center; 
	justify-content: center;
    z-index: 10; 
	opacity: 0; 
	transition: opacity 0.3s ease;
}
.spinner-wrapper.is-loading { 
	opacity: 1; 
}
.spinner {
    width: 50px; 
	height: 50px; 
	border: 5px solid rgba(0, 0, 0, 0.3);
    border-top-color: #000; 
	border-radius: 50%;
    animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Финальное изображение в модальном окне */
.modal-artwork-image {
    position: absolute; 
	top: 0; 
	left: 0; 
	width: 100%; 
	height: 100%;
    object-fit: contain; 
	z-index: 2;
    opacity: 0; 
	transition: opacity 0.2s ease-in;
}
.modal-artwork-image.is-visible { opacity: 1; }


/*////// Кастомные стили для кнопки "Закрыть" в модальном окне //////*/

#artworkDetailModal .btn-close {
    background-color: #fff; 
	margin: 0.15em 0.15em 0 0;
	margin-left: auto;
    width: 1.2em;
    height: 1.2em;
    border: 2px solid #dfdfdf;
    border-radius: 12px;
    opacity: 1;
}
	
#artworkDetailModal .btn-close:hover {
    border: 2px solid #bababa;
}

.btn-close:focus {
    box-shadow: none !important;
}

/* Текстовый блок в модальном окне и его отступы */
.text-container .artwork-title-in-body {
    font-size: var(--font-size-h3); 
    font-weight: 600;
    margin-bottom: 16px;
}
.text-container .artwork-description-wrapper {
    position: relative; 
    overflow: hidden;
    max-height: 100px;
    transition: max-height 0.35s ease-out;
    margin-bottom: 10px;
}
.text-container .artwork-description-wrapper.expanded {
    max-height: 1000px;
}
.text-container .artwork-description {
    font-size: var(--font-size-4); 
    line-height: 1.4;
    margin-right: 10px; 
    color: #454545;
}
.description-fadeout {
    position: absolute; 
	bottom: 0; 
	left: 0; 
	right: 0;
    height: 30px;
    background: linear-gradient(to bottom, rgba(255,255,255,0) 0%, rgba(255,255,255,1) 90%);
    pointer-events: none; 
	transition: opacity 0.35s ease-out;
    opacity: 1;
}
.text-container .artwork-description-wrapper.expanded .description-fadeout {
    opacity: 0;
}
.artwork-description-wrapper:has(> .artwork-description:empty) {
    display: none;
}
.artwork-expand-button {
    display: none; 
	align-self: flex-start;
    margin-bottom: 0; 
	padding: 0.25rem 0;
    font-size: var(--font-size-4); 
	color: #007bff;
    text-decoration: none; 
	border: none;
    background: none; 
	cursor: pointer;
}
.artwork-expand-button:hover { text-decoration: underline; }
.text-container .artwork-details-placeholder p {
    margin-bottom: 5px;
    line-height: 1.4;
}
.text-container .artwork-price {
    font-size: var(--font-size-3); 
    font-weight: bold;
    color: #000;
    margin-top: 10px;
    line-height: 1.2;
}
.artwork-details-placeholder:empty,
.artwork-price:empty {
    display: none;
}

/* Адаптивность модального окна */
@media (max-width: 767.98px) {
    .modal-dialog {
        width: 100% !important; 
		margin: 0 !important;
        min-height: 100vh !important; 
		align-items: stretch !important;
    }
    .modal-content {
        width: 100% !important; 
		max-width: 100% !important;
        height: 100% !important; 
		max-height: 100vh !important;
        overflow-y: auto !important; 
		border-radius: 0 !important;
        display: flex; 
		flex-direction: column;
    }
    .modal-header {
        position: -webkit-sticky; 
		position: sticky;
        top: 0; 
		background-color: #fff; 
		z-index: 10; 
		flex-shrink: 0;	
    }
    .modal-footer {
        padding: 0.5rem 0.75rem;
        position: -webkit-sticky; 
		position: sticky;
        bottom: 0; 
		background-color: #fff; 
		z-index: 10; 
		flex-shrink: 0;	
    }
    .modal-footer .btn { 
        font-size: var(--font-size-4); 
    }
    .modal-body { 
        flex-direction: column; 
		gap: 15px;
        padding: 0.75rem !important; 
		overflow: visible; 
		flex-grow: 1;
    }
    .left-column, .text-container { 
		width: 100%; 
		flex-shrink: 1; 
	}
    .text-container { 
		max-height: none; 
		overflow: visible; 
	}
}
@media (min-width: 768px) {
    .modal-body {
        flex-direction: row; 
		align-items: flex-start;
        overflow-y: hidden;
    }
    .text-container {
        width: auto;
        max-height: 80vh;
        overflow-y: auto;
        padding: 0;
    }
    .text-container::-webkit-scrollbar { 
		width: 6px; 
	}
    .text-container::-webkit-scrollbar-thumb { 
		background-color: #ccc; 
		border-radius: 3px; 
	}
    .text-container { 
		scrollbar-width: thin; 
		scrollbar-color: #ccc transparent; 
	}
    .artwork-description-wrapper, .artwork-description-wrapper.expanded { 
		max-height: none; 
		overflow: visible; 
	}
    .description-fadeout, .artwork-expand-button { 
		display: none !important; 
	}
}


/*///////// 5. Сервисные стили (кнопки, индикаторы) /////////*/

/* Кнопки навигации в модальном окне */
.modal-prev, .modal-next {
    border: 2px solid #dfdfdf; 
    color: #000;       
}
.modal-prev {
	border-right: none;
	border-radius: 14px 0px 0px 14px !important;        
}
.modal-next {
	border-left: none;
	border-radius: 0px 14px 14px 0px !important;      
}
.modal-prev:hover, .modal-next:hover {
    background-color: #3d3d3d; 	
}

/* Кнопка "Загрузить ещё" */
#load-more-btn {
    background-color: transparent; 
	border: 2px solid #dfdfdf; 
	border-top: none;
    color: #333; 
	border-radius: 0px 0px 14px 14px !important; 
    padding: 6px 16px; 
	font-size: var(--font-size-2); 
	line-height: 1.5; 
    cursor: pointer;
    transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out, border-color 0.2s ease-in-out;
}
#load-more-btn:hover {
    background-color: #dfdfdf; 
}

/* Стили для индикатора загрузки */
#loading-indicator {
	width: 100%;
	text-align: center;
	padding: 20px 0;
	font-style: italic;
	color: #6c757d;
}
#loading-indicator .spinner-svg {
    animation: rotate 2s linear infinite;
    width: 40px;
    height: 40px;
}
#loading-indicator .spinner-svg .path {
    stroke: #0d6efd;
    stroke-linecap: round;
    animation: dash 1.5s ease-in-out infinite;
}
@keyframes rotate { 100% { transform: rotate(360deg); } }
@keyframes dash { 0% { stroke-dasharray: 1, 150; stroke-dashoffset: 0; } 50% { stroke-dasharray: 90, 150; stroke-dashoffset: -35; } 100% { stroke-dasharray: 90, 150; stroke-dashoffset: -124; } }

/* Сообщение, если нет элементов в галерее */
.gallery-no-items-message {
    width: 100%; 
    grid-column: 1 / -1;
    padding: 20px;
    text-align: center;
    color: #6c757d;
}

/*///////// 6. Стили Вопросы и Ответы /////////*/
/* ///// Стили для FAQ с SVG-иконкой ///// */

.faq-item {
    border-bottom: 1px solid #e9ecef;
}

.faq-question {
    font-size: 1.1em;
    font-weight: 600;
    padding: 20px 5px;
    cursor: pointer;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.faq-question::-webkit-details-marker {
    display: none;
}

/* Стили для SVG-иконки */
.faq-icon {
    flex-shrink: 0; /* Запрещаем иконке сжиматься */
    margin-left: 15px;
    color: #888; /* Серый цвет для иконки */
    transition: transform 0.3s ease-in-out; /* Плавный поворот */
}

/* Анимация: поворачиваем иконку при открытии */
.faq-item[open] > .faq-question > .faq-icon {
    transform: rotate(45deg);
    color: #e74c3c; /* Меняем цвет на красный */
}

/* Анимация для ответа остается прежней */
.faq-answer {
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.4s ease-in-out;
}
.faq-answer-content {
    padding: 0 10px 20px 10px;
}
.faq-item[open] > .faq-answer {
    max-height: 500px;
}

/* Единственное правило для ответа: он по умолчанию скрыт */
.faq-answer {
    overflow: hidden;
}
