:root {
	--primary: #000000;
	--accent: #25D465;
	--danger: #FF4D36;
	--text: #111827;
	--muted: #6b7280;
	--border: #e5e7eb;
	--bg: #ffffff;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif; color: var(--text); background: var(--bg); }
a { color: inherit; text-decoration: none; }

.container { width: 100%; max-width: 1100px; margin: 0 auto; padding: 0 16px; }

header.topbar { background: var(--primary); color: white; padding: 14px 0; text-align: center; font-weight: 700; }
header.topbar img.logo { 
    height: 79px; 
    vertical-align: middle; 
    /* Comprehensive copy protection */
    user-select: none; 
    -webkit-user-select: none; 
    -moz-user-select: none; 
    -ms-user-select: none; 
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    pointer-events: none;
    /* Drag protection - using standard properties */
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
    /* Additional protection */
}

.banner { background: #d1d5db; height: 500px; display: flex; align-items: center; justify-content: center; color: #111; font-size: 40px; font-weight: 700; }
.banner img { width: 100%; height: 100%; object-fit: cover; display: block; }

.top-lines { text-align: center; padding: 28px 0 8px; }
.top-lines .l1 { font-size: 28px; font-weight: 700; }
.top-lines .l2 { margin-top: 8px; font-size: 22px; color: #111; }
.top-lines .l3 { margin-top: 8px; font-size: 16px; color: var(--muted); }
.see-work { margin: 10px auto 0; }
.see-work .label { color: #000; font-weight: 700; margin-bottom: 8px; text-align: center; }
.see-work .chips { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.see-work .chip { display: inline-block; border: 1px solid var(--border); border-radius: 24px; padding: 12px 16px; background: #fff; text-align: center; color: #7A7B8C; }

.cta-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; justify-content: center; max-width: 420px; margin: 18px auto 30px; }
.btn { display: inline-block; padding: 12px 16px; text-align: center; border-radius: 6px; font-weight: 700; color: #fff; }
.btn.red { background: var(--danger); }
.btn.green { background: var(--accent); }

.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; padding: 10px 0 20px; }
.card { border: 1px solid var(--border); border-radius: 8px; padding: 16px; }
.card h3 { margin: 0 0 8px; }
.card p { margin: 0; color: #374151; line-height: 1.6; }

.works { padding: 16px 0; }
.works h2 { text-align: center; margin: 0 0 16px; }
.works-box { background: #F5F5F7; padding: 20px 12px; border-radius: 8px; }
.gallery { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.gallery-scroll { grid-template-columns: repeat(var(--home-cols-desktop, 4), 1fr); gap: 12px; overflow-x: visible; padding-bottom: 0; scroll-padding-left: 0; }
.gallery-scroll .item { aspect-ratio: 1 / 1; }
.gallery-scroll .item img { width: 100%; height: 100%; object-fit: cover; }
.gallery .item { aspect-ratio: 1 / 1; background: #f3f4f6; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.gallery .item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.all-link { display: inline-block; margin: 8px 0 24px; padding: 8px 14px; border: 1px solid var(--border); border-radius: 6px; font-weight: 600; }

/* FAQ Styles */
.faq { max-width: 800px; margin: 16px auto 40px; }
.faq h2 { text-align: center; }
.accordion { border-top: 1px solid var(--border); }
.accordion-item { border-bottom: 1px solid var(--border); }
.accordion-button { 
    width: 100%; 
    text-align: left; 
    background: none; 
    border: 0; 
    padding: 16px; 
    font-size: 16px; 
    font-weight: 700; 
    display: flex; 
    align-items: center; 
    justify-content: space-between; 
    cursor: pointer;
}
.accordion-button span.plus { 
    font-size: 20px; 
    font-weight: 900; 
    transition: transform .2s ease; 
}
.accordion-panel { 
    max-height: 0; 
    overflow: hidden; 
    transition: max-height .25s ease, padding .25s ease; 
    padding: 0 16px; 
}
.accordion-item.active .accordion-panel { 
    padding: 0 16px 16px; 
}
.accordion-item.active .accordion-button .plus { 
    transform: rotate(45deg); 
}
.accordion-panel p { 
    margin: 0; 
    color: #374151; 
    line-height: 1.6;
}

footer.site { background: #f3f4f6; padding: 24px 0; border-top: 1px solid var(--border); }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; align-items: start; }
.qr-box { text-align: center; }
.qr-box img { width: 160px; height: 160px; object-fit: contain; }
.copy { text-align: center; color: var(--muted); padding: 10px 0 20px; font-size: 13px; }

/* Back button */
.back { 
	display: inline-flex; 
	align-items: center; 
	gap: 4px; 
	padding: 10px 16px; 
	background: var(--primary); 
	color: white; 
	border-radius: 6px; 
	font-weight: 600; 
	margin: 20px 0; 
	transition: background 0.2s ease;
}
.back:hover { 
	background: #333; 
}

/* Carousel on mobile */
.carousel { display: none; }

/* Lightbox */

/* Navigation arrows */
.nav-arrow {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	background: rgba(255, 255, 255, 0.9);
	border: 1px solid var(--border);
	border-radius: 50%;
	width: 40px;
	height: 40px;
	display: none;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	z-index: 10;
	transition: all 0.2s ease;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
	color: var(--text);
}

.nav-arrow:hover {
	background: rgba(255, 255, 255, 1);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
	transform: translateY(-50%) scale(1.1);
}

.nav-arrow:active {
	transform: translateY(-50%) scale(0.95);
}

.nav-arrow-left {
	left: 8px;
}

.nav-arrow-right {
	right: 8px;
}

/* Ensure gallery-scroll has horizontal scroll when needed */
.gallery-scroll {
	overflow-x: auto;
	scroll-behavior: smooth;
}

/* Hide scrollbar but keep functionality */
.gallery-scroll::-webkit-scrollbar {
	height: 6px;
}

.gallery-scroll::-webkit-scrollbar-track {
	background: transparent;
}

.gallery-scroll::-webkit-scrollbar-thumb {
	background: rgba(0, 0, 0, 0.2);
	border-radius: 3px;
}

.gallery-scroll::-webkit-scrollbar-thumb:hover {
	background: rgba(0, 0, 0, 0.3);
}

/* Position arrows relative to works-box section */
.works-box {
	position: relative;
}

@media (max-width: 768px) {
	/* Chips responsiveness - flexible layout */
	.see-work .chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
	.see-work .chip { font-size: 14px; padding: 10px 12px; white-space: nowrap; flex: 0 0 auto; }
	.banner { height: 200px; font-size: 24px; }
	.top-lines .l1 { font-size: 22px; }
	.top-lines .l2 { font-size: 18px; }
	.cta-row { grid-template-columns: 1fr 1fr; max-width: 360px; }
	.btn { padding: 10px 14px; font-size: 14px; }
	.cards { grid-template-columns: 1fr; }
	/* Mobile: larger photos (~70% width each) with horizontal scroll */
	.gallery-scroll { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: var(--home-scale-mobile, 70%); overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding-left: 0; padding-bottom: 8px; }
	.gallery-scroll .item { scroll-snap-align: start; }
	.carousel { display: none; }
	.footer-grid { display: flex !important; flex-direction: column !important; }
	.contact-info { order: 1; }
	.qr-box { order: 2; margin-top: 20px; }
	
	.nav-arrow {
		width: 36px;
		height: 36px;
		background: rgba(255, 255, 255, 0.95);
	}
	
	.lightbox-close {
		font-size: 24px;
	}
	
	#galleryModal .lightbox-close {
		font-size: 24px;
	}
	
	.nav-arrow-left {
		left: 4px;
	}
	
	.nav-arrow-right {
		right: 4px;
	}
}

/* Small mobile devices */
@media (max-width: 480px) {
	.banner { height: 150px; font-size: 20px; }
	.top-lines .l1 { font-size: 18px; }
	.top-lines .l2 { font-size: 16px; }
	.btn { padding: 8px 12px; font-size: 12px; }
	.lightbox-close { font-size: 20px; }
	#galleryModal .lightbox-close { font-size: 20px; }
}

/* Desktop: лимит количества фото задаётся динамически из index.php */



@media (max-width: 560px) {
  .gallery-row { grid-template-columns: repeat(2, 1fr); }
  .photo img { height: 120px; }
  /* Keep Number and WhatsApp on a single line */
  .cta-row { flex-wrap: nowrap; }
  .btn { white-space: nowrap; }
}

/* Accessible image buttons */
.gallery .item button {
	background: none;
	border: none;
	padding: 0;
	margin: 0;
	cursor: zoom-in;
	display: block;
	width: 100%;
	height: 100%;
}

.gallery .item button:focus {
	outline: 2px solid #007bff;
	outline-offset: 2px;
}

.gallery .item button:focus img {
	opacity: 0.8;
}

/* Lightbox overlay styles */
.lightbox-overlay {
	display: none;
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0, 0, 0, 0.9);
	z-index: 1000;
	align-items: center;
	justify-content: center;
}

.lightbox-overlay.open {
	display: flex;
}

.lightbox-overlay img {
	max-width: 90%;
	max-height: 90%;
	object-fit: contain;
	border-radius: 8px;
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.lightbox-close {
	position: absolute;
	top: 20px;
	right: 30px;
	color: white;
	font-size: 30px;
	font-weight: bold;
	cursor: pointer;
	background: none;
	border: none;
	padding: 0;
	width: auto;
	height: auto;
}

.lightbox-close:hover {
	color: #ccc;
}

/* Gallery Modal - Highest z-index to ensure it overlays everything */
#galleryModal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10000; /* Higher than lightbox-overlay (1000) and nav-arrow (10) */
  backdrop-filter: blur(2px); /* Subtle blur for better focus */
}

#galleryModal img {
  max-width: 95%;
  max-height: 95%;
  border-radius: 8px;
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.7);
  transition: transform 0.2s ease;
  cursor: zoom-out;
}

#galleryModal img:hover {
  transform: scale(1.02);
}

#galleryModal span {
  position: absolute;
  top: 20px;
  right: 30px;
  color: #fff;
  font-size: 40px;
  font-weight: bold;
  background: rgba(0, 0, 0, 0.5);
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

#galleryModal span:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.1);
}

/* Ensure modal images are above other elements */
.gallery .item img.zoom-img,
.carousel .item img.zoom-img {
  cursor: zoom-in;
  transition: transform 0.2s ease;
  position: relative;
  z-index: 1;
}

.gallery .item img.zoom-img:hover,
.carousel .item img.zoom-img:hover {
  transform: scale(1.05);
}

/* Гарантированные стили для модального окна */
.zoom-img {
  pointer-events: auto !important; /* Гарантирует, что картинка принимает клики */
  transition: transform 0.2s;
}

.zoom-img:hover {
  transform: scale(1.02); /* Легкий эффект при наведении, чтобы понять, что кнопка активна */
}

#galleryModal {
  display: none; 
  position: fixed; 
  inset: 0; /* Растягивает на весь экран */
  background: rgba(0,0,0,0.85); 
  z-index: 999999; /* Максимальный приоритет */
  align-items: center; 
  justify-content: center;
}


