/* Головна: зала перед входом — заголовок, зона прийому фото, стрічка експонатів. */

.wrap { width: min(1280px, 100% - 48px); margin-inline: auto; }

@media (max-width: 640px) { .wrap { width: calc(100% - 32px); } }

/* ─── шапка ────────────────────────────────────────────────────────────── */

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 0 18px;
}

.masthead__brand { display: flex; align-items: baseline; gap: 10px; }

.masthead__mark {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 15px;
  letter-spacing: -0.02em;
}

/* ─── герой ────────────────────────────────────────────────────────────── */

.hero { padding: clamp(36px, 9vw, 96px) 0 clamp(28px, 5vw, 56px); }

.hero__title {
  font-size: clamp(2.6rem, 8.5vw, 6.4rem);
  font-weight: 600;
  letter-spacing: -0.045em;
  max-width: 15ch;
}

.hero__title em { font-style: normal; color: var(--accent); }

.hero__lede {
  margin: 26px 0 0;
  max-width: 46ch;
  font-size: clamp(1.05rem, 2.2vw, 1.3rem);
  font-weight: 300;
  color: var(--dim);
}

.hero__stats {
  display: flex;
  gap: 26px;
  margin-top: 34px;
  flex-wrap: wrap;
}

.stat { display: flex; align-items: baseline; gap: 9px; }

.stat__value {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 500;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

/* Поява при завантаженні сторінки: сходинками, згори вниз. */
.reveal { opacity: 0; transform: translateY(14px); animation: reveal 900ms cubic-bezier(0.22, 1, 0.36, 1) forwards; }
.reveal:nth-child(1) { animation-delay: 60ms; }
.reveal:nth-child(2) { animation-delay: 180ms; }
.reveal:nth-child(3) { animation-delay: 300ms; }

@keyframes reveal { to { opacity: 1; transform: none; } }

/* ─── зона прийому ─────────────────────────────────────────────────────── */

.intake {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--paper-2);
  padding: clamp(22px, 4vw, 40px);
  overflow: hidden;
  transition: border-color 260ms ease, background 260ms ease, transform 260ms ease;
}

/* Тепле світло згори — ніби лампа над столом приймання. */
.intake::before {
  content: "";
  position: absolute;
  inset: -45% -15% auto -15%;
  height: 460px;
  background: radial-gradient(ellipse 62% 100% at 50% 100%,
              color-mix(in srgb, var(--accent) 20%, transparent), transparent 72%);
  opacity: 0.45;
  pointer-events: none;
  transition: opacity 400ms ease;
}

.intake.is-dragging {
  border-color: var(--accent);
  transform: scale(1.006);
}
.intake.is-dragging::before { opacity: 1; }

.intake__inner { position: relative; }

.intake__prompt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  text-align: center;
  padding: clamp(26px, 6vw, 58px) 12px;
  cursor: pointer;
}

.intake__icon {
  width: 54px;
  height: 54px;
  border: 1.5px solid var(--line);
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--dim);
  transition: color 260ms ease, border-color 260ms ease, transform 500ms cubic-bezier(0.34, 1.4, 0.64, 1);
}

.intake__prompt:hover .intake__icon,
.intake.is-dragging .intake__icon {
  color: var(--accent);
  border-color: var(--accent);
  transform: translateY(-4px);
}

.intake__headline {
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 3vw, 1.6rem);
  font-weight: 400;
  letter-spacing: -0.02em;
}

.intake__hint { font-size: 0.9rem; color: var(--dim); max-width: 46ch; }

.intake input[type="file"] { display: none; }

/* ─── стан «фото обрано» ───────────────────────────────────────────────── */

.compose {
  display: grid;
  grid-template-columns: minmax(0, 260px) minmax(0, 1fr);
  gap: clamp(20px, 4vw, 40px);
  align-items: start;
}

@media (max-width: 720px) { .compose { grid-template-columns: 1fr; } }

.compose__preview {
  position: relative;
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--paper-3);
  box-shadow: var(--shadow);
  aspect-ratio: 3 / 4;
}

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

.compose__form { display: flex; flex-direction: column; gap: 22px; }

.compose__fields { display: flex; flex-direction: column; gap: 18px; }

.compose__label {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--dim);
  margin-bottom: 4px;
}

.compose__optional { text-transform: none; letter-spacing: 0.02em; opacity: 0.7; }

.compose__actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }

.compose__filename {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.notice { font-size: 0.92rem; margin: 0; }
.notice--error { color: var(--danger); }
.notice--ok { color: var(--accent); }

/* Успіх: фото «проявляється» і зала вітає. */
.done { text-align: center; padding: clamp(30px, 6vw, 60px) 12px; }

.done__title {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 4vw, 2.2rem);
  font-weight: 600;
  letter-spacing: -0.03em;
}

.done__sub { color: var(--dim); margin-top: 12px; }

.done__frame {
  width: min(260px, 70vw);
  margin: 0 auto 26px;
  border-radius: var(--r-md);
  overflow: hidden;
  box-shadow: var(--shadow);
  animation: develop 1200ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.done__frame img { display: block; width: 100%; }

@keyframes develop {
  from { opacity: 0; filter: blur(16px) brightness(0.25) saturate(0.4); transform: scale(1.06); }
  to   { opacity: 1; filter: none; transform: none; }
}

/* ─── стрічка ──────────────────────────────────────────────────────────── */

.gallery { padding: clamp(56px, 10vw, 110px) 0 40px; }

.gallery__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 18px;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--line);
}

.gallery__title {
  font-size: clamp(1.5rem, 4vw, 2.4rem);
  font-weight: 600;
  letter-spacing: -0.035em;
}

/* Колонки — це flex, а не CSS multi-column.
   Multi-column перебалансовує всю сітку щоразу, коли додається порція фото:
   при нескінченному гортанні вже переглянуті плитки стрибають на тисячі
   пікселів і пропливають повз око вдруге. Тут кожна плитка лягає у свою
   колонку назавжди, тож довантаження лише подовжує сітку вниз. */
.gallery__grid {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.gallery__col {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

@media (max-width: 640px) {
  .gallery__grid { gap: 10px; }
  .gallery__col { gap: 10px; }
}

.tile {
  position: relative;
  /* figure має власні браузерні margin: 1em 40px — без явного нуля
     плитки стоять у колонках із широкими бічними полями. */
  margin: 0;
  border-radius: var(--r-sm);
  overflow: hidden;
  background: var(--paper-2);
  cursor: zoom-in;
  opacity: 0;
  transform: translateY(10px);
}

.tile.is-in { animation: tile-develop 1000ms cubic-bezier(0.22, 1, 0.36, 1) forwards; }

@keyframes tile-develop {
  from { opacity: 0; transform: translateY(10px); filter: blur(10px) brightness(0.35); }
  to   { opacity: 1; transform: none; filter: none; }
}

.tile img { display: block; width: 100%; height: auto; }

.tile__label {
  position: absolute;
  inset: auto 0 0 0;
  padding: 26px 12px 10px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.78), transparent);
  color: #f6f1e8;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 260ms ease, transform 260ms ease;
}

.tile:hover .tile__label { opacity: 1; transform: none; }

.tile__author { font-size: 0.86rem; font-weight: 500; }
.tile__caption { font-size: 0.78rem; opacity: 0.75; margin-top: 2px; }

.tile__no {
  position: absolute;
  top: 8px;
  left: 10px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: #f6f1e8;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.7);
  opacity: 0;
  transition: opacity 260ms ease;
}

.tile:hover .tile__no { opacity: 0.85; }

/* Щойно надіслане фото на секунду світиться акцентом. */
.tile.is-fresh { box-shadow: 0 0 0 2px var(--accent), 0 0 40px color-mix(in srgb, var(--accent) 45%, transparent); }

.gallery__more { display: flex; justify-content: center; padding: 30px 0 10px; }

.sentinel { height: 1px; }

/* ─── лайтбокс ─────────────────────────────────────────────────────────── */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 4vmin;
  background: color-mix(in srgb, var(--paper) 88%, black);
  backdrop-filter: blur(14px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 320ms ease;
  cursor: zoom-out;
}

.lightbox.is-open { opacity: 1; pointer-events: auto; }

.lightbox img {
  max-width: 100%;
  max-height: 82vh;
  border-radius: var(--r-sm);
  box-shadow: var(--shadow);
  transform: scale(0.97);
  transition: transform 380ms cubic-bezier(0.22, 1, 0.36, 1);
}

.lightbox.is-open img { transform: none; }

.lightbox__cap {
  position: absolute;
  inset: auto 0 4vmin 0;
  text-align: center;
  color: var(--ink);
}

/* ─── підвал ───────────────────────────────────────────────────────────── */

.footer {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  padding: 40px 0 48px;
  border-top: 1px solid var(--line);
  margin-top: 30px;
}
