/* Artwork detail page — reuses gallery.css (fonts, cards, form, dialog, canvas edge) and adds
   a product-page layout: photos left, sticky info column right, "Další obrazy" below. */

.agd {
  position: relative;
  min-height: 100svh;
  font-family: 'Source Sans 3', system-ui, sans-serif;
  color: var(--ag-ink);
  background: var(--ag-bg);
}

.agd-wrap {
  width: min(1299px, calc(100% - 2 * clamp(16px, 4.86vw, 70px)));
  margin: 0 auto;
  padding: 84px 0 80px;
}

.agd:not(.is-ready) .agd-wrap {
  visibility: hidden;
}

.agd-topbar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.agd-pager {
  display: flex;
  gap: 24px;
}

.agd-back {
  display: inline-block;
  font-size: 15px;
  color: inherit;
  opacity: 0.55;
  text-decoration: none;
  transition: opacity 150ms ease;
}

.agd-back:hover {
  opacity: 1;
}

.agd-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 440px);
  gap: 40px;
  align-items: start;
}

/* ---------- Photos ---------- */

/* When the info column is taller than the photos, the photos travel down with it (centred in
   the viewport, like the info column) until the end of the row. --agd-media-h from detail.js. */
.agd-media {
  position: sticky;
  top: max(24px, calc(50svh - var(--agd-media-h, 0px) / 2));
  min-width: 0;
}

.agd-stage {
  --agd-h: min(74svh, 780px);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: var(--agd-h);
  box-sizing: border-box;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}

/* The photo as a canvas on the wall: same edge + drop shadow as in the gallery. */
.agd-canvas {
  position: relative;
  margin: 0;
  line-height: 0;
  cursor: zoom-in;
  box-shadow:
    0 2px 4px rgba(0, 0, 0, 0.1),
    4px 18px 26px -10px rgba(0, 0, 0, 0.28),
    10px 40px 60px -24px rgba(0, 0, 0, 0.22);
  transition:
    opacity 260ms ease,
    transform 420ms cubic-bezier(0.22, 0.61, 0.36, 1);
}

.agd-canvas.is-switching {
  opacity: 0;
  transform: translateY(8px);
  transition-duration: 160ms;
}

.agd-canvas::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow:
    inset -2px -2px 2px 0 rgba(0, 0, 0, 0.25),
    inset 2px 2px 0 0 rgba(255, 255, 255, 0.25);
}

.agd-img {
  display: block;
  max-width: 100%;
  max-height: var(--agd-h);
  width: auto;
  height: auto;
  -webkit-user-drag: none;
}

/* Other photos (details, interiors…) are plain photos: no canvas shadow or edge. */
.agd-canvas.is-photo {
  box-shadow: none;
}

.agd-canvas.is-photo::after {
  display: none;
}

.agd-thumbs {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 28px;
  overflow-x: auto;
  padding: 4px;
  scrollbar-width: none;
}

.agd-thumbs::-webkit-scrollbar {
  display: none;
}

.agd-thumb {
  flex: none;
  width: 64px;
  height: 64px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 8px;
  overflow: hidden;
  background: var(--ag-card-bg);
  cursor: pointer;
  opacity: 0.55;
  outline: 2px solid transparent;
  outline-offset: 2px;
  transition: opacity 150ms ease, outline-color 150ms ease;
}

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

.agd-thumb:hover {
  opacity: 0.9;
}

.agd-thumb[aria-selected='true'] {
  opacity: 1;
  outline-color: #090909;
}

.agd-thumb:focus-visible {
  outline-color: #090909;
}

/* Phones only: swipeable strip of all photos + "‹ 1/5 ›" (detail.js renderSwipe). */
.agd-swipe,
.agd-photo-pager {
  display: none;
}

@media (max-width: 760px) {
  .agd-stage,
  .agd-thumbs {
    display: none !important;
  }

  .agd-swipe {
    --agd-h: min(120vw, 64svh);
    display: flex;
    margin: 0 -16px; /* edge to edge, the page has 16px gutters */
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .agd-swipe::-webkit-scrollbar {
    display: none;
  }

  .agd-swipe__slide {
    display: grid;
    flex: 0 0 100%;
    place-items: center;
    height: var(--agd-h);
    padding: 12px 24px 28px; /* room for the canvas shadow */
    box-sizing: border-box;
    scroll-snap-align: center;
    scroll-snap-stop: always;
  }

  .agd-swipe__img {
    display: block;
    max-width: 100%;
    max-height: calc(var(--agd-h) - 40px);
    width: auto;
    height: auto;
    -webkit-user-drag: none;
  }

  .agd-swipe .agd-canvas {
    cursor: zoom-in;
  }

  .agd-photo-pager:not([hidden]) {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 22px;
    margin-top: 4px;
    font-size: 17px;
    font-variant-numeric: tabular-nums;
  }

  .agd-photo-pager button {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: none;
    color: #090909;
    cursor: pointer;
  }

  .agd-photo-pager button:disabled {
    opacity: 0.3;
    cursor: default;
  }
}

/* ---------- Info column ---------- */

/* Held in the vertical centre of the viewport while the photos scroll (--agd-side-h comes from
   detail.js); a column taller than the screen falls back to sticking 24px from the top. */
.agd-side {
  position: sticky;
  top: max(24px, calc(50svh - var(--agd-side-h, 0px) / 2));
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Info / price / description: no frames, just a fine line between the sections. */
.agd-card {
  flex: none;
  min-height: 0;
  padding: 24px 0;
  border-radius: 0;
}

.agd-side .agd-card:first-child {
  padding-top: 0;
}

.agd-side .agd-card:last-child {
  padding-bottom: 0;
}

.agd-side .agd-card + .agd-card {
  border-top: 1px solid var(--ag-line);
}

.agd-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.agd-title {
  margin: 0;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 32px;
  font-weight: 700;
  line-height: 1.2;
}

.agd-medium {
  white-space: normal;
}

.agd-facts {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 2px 10px;
  margin: 10px 0 0;
  font-size: 17px;
  line-height: 1.4;
}

.agd-facts dt {
  opacity: 0.55;
}

.agd-facts dd {
  margin: 0;
}

.agd-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.agd-tags li {
  padding: 3px 10px;
  border: 1px solid var(--ag-line);
  border-radius: 999px;
  font-size: 13px;
  line-height: 18px;
  color: #59616e;
}

.agd-card.ag-card--action {
  min-height: 0;
}

/* Narrow column: field and button stacked full-width (product-page style). */
.agd .ag-price .ag-field,
.agd .ag-price .ag-button {
  flex: 1 1 100%;
}

.agd-h2 {
  margin: 0 0 8px;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 20px;
  font-weight: 700;
  line-height: normal;
}

.agd-story__text {
  margin: 0;
  font-size: 17px;
  line-height: 1.55;
  white-space: pre-line;
}

/* ---------- More artworks ---------- */

.agd-more {
  margin-top: 72px;
  padding-top: 40px;
  border-top: 1px solid var(--ag-line);
}

/* Swipeable row: touch swipe / trackpad natively, mouse drag via detail.js. 4 visible on desktop. */
.agd-more__row {
  --agd-more-n: 4;
  display: flex;
  gap: 20px;
  margin-top: 12px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  cursor: grab;
}

.agd-more__row::-webkit-scrollbar {
  display: none;
}

.agd-more__row.is-dragging {
  scroll-snap-type: none;
  cursor: grabbing;
  user-select: none;
  -webkit-user-select: none;
}

.agd-more__row > .agd-more__item {
  flex: 0 0 calc((100% - (var(--agd-more-n) - 1) * 20px) / var(--agd-more-n));
  scroll-snap-align: start;
}

.agd-more__item img {
  -webkit-user-drag: none;
}

.agd-more__item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.agd-more__pic {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 260px;
  margin-bottom: 14px;
  padding: 20px;
  box-sizing: border-box;
  border-radius: 12px;
  background: var(--ag-card-bg);
}

.agd-more__pic img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  box-shadow: 4px 12px 18px -8px rgba(0, 0, 0, 0.35);
  transition: transform 300ms cubic-bezier(0.22, 0.61, 0.36, 1);
}

.agd-more__item:hover .agd-more__pic img {
  transform: translateY(-4px);
}

.agd-more__name {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 17px;
  font-weight: 700;
}

.agd-more__meta {
  font-size: 15px;
  opacity: 0.6;
}

/* ---------- About the artist ---------- */

.agd-artist {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)); /* photo | text, half and half */
  gap: 20px;
  align-items: center;
  margin-top: 72px;
  padding-top: 40px;
  border-top: 1px solid var(--ag-line);
}

.agd-artist__photo {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 10; /* landscape crop of the portrait photo, keeps the row low */
  object-fit: cover;
  object-position: 60% 74%; /* keep Pauser and the can in frame */
  border-radius: 12px;
  background: var(--ag-card-bg);
}

.agd-artist__text {
  align-items: center;
  padding: 0 clamp(0px, 3vw, 40px);
}

.agd-artist__name {
  margin: 0 0 10px;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 32px;
  font-weight: 700;
  line-height: 1.2;
}

.agd-artist__bio {
  max-width: 46ch;
  margin: 0;
  font-size: 20px;
  line-height: 1.5;
}

.agd-message {
  position: absolute;
  left: 50%;
  top: 40vh;
  margin: 0;
  transform: translateX(-50%);
  font-size: 17px;
  opacity: 0.6;
}

/* ---------- Phone CTA bar (detail.js setupCta) ---------- */

.agd-cta {
  display: none;
}

@media (max-width: 760px) {
  .agd-cta {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 250;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 16px max(10px, env(safe-area-inset-bottom));
    border-top: 1px solid var(--ag-line);
    background: #ffffff;
    animation: agd-cta-in 220ms cubic-bezier(0.22, 0.61, 0.36, 1);
  }

  .agd-cta[hidden] {
    display: none !important;
  }

  .agd-cta__info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.25;
  }

  .agd-cta__name {
    overflow: hidden;
    font-size: 14px;
    color: #59616e;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .agd-cta__price {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 17px;
    font-weight: 700;
    white-space: nowrap;
  }

  .agd-cta .ag-button {
    flex: none;
    padding: 10px 18px;
  }

  /* Room so the bar never covers the end of the page. */
  .agd-footer {
    padding-bottom: 96px;
  }
}

@keyframes agd-cta-in {
  from {
    transform: translateY(100%);
  }
}

/* ---------- Footer sign-off ---------- */

.agd-footer {
  display: flex;
  justify-content: center;
  padding: 0 16px 48px;
}

.agd:not(.is-ready) .agd-footer {
  visibility: hidden;
}

.agd-footer img {
  display: block;
  width: 150px;
  height: auto;
  opacity: 0.7;
}

/* ---------- Lightbox ---------- */

.agd-lightbox {
  width: 100vw;
  height: 100svh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: rgba(255, 255, 255, 0.97);
}

.agd-lightbox::backdrop {
  background: transparent;
}

.agd-lightbox[open] {
  display: grid;
  place-items: center;
  animation: agd-fade 220ms ease;
}

@keyframes agd-fade {
  from {
    opacity: 0;
  }
}

.agd-lightbox__img {
  max-width: calc(100vw - 48px);
  max-height: calc(100svh - 96px);
  box-shadow: 0 30px 60px -24px rgba(0, 0, 0, 0.3);
  cursor: zoom-out;
}

.agd-lightbox__img.is-photo {
  box-shadow: none;
}

.agd-lightbox__close {
  position: fixed;
  top: 16px;
  right: 16px;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: none;
  color: #090909;
  cursor: pointer;
}

.agd-lightbox__close:hover {
  background: rgba(0, 0, 0, 0.06);
}

.agd-lightbox__count {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 14px;
  opacity: 0.55;
}

/* ---------- Narrow screens ---------- */

@media (max-width: 1000px) {
  .agd-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
  }

  .agd-side,
  .agd-media {
    position: static;
  }

  .agd-more__row {
    --agd-more-n: 2.4; /* the next one peeks in, so it's clear the row scrolls */
  }

  .agd-artist {
    grid-template-columns: minmax(0, 1fr);
  }

  .agd-artist__photo {
    aspect-ratio: 4 / 3;
  }
}

@media (max-width: 760px) {
  .agd-wrap {
    width: auto;
    margin: 0 16px;
    padding-top: 64px;
  }

  .agd-stage {
    --agd-h: min(120vw, 64svh);
  }

  .agd-thumbs {
    justify-content: flex-start;
  }

  .agd-title {
    font-size: 26px;
  }

  .agd-more,
  .agd-artist {
    margin-top: 48px;
    padding-top: 32px;
  }

  .agd-more__pic {
    height: 180px;
    padding: 14px;
  }

  .agd-more__row {
    --agd-more-n: 1.6;
    gap: 12px;
  }

  .agd-more__row > .agd-more__item {
    flex-basis: calc((100% - 12px) / 1.6);
  }
}
