/*
Theme Name: Andamento Gallery
Theme URI: https://andamento.art
Description: Mosaic Gallery Theme
Version: 1.0
Author: ArtWorker
*/
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: #f8f6f3;
  color: #333;
}

header {
  background: #fff;
  padding: 12px 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 8px rgba(0,0,0,0.08);
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.lang-switcher { margin-left: auto; }

.logo {
  font-size: 22px;
  font-weight: 700;
  color: #1a1a1a;
  text-decoration: none;
  letter-spacing: -0.5px;
}
.logo span { color: #e85d3a; }

.search-box {
  flex: 1;
  max-width: 480px;
  position: relative;
}
.search-box input {
  width: 100%;
  padding: 10px 18px 10px 42px;
  border: 1.5px solid #e0dbd5;
  border-radius: 50px;
  font-size: 14px;
  background: #f8f6f3;
  outline: none;
  transition: border-color 0.2s;
}
.search-box input:focus { border-color: #e85d3a; background: #fff; }
.search-box svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #999;
}

.tags-bar {
  background: #fff;
  border-bottom: 1px solid #ede9e4;
  padding: 10px 24px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.tag-btn {
  padding: 6px 16px;
  border-radius: 50px;
  border: 1.5px solid #e0dbd5;
  background: #fff;
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
  color: #555;
  transition: all 0.2s;
  white-space: nowrap;
}
.tag-btn:hover, .tag-btn.active {
  background: #e85d3a;
  border-color: #e85d3a;
  color: #fff;
}

.gallery-container {
  width: 100%;
  padding: 20px 16px;
  columns: 7;
  column-gap: 14px;
}

@media (max-width: 1600px) { .gallery-container { columns: 6; } }
@media (max-width: 1280px) { .gallery-container { columns: 5; } }
@media (max-width: 1024px) { .gallery-container { columns: 4; } }
@media (max-width: 768px)  { .gallery-container { columns: 3; } }
@media (max-width: 480px)  { .gallery-container { columns: 2; } }

.mosaic-card {
  break-inside: avoid;
  margin-bottom: 16px;
  background: #fff;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.07);
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: pointer;
}
.mosaic-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.13);
}
.mosaic-card img {
  width: 100%;
  height: auto;
  display: block;
}
.card-body {
  padding: 12px 14px 14px;
}
.card-title {
  font-size: 13px;
  font-weight: 600;
  color: #1a1a1a;
  line-height: 1.4;
  margin-bottom: 6px;
}
.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.card-tag {
  font-size: 11px;
  padding: 2px 8px;
  background: #f0ece7;
  border-radius: 20px;
  color: #777;
  text-decoration: none;
}
.card-tag:hover { background: #e85d3a; color: #fff; }

.no-results {
  text-align: center;
  padding: 80px 20px;
  color: #999;
  grid-column: 1/-1;
}

footer {
  text-align: center;
  padding: 32px;
  color: #aaa;
  font-size: 13px;
  border-top: 1px solid #ede9e4;
  margin-top: 20px;
}

.filters-wrap {
  background: #fff;
  border-bottom: 1px solid #ede9e4;
  position: sticky;
  top: 57px;
  z-index: 90;
}

.tags-bar {
  border-bottom: none;
  border-top: 1px solid #f0ece8;
  padding: 8px 16px;
}
.tags-bar:first-child { border-top: none; }

.filter-label {
  font-size: 12px;
  color: #aaa;
  font-weight: 500;
  margin-right: 4px;
  white-space: nowrap;
}

.tags-bar--subjects .tag-btn--subject {
  border-color: #c8e6c9;
  color: #388e3c;
}
.tags-bar--subjects .tag-btn--subject:hover,
.tags-bar--subjects .tag-btn--subject.active {
  background: #388e3c;
  border-color: #388e3c;
  color: #fff;
}

.card-tag--subject {
  background: #e8f5e9;
  color: #388e3c;
}
.card-tag--subject:hover { background: #388e3c; color: #fff; }

/* ===== LIGHTBOX ===== */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  align-items: center;
  justify-content: center;
}
.lightbox.active { display: flex; }

.lightbox-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(4px);
}

.lightbox-box {
  position: relative;
  z-index: 1;
  background: #fff;
  border-radius: 20px;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0,0,0,0.4);
}

.lightbox-img-wrap {
  flex: 0 0 auto;
  max-width: 65vw;
  max-height: 90vh;
  display: flex;
  align-items: center;
  background: #111;
}
.lightbox-img-wrap img {
  max-width: 65vw;
  max-height: 90vh;
  width: auto;
  height: auto;
  display: block;
}

.lightbox-info {
  width: 300px;
  min-width: 260px;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  max-height: 90vh;
}
.lightbox-info h2 {
  font-size: 18px;
  font-weight: 700;
  color: #1a1a1a;
  line-height: 1.4;
}
#lightbox-desc {
  font-size: 13px;
  color: #666;
  line-height: 1.6;
}

.lightbox-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 10;
  background: rgba(0,0,0,0.5);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.lightbox-close:hover { background: rgba(0,0,0,0.8); }

.mosaic-card { cursor: pointer; }

@media (max-width: 600px) {
  .lightbox-box { flex-direction: column; max-width: 95vw; }
  .lightbox-img-wrap { max-width: 95vw; }
  .lightbox-info { width: 100%; padding: 16px; }
}

.lang-btn {
  padding: 5px 10px;
  border-radius: 20px;
  border: 1.5px solid #e0dbd5;
  background: #fff;
  font-size: 12px;
  cursor: pointer;
  color: #666;
  transition: all 0.2s;
  white-space: nowrap;
}
.lang-btn:hover { border-color: #e85d3a; color: #e85d3a; }
.lang-btn.active { background: #e85d3a; border-color: #e85d3a; color: #fff; font-weight: 600; }

/* CTA кнопка в лайтбоксе */
.lightbox-cta-btn {
  display: inline-block;
  margin-top: 16px;
  padding: 10px 20px;
  background: #e85d3a;
  color: #fff;
  border-radius: 50px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  transition: background 0.2s;
}
.lightbox-cta-btn:hover { background: #c94a2a; }

/* Хедер адаптив */
@media (max-width: 768px) {
  .lang-switcher { display: none; }
}

/* ===== COMMENTS ===== */
.lightbox-comments {
  margin-top: 20px;
  border-top: 1px solid #ede9e4;
  padding-top: 16px;
}
.comment-form-title {
  font-size: 13px;
  font-weight: 600;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: block;
  margin-bottom: 12px;
}
.comments-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }
.comment-item { display: flex; gap: 10px; align-items: flex-start; }
.comment-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.comment-body { flex: 1; }
.comment-meta { display: flex; gap: 8px; align-items: baseline; margin-bottom: 3px; }
.comment-meta strong { font-size: 13px; color: #1a1a1a; }
.comment-meta span { font-size: 11px; color: #aaa; }
.comment-text { font-size: 13px; color: #555; line-height: 1.5; }
.no-comments { font-size: 13px; color: #aaa; text-align: center; padding: 8px 0; }
.comments-loading { font-size: 13px; color: #aaa; text-align: center; }

.comment-submit-form { display: flex; flex-direction: column; gap: 8px; }
.comment-submit-form input,
.comment-submit-form textarea {
  border: 1.5px solid #e0dbd5; border-radius: 8px; padding: 8px 12px;
  font-size: 13px; font-family: inherit; outline: none; resize: none;
  transition: border-color 0.2s;
}
.comment-submit-form input:focus,
.comment-submit-form textarea:focus { border-color: #e85d3a; }
.comment-submit-btn {
  background: #e85d3a; color: #fff; border: none; border-radius: 50px;
  padding: 9px 20px; font-size: 13px; font-weight: 600; cursor: pointer;
  transition: background 0.2s; align-self: flex-start;
}
.comment-submit-btn:hover { background: #c94a2a; }

/* ===== AUTH ===== */
.auth-block { display: flex; align-items: center; gap: 8px; }
.auth-btn {
  padding: 7px 16px; border-radius: 50px; border: 1.5px solid #e85d3a;
  background: #e85d3a; color: #fff; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: background 0.2s; white-space: nowrap;
}
.auth-btn:hover { background: #c94a2a; }
.auth-btn--secondary { background: #fff; color: #e85d3a; }
.auth-btn--secondary:hover { background: #fff3f0; }

.auth-avatar {
  width: 34px; height: 34px; border-radius: 50%; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff;
}
#auth-user { position: relative; display: flex; align-items: center; gap: 8px; }
.user-menu {
  position: absolute; top: 42px; right: 0; background: #fff;
  border-radius: 12px; box-shadow: 0 4px 24px rgba(0,0,0,0.15);
  padding: 12px 16px; flex-direction: column; gap: 8px; z-index: 200;
  min-width: 160px;
}
.user-menu span { font-size: 14px; font-weight: 600; color: #1a1a1a; }
.user-menu button { background: none; border: none; color: #e85d3a; cursor: pointer; font-size: 13px; text-align: left; padding: 0; }

/* Auth Modal */
.auth-modal { display: none; position: fixed; inset: 0; z-index: 2000; align-items: center; justify-content: center; }
.auth-modal.active { display: flex; }
.auth-modal-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(4px); }
.auth-modal-box {
  position: relative; z-index: 1; background: #fff; border-radius: 20px;
  padding: 32px 28px; width: 360px; max-width: 95vw;
  box-shadow: 0 24px 80px rgba(0,0,0,0.3);
}
.auth-modal-close {
  position: absolute; top: 14px; right: 14px; background: #f0ece7;
  border: none; border-radius: 50%; width: 30px; height: 30px;
  font-size: 14px; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.auth-tabs { display: flex; gap: 0; margin-bottom: 24px; border-bottom: 2px solid #f0ece7; }
.auth-tab {
  flex: 1; padding: 10px; border: none; background: none; font-size: 14px;
  font-weight: 600; color: #aaa; cursor: pointer; border-bottom: 2px solid transparent;
  margin-bottom: -2px; transition: all 0.2s;
}
.auth-tab.active { color: #e85d3a; border-bottom-color: #e85d3a; }
.auth-logo { font-size: 22px; font-weight: 700; color: #1a1a1a; margin-bottom: 20px; text-align: center; }
.auth-logo span { color: #e85d3a; }
.auth-form { display: flex; flex-direction: column; gap: 10px; }
.auth-form input {
  border: 1.5px solid #e0dbd5; border-radius: 10px; padding: 10px 14px;
  font-size: 14px; font-family: inherit; outline: none;
}
.auth-form input:focus { border-color: #e85d3a; }
.auth-submit-btn {
  background: #e85d3a; color: #fff; border: none; border-radius: 50px;
  padding: 12px; font-size: 14px; font-weight: 700; cursor: pointer;
  margin-top: 4px; transition: background 0.2s;
}
.auth-submit-btn:hover { background: #c94a2a; }
.auth-error { color: #e85d3a; font-size: 13px; min-height: 18px; }
.auth-success { color: #388e3c; font-size: 13px; min-height: 18px; }

.comment-login-prompt { display: flex; align-items: center; gap: 10px; padding: 12px 0; flex-wrap: wrap; }
.comment-or { font-size: 12px; color: #aaa; }
.comment-current-user { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-size: 13px; font-weight: 600; color: #1a1a1a; }

.verified-toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: #388e3c; color: #fff; padding: 12px 24px; border-radius: 50px;
  font-size: 14px; font-weight: 600; z-index: 9999; box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

/* ===== FOOTER & COOKIE ===== */
footer { text-align: center; padding: 24px 32px; color: #aaa; font-size: 13px; border-top: 1px solid #ede9e4; margin-top: 20px; }
footer a { color: #aaa; text-decoration: none; }
footer a:hover { color: #e85d3a; }
.footer-legal { margin-top: 8px; font-size: 12px; }
.footer-legal a { margin: 0 4px; }

.cookie-banner {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 3000;
  background: #1a1a1a; color: #fff;
  padding: 16px 24px; display: flex; align-items: center;
  gap: 16px; flex-wrap: wrap; justify-content: space-between;
  box-shadow: 0 -4px 24px rgba(0,0,0,0.2);
}
.cookie-text { font-size: 13px; flex: 1; min-width: 200px; }
.cookie-text a { color: #e85d3a; }
.cookie-buttons { display: flex; gap: 10px; flex-shrink: 0; }
.cookie-btn {
  padding: 8px 18px; border-radius: 50px; border: none;
  font-size: 13px; font-weight: 600; cursor: pointer; transition: opacity 0.2s;
}
.cookie-btn:hover { opacity: 0.85; }
.cookie-btn--accept { background: #e85d3a; color: #fff; }
.cookie-btn--decline { background: #333; color: #ccc; }

.auth-checkbox {
  display: flex; align-items: flex-start; gap: 8px;
  font-size: 12px; color: #666; cursor: pointer; line-height: 1.5;
}
.auth-checkbox input[type=checkbox] {
  margin-top: 2px; flex-shrink: 0; width: 15px; height: 15px;
  accent-color: #e85d3a; cursor: pointer;
}
.auth-checkbox a { color: #e85d3a; text-decoration: underline; }

/* ===== LIGHTBOX COMMENTS SCROLL ===== */
.lightbox-comments {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  margin-top: 16px;
  border-top: 1px solid #ede9e4;
  padding-top: 12px;
  overflow: hidden;
}
.comments-list {
  overflow-y: auto;
  flex: 1;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: #e0dbd5 transparent;
}
.comments-list::-webkit-scrollbar { width: 4px; }
.comments-list::-webkit-scrollbar-thumb { background: #e0dbd5; border-radius: 4px; }

/* Фиксированная нижняя часть */
.comment-form { flex-shrink: 0; padding-top: 10px; border-top: 1px solid #f0ece8; margin-top: 8px; }

/* Убираем старые кнопки — делаем текстовую строку */
.comment-login-prompt {
  display: block;
  font-size: 13px;
  color: #888;
  padding: 6px 0;
}
.comment-login-prompt a { color: #e85d3a; text-decoration: none; font-weight: 600; }
.comment-login-prompt a:hover { text-decoration: underline; }

/* Lightbox info — flex column чтобы комменты занимали оставшееся место */
.lightbox-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ===== MOBILE FILTERS ===== */
.mobile-filters { display: none; }

.search-box input { padding: 10px 14px; }

@media (max-width: 600px) {
  .desktop-filters { display: none !important; }
  .mobile-filters {
    display: flex;
    gap: 10px;
    padding: 10px 14px;
    background: #fff;
    border-bottom: 1px solid #ede9e4;
  }

  .mobile-filter-group { position: relative; flex: 1; }

  .mobile-filter-btn {
    width: 100%;
    padding: 9px 14px;
    border-radius: 50px;
    border: 1.5px solid #e0dbd5;
    background: #fff;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    color: #555;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .mobile-filter-btn.has-value { border-color: #e85d3a; color: #e85d3a; }
  .mobile-filter-btn--subject.has-value { border-color: #388e3c; color: #388e3c; }

  .mobile-filter-drop {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
    z-index: 500;
    overflow: hidden;
    max-height: 60vh;
    overflow-y: auto;
  }
  .mobile-filter-drop.open { display: block; }

  .mobile-filter-item {
    display: block;
    padding: 12px 16px;
    font-size: 14px;
    color: #333;
    text-decoration: none;
    border-bottom: 1px solid #f5f2ef;
  }
  .mobile-filter-item:last-child { border-bottom: none; }
  .mobile-filter-item.active { color: #e85d3a; font-weight: 600; }
  .mobile-filter-item--subject.active { color: #388e3c; }
  .mobile-filter-item:hover { background: #f8f6f3; }

  /* Поиск без лупы — убираем лишний padding-left */
  .search-box input { padding: 10px 14px; }
}
