/* ─── Page View ─── */

.pageview-back-btn-side {
  position: fixed;
  left: 20px;
  top: 140px;
  z-index: 200;
  background: transparent;
  color: var(--accent-green);
  text-decoration: none;
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: all 0.3s ease;
  cursor: pointer;
  user-select: none;
}

.pageview-back-btn-side:hover {
  background: transparent;
  transform: scale(1.1);
  opacity: 0.7;
}

.pageview-back-arrow {
  font-size: 32px;
  line-height: 1;
  font-weight: bold;
}

.pageview-back-text {
  font-size: 0.9rem;
  font-family: 'Quicksand', sans-serif;
  font-weight: 600;
  letter-spacing: 0.5px;
}

@media (max-width: 960px) {
  .pageview-back-btn-side {
    display: none;
  }
}

.page-view-container {
  position: relative;
  background: var(--bg-warm);
  padding: 100px 30px 30px 10px;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  max-width: 100%;
  margin: 0;
}

.pageViewInner {
  display: grid;
  grid-template-columns: 2fr 1fr;
  background: var(--bg-warm);
  border-radius: 16px;
  padding: 30px;
  width: 90vw;
  height: auto;
  position: relative;
}

.pageViewLeft {
  display: flex;
  flex-direction: column;
  gap: 12px;
  justify-content: flex-start;
}

.pageViewImageWrapper {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
  min-height: 40vh;
  max-height: 65vh;
  flex-direction: column;
}

/* Image wrapper and image styling (desktop only) */
@media (min-width: 961px) {
  .pageViewImageWrapper {
    cursor: default;
  }

  .pageViewImageWrapper img {
    max-width: 100%;
    max-height: 65vh;
    object-fit: contain;
    border-radius: 8px;
    display: block;
    margin: 0 auto;
    pointer-events: auto;
    cursor: pointer;
    transform: scale(1);
    transform-origin: center center;
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: relative;
    z-index: 1;
  }

  .pageViewImageWrapper img:hover {
    transform: none;
    opacity: 0.9;
  }
}

/* Image navigation arrows inside wrapper - HIDDEN */
.pageViewArrow {
  display: none !important;
}

/* Thumbnails */
.pageViewThumbs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.pageViewThumb {
  width: 100px;
  height: 100px;
  object-fit: cover;
  border-radius: 6px;
  cursor: pointer !important;
  border: 2px solid transparent;
  transition: border-color 0.2s, opacity 0.2s;
  opacity: 0.6;
}

.pageViewThumb:hover,
.pageViewThumb.active {
  border-color: var(--accent-green);
  opacity: 1;
}

.pageview-sold-flag {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2;
  background: var(--accent-green);
  color: var(--text-light);
  padding: 6px 16px;
  border-radius: 999px;
  font-size: 0.75rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  font-weight: 600;
  pointer-events: none;
}

.pageview-sold-flag[hidden] {
  display: none;
}

/* Right column with info */
.pageViewRight {
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
  color: var(--text-dark);
}

/* The work's own page titles it with an <h1> — it is the page's subject —
   while the shared view.html shell still uses an <h3>. Both are this heading. */
.pageViewRight h3,
#pageview-title {
  font-size: 1.6rem;
  margin: 0 0 10px;
}

.pageViewRight p {
  margin: 4px 0;
  font-size: 1rem;
  max-width: 100%;
}

#pageview-buttons {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 20px;
  gap: 10px;
}

/* A sold work offers a way on instead of ending at "Såld": a commission
   enquiry and a place to hear about new work. One is a link and one a button,
   so both are styled here rather than leaning on `.pageViewRight button`. */
.pageview-sold-btn {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: 10px 20px;
  border-radius: 8px;
  border: 1.5px solid var(--accent-green);
  font-family: 'Quicksand', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: 0.2s;
}

a.pageview-sold-btn.btn-primary,
button.pageview-sold-btn.btn-primary {
  background: var(--accent-green);
  color: var(--text-light);
}

a.pageview-sold-btn.btn-secondary,
button.pageview-sold-btn.btn-secondary {
  background: transparent;
  color: var(--accent-green);
}

.pageview-sold-btn:hover {
  opacity: 0.85;
}

.pageViewRight button {
  padding: 10px 20px;
  border: 1.5px solid var(--accent-green);
  background: var(--accent-green);
  color: var(--text-light);
  border-radius: 8px;
  cursor: pointer !important;
  font-size: 0.95rem;
  font-family: 'Quicksand', sans-serif;
  font-weight: 600;
  transition: 0.2s;
  width: 100%;
}

.pageViewRight button:hover {
  background: var(--bg-warm);
  color: var(--accent-green);
}

@media (max-width: 960px) {
  #pageview-buttons {
    position: sticky;
    bottom: 0;
    width: 100%;
    padding: 10px;
    z-index: 50;
    box-sizing: border-box;
    margin-top: 20px;
  }

  #pageview-buttons button {
    width: 100%;
  }

  /* Frame selector modal on mobile */
  .frame-selector {
    display: none;
  }

  .frame-selector.mobile-visible {
    display: flex;
    flex-direction: column;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    padding: 20px;
    background: var(--bg-warm);
    border-top: 2px solid var(--accent-green);
    border-radius: 16px 16px 0 0;
    box-sizing: border-box;
    z-index: 10001;
    animation: slideUp 0.3s ease-out;
    max-height: 80vh;
    overflow-y: auto;
  }

  .frame-selector.mobile-visible.closing {
    animation: slideDown 0.3s ease-out forwards;
  }

  .frame-selector.mobile-visible .frame-options {
    display: none;
  }

  .frame-action-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .frame-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 14px 12px;
    border: 1.5px solid var(--accent-green);
    background: var(--accent-green);
    color: var(--text-light);
    border-radius: 8px;
    cursor: pointer;
    font-family: 'Quicksand', sans-serif;
    font-weight: 600;
    transition: 0.2s;
  }

  .frame-action-btn:hover {
    background: var(--bg-warm);
    color: var(--accent-green);
  }

  .frame-action-btn .btn-title {
    font-size: 0.85rem;
    opacity: 0.9;
  }

  .frame-action-btn .btn-price {
    font-size: 1rem;
    font-weight: 700;
  }

  @keyframes slideUp {
    from {
      transform: translateY(100%);
      opacity: 0;
    }
    to {
      transform: translateY(0);
      opacity: 1;
    }
  }

  @keyframes slideDown {
    from {
      transform: translateY(0);
      opacity: 1;
    }
    to {
      transform: translateY(100%);
      opacity: 0;
    }
  }

  .frame-selector-overlay {
    display: none;
  }

  .frame-selector-overlay.mobile-visible {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 10000;
    animation: fadeIn 0.3s ease-out;
  }

  @keyframes fadeIn {
    from {
      opacity: 0;
    }
    to {
      opacity: 1;
    }
  }
}

#pageview-price-section {
  margin: 10px 0 15px 0;
}

.pageview-price {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-dark);
  margin: 0;
}

.pageview-buy-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.pageview-buy-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-green);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 999px;
}

.pageview-old-price {
  font-size: 0.95rem;
  color: var(--text-dark-muted);
  margin: 3px 0 0 0;
  text-decoration: line-through;
}

.option-price-old {
  display: block;
  font-size: 0.9rem;
  color: var(--text-dark-muted);
  margin-top: 2px;
  text-decoration: line-through;
}

.btn-price-old {
  display: block;
  font-size: 0.9rem;
  color: var(--text-dark-muted);
  margin-top: 4px;
  text-decoration: line-through;
}

.pageview-discount-note {
  font-size: 0.95rem;
  color: var(--accent-green);
  margin: 3px 0 0 0;
}

.pageview-multibuy-note {
  font-size: 0.9rem;
  color: var(--accent-green);
  margin: 4px 0 0 0;
}

#pageview-medium {
  font-size: 0.95rem;
  color: var(--text-dark);
  margin: 8px 0;
  font-style: italic;
}

.pageview-frame-info {
  font-size: 0.95rem;
  color: var(--text-dark);
  margin: 8px 0;
  font-style: italic;
}

.frame-included-note {
  font-size: 0.85rem;
  color: var(--accent-green);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
}

/* Painting navigation arrows (left/right of page) - HIDDEN */
.page-view-container .arrow {
  display: none !important;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
  .pageViewInner {
    width: 85vw;
    grid-template-columns: 1fr;
    padding: 20px;
    gap: 20px;
  }

  .pageViewImageWrapper {
    min-height: 35vh;
    max-height: 55vh;
  }

  .pageViewImageWrapper img {
    max-height: 55vh;
  }
}

@media (max-width: 960px) {
  .page-view-container {
    padding: 120px 10px 20px 10px;
    min-height: auto;
  }

  .pageViewInner {
    width: 100%;
    padding: 15px;
    gap: 15px;
  }

  .pageViewImageWrapper {
    min-height: 30vh;
    max-height: 45vh;
    overflow: visible;
  }

  .pageViewImageWrapper img {
    max-height: 45vh;
  }

  .pageViewThumb {
    width: 60px;
    height: 60px;
  }

  .pageview-sold-flag {
    top: 8px;
    left: 8px;
    padding: 4px 12px;
    font-size: 0.65rem;
    letter-spacing: 1px;
  }

  .page-view-container .arrow {
    opacity: 0;
    pointer-events: none;
  }
}

/* ── "Vill du ha fler bokmärken?" ───────────────────────────────
   Shown once a bookmark is in the cart. Bookmarks cost less by the piece when
   you buy more than one, and nothing on a single bookmark's page says so — nor
   shows the nine others. The panel does both, and adds without leaving the
   page. */

.more-bookmarks-modal {
  position: fixed;
  inset: 0;
  z-index: 10002;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.more-bookmarks-modal.active {
  opacity: 1;
}

.more-bookmarks-inner {
  position: relative;
  width: 100%;
  max-width: 620px;
  max-height: 90vh;
  overflow-y: auto;
  box-sizing: border-box;
  padding: 24px;
  border-radius: 12px;
  background: var(--bg-warm);
  color: var(--text-dark);
  text-align: center;
}

.more-bookmarks-close {
  position: absolute;
  top: 8px;
  right: 12px;
  border: none;
  background: none;
  color: var(--text-dark);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.6;
}

.more-bookmarks-close:hover {
  opacity: 1;
}

.more-bookmarks-title {
  margin: 0 0 6px;
  font-size: 1.15rem;
}

.more-bookmarks-added {
  margin: 0 0 4px;
  font-size: 0.9rem;
  opacity: 0.75;
}

.more-bookmarks-offer {
  margin: 0 0 16px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--accent-green);
}

/* Once the cheaper price is actually theirs, the line stops being an offer and
   becomes a receipt */
.more-bookmarks-offer.is-active::before {
  content: "✓ ";
}

/* Narrow columns, because every pick in here is a bookmark and a bookmark is
   a third as wide as it is tall */
.more-bookmarks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.more-bookmarks-pick {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px;
  border: 1.5px solid transparent;
  border-radius: 8px;
  background: none;
  color: inherit;
  font-family: inherit;
  cursor: pointer;
  transition: 0.2s;
}

.more-bookmarks-pick:hover {
  border-color: var(--accent-green);
  transform: translateY(-2px);
}

/* The shape is set per pick, from the piece's own measurements. Held to a
   square and filled, all a buyer saw of a bookmark was a band across it. */
.more-bookmarks-pick img {
  width: 100%;
  object-fit: cover;
  border-radius: 6px;
}

.more-bookmarks-pick-title {
  /* Takes the slack, so a name that wraps to two lines does not push its own
     price out of line with the others */
  flex: 1;
  font-size: 0.85rem;
  font-weight: 600;
}

/* Stacked rather than side by side: the columns are a bookmark wide, and
   "100 kr 120 kr" on one line does not fit in one */
.more-bookmarks-pick-price {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 0.8rem;
  line-height: 1.3;
  opacity: 0.75;
}

.more-bookmarks-pick-price-old {
  text-decoration: line-through;
  opacity: 0.6;
}

.more-bookmarks-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.more-bookmarks-actions .btn {
  padding: 10px 20px;
  border: 1.5px solid var(--accent-green);
  border-radius: 8px;
  background: var(--accent-green);
  color: var(--text-light);
  font-family: 'Quicksand', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: 0.2s;
}

.more-bookmarks-actions .btn.btn-secondary {
  background: var(--bg-warm);
  color: var(--accent-green);
}

.more-bookmarks-actions .btn:hover {
  background: var(--bg-warm);
  color: var(--accent-green);
}

@media (max-width: 600px) {
  .more-bookmarks-inner {
    padding: 20px 14px;
  }

  .more-bookmarks-grid {
    grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
    gap: 8px;
  }

  .more-bookmarks-actions .btn {
    flex: 1 1 auto;
  }
}

/* ── Fler verk ─────────────────────────────────────────────────
   Every work page used to end at its own buy button, which left a visitor who
   did not want this particular painting with only the back button — and left
   the catalogue reachable to a crawler through the shop page alone. */

.related-works {
  max-width: 1100px;
  margin: 60px auto 0;
  padding: 0 20px 40px;
  text-align: center;
}

.related-works h2 {
  font-family: 'Playfair Display', serif;
  font-size: 1.5rem;
  font-weight: 400;
  color: var(--text-dark);
  margin: 0 0 24px;
}

.related-works-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 20px;
  /* Thumbnails keep each painting's proportions, so they differ in height —
     a shared baseline lines the titles up */
  align-items: end;
}

.related-work {
  position: relative;
  display: block;
  text-decoration: none;
  color: var(--text-dark);
}

.related-work img {
  width: 100%;
  /* Overridden per card with the real ratio from metadata.json; this is the
     fallback for a painting the image sync has not measured yet */
  aspect-ratio: 3 / 4;
  object-fit: cover;
  display: block;
  border-radius: 2px;
  box-shadow: 0 4px 20px var(--shadow-light);
  transition: transform 0.3s ease;
}

.related-work:hover img {
  transform: scale(1.03);
}

.related-work-title {
  display: block;
  margin-top: 10px;
  font-family: 'Quicksand', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
}

.related-work-sold {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 3px 10px;
  border-radius: 2px;
  background: rgba(30, 21, 16, 0.75);
  color: var(--text-light);
  font-family: 'Quicksand', sans-serif;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.related-works-all {
  display: inline-block;
  margin-top: 28px;
  font-family: 'Quicksand', sans-serif;
  font-weight: 600;
  color: var(--text-link);
  text-decoration: none;
}

.related-works-all:hover {
  text-decoration: underline;
}

@media (max-width: 600px) {
  .related-works-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
  }
}
