/* ====================================================
DETAIL
Attachment detail page
==================================================== */

/* ====================================================
1. Page shell
==================================================== */

/* Keep the detail page centered and preserve its existing outer spacing. */
.yrk-detail-wrap {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px 14px 40px;
}

/* Define the default two-column detail layout. */
.yrk-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(320px, 0.92fr);
  grid-template-areas: "media content";
  align-items: stretch;
}

/* ====================================================
2. Media column
==================================================== */

/* Keep the media panel separate from the content panel. */
.yrk-detail-media-column {
  grid-area: media;
  border-right: 1px solid var(--yrk-clr-border-strong);
  background: transparent;
}

/* Provide a neutral media container for images and videos. */
.yrk-detail-media-box {
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  overflow: hidden;
  touch-action: pan-y;
}

/* Keep the inline image responsive before desktop sizing overrides apply. */
.yrk-detail-image {
  display: block;
  width: 100%;
  height: auto;
  min-height: 0;
  object-fit: contain;
  border: 0;
  border-radius: 0;
  background: transparent;
  -webkit-user-drag: none;
  user-select: none;
  will-change: transform, opacity;
}

/* Disable transitions while a touch swipe is in progress. */
.yrk-detail-image.is-swiping {
  transition: none;
}

/* Animate an image back to its original position after a cancelled swipe. */
.yrk-detail-image.is-swipe-return {
  transition:
    transform 220ms ease-out,
    opacity 220ms ease-out;
}

/* Animate an image out before navigating to the next or previous media item. */
.yrk-detail-image.is-swipe-exit {
  transition:
    transform 180ms ease-in,
    opacity 180ms ease-in;
}

/* Keep WordPress video players responsive before desktop sizing overrides apply. */
.yrk-detail-media-box video,
.yrk-detail-media-box .wp-video,
.yrk-detail-media-box .mejs-container {
  display: block;
  width: 100% !important;
  max-width: 100%;
  height: auto !important;
  background: #000;
}

/* Keep the WordPress shortcode video element responsive. */
.yrk-detail-media-box .wp-video-shortcode {
  display: block;
  width: 100% !important;
  height: auto !important;
}

/* ====================================================
3. Content column
==================================================== */

/* Define the default content panel structure. */
.yrk-detail-content-column {
  grid-area: content;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: transparent;
}

/* Keep the existing internal spacing around detail content. */
.yrk-detail-content {
  padding: 18px 18px 20px;
}

/* ====================================================
4. Top bar
==================================================== */

/* Center the title while allowing navigation controls to be positioned independently. */
.yrk-detail-topbar {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px 0px 12px;
  position: relative;
  overflow: visible;
}

/* Draw the separator below the top bar. */
.yrk-detail-topbar::after {
  content: "";
  position: absolute;
  left: 0px;
  right: 0px;
  bottom: 0px;
  height: 1px;
  background: var(--yrk-clr-border-strong);
}

/* Keep the title compact and allow it to wrap when needed. */
.yrk-detail-title {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  margin: 0;
  font-size: 1rem;
  line-height: 1.05;
  font-weight: 700;
}

/* Align the optional video marker with the creation title. */
.yrk-detail-video-marker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0 0 0 5px;
  font-size: 0.9em;
  line-height: 1;
}

/* ====================================================
5. Navigation controls
==================================================== */

/* Position media and gallery navigation relative to the top bar. */
.yrk-detail-media-nav,
.yrk-detail-gallery-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Place media navigation on the left side of the top bar. */
.yrk-detail-media-nav {
  left: -10px;
}

/* Place gallery navigation on the right side of the top bar. */
.yrk-detail-gallery-nav {
  right: -10px;
}

/* Use a refined arrow style without making the controls overly decorative. */
.yrk-detail-media-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0px 15px;
  border-radius: 999px;
  font-size: 1.2rem !important;
  font-weight: 900;
  font-family: Georgia, "Times New Roman", serif;
  z-index: 1;
  text-decoration: none;
  transition:
    background var(--yrk-transition-norm),
    transform var(--yrk-transition-norm),
    opacity var(--yrk-transition-norm);
}

/* Provide hover and keyboard feedback for navigation arrows. */
.yrk-detail-media-arrow:hover,
.yrk-detail-media-arrow:focus-visible {
  background: var(--yrk-clr-hover);
  transform: translateY(-1px);
  opacity: 1;
}

/* Style media and gallery counters consistently. */
.yrk-detail-media-count,
.yrk-detail-gallery-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem !important;
  font-weight: 700;
  line-height: 1;
  padding: 0px 2px 1px 2px;
  border-radius: 999px;
  border: 1px solid var(--yrk-clr-strike-border);
  background: var(--yrk-clr-surface-1);
  pointer-events: none;
}

/* Style the central media and gallery navigation links. */
.yrk-detail-media-center,
.yrk-detail-gallery-center {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0px 2px;
  border-radius: 999px;
  text-decoration: none;
  background: var(--yrk-clr-surface-1);
  color: var(--theme-palette-color-1);
  box-shadow: var(--yrk-shadow-soft);
  transition:
    background var(--yrk-transition-norm),
    transform var(--yrk-transition-norm),
    opacity var(--yrk-transition-norm);
}

/* Provide hover and keyboard feedback for central navigation links. */
.yrk-detail-media-center:hover,
.yrk-detail-media-center:focus-visible,
.yrk-detail-gallery-center:hover,
.yrk-detail-gallery-center:focus-visible {
  background: var(--yrk-clr-hover);
  border-color: var(--yrk-clr-strike-border-strong);
  transform: translateY(-1px);
}

/* Center decorative icons within their navigation controls. */
.yrk-detail-media-icon,
.yrk-detail-gallery-icon {
  position: absolute;
  inset: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

/* Add the image icon texture behind media navigation controls. */
.yrk-detail-media-nav::before {
  content: "";
  position: absolute;
  inset: -4px 20px;
  pointer-events: none;
  opacity: 0.3;
  z-index: 0;
  background-image: url("/wp-content/themes/blocksy-child/icoImage.svg");
  background-repeat: repeat;
  background-position: center;
  background-size: contain;
}

/* Add the gallery icon texture behind gallery navigation controls. */
.yrk-detail-gallery-nav::before {
  content: "";
  position: absolute;
  inset: -6px 20px;
  pointer-events: none;
  opacity: 0.2;
  z-index: 0;
  background-image: url("/wp-content/themes/blocksy-child/icoGallery.svg");
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
}

/* Provide a fallback link back to the gallery when gallery context is unavailable. */
.yrk-detail-back-link {
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 4px 12px;
  border: 1px solid var(--yrk-clr-strike-border);
  border-radius: 999px;
  background: var(--yrk-clr-surface-1);
  text-decoration: none;
  line-height: 1;
  white-space: nowrap;
  font-weight: 600;
  letter-spacing: 0.01em;
  box-shadow: var(--yrk-shadow-soft);
  transition:
    background var(--yrk-transition-norm),
    transform var(--yrk-transition-norm),
    border-color var(--yrk-transition-norm);
  color: var(--theme-palette-color-1);
}

/* Provide hover and keyboard feedback for the fallback gallery link. */
.yrk-detail-back-link:hover,
.yrk-detail-back-link:focus-visible {
  background: var(--yrk-clr-hover);
  border-color: var(--yrk-clr-strike-border-strong);
  transform: translateY(calc(-50% - 1px));
}

/* ====================================================
6. Specs panel
==================================================== */

/* Keep the semantic definition list compact and free of browser defaults. */
.yrk-detail-specs {
  margin: 0;
  padding: 0;
}

/* Use a compact two-column layout for each label and value pair. */
.yrk-detail-spec {
  display: grid;
  grid-template-columns: minmax(92px, 118px) minmax(0, 1fr);
  gap: 10px 14px;
  align-items: start;
  margin: 0;
  padding: 7px 0;
  border-bottom: 1px solid color-mix(in srgb, var(--yrk-clr-border) 72%, transparent);
}

/* Add subtle spacing before each logical group of specifications. */
.yrk-detail-spec.is-group-start {
  margin-top: 16px;
  padding-top: 20px;
}

/* Avoid extra spacing before the first visible specification row. */
.yrk-detail-spec:first-child.is-group-start {
  margin-top: 0;
  padding-top: 7px;
}

/* Remove the final divider for a cleaner end to the specification list. */
.yrk-detail-spec:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

/* Keep labels visually distinct while preserving a restrained hierarchy. */
.yrk-detail-label {
  margin: 0;
  color: var(--yrk-clr-text);
  font-weight: 700;
}

/* Keep values readable and aligned with the specification labels. */
.yrk-detail-value {
  margin: 0;
  color: var(--yrk-clr-text);
  line-height: 1.45;
}

/* Center request actions within their own full-width specification row. */
.yrk-detail-spec-request {
  display: flex;
  justify-content: center;
}

/* Hide the unused label in the request action row. */
.yrk-detail-spec-request .yrk-detail-label {
  display: none;
}

/* Stack request actions vertically and keep them centered. */
.yrk-detail-spec-request .yrk-detail-value {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  margin: 0;
}

/* Style request links as restrained pill-shaped calls to action. */
.yrk-detail-request-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 8px 14px;
  border: 1px solid var(--yrk-clr-strike-border);
  border-radius: 999px;
  background: var(--yrk-clr-surface-1);
  color: var(--theme-palette-color-1);
  text-decoration: none;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  box-shadow: var(--yrk-shadow-soft);
  transition:
    background var(--yrk-transition-norm),
    border-color var(--yrk-transition-norm),
    transform var(--yrk-transition-norm);
}

/* Provide hover and keyboard feedback for request links. */
.yrk-detail-request-link:hover,
.yrk-detail-request-link:focus-visible {
  background: var(--yrk-clr-hover);
  border-color: var(--yrk-clr-strike-border-strong);
  transform: translateY(-1px);
}

/* Separate the secondary request action from the primary one. */
.yrk-detail-request-link-secondary {
  margin-top: 10px;
}

/* ====================================================
7. Description block
==================================================== */

/* Separate editorial description text from the technical specifications. */
.yrk-detail-description {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--yrk-clr-border);
}

/* Preserve line breaks entered in the creation description. */
.yrk-detail-description-text {
  display: block;
  margin: 0;
  color: var(--yrk-clr-text);
  line-height: 1.6;
  white-space: pre-wrap;
}


/* ====================================================
8. Media preview and expand control
==================================================== */

/* Keep images, videos, and their expand controls in the same media area. */
.yrk-detail-media-preview {
  position: relative;
  width: 100%;
  height: 100%;
}

/* Position the common GLightbox trigger inside the visible media area. */
.yrk-detail-media-expand {
  position: absolute;
  z-index: 20;
  top: 12px;
  right: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--yrk-clr-strike-border);
  border-radius: 50%;
  background: var(--yrk-clr-surface-1);
  color: var(--theme-palette-color-1);
  text-decoration: none;
  font-size: 24px;
  line-height: 1;
  cursor: zoom-in;
  box-shadow: var(--yrk-shadow-soft);
  opacity: 0.95;
  transition:
    background var(--yrk-transition-norm),
    border-color var(--yrk-transition-norm),
    transform var(--yrk-transition-norm),
    opacity var(--yrk-transition-norm);
}

.yrk-detail-media-expand-icon {
  display: block;
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}

/* Match the hover behaviour of the existing detail navigation controls. */
.yrk-detail-media-expand:hover,
.yrk-detail-media-expand:focus-visible {
  background: var(--yrk-clr-hover);
  border-color: var(--yrk-clr-strike-border-strong);
  color: var(--theme-palette-color-1);
  opacity: 1;
  transform: translateY(-1px);
}

.yrk-detail-media-expand:focus-visible {
  outline: 2px solid var(--yrk-clr-strike-border-strong);
  outline-offset: 3px;
}


/* Provide a positioning context for the video player and its expand control. */
.yrk-detail-video-preview {
  position: relative;
  width: 100%;
  height: 100%;
}

/* Keep WordPress video wrappers within the preview container. */
.yrk-detail-video-preview .wp-video,
.yrk-detail-video-preview .mejs-container,
.yrk-detail-video-preview .mejs-inner,
.yrk-detail-video-preview .mejs-mediaelement,
.yrk-detail-video-preview video {
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
}

/* Preserve the full video frame without cropping. */
.yrk-detail-video-preview video {
  object-fit: contain;
    cursor: pointer;
}


/* Make the GLightbox close control easier to see. */
.glightbox-container .gclose {
  width: 48px;
  height: 48px;
  background-color: rgb(156 52 35 / 92%);
  border: 2px solid rgb(255 255 255 / 90%);
  border-radius: 50%;
  color: #fff;
  opacity: 1;
  font-size: 32px;
  line-height: 48px;
  text-shadow: 0 1px 3px rgb(0 0 0 / 70%);
}

/* Strengthen hover and keyboard focus feedback. */
.glightbox-container .gclose:hover,
.glightbox-container .gclose:focus-visible {
  background-color: rgb(190 63 42 / 100%);
  outline: 3px solid #fff;
  outline-offset: 3px;
}

/* Keep additional lightbox media links available to GLightbox but invisible in the detail layout. */
.yrk-detail-lightbox-gallery {
  display: none;
}

/* ====================================================
9. Responsive layout
==================================================== */

/* ----------------------------------------------------
   Desktop layout: 769px and above
---------------------------------------------------- */

@media (min-width: 769px) {

  /* Make Blocksy's page container a full-height vertical layout. */
  body.page-template-page-detail #main-container {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
  }

  /* Keep the header and footer at their natural heights. */
  body.page-template-page-detail #header,
  body.page-template-page-detail #footer {
    flex: 0 0 auto;
  }

  /* Let main fill only the remaining space between header and footer. */
  body.page-template-page-detail #main,
  body.page-template-page-detail #primary {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }

  /* Let the custom wrapper and its border fill the available main area. */
  body.page-template-page-detail .yrk-detail-wrap,
  body.page-template-page-detail .yrk-section-border {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }

  /* Keep the inner page spacing inside the available height. */
  body.page-template-page-detail .yrk-detail-wrap {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px 14px 40px;
    box-sizing: border-box;
  }

  /* Make the detail grid use only the available viewport height. */
  body.page-template-page-detail .yrk-detail-grid {
    flex: 1 1 0;
    min-height: 0;
    height: 0;
    display: grid;
    grid-template-columns: minmax(0, 1.08fr) minmax(320px, 0.92fr);
    grid-template-areas: "media content";
    grid-template-rows: minmax(0, 1fr);
    align-items: stretch;
    overflow: hidden;
  }

  /* Match the media column height to the grid height. */
  body.page-template-page-detail .yrk-detail-media-column {
    position: relative;
    min-height: 0;
  }

  /* Remove media from normal document height calculations on desktop. */
  body.page-template-page-detail .yrk-detail-media-box {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    height: auto;
    overflow: hidden;
    cursor: default;
  }


  /* Show the entire image within the available desktop media area. */
  body.page-template-page-detail .yrk-detail-image {
    display: block;
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    object-fit: contain;
    object-position: center;
  }

  /* Keep the right panel inside the grid and scroll its own content. */
  body.page-template-page-detail .yrk-detail-content-column {
    grid-area: content;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
  }

  /* Allow the right panel content to shrink inside its scroll container. */
  body.page-template-page-detail .yrk-detail-content {
    min-height: 0;
  }

  /* Make every media preview fill the available desktop media panel. */
  body.page-template-page-detail .yrk-detail-media-box .yrk-detail-media-preview {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* Make every WordPress video wrapper fill the desktop media panel. */
  body.page-template-page-detail .yrk-detail-video-preview .wp-video,
  body.page-template-page-detail .yrk-detail-video-preview .mejs-container,
  body.page-template-page-detail .yrk-detail-video-preview .mejs-inner,
  body.page-template-page-detail .yrk-detail-video-preview .mejs-mediaelement,
  body.page-template-page-detail .yrk-detail-video-preview video {
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
  }

  /* Preserve the full video frame inside the available desktop area. */
  body.page-template-page-detail .yrk-detail-video-preview video {
    object-fit: contain;
  }
}

/* ----------------------------------------------------
   Mobile layout: 768px and below
---------------------------------------------------- */

@media (max-width: 768px) {

  /* Switch to a single-column layout and restore normal document flow. */
  .yrk-detail-grid {
    grid-template-columns: 1fr;
    grid-template-areas:
      "top"
      "media"
      "content";
  }

  /* Let content participate in normal page scrolling on mobile. */
  .yrk-detail-content-column {
    display: contents;
    overflow: visible;
  }

  /* Restore normal media preview sizing on mobile devices. */
  .yrk-detail-media-preview {
    height: auto;
  }

  /* Remove the desktop divider and positioning behaviour from the media column. */
  .yrk-detail-media-column {
    border-right: 0;
    border-bottom: 1px solid var(--yrk-clr-border-strong);
    position: static;
  }

  /* Return the media box to normal document flow on mobile. */
  .yrk-detail-media-box {
    position: static;
    display: block;
    height: auto;
    overflow: visible;
  }

  /* Keep mobile images responsive and fully visible. */
  .yrk-detail-image {
    width: 100%;
    height: auto;
    min-height: 0;
    object-fit: contain;
  }

  /* Use a narrower label column for compact mobile specifications. */
  .yrk-detail-spec {
    grid-template-columns: minmax(84px, 108px) minmax(0, 1fr);
    gap: 8px 12px;
    padding: 8px 0;
  }

  /* Prevent desktop full-height video rules from affecting mobile playback. */
  .yrk-detail-video-preview .wp-video,
  .yrk-detail-video-preview .mejs-container,
  .yrk-detail-video-preview .mejs-inner,
  .yrk-detail-video-preview .mejs-mediaelement,
  .yrk-detail-video-preview video {
    width: 100% !important;
    height: auto !important;
    max-height: none !important;
  }
}
