/* Стили для страницы портфолио */
.filters {
    display: flex;
    justify-content: center;
    flex-wrap: nowrap;
    gap: 1rem;
    margin-bottom: 3rem;
    width: calc(100% + 25rem);
    margin-left: -12.5rem;
}

.filter-btn {
    padding: 0.7rem 1.5rem;
    background: white;
    border: 2px solid var(--p-brand);
    color: var(--p-brand);
    border-radius: 25px;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    font-size: 1rem;
    flex: 1 1 0;
    line-height: 1.4;
    min-height: 50px;
    text-align: center;
}

.filter-btn:hover,
.filter-btn.active {
    background: var(--p-brand);
    color: white;
}

/* Сетка проектов */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2.5rem;
    margin-bottom: 3rem;
    justify-content: center;
}

.public-project-card {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
    transition: transform 0.3s, box-shadow 0.3s;
    width: 350px;
    max-width: 100%;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    will-change: transform, box-shadow;
    justify-self: center;
}

.public-project-card:hover,
.public-project-card:focus-within {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
}

/* Изображения проектов */
.public-project-image {
    width: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    position: relative;
    background: #f0f0f0;
    border-top-left-radius: 15px;
    border-top-right-radius: 15px;
}

.public-project-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
    object-position: center center;
}

.public-project-card:hover .public-project-image img {
    transform: scale(1.05);
}

/* Контент карточек */
.public-project-content {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.public-project-content h3 {
    font-size: 1.4rem;
    font-weight: bold;
    color: var(--p-text-700);
    min-height: 2rem;
    line-height: 1.2;
}

.public-project-content .project-size {
    font-size: 1rem;
    color: var(--p-brand);
    font-weight: 600;
    margin-bottom: 1rem;
    min-height: 1.5rem;
}

/* Категории проектов */
.public-project-content .project-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.8rem;
}

.category-tag {
    background: #f0f0f0;
    padding: 0.3rem 0.8rem;
    border-radius: 15px;
    font-size: 0.8rem;
    color: var(--p-text-500);
}

.category-tag.active {
    background: var(--p-brand);
    color: #fff;
    font-weight: 600;
}

/* Кнопка "Подробнее" */
.project-detail-btn {
    display: inline-block;
    background: linear-gradient(135deg, var(--p-brand) 0%, var(--p-brand-2) 100%);
    color: white;
    padding: 0.7rem 1.5rem;
    text-decoration: none;
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s ease;
    text-align: center;
}

.project-detail-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    color: white;
    text-decoration: none;
}

/* Контейнер для нижних элементов */
.project-bottom { margin-top: auto; }

/* Стили только для публичных карточек */
.public-project-card .project-content {
    display: flex;
    flex-direction: column;
    flex: 1;
}

/* === Project Modal (общие стили) === */
.project-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    display: none; /* по умолчанию скрыто */
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    z-index: 1000;
    backdrop-filter: blur(2px);
}

.project-modal.is-open { display: flex; }

.project-modal__dialog {
    width: min(980px, 96vw);
    max-height: 90vh;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
    overflow: hidden;
    display: grid;
    grid-template-columns: 58% 42%;
    animation: modalIn .18s ease-out;
}

@keyframes modalIn {
    from { transform: translateY(6px); opacity: .85; }
    to   { transform: translateY(0);    opacity: 1; }
}

/* Левая зона: изображение */
.project-modal__media {
    background: #0f0f0f;
    position: relative;
    aspect-ratio: 4 / 3;
    overflow: hidden;
}

.project-modal__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Кнопки навигации галереи */
.gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
}

.gallery-nav:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: translateY(-50%) scale(1.1);
}

.gallery-nav-prev {
    left: 1rem;
}

.gallery-nav-next {
    right: 1rem;
}

/* Счетчик изображений */
.gallery-counter {
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    z-index: 10;
}

/* Правая зона: контент */
.project-modal__body {
    padding: 1.25rem 1.25rem 1.1rem 1.25rem;
    overflow: auto;
    display: flex;
    flex-direction: column;
}

.project-modal__title {
    font-size: 1.4rem;
    font-weight: 800;
    margin: 0 2rem .4rem 0;
    color: #222;
}

.project-modal__specs {
    color: var(--p-brand);
    font-weight: 700;
    margin-bottom: .6rem;
    font-size: 1rem;
}

.project-modal__location {
    color: #8a8a8a;
    font-size: .95rem;
    margin-bottom: .75rem;
}

.project-modal__desc {
    color: #555;
    line-height: 1.55;
    margin-bottom: .75rem;
}

/* Кнопка в модалке - прижата к низу */
.project-modal__body .project-detail-btn {
    margin-top: auto;
}

/* Кнопка закрытия */
.project-modal__close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(0,0,0,.5);
    color: #fff;
    border: none;
    cursor: pointer;
    line-height: 36px;
    text-align: center;
    font-size: 20px;
    transition: background .2s ease;
    z-index: 10;
}
.project-modal__close:hover { background: rgba(0,0,0,.75); }

.project-modal__dialog {
    position: relative;
}

/* Полоса прокрутки (внутри контента) — необязательно */
.project-modal__body::-webkit-scrollbar { width: 10px; }
.project-modal__body::-webkit-scrollbar-thumb {
    background: #d9d9d9;
    border-radius: 8px;
}

/* Блокируем прокрутку body, когда модалка открыта */
body.modal-open { overflow: hidden; }

/* Фильтры: фокус как ховер */
.filter-btn:focus-visible {
  outline: none;
  background: var(--p-brand);
  color: #fff;
}

/* Кнопка "Подробнее": фокус как ховер */
.project-detail-btn:focus-visible {
  outline: none;
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
  color: #fff;
  text-decoration: none;
}

/* Кнопка "Смотреть еще" */
.load-more-container {
  display: none;
  justify-content: center;
  margin-top: 2rem;
}

/* Классы для центрирования неполных рядов (управляются JS) */
.js-center-single-3col {
  grid-column: 2 / 3 !important;
}

.js-center-double-3col-first,
.js-center-double-3col-second {
  transform: translateX(57%) !important;
}

.js-center-single-2col {
  grid-column: span 2 !important;
  justify-self: center !important;
}

.load-more-btn {
  background: linear-gradient(90deg, var(--p-brand), var(--p-brand-2) 90%) !important;
  color: #fff !important;
  font-size: 1.1rem;
  font-weight: 600;
  border: none !important;
  padding: 0.9em 2.1em;
  border-radius: 26px;
  box-shadow: 0 2px 18px rgba(102,126,234,0.11);
  transition: background 0.25s, transform 0.17s, box-shadow 0.25s;
  cursor: pointer;
  text-decoration: none;
  outline: none;
}

.load-more-btn:hover {
  background: linear-gradient(90deg, var(--p-brand), var(--p-brand-2) 90%) !important;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.15);
  transform: translateY(-2px) scale(1.04);
  color: #fff !important;
  text-decoration: none;
  border: none !important;
}

.load-more-btn:active {
  transform: translateY(0);
  background: linear-gradient(90deg, var(--p-brand), var(--p-brand-2) 90%) !important;
}

.load-more-btn:focus-visible {
  outline: 2px solid var(--p-brand);
  outline-offset: 3px;
}
