/* Общий альбом свадьбы — палитра и шрифты сайта-приглашения */

:root {
  --paper: #f3eee1;
  --art: #96a678;
  --art-soft: #b3c09b;
  --art-deep: #6f8058;
  --ink: #4a5440;
  --ink-soft: #6b7460;
  --ink-mute: #929a86;
  --clay: #a5705a;
  --night: #12150e;
  --display: "Fraunces", "Iowan Old Style", Palatino, serif;
  --sans: "Manrope", "Helvetica Neue", Arial, sans-serif;
  --script: "Marck Script", "Fraunces", cursive;
  --soft: cubic-bezier(0.22, 1, 0.36, 1);
  color-scheme: light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  padding-bottom: calc(100px + env(safe-area-inset-bottom));
  font: 400 16px/1.5 var(--sans);
  color: var(--ink);
  background-color: #f1ecde;
  /* Бумага: мягкий свет сверху и процедурное волокно, как на сайте */
  background-image:
    radial-gradient(120% 70% at 50% -10%, rgba(255, 255, 255, 0.85), transparent 60%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='f'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23f)' opacity='0.085'/%3E%3C/svg%3E");
  background-size: 100% 100vh, 200px 200px;
  background-repeat: no-repeat, repeat;
}

button {
  font: inherit;
  color: inherit;
}

.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  flex: none;
  width: 1.25em;
  height: 1.25em;
}

:focus-visible {
  outline: 3px solid var(--art-soft);
  outline-offset: 3px;
}

/* ——— Шапка ——————————————————————————————————————————————————————— */

.hero {
  max-width: 34rem;
  margin: 0 auto;
  padding: calc(28px + env(safe-area-inset-top)) 20px 18px;
  text-align: center;
}

.bow {
  display: block;
  width: 76px;
  height: auto;
  margin: 0 auto 6px;
  color: var(--art-deep);
}

.eyebrow {
  margin: 0;
  font: 500 0.72rem/1.6 var(--display);
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--art-deep);
}

.names {
  margin: 4px 0 0;
  font: 400 clamp(2.5rem, 12vw, 3.4rem) / 1.05 var(--script);
  color: var(--art-deep);
}

.names .amp {
  font-size: 0.55em;
  color: var(--art);
}

.lead {
  max-width: 24rem;
  margin: 12px auto 0;
  font-size: 0.98rem;
  color: var(--ink-soft);
}

.add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  max-width: 22rem;
  min-height: 56px;
  margin-top: 20px;
  padding: 0 24px;
  border: 0;
  border-radius: 999px;
  background: var(--art-deep);
  color: #fbf8f0;
  font: 600 1rem/1 var(--sans);
  letter-spacing: 0.02em;
  box-shadow: 0 12px 26px -14px rgba(46, 50, 32, 0.7);
  cursor: pointer;
  transition: transform 0.2s var(--soft), background-color 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.add:hover {
  background: #637350;
}

.add:active {
  transform: scale(0.98);
}

.picker {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* ——— Очередь загрузки ——————————————————————————————————————————————— */

.uploads {
  width: calc(100% - 32px);
  max-width: 34rem;
  margin: 6px auto 0;
  padding: 14px 16px;
  border: 1px solid rgba(150, 166, 120, 0.3);
  border-radius: 16px;
  background: rgba(255, 253, 247, 0.72);
}

.uploads-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.uploads-title {
  margin: 0;
  font-weight: 600;
}

.uploads-hint {
  margin: 2px 0 0;
  font-size: 0.82rem;
  color: var(--ink-mute);
}

.link {
  padding: 4px 0;
  border: 0;
  background: none;
  color: var(--art-deep);
  font-weight: 600;
  cursor: pointer;
}

.upload-list {
  max-height: 42vh;
  margin: 10px 0 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
}

.up {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  grid-template-areas:
    "icon text status retry"
    "bar  bar  bar    bar";
  align-items: center;
  column-gap: 10px;
  row-gap: 6px;
  padding: 9px 0;
  border-top: 1px solid rgba(150, 166, 120, 0.18);
}

.up:first-child {
  border-top: 0;
}

.up-icon {
  grid-area: icon;
  width: 20px;
  height: 20px;
  color: var(--art-deep);
}

.up-text {
  grid-area: text;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.up-name {
  overflow: hidden;
  font-size: 0.9rem;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.up-meta {
  font-size: 0.75rem;
  color: var(--ink-mute);
}

.up-status {
  grid-area: status;
  font-size: 0.8rem;
  color: var(--ink-soft);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.up-retry {
  grid-area: retry;
  padding: 5px 12px;
  border: 1px solid var(--art-deep);
  border-radius: 999px;
  background: none;
  color: var(--art-deep);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.up-bar {
  grid-area: bar;
  height: 3px;
  overflow: hidden;
  border-radius: 3px;
  background: rgba(150, 166, 120, 0.2);
}

.up-fill {
  display: block;
  height: 100%;
  background: var(--art-deep);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s linear;
}

.up[data-status="hash"] .up-fill {
  background: var(--art-soft);
}

.up[data-status="done"] .up-status,
.up[data-status="dup"] .up-status {
  font-weight: 600;
  color: var(--art-deep);
}

.up[data-status="done"] .up-bar,
.up[data-status="dup"] .up-bar {
  opacity: 0;
  transition: opacity 0.6s 0.6s;
}

.up[data-status="error"] .up-status {
  color: var(--clay);
}

/* ——— Альбом ——————————————————————————————————————————————————————— */

.album {
  max-width: 1100px;
  margin: 22px auto 0;
}

.tabs {
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 0 16px 14px;
}

.tabs button {
  padding: 8px 16px;
  border: 1px solid rgba(150, 166, 120, 0.45);
  border-radius: 999px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
}

.tabs button[aria-selected="true"] {
  border-color: var(--ink);
  background: var(--ink);
  color: #fbf8f0;
}

.count {
  margin-left: 2px;
  font-weight: 500;
  opacity: 0.7;
}

.count:empty {
  display: none;
}

.notice,
.empty {
  max-width: 26rem;
  margin: 24px auto;
  padding: 0 20px;
  text-align: center;
  color: var(--ink-mute);
}

/* Телефон: три колонки встык, как в галерее телефона */
.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2px;
  margin: 0;
  padding: 0 2px;
  list-style: none;
}

.cell {
  min-width: 0;
}

.tile {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  padding: 0;
  overflow: hidden;
  border: 0;
  background: #e4dfcf;
  cursor: zoom-in;
  -webkit-tap-highlight-color: transparent;
}

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

.ph {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--ink-soft);
  background: linear-gradient(145deg, #e9e3d2, #ddd6c2);
}

.tile-video .ph {
  color: #fbf8f0;
  background: linear-gradient(145deg, #7a8b62, #3f4a33);
}

.ph-play {
  width: 40%;
  max-width: 56px;
  height: auto;
  aspect-ratio: 1;
}

.ph-icon {
  width: 28px;
  height: 28px;
}

.ph-ext {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.12em;
}

@media (min-width: 640px) {
  .grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    padding: 0 16px;
  }

  .tile {
    border-radius: 6px;
  }
}

@media (min-width: 1000px) {
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 8px;
    padding: 0 24px;
  }
}

/* ——— Нижняя кнопка ——————————————————————————————————————————————— */

.dock {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 10;
  display: flex;
  justify-content: center;
  padding: 18px 16px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, rgba(241, 236, 222, 0.97) 55%, rgba(241, 236, 222, 0));
  pointer-events: none;
}

.dock .add {
  margin: 0;
  pointer-events: auto;
}

/* ——— Просмотр ————————————————————————————————————————————————————— */

.viewer {
  width: 100vw;
  max-width: 100vw;
  height: 100vh;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  background: var(--night);
  color: #f3eee1;
}

.viewer::backdrop {
  background: var(--night);
}

.viewer-bar {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: calc(8px + env(safe-area-inset-top)) 8px 8px 16px;
  background: linear-gradient(to bottom, rgba(18, 21, 14, 0.75), transparent);
}

.viewer-count {
  flex: 1;
  font-size: 0.9rem;
  opacity: 0.85;
  font-variant-numeric: tabular-nums;
}

.viewer-btn {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.viewer-btn .icon {
  width: 24px;
  height: 24px;
}

.viewer-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

.viewer-stage {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: pan-y pinch-zoom;
}

.v-media {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

video.v-media {
  width: 100%;
  height: 100%;
}

.v-file {
  padding: 24px;
  text-align: center;
}

.v-file-icon {
  width: 56px;
  height: 56px;
  opacity: 0.8;
}

.v-file-name {
  margin: 12px 0 4px;
  word-break: break-word;
}

.v-file-size {
  margin: 0;
  font-size: 0.9rem;
  opacity: 0.6;
}

.viewer-nav {
  position: absolute;
  top: 50%;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 50%;
  background: rgba(18, 21, 14, 0.45);
  color: inherit;
  cursor: pointer;
  transform: translateY(-50%);
}

.viewer-nav .icon {
  width: 26px;
  height: 26px;
}

.viewer-nav:disabled {
  opacity: 0;
  pointer-events: none;
}

.viewer-prev {
  left: 12px;
}

.viewer-next {
  right: 12px;
}

/* На сенсорных экранах листают свайпом — стрелки только мешают */
@media (hover: none) {
  .viewer-nav {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
  }
}
