/* Container layout */
.work-container {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  padding: 2rem;
  flex-flow: row;
}

/* Left side: image and thumbnails */
.work-images {
  flex: 1 1 70%;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.image-preview {
  position: relative;
}

.viewer-open {
  position: absolute;
  top: 1rem;
  right: 1rem;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  cursor: pointer;
}

.viewer-open svg {
  width: 24px;
  height: 24px;
}

.image-viewer[open] {
  position: fixed;
  inset: 0;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  grid-template-rows: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.5rem;
  box-sizing: border-box;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 4rem 1rem 1rem;
  border: 0;
  background: transparent;
  color: #fff;
}

.image-viewer::backdrop {
  background: rgba(0, 0, 0, 0.85);
}

.viewer-frame {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 0;
  height: 100%;
}

.image-viewer:not(.gallery-image-viewer) .viewer-frame {
  touch-action: pan-y pinch-zoom;
}

.viewer-thumbnails {
  grid-column: 1 / -1;
  display: flex;
  gap: 0.5rem;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  padding: 3px;
}

.viewer-thumbnail {
  flex: 0 0 60px;
  height: 60px;
  padding: 2px;
  border: 2px solid transparent;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.6);
  cursor: pointer;
}

.viewer-thumbnail:first-child {
  margin-inline-start: auto;
}

.viewer-thumbnail:last-child {
  margin-inline-end: auto;
}

.viewer-thumbnail[aria-current="true"] {
  border-color: #fff;
}

.viewer-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.viewer-image {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.viewer-image[hidden] {
  display: none;
}

.viewer-close,
.viewer-arrow {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 2rem;
  cursor: pointer;
}

.viewer-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
}

.viewer-arrow:disabled {
  opacity: 0.35;
  cursor: default;
}

.viewer-open:focus-visible,
.viewer-close:focus-visible,
.viewer-arrow:focus-visible,
.viewer-thumbnail:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 3px;
}

.image-preview img {
  width: 100%;
  height: auto;
  border-radius: 8px;
  border: 1px solid #ccc;
  object-fit: contain;
}

/* Thumbnails */
.thumbnail-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: center;
}

.thumbnail-row img {
  height: 80px;
  width: auto;
  cursor: pointer;
  border-radius: 4px;
  border: 1px solid transparent;
  transition: border-color 0.2s ease;
}

.thumbnail-row img.active {
  border-color: #000;
}

/* Right side: text */
.work-info {
  flex: 1 1 30%;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding-top: 6rem;
}

.work-title {
  font-size: 2rem;
  margin-bottom: 1rem;
}

.work-description {
  font-size: 1rem;
  line-height: 1.6;
  color: #333;
}

#main-image {
  filter: blur(16px);
}

.order-form {
    margin-top: 20px;
    display: flex;
    gap: 12px;
    align-items: center;
}

.order-form input[type="email"] {
    flex: 1;
    border: none;
    border-bottom: 2px solid #333;
    padding: 8px 4px;
    font-size: 16px;
    outline: none;
    background: transparent;
    transition: border-color 0.3s ease;
}

.order-form input[type="email"]:focus {
    border-color: #555;
}

.order-form button {
    padding: 10px 20px;
    border: 2px solid #333;
    border-radius: 8px;
    background: #fefefe;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.order-form button:hover {
    background: #333;
    color: #fff;
}

#orderMessage {
    margin-top: 10px;
    font-size: 14px;
}

@media (min-width: 769px) {
  .portrait-preview .work-images {
    flex: 1 1 40%;
  }

  .portrait-preview .work-info {
    flex: 1 1 60%;
  }
}

@media (max-width: 768px) {
  .image-viewer:not(.gallery-image-viewer)[open] {
    grid-template-columns: minmax(0, 1fr);
    padding-inline: 0;
  }

  .image-viewer:not(.gallery-image-viewer) .viewer-arrow {
    display: none;
  }

  .work-title {
    font-size: 1.5rem;
    margin-bottom: 1rem;
  }

  .thumbnail-row img {
    height: 53px;
  }
  .work-images {
    flex: 1 1 70%;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
  }
  .work-container {
    overflow-x: hidden;
    display: flex;
    flex-wrap: wrap;
    gap: 0rem;
    padding: 30% 0 0 0;
    flex-flow: column;
  }

  .work-info {
    flex: 1 1 30%;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding: 1rem;
    text-align: center;
  }
}