/* Lovely Gallery – стиль з каталогу клієнта, верстка за методикою Саші.
   Усі розміри в rem / em. vw – тільки в html { font-size }. Макети: 390 / 1024 / 1920. */

/* ---------- гумова база ---------- */
html { font-size: calc(100vw / 390 * 16); }
@media (width >= 500px)  { html { font-size: calc(500px / 390 * 16); } }
@media (width >= 768px)  { html { font-size: calc(100vw / 1024 * 16); } }
@media (width >= 1280px) { html { font-size: calc(100vw / 1920 * 16); } }
@media (width >= 1920px) { html { font-size: 16px; } }
@media (width >= 2240px) { html { font-size: calc(16px + (100vw - 2240px) * 0.007); } }
@media (width >= 2560px) { html { font-size: 18.24px; } }

/* ---------- токени: мобайл 390 ---------- */
:root {
  --serif: Georgia, "Gelasio", "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --bg: #ffffff;
  --ink: #1d2634;
  --muted: #5e6470;
  --line: #dedcd6;
  --mat: #f2f1ed;
  --price: #1b2d4d;
  --ukraine: #2256a6;
  --sold: #a5302a;

  --wrap-max: 24.375rem;
  --pad-x: 1.25rem;
  --section-y: 4rem;
  --header-h: 3.5rem;

  --h1: 2.5rem;
  --h2: 2.125rem;
  --h3: 1.5rem;
  --title: 1.3125rem;
  --body: 1rem;
  --meta: 0.875rem;
  --label: 0.6875rem;
  --price-size: 1.375rem;

  --cols: 1;
  --gap: 1.875rem;
}

/* планшет 1024 */
@media (width >= 768px) {
  :root {
    --wrap-max: none;
    --pad-x: 2.5rem;
    --section-y: 5.5rem;
    --header-h: 4rem;
    --h1: 4rem;
    --h2: 3rem;
    --h3: 1.875rem;
    --title: 1.375rem;
    --body: 1.0625rem;
    --meta: 0.9375rem;
    --label: 0.75rem;
    --price-size: 1.5rem;
    --cols: 2;
    --gap: 1.5rem;
  }
}

/* веб 1920 */
@media (width >= 1280px) {
  :root {
    --wrap-max: 105rem;
    --pad-x: 7.5rem;
    --section-y: 8rem;
    --header-h: 5.5rem;
    --h1: 6.5rem;
    --h2: 4.5rem;
    --h3: 2.75rem;
    --title: 1.875rem;
    --body: 1.375rem;
    --meta: 1.125rem;
    --label: 1rem;
    --price-size: 2rem;
    --cols: 3;
    --gap: 2.5rem;
  }
}

/* ---------- база ---------- */
*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}
img { display: block; max-width: 100%; height: auto; }
h1, h2, h3, h4, p, ul, figure, blockquote, dl, dd { margin: 0; padding: 0; }
ul { list-style: none; }
a { color: inherit; }
em { font-style: italic; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 1rem); }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

.wrap {
  width: 100%;
  max-width: calc(var(--wrap-max) + var(--pad-x) * 2);
  margin-inline: auto;
  padding-inline: var(--pad-x);
}
@media (500px <= width < 768px) {
  .wrap { max-width: 24.375rem; padding-inline: 0; }
}

.label {
  font-family: var(--sans);
  font-size: var(--label);
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 1.3;
}

/* ---------- кнопки ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6em;
  min-height: 3em;
  padding: 0 1.6em;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: #fff;
  font: 600 var(--meta) / 1 var(--sans);
  letter-spacing: 0.04em;
  cursor: pointer;
  text-decoration: none;
  transition: background-color .2s, color .2s;
}
.btn:hover { background: #fff; color: var(--ink); }
.btn:focus-visible, a:focus-visible, input:focus-visible, .modal__close:focus-visible {
  outline: 2px solid var(--ukraine);
  outline-offset: 3px;
}
.btn--small { min-height: 2.6em; padding: 0 1.2em; }
.btn--full { width: 100%; }
.btn[disabled] { opacity: .5; cursor: default; }

/* ---------- шапка ---------- */
.top {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(255, 255, 255, .96);
  border-bottom: 1px solid var(--line);
}
.top__in {
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}
.top__logo {
  font-family: var(--serif);
  font-size: calc(var(--title) * 1.05);
  text-decoration: none;
  white-space: nowrap;
}
.top__nav { display: none; }
@media (width >= 1280px) {
  .top__nav { display: flex; gap: 2.25rem; margin-left: auto; margin-right: 1rem; }
  .top__nav a {
    font-size: var(--meta);
    color: var(--muted);
    text-decoration: none;
    transition: color .2s;
  }
  .top__nav a:hover { color: var(--ink); }
}

/* ---------- перший екран ---------- */
.btn--ghost { background: transparent; color: var(--ink); }
.btn--ghost:hover { background: var(--ink); color: #fff; }

.hero__in { display: flex; flex-direction: column-reverse; gap: 1.75rem; padding-top: 1rem; }
.hero__photo { aspect-ratio: 4 / 3; overflow: hidden; background: var(--mat); }
.hero__photo img { width: 100%; height: 100%; object-fit: cover; object-position: 38% 50%; }
.hero__title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: var(--h1);
  line-height: 1.05;
  letter-spacing: -0.01em;
}
.hero__lead {
  margin-top: 1rem;
  font-size: var(--body);
  line-height: 1.5;
  color: var(--muted);
  max-width: 28em;
}
.hero__actions { margin-top: 1.5rem; display: flex; flex-wrap: wrap; gap: .75rem; }
.hero__actions .btn { flex: 1 1 auto; }
.hero__facts {
  margin-top: 1.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: auto 1fr;
  gap: .75rem 1.5rem;
  font-size: var(--meta);
}
.hero__facts div { display: contents; }
.hero__facts dt { color: var(--muted); }

@media (width >= 768px) {
  .hero__in {
    flex-direction: row;
    align-items: stretch;
    gap: 3rem;
    padding-top: 2rem;
    min-height: min(calc(100svh - var(--header-h) - 2rem), 46rem);
  }
  .hero__text { flex: 0 0 42%; display: flex; flex-direction: column; justify-content: flex-end; padding-bottom: .5rem; }
  .hero__photo { flex: 1; aspect-ratio: auto; min-height: 26rem; }
  .hero__actions .btn { flex: 0 0 auto; }
  .hero__facts { margin-top: 2.5rem; }
}
/* планшет: квадратне фото, щоб вивіска «Lovely» влазила цілком */
@media (768px <= width < 1280px) {
  .hero__in { min-height: 0; align-items: flex-end; }
  .hero__photo { aspect-ratio: 1; min-height: 0; }
  .hero__photo img { object-position: 45% 50%; }
}
@media (width >= 1280px) {
  .hero__in { gap: 5rem; padding-top: 2.5rem; min-height: min(calc(100svh - var(--header-h) - 2.5rem), 62rem); }
  .hero__text { flex-basis: 40%; padding-bottom: 1rem; }
  .hero__lead { margin-top: 1.75rem; font-size: calc(var(--body) * 1.1); }
  .hero__actions { margin-top: 2.5rem; gap: 1rem; }
  .hero__facts { margin-top: 3.5rem; padding-top: 1.75rem; gap: 1rem 3rem; }
}

/* ---------- про галерею ---------- */
.about { padding-top: var(--section-y); }
.about__in { display: grid; gap: 2rem; }
.quote blockquote {
  font-family: var(--serif);
  font-style: italic;
  font-size: var(--h3);
  line-height: 1.3;
}
.quote figcaption { margin-top: 1rem; font-size: var(--meta); color: var(--muted); }
.about__text { font-size: var(--body); line-height: 1.65; }
.about__text p + p { margin-top: .9em; }
@media (width >= 768px) {
  .about__in { grid-template-columns: 1fr 1fr; gap: 3rem; align-items: start; }
}
@media (width >= 1280px) {
  .about__in { grid-template-columns: 7fr 5fr; gap: 8rem; }
  .about__text { padding-top: .5rem; }
}

/* ---------- покажчик митців ---------- */
.index { padding-top: var(--section-y); }
.index__list { margin-top: 1rem; border-top: 1px solid var(--line); }
.index__list a {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  font-family: var(--serif);
  font-size: var(--h3);
  line-height: 1.2;
  transition: color .2s;
}
.index__list a span { font-family: var(--sans); font-size: var(--meta); color: var(--muted); white-space: nowrap; }
.index__list a:hover { color: var(--ukraine); }
@media (width >= 1280px) {
  .index__list { display: grid; grid-template-columns: 1fr 1fr; column-gap: var(--gap); border-top: 0; }
  .index__list li { border-top: 1px solid var(--line); }
  .index__list a { padding: 1.5rem 0; }
}

/* ---------- митець ---------- */
.artist { padding-top: var(--section-y); }
.artist__name {
  font-family: var(--serif);
  font-weight: 400;
  font-size: var(--h2);
  line-height: 1.1;
}
.artist__bio {
  margin-top: 1rem;
  max-width: 52em;
  font-size: var(--body);
  line-height: 1.6;
}
.artist__head { padding-bottom: 2rem; border-bottom: 1px solid var(--line); }
.group { margin-top: 2.5rem; }
.group__title {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: var(--h3);
  line-height: 1.2;
}
.group__text {
  margin-top: .6rem;
  max-width: 60em;
  color: var(--muted);
  font-size: var(--meta);
  line-height: 1.6;
}
.group__title + .grid, .group__text + .grid { margin-top: 1.5rem; }
@media (width >= 1280px) {
  .artist__bio { margin-top: 1.5rem; }
  .artist__head { padding-bottom: 3rem; }
  .group { margin-top: 4rem; }
  .group__text { font-size: var(--body); }
  .group__title + .grid, .group__text + .grid { margin-top: 2.5rem; }
}

/* ---------- сітка й картка роботи ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  gap: var(--gap);
}
.work {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  background: #fff;
}
.work__mat {
  position: relative;
  aspect-ratio: 5 / 4;
  background: var(--mat);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.work__mat img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; }
.work__sold {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  background: var(--sold);
  color: #fff;
  font: 700 var(--label) / 1 var(--sans);
  letter-spacing: .18em;
  text-transform: uppercase;
  padding: .55em .8em .5em;
}
.work__body {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 1.25rem 1.25rem 1.5rem;
}
.work__by { margin-bottom: .35rem; }
.work__title {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: var(--title);
  line-height: 1.25;
}
.work__meta {
  margin-top: .75rem;
  color: var(--muted);
  font-size: var(--meta);
  line-height: 1.5;
}
.work__price {
  margin-top: auto;
  padding-top: 1.25rem;
}
.work__price-in { border-top: 1px solid var(--line); padding-top: .9rem; }
.work__price-in > div { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.work__price-in > div + div { margin-top: .3rem; }
.work__price dt { color: var(--muted); font-size: var(--meta); }
.work__price dd { font-size: var(--meta); font-variant-numeric: tabular-nums; }
.work__price .is-total dd { font-size: var(--price-size); font-weight: 800; color: var(--price); line-height: 1.2; }
.work__price .is-ukraine dt, .work__price .is-ukraine dd { color: var(--ukraine); font-weight: 600; }
.work__cta { margin-top: 1.25rem; width: 100%; }
.work__cta span { transition: transform .2s; }
.work__cta:hover span { transform: translateX(.25em); }
.work__soldnote {
  margin-top: 1.25rem;
  min-height: 3em;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: var(--meta);
}
@media (width >= 1280px) {
  .work__mat { padding: 2rem; }
  .work__body { padding: 1.75rem 2rem 2rem; }
  .work__sold { top: 1.25rem; left: 1.25rem; }
}

/* широка картка: одна робота на весь ряд */
@media (width >= 768px) {
  .work--wide { grid-column: 1 / -1; flex-direction: row; }
  .work--wide .work__mat { flex: 0 0 60%; aspect-ratio: 4 / 3; }
  .work--wide .work__body { justify-content: flex-end; }
  .work--wide .work__title { font-size: var(--h3); }
}
@media (width >= 1280px) {
  .work--wide .work__mat { flex-basis: 66.6%; padding: 3rem; }
  .work--wide .work__body { padding: 2.5rem 3rem 3rem; }
}

/* ---------- футер ---------- */
.foot {
  margin-top: var(--section-y);
  padding: 3rem 0 calc(3rem + env(safe-area-inset-bottom));
  background: var(--mat);
  border-top: 1px solid var(--line);
}
.foot__in { display: grid; gap: 1.5rem; }
.foot__logo { font-family: var(--serif); font-size: var(--h3); }
.foot__addr, .foot__note { color: var(--muted); font-size: var(--meta); margin-top: .3rem; }
.foot .btn { justify-self: start; }
@media (width >= 768px) {
  .foot__in { grid-template-columns: 1fr 1fr auto; align-items: center; }
  .foot__note { margin-top: 0; }
}

/* ---------- попап ---------- */
html.is-locked { overflow: hidden; }
.modal {
  width: min(100% - 2rem, 34rem);
  max-height: calc(100dvh - 2rem);
  padding: 0;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  overflow: auto;
  overscroll-behavior: contain;
}
.modal::backdrop { background: rgba(20, 26, 36, .55); }
.modal[open] { animation: modal-in .22s ease-out; }
@keyframes modal-in { from { opacity: 0; transform: translateY(.75rem); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .modal[open] { animation: none; } }
@media (width >= 768px) { .modal { width: 32rem; } }
@media (width >= 1280px) { .modal { width: 40rem; } }

.modal__box { position: relative; padding: 1.5rem; }
@media (width >= 1280px) { .modal__box { padding: 2.5rem; } }
.modal__close {
  position: absolute;
  top: .5rem;
  right: .5rem;
  width: 2.75rem;
  height: 2.75rem;
  border: 0;
  background: none;
  font: 300 1.75rem / 1 var(--sans);
  color: var(--muted);
  cursor: pointer;
}
.modal__close:hover { color: var(--ink); }
.modal__work {
  display: grid;
  grid-template-columns: 6rem 1fr;
  gap: 1rem;
  align-items: center;
  padding-right: 2rem;
}
.modal__work[hidden], .modal__general[hidden], .modal__fields[hidden], .modal__done[hidden] { display: none; }
.modal__thumb {
  aspect-ratio: 1;
  background: var(--mat);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: .5rem;
}
.modal__thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.modal__title {
  font-family: var(--serif);
  font-style: italic;
  font-size: var(--title);
  line-height: 1.25;
  margin-top: .3rem;
}
.modal__general .modal__title { font-size: var(--h3); }
.modal__by { color: var(--muted); font-size: var(--meta); margin-top: .2rem; }
.modal__price { font-weight: 800; color: var(--price); margin-top: .2rem; }
.modal__fields { margin-top: 1.5rem; display: grid; gap: 1rem; }
.field { display: grid; gap: .4rem; }
.field span { font-size: var(--meta); color: var(--muted); }
.field input {
  width: 100%;
  min-height: 3rem;
  padding: 0 .9rem;
  border: 1px solid var(--line);
  border-radius: 0;
  background: #fff;
  color: var(--ink);
  font: 400 max(16px, var(--body)) / 1.2 var(--sans); /* ≥16px – iOS не зумить */
  -webkit-appearance: none;
  appearance: none;
}
.field input:focus { border-color: var(--ink); }
.field input[aria-invalid="true"] { border-color: var(--sold); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.modal__error { color: var(--sold); font-size: var(--meta); }
.modal__error[hidden] { display: none; }
.modal__fine { color: var(--muted); font-size: calc(var(--meta) * .9); line-height: 1.45; }
.modal__done { margin-top: 1.5rem; display: grid; gap: 1rem; justify-items: start; }
.modal__done .modal__title { font-size: var(--h3); }
