/* Horizontal exhibition gallery (desktop only). See js/horizontal-gallery.js. */

.hg { display: none; }

/* Desktops, and tablets turned sideways (landscape). Phones and upright tablets keep the vertical page. */
@media (min-width: 1024px) and (orientation: landscape) {
  html.hg-on,
  html.hg-on body { height: 100%; overflow: hidden; }

  /* Hide the normal vertical page; the frame below replaces it. */
  html.hg-on .wp-site-blocks { display: none; }

  .hg.is-built {
    display: grid;
    grid-template-columns: clamp(220px, 20vw, 300px) 1fr;
    grid-template-rows: minmax(0, 1fr);   /* keep slides exactly one screen tall */
    position: fixed;
    inset: 0;
    background: var(--wp--preset--color--custom-color-1);
    color: var(--wp--preset--color--custom-color-2);
  }

  /* ---- Left: name, menu, exhibition details, language ---- */
  .hg-side {
    display: flex;
    flex-direction: column;
    gap: 48px;
    padding: 40px 32px 40px 40px;
    overflow-y: auto;
  }
  .hg-side a { color: inherit; text-decoration: none; }
  .hg-name {
    font-size: clamp(14px, 0.875rem + ((1vw - 3.2px) * 0.37), 18px);
    text-transform: uppercase;
    letter-spacing: 0.02em;
  }
  .hg-nav ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
  .hg-nav a {
    font-size: 14px;
    text-transform: uppercase;
    opacity: 0.55;
    transition: opacity 0.2s;
  }
  .hg-nav a:hover,
  .hg-nav a[aria-current] { opacity: 1; }
  .hg-info p,
  .hg-info h1, .hg-info h2, .hg-info h3 { margin: 0 0 12px; font-size: 14px !important; font-weight: 400; line-height: 1.5; }
  .hg-info h1, .hg-info h2, .hg-info h3 { text-transform: uppercase; }
  .hg-info p:first-child { text-transform: uppercase; }
  .hg-tools { margin-top: auto; }
  .hg-tools .lang-switch__menu { top: auto; bottom: 100%; left: 0; right: auto; }

  /* ---- Right: one slide at a time ---- */
  .hg-stage { position: relative; min-width: 0; min-height: 0; overflow: hidden; }
  .hg-track {
    display: flex;
    height: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
  }
  .hg-track::-webkit-scrollbar { display: none; }

  .hg-slide {
    flex: 0 0 100%;
    height: 100%;
    scroll-snap-align: start;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 6vw 96px 2vw;
    box-sizing: border-box;
  }

  .hg-slide figure {
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 100%;
    max-height: 100%;
  }
  .hg-slide img {
    display: block;
    width: auto !important;
    height: auto !important;
    max-width: 100% !important;
    max-height: calc(100vh - 200px) !important;
    object-fit: contain;
    cursor: zoom-in;
  }
  .hg-slide figcaption {
    margin-top: 14px;
    font-size: 13px;
    text-align: center;
    opacity: 0.8;
  }

  .hg-slide--text > * { max-width: 34rem; }
  .hg-slide--text {
    flex-direction: column;
    justify-content: safe center;   /* long texts start at the top and scroll inside the slide */
    overflow-y: auto;
  }
  /* Texts page: four publications per slide, two by two */
  .hg-slide--cards {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: minmax(0, auto);
    align-content: center;
    gap: 40px 48px;
  }
  .hg-slide--cards > * { min-width: 0; }
  .hg-slide--cards figure { align-items: flex-start; }
  .hg-slide--cards img {
    max-height: calc((100vh - 136px - 40px) / 2 - 110px) !important;
    cursor: pointer;
  }
  .hg-slide--cards p { margin: 0; }
  .hg-slide--cards a { color: inherit; }

  /* CV and About: headings and paragraphs */
  .hg-slide--text h2 { font-size: 22px; margin: 0 0 1em; }

  .hg-slide--image { flex-direction: column; }
  .hg-slide--image:has(> p) img { max-height: calc(100vh - 300px) !important; }
  .hg-slide--image p { margin: 14px 0 0; max-width: 40rem; font-size: 13px; text-align: center; }
  .hg-slide--image p a { color: inherit; }
  .hg-slide--text p { font-size: 17px; line-height: 1.65; margin: 0 0 1em; }
  .hg-slide--text .wp-block-group { padding: 0 !important; margin: 0 !important; }
  .hg-slide--text a { color: inherit; }

  /* ---- Controls, bottom right ---- */
  .hg-controls {
    position: absolute;
    right: 6vw;
    bottom: 32px;
    display: flex;
    align-items: center;
    gap: 18px;
    font-size: 13px;
  }
  .hg-controls button {
    background: none;
    border: 0;
    padding: 6px;
    color: inherit;
    cursor: pointer;
    display: grid;
    place-items: center;
  }
  .hg-controls button:disabled { opacity: 0.2; cursor: default; }
  .hg-controls svg { width: 28px; height: 28px; }
  .hg-count { min-width: 4.5em; text-align: center; font-variant-numeric: tabular-nums; }
  .hg-close {
    position: absolute;
    top: 28px;
    right: 6vw;
    font-size: 28px;
    line-height: 1;
    color: inherit;
    text-decoration: none;
  }
}
