/* ==========================================================
Base
========================================================== */

* {
  box-sizing: border-box;
}

html {
  width: 100%;

  margin: 0;
  padding: 0;

  overflow-x: hidden;
}

body {
  width: 100%;

  margin: 0;

  min-height: 100vh;

  overflow-x: hidden;

  font-family:
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    Helvetica,
    Arial,
    sans-serif;

  background:
    linear-gradient(
      135deg,
      #fff7f5 0%,
      #f7ece9 100%
    );

  color: #342b2a;
}

button,
input {
  font: inherit;
}

button {
  border: none;
}

html.no-scroll,
body.no-scroll {
  overflow: hidden !important;

  width: 100%;
  height: 100%;

  overscroll-behavior: none;
}

.hidden {
  display: none !important;
}


/* ==========================================================
Main upload page
========================================================== */

.page-container {
  min-height: 100vh;

  display: flex;
  align-items: center;
  justify-content: center;

  padding: 24px;
}

.wedding-layout {
  position: relative;

  width: 100%;
  max-width: 480px;

  display: flex;
  align-items: center;
  justify-content: center;
}

.card {
  width: 100%;
  max-width: 480px;

  background:
    rgba(
      255,
      255,
      255,
      0.96
    );

  border-radius: 24px;

  padding: 36px 28px;

  box-shadow:
    0 20px 60px
    rgba(
      70,
      45,
      40,
      0.12
    );
}

.upload-card {
  position: relative;

  z-index: 2;
}


/* ==========================================================
Wedding characters
========================================================== */

.wedding-character {
  position: absolute;

  z-index: 3;

  height: auto;

  pointer-events: none;

  user-select: none;

  -webkit-user-drag: none;
}

.wedding-character-groom {
  width: 360px;

  left: -245px;
  top: 145px;
}

.wedding-character-bride {
  width: 360px;

  right: -275px;
  top: 155px;
}

/* ==========================================================
Header
========================================================== */

.header {
  width: 100%;

  margin-bottom: 32px;

  text-align: center;
}

.header h1,
.gallery-title h1 {
  margin:
    8px
    0
    8px;

  font-size: 32px;

  font-weight: 600;
}

.header p,
.gallery-title p {
  margin: 0;

  color: #7f706d;

  line-height: 1.5;
}

.heart {
  color: #b96b70;

  font-size: 28px;
}

/* ==========================================================
Upload
========================================================== */

.file-picker {
  width: 100%;

  min-height: 140px;

  display: flex;
  flex-direction: column;

  justify-content: center;
  align-items: center;

  gap: 12px;

  border: 2px dashed #d7beb9;

  border-radius: 18px;

  cursor: pointer;

  padding: 24px;

  text-align: center;

  background: #fffaf9;

  transition:
    border-color 0.2s ease,
    background 0.2s ease;
}

.file-picker:hover {
  border-color: #b96b70;

  background: #fff5f3;
}

.file-picker-icon {
  font-size: 38px;
}

.preview-container {
  margin-top: 20px;

  padding: 10px;

  overflow: hidden;

  border-radius: 16px;

  background: #f6efed;
}

.preview-grid {
  display: grid;

  grid-template-columns:
    repeat(
      3,
      minmax(0, 1fr)
    );

  gap: 10px;
}

.preview-item {
  min-width: 0;
}

.preview-media {
  position: relative;

  width: 100%;

  aspect-ratio: 1 / 1;

  overflow: hidden;

  border-radius: 12px;

  background: #eadedb;
}

.preview-media img,
.preview-media video {
  width: 100%;
  height: 100%;

  display: block;

  object-fit: cover;
}

.preview-remove {
  position: absolute;

  top: 6px;
  right: 6px;

  z-index: 10;

  width: 30px;
  height: 30px;

  display: flex;

  align-items: center;
  justify-content: center;

  padding: 0;

  border-radius: 50%;

  background:
    rgba(
      0,
      0,
      0,
      0.65
    );

  color: white;

  font-size: 22px;

  line-height: 1;

  cursor: pointer;
}

.preview-remove:hover {
  background:
    rgba(
      0,
      0,
      0,
      0.85
    );
}

.preview-video-icon {
  position: absolute;

  top: 50%;
  left: 50%;

  transform:
    translate(
      -50%,
      -50%
    );

  width: 38px;
  height: 38px;

  display: flex;

  align-items: center;
  justify-content: center;

  padding-left: 3px;

  border-radius: 50%;

  background:
    rgba(
      0,
      0,
      0,
      0.55
    );

  color: white;

  font-size: 17px;

  pointer-events: none;
}

.preview-file-name {
  margin-top: 6px;

  overflow: hidden;

  color: #6f605d;

  font-size: 12px;

  text-align: center;

  text-overflow: ellipsis;

  white-space: nowrap;
}

.clear-files-button {
  display: block;

  margin:
    12px
    auto
    0;

  padding: 8px 12px;

  background: transparent;

  color: #8d5359;

  cursor: pointer;

  font-size: 14px;

  font-weight: 500;
}

.clear-files-button:hover {
  text-decoration: underline;
}

.clear-files-button:disabled {
  opacity: 0.5;

  cursor: not-allowed;
}


/* ==========================================================
Buttons
========================================================== */

.button {
  width: 100%;

  min-height: 52px;

  display: flex;

  align-items: center;
  justify-content: center;

  margin-top: 20px;

  padding: 12px 20px;

  border-radius: 14px;

  text-decoration: none;

  cursor: pointer;

  font-weight: 600;

  transition:
    transform 0.15s ease,
    opacity 0.15s ease,
    background 0.15s ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button:active {
  transform: translateY(0);
}

.button:disabled {
  opacity: 0.45;

  cursor: not-allowed;

  transform: none;
}

.button-primary {
  background: #9e5f65;

  color: white;
}

.button-primary:hover {
  background: #8d5359;
}

.button-secondary {
  background: #f3e5e2;

  color: #71494d;
}


/* ==========================================================
Password
========================================================== */

.password-form {
  width: 100%;
  max-width: 320px;

  margin-left: auto;
  margin-right: auto;
}

.password-field {
  position: relative;

  width: 100%;

  display: flex;
  align-items: center;

  border: 1px solid #e4cfcb;

  border-radius: 14px;

  background: #fffaf9;

  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    background 0.2s ease;
}

.password-field:focus-within {
  border-color: #b96b70;

  background: white;

  box-shadow:
    0 0 0 4px
    rgba(
      185,
      107,
      112,
      0.12
    );
}

.password-field-icon {
  position: absolute;

  left: 18px;
  top: 50%;

  transform: translateY(-50%);

  font-size: 17px;

  opacity: 0.65;

  pointer-events: none;
}

.password-input {
  width: 100%;

  min-height: 54px;

  padding:
    12px
    52px;

  border: none;

  outline: none;

  background: transparent;

  color: #342b2a;

  font-size: 16px;

  text-align: center;
}

.password-input::placeholder {
  color: #aa9995;

  text-align: center;
}

.password-form .button {
  width: 100%;

  margin-top: 18px;
}


/* ==========================================================
Status
========================================================== */

.status {
  margin-top: 20px;

  padding: 14px 16px;

  border-radius: 12px;

  text-align: center;

  line-height: 1.4;
}

.status-info {
  background: #eef3f7;

  color: #4c5c68;
}

.status-success {
  background: #eaf5ec;

  color: #396443;
}

.status-error {
  background: #fae8e8;

  color: #853f3f;
}

.separator {
  display: flex;

  align-items: center;

  margin: 26px 0 6px;

  color: #a79692;
}

.separator::before,
.separator::after {
  content: "";

  flex: 1;

  height: 1px;

  background: #eadedb;
}

.separator span {
  padding: 0 14px;

  font-size: 14px;
}


/* ==========================================================
Gallery header
========================================================== */

.gallery-header {
  max-width: 1400px;

  margin: 0 auto;

  padding: 30px 30px 20px;

  display: grid;

  grid-template-columns:
    1fr
    auto
    1fr;

  align-items: center;

  gap: 20px;
}

.gallery-title {
  text-align: center;
}

.back-link {
  justify-self: start;

  color: #71494d;

  text-decoration: none;

  font-weight: 500;
}

.slideshow-button {
  justify-self: end;

  width: auto;
  min-height: 52px;
  height: auto;

  margin: 0;

  padding:
    12px
    24px;

  position: static;

  inset: auto;
}


/* ==========================================================
Gallery
========================================================== */

.gallery-container {
  width: 100%;

  max-width: 1400px;

  margin: 0 auto;

  padding: 20px 30px 50px;
}

.gallery-message {
  width: 100%;

  padding: 80px 20px;

  text-align: center;

  color: #7f706d;

  font-size: 18px;
}

.gallery-message.error {
  color: #853f3f;
}

.gallery-grid {
  display: grid;

  grid-template-columns:
    repeat(
      auto-fill,
      minmax(
        190px,
        1fr
      )
    );

  gap: 14px;
}

.gallery-item {
  position: relative;

  width: 100%;

  aspect-ratio: 1 / 1;

  padding: 0;

  border-radius: 14px;

  overflow: hidden;

  background: #eadedb;

  cursor: pointer;
}

.gallery-item img,
.gallery-item video {
  width: 100%;
  height: 100%;

  display: block;

  object-fit: cover;

  transition:
    transform
    0.3s
    ease;
}

.gallery-item:hover img,
.gallery-item:hover video {
  transform: scale(1.04);
}

.gallery-video-play {
  position: absolute;

  top: 50%;
  left: 50%;

  transform:
    translate(
      -50%,
      -50%
    );

  width: 54px;
  height: 54px;

  display: flex;

  align-items: center;
  justify-content: center;

  padding-left: 4px;

  border-radius: 50%;

  background:
    rgba(
      0,
      0,
      0,
      0.55
    );

  color: white;

  font-size: 24px;

  pointer-events: none;
}


/* ==========================================================
Gallery summary and pagination
========================================================== */

.gallery-summary {
  display: flex;

  align-items: center;
  justify-content: space-between;

  gap: 20px;

  margin-bottom: 18px;

  padding:
    14px
    16px;

  border-radius: 14px;

  background:
    rgba(
      255,
      255,
      255,
      0.72
    );

  border:
    1px
    solid
    #eadedb;
}

.gallery-stats {
  color: #71494d;

  font-size: 14px;

  font-weight: 600;
}

.gallery-page-top {
  color: #7f706d;

  font-size: 14px;

  font-weight: 500;

  white-space: nowrap;
}

.gallery-pagination {
  display: flex;

  align-items: center;
  justify-content: center;

  gap: 18px;

  margin-top: 32px;
}

.gallery-page-button {
  min-width: 115px;

  padding:
    11px
    18px;

  border-radius: 12px;

  background: #f3e5e2;

  color: #71494d;

  cursor: pointer;

  font-weight: 600;

  transition:
    background 0.2s ease,
    opacity 0.2s ease,
    transform 0.15s ease;
}

.gallery-page-button:hover {
  background: #ead4d0;

  transform:
    translateY(-1px);
}

.gallery-page-button:active {
  transform:
    translateY(0);
}

.gallery-page-button:disabled {
  opacity: 0.4;

  cursor: default;

  transform: none;
}

.gallery-page-number {
  min-width: 110px;

  color: #7f706d;

  text-align: center;

  font-size: 14px;

  font-weight: 600;
}


/* ==========================================================
Media modal
========================================================== */

.modal {
  position: fixed;

  inset: 0;

  z-index: 1000;

  display: flex;

  align-items: center;
  justify-content: center;

  padding: 40px;

  background:
    rgba(
      0,
      0,
      0,
      0.94
    );
}

.modal-media {
  max-width: 100%;
  max-height: 100%;

  display: block;

  object-fit: contain;
}

.modal-media[src=""] {
  display: none;
}

.modal-close {
  position: absolute;

  top: 18px;
  right: 22px;

  z-index: 1010;

  width: 48px;
  height: 48px;

  display: flex;

  align-items: center;
  justify-content: center;

  border-radius: 50%;

  background:
    rgba(
      255,
      255,
      255,
      0.15
    );

  color: white;

  font-size: 36px;

  line-height: 1;

  cursor: pointer;
}


/* ==========================================================
Media navigation
========================================================== */

.modal-navigation {
  position: absolute;

  top: 50%;

  z-index: 1010;

  width: 56px;
  height: 56px;

  display: flex;

  align-items: center;
  justify-content: center;

  transform:
    translateY(-50%);

  border-radius: 50%;

  background:
    rgba(
      255,
      255,
      255,
      0.15
    );

  color: white;

  font-size: 46px;

  line-height: 1;

  cursor: pointer;

  user-select: none;

  transition:
    opacity 0.2s ease,
    background 0.2s ease;
}

.modal-navigation:hover {
  background:
    rgba(
      255,
      255,
      255,
      0.25
    );
}

.modal-navigation-left {
  left: 22px;
}

.modal-navigation-right {
  right: 22px;
}


/* ==========================================================
Slideshow
========================================================== */

.slideshow {
  position: fixed;

  inset: 0;

  width: 100vw;
  height: 100dvh;

  z-index: 2000;

  display: flex;

  align-items: center;
  justify-content: center;

  overflow: hidden;

  background: black;
}

.slideshow-images {
  position: absolute;

  inset: 0;

  overflow: hidden;
}

.slideshow-photo {
  position: absolute;

  inset: 0;

  width: 100%;
  height: 100%;

  object-fit: contain;

  opacity: 0;

  transition:
    opacity 0.6s ease-in-out;
}

.slideshow-photo-visible {
  opacity: 1;
}

.slideshow-loading {
  position: relative;

  z-index: 10;

  color: white;

  font-size: 18px;
}

#close-slideshow {
  opacity: 0;

  pointer-events: none;

  transition:
    opacity 0.25s ease;
}

.slideshow:hover #close-slideshow {
  opacity: 1;

  pointer-events: auto;
}


/* ==========================================================
Tablet
========================================================== */

@media (max-width: 1100px) and (min-width: 701px) {

  .wedding-character {
    width: 250px;
  }

  .wedding-character-groom {
    left: -200px;
    top: 170px;
  }

  .wedding-character-bride {
    right: -200px;
    top: 170px;
  }
}


/* ==========================================================
Mobile
========================================================== */

@media (max-width: 700px) {

  .page-container {
    width: 100%;
    min-height: 100dvh;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 0;

    overflow-x: hidden;
    overflow-y: visible;

    overscroll-behavior-x: none;
    overscroll-behavior-y: auto;
  }

  html,
  body {
    width: 100%;
    min-height: 100%;

    overflow-x: hidden;
    overflow-y: auto;

    overscroll-behavior-x: none;
    overscroll-behavior-y: auto;
  }

  .wedding-layout {
    position: relative;

    height: 320px;

    width: 480px;
    max-width: 480px;

    margin-top: 20px;

    transform:
      scale(0.78);

    transform-origin:
      top
      center;
  }

  .card {
    width: 100%;
    max-width: 480px;

    margin: 0;

    padding:
      36px
      28px;

    border-radius: 24px;
  }

  .wedding-character {
    width: 250px;

    z-index: 3;
  }

  .wedding-character-groom {
    left: -140px;
    top: 100px;
  }

  .wedding-character-bride {
    right: -165px;
    top: 105px;
  }

  .header h1,
  .gallery-title h1 {
    font-size: 27px;
  }

  .gallery-header {
    display: flex;

    flex-direction: column;

    padding:
      22px
      18px
      10px;
  }

  .gallery-title {
    order: 1;
  }

  .back-link {
    order: 2;

    align-self: center;
  }

  .slideshow-button {
    justify-self: end;

    width: auto;
    min-height: 52px;
    height: auto;

    margin: 0;

    padding:
      12px
      24px;

    position: static;

    inset: auto;
  }

  .gallery-container {
    padding:
      16px
      10px
      30px;
  }

  .gallery-grid {
    grid-template-columns:
      repeat(
        2,
        1fr
      );

    gap: 6px;
  }

  .gallery-item {
    border-radius: 8px;
  }

  .modal {
    padding: 0;
  }

  .modal-media {
    width: 100%;
    height: 100%;

    object-fit: contain;
  }

  .preview-grid {
    grid-template-columns:
      repeat(
        3,
        minmax(0, 1fr)
      );

    gap: 6px;
  }

  .preview-container {
    padding: 6px;
  }

  .preview-media {
    border-radius: 8px;
  }

  .preview-remove {
    top: 4px;
    right: 4px;

    width: 28px;
    height: 28px;

    font-size: 20px;
  }

  .preview-file-name {
    font-size: 11px;
  }

  /*
   * On mobile all modal controls
   * are hidden by default.
   */

  .modal .modal-navigation,
  .modal .modal-close {
    opacity: 0;

    pointer-events: none;

    transition:
      opacity 0.2s ease,
      background 0.2s ease;
  }

  /*
   * One tap shows all modal controls.
   */

  .modal.controls-visible
  .modal-navigation,
  .modal.controls-visible
  .modal-close {
    opacity: 1;

    pointer-events: auto;
  }

  .modal-navigation {
    width: 46px;
    height: 46px;

    font-size: 38px;

    background:
      rgba(
        0,
        0,
        0,
        0.45
      );
  }

  .modal-navigation-left {
    left: 10px;
  }

  .modal-navigation-right {
    right: 10px;
  }

  .modal-close {
    top: 12px;
    right: 12px;

    background:
      rgba(
        0,
        0,
        0,
        0.45
      );
  }

  .gallery-summary {
    flex-direction: column;

    gap: 6px;

    margin-bottom: 12px;

    padding:
      12px
      14px;

    text-align: center;
  }

  .gallery-stats {
    font-size: 13px;
  }

  .gallery-page-top {
    font-size: 13px;
  }

  .gallery-pagination {
    gap: 6px;

    margin-top: 22px;
  }

  .gallery-page-button {
    min-width: 0;

    flex: 1;

    padding:
      10px
      8px;

    font-size: 13px;
  }

  .gallery-page-number {
    min-width: 92px;

    font-size: 13px;
  }
}
