:root {
  --bg: #ffffff;
  --bg-soft: #f6f4f1;
  --text: #161616;
  --muted: #625d58;
  --line: #e2ddd7;
  --serif: "Cormorant Garamond", Georgia, serif;
  --sans: "Montserrat", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-weight: 400;
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 32px; }
.center { text-align: center; }

h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.15; }
h1 { font-size: clamp(40px, 6vw, 68px); }
h2 { font-size: clamp(32px, 4vw, 46px); margin-bottom: 24px; }
h3 { font-size: 28px; }

.eyebrow {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 16px;
}

/* Header */
.header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,.97);
  border-bottom: 1px solid transparent;
  transition: border-color .3s;
}
.header.scrolled { border-bottom-color: var(--line); }
.header__inner { display: flex; align-items: center; justify-content: space-between; height: 72px; }
.logo { font-weight: 600; font-size: 16px; letter-spacing: .3em; }
.nav { display: flex; gap: 40px; }
.nav a {
  font-size: 12px; font-weight: 500; letter-spacing: .18em; text-transform: uppercase;
  color: var(--muted); transition: color .2s;
}
.nav a:hover { color: var(--text); }
.burger { display: none; width: 44px; height: 44px; margin-right: -8px; position: relative; }
.burger span { position: absolute; left: 8px; right: 8px; height: 2px; background: var(--text); transition: transform .3s, top .3s; }
.burger span:first-child { top: 17px; }
.burger span:last-child { top: 25px; }
.burger[aria-expanded="true"] span:first-child { top: 21px; transform: rotate(45deg); }
.burger[aria-expanded="true"] span:last-child { top: 21px; transform: rotate(-45deg); }

/* Hero */
.hero { text-align: center; padding: 96px 32px 72px; }
.hero__text { max-width: 480px; margin: 20px auto 0; color: var(--muted); }

/* Portfolio filters */
.filters { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px 32px; margin-bottom: 16px; }
.filters button {
  font-size: 12px; font-weight: 500; letter-spacing: .18em; text-transform: uppercase;
  color: var(--muted); padding: 6px 0; border-bottom: 2px solid transparent;
  transition: color .2s, border-color .2s;
}
.filters button:hover { color: var(--text); }
.filters button.active { color: var(--text); border-bottom-color: var(--text); }
.filters__note { text-align: center; color: var(--muted); font-size: 15px; margin-bottom: 48px; min-height: 1.7em; }

/* Collection cards */
.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 56px 32px; }
.card { display: block; animation: fade .5s ease both; }
.card__img { overflow: hidden; background: var(--bg-soft); aspect-ratio: 4 / 5; }
.card__img img { width: 100%; height: 100%; object-fit: cover; transition: transform .8s ease; }
.card:hover .card__img img { transform: scale(1.04); }
.card__caption {
  margin-top: 18px; font-size: 11px; font-weight: 500; letter-spacing: .2em; text-transform: uppercase; color: var(--muted);
}
.card__title { font-size: 28px; margin-top: 4px; }
.card__count { font-size: 14px; color: var(--muted); }
.cards__empty { grid-column: 1 / -1; text-align: center; padding: 64px 0; }
.cards__empty p { font-family: var(--serif); font-weight: 600; font-size: 28px; margin-bottom: 12px; }

/* Collection page */
.collection { padding-top: 40px; padding-bottom: 120px; }
.collection[hidden], main[hidden] { display: none; }
.back-link { font-size: 12px; font-weight: 500; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); padding: 8px 0; display: inline-block; }
.back-link:hover { color: var(--text); }
.collection__head { text-align: center; padding: 40px 0 48px; }
.collection__title { font-size: clamp(38px, 5vw, 58px); }
.collection__desc { max-width: 540px; margin: 16px auto 0; color: var(--muted); }
.collection__meta { display: flex; justify-content: center; align-items: center; gap: 32px; margin-top: 28px; }
.collection__count { font-size: 14px; color: var(--muted); }
.switch { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; max-width: 640px; }
.switch:empty { display: none; }
.switch a {
  font-size: 12px; font-weight: 500; letter-spacing: .14em; text-transform: uppercase;
  padding: 10px 20px; color: var(--muted); border: 1px solid var(--text);
  transition: background .2s, color .2s;
}
.switch a:hover { color: var(--text); }
.switch a.active { background: var(--text); color: var(--bg); }
.collection__foot { display: flex; justify-content: space-between; gap: 24px; margin-top: 64px; }

/* Gallery: рівні ряди без пропусків */
.gallery { display: flex; flex-direction: column; }
.gallery__row { display: flex; justify-content: center; }
.gallery__item {
  flex: none; overflow: hidden; cursor: zoom-in; background: var(--bg-soft);
  animation: fade .5s ease both;
}
.gallery__row--full .gallery__item:last-child { flex-grow: 1; }
.gallery__item img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s ease; }
.gallery__item:hover img { transform: scale(1.03); }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* About */
.about { background: var(--bg-soft); margin-top: 120px; padding: 120px 0; }
.about__inner { display: grid; grid-template-columns: 1fr 1fr; gap: 96px; align-items: center; }
.about__photo img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; }
.about__text p:not(.eyebrow) { margin-bottom: 18px; max-width: 480px; }
.link-arrow {
  display: inline-block; margin-top: 12px;
  font-size: 12px; font-weight: 600; letter-spacing: .18em; text-transform: uppercase;
  border-bottom: 2px solid var(--text); padding-bottom: 4px;
}

/* Services */
.services { padding-top: 120px; padding-bottom: 120px; }
.services__grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 32px; margin-top: 56px; }
.services__rule {
  max-width: 640px; margin: 56px auto 0; padding: 24px 28px;
  background: var(--bg-soft); border-left: 3px solid var(--text); text-align: left;
}
.services__rule-title {
  font-size: 12px; font-weight: 600; letter-spacing: .18em; text-transform: uppercase; margin-bottom: 8px;
}
.service { border-top: 2px solid var(--text); padding-top: 28px; }
.service__price { font-family: var(--serif); font-weight: 600; font-size: 22px; color: var(--muted); margin: 6px 0 20px; }
.service ul { list-style: none; }
.service li { padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.services__note { text-align: center; color: var(--muted); margin-top: 48px; font-size: 15px; }
.services__note p + p { margin-top: 4px; }
.about__gear { color: var(--muted); font-size: 15px; }
.contacts__links a.contacts__email { text-transform: none; letter-spacing: .04em; font-size: 14px; }

/* Contacts */
.contacts { border-top: 1px solid var(--line); padding: 120px 0; }
.contacts__text { color: var(--muted); }
.contacts__links { display: flex; justify-content: center; flex-wrap: wrap; gap: 16px 48px; margin-top: 40px; }
.contacts__links a {
  font-size: 13px; font-weight: 600; letter-spacing: .18em; text-transform: uppercase;
  border-bottom: 2px solid var(--line); padding-bottom: 4px; transition: border-color .2s;
}
.contacts__links a:hover { border-color: var(--text); }

/* Footer */
.footer { border-top: 1px solid var(--line); }
.footer__inner { display: flex; justify-content: space-between; padding-top: 28px; padding-bottom: 28px; font-size: 13px; color: var(--muted); }

/* Lightbox */
.lightbox {
  position: fixed; inset: 0; z-index: 100;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity .3s;
}
.lightbox.open { opacity: 1; pointer-events: auto; }
.lightbox__img { max-width: calc(100vw - 160px); max-height: calc(100vh - 80px); object-fit: contain; }
.lightbox__close { position: absolute; top: 12px; right: 16px; width: 48px; height: 48px; font-size: 40px; line-height: 1; color: var(--text); }
.lightbox__nav { position: absolute; top: 50%; transform: translateY(-50%); width: 56px; height: 72px; font-size: 52px; line-height: 1; color: var(--text); }
.lightbox__close:hover, .lightbox__nav:hover { opacity: .6; }
.lightbox__prev { left: 16px; }
.lightbox__next { right: 16px; }

/* Планшет */
@media (max-width: 900px) {
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 40px 16px; }
  .about__inner { grid-template-columns: 1fr; gap: 48px; }
  .services__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 40px 24px; }
}

/* Телефон */
@media (max-width: 720px) {
  html { scroll-padding-top: 60px; }
  .container { padding: 0 16px; }
  .header__inner { height: 60px; }
  .burger { display: block; }
  .nav {
    position: absolute; top: 60px; left: 0; right: 0;
    flex-direction: column; gap: 0; background: var(--bg);
    border-bottom: 1px solid var(--line);
    max-height: 0; overflow: hidden; transition: max-height .35s ease;
  }
  .nav.open { max-height: 320px; }
  .nav a { padding: 16px; text-align: center; font-size: 13px; color: var(--text); }

  .hero { padding: 48px 16px 40px; }
  .hero__text { font-size: 15px; }

  .filters {
    flex-wrap: nowrap; justify-content: flex-start; gap: 24px;
    overflow-x: auto; scrollbar-width: none; margin: 0 -16px 12px; padding: 0 16px;
  }
  .filters::-webkit-scrollbar { display: none; }
  .filters button { flex: none; padding: 10px 0; }
  .filters__note { font-size: 14px; margin-bottom: 28px; text-align: left; }

  .cards { gap: 32px 12px; }
  .card__caption { margin-top: 12px; font-size: 10px; letter-spacing: .14em; }
  .card__title { font-size: 22px; }
  .card__count { font-size: 13px; }

  .collection { padding-top: 16px; padding-bottom: 72px; }
  .collection__head { padding: 24px 0 28px; }
  .collection__meta { flex-direction: column; gap: 12px; margin-top: 20px; }
  .collection__foot { flex-direction: column; align-items: center; gap: 20px; margin-top: 40px; }

  .about, .services, .contacts { padding-top: 72px; padding-bottom: 72px; }
  .about { margin-top: 72px; }
  .services__grid { grid-template-columns: 1fr; margin-top: 32px; }
  .services__rule { margin-top: 40px; padding: 20px; }
  .contacts__links { flex-direction: column; align-items: center; }
  .footer__inner { flex-direction: column; gap: 4px; text-align: center; }

  .lightbox__img { max-width: 100vw; max-height: calc(100vh - 140px); }
  .lightbox__nav { top: auto; bottom: 12px; transform: none; }
  .lightbox__prev { left: 8px; }
  .lightbox__next { right: 8px; }
}
