/*!
 * Draggable Image Gallery — Filip Zrnzevic
 * https://codepen.io/filipz/pen/dPGKGOo
 * Copyright (c) Filip Zrnzevic
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */

@import url("https://fonts.cdnfonts.com/css/thegoodmonolith");

@font-face {
  font-family: "PPNeueMontreal";
  src: url("https://assets.codepen.io/7558/PPNeueMontreal-Variable.woff2")
    format("woff2");
  font-weight: 100 900;
  font-style: normal;
}

:root {
  --spacing-base: 1rem;
  --spacing-md: 1.5rem;
  --spacing-lg: 2rem;
  --color-text: #ffffff;
  --color-text-dim: 0.6;
  --transition-medium: 0.3s ease;
  --font-size-base: 14px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-user-select: none;
     -moz-user-select: none;
          user-select: none;
}

body {
  font-family: "PPNeueMontreal", sans-serif;
  background: #000;
  overflow: hidden;
  height: 100vh;
  cursor: grab;
}

body.dragging {
  cursor: grabbing;
}

body.zoom-mode {
  cursor: default;
}

#preloader-overlay {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: grid;
  place-items: center;
  color: #fff;
  background: #000;
}

.loader-signature {
  display: block;
  width: min(72vw, 360px);
  height: auto;
}

@media (prefers-reduced-motion: no-preference) {
  .loader-signature image {
    mask: url(#loader-ink);
    visibility: hidden;
  }
}

/* Header and Footer */
.header,
.footer {
  position: fixed;
  left: 0;
  width: 100vw;
  padding: 1.5rem;
  z-index: 10000;
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  -moz-column-gap: var(--spacing-base);
       column-gap: var(--spacing-base);
  pointer-events: none;
  opacity: 0;
}

.header > *,
.footer > * {
  pointer-events: auto;
}

.header {
  top: 0;
  padding: 0;
}

.gallery-banner {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 24px;
  padding: 10px 24px;
  isolation: isolate;
  position: relative;
  color: #fff8ed;
  background: rgb(23 17 27 / 68%);
  backdrop-filter: blur(12px) saturate(1.2);
  box-shadow: inset 0 1px rgb(255 255 255 / 18%), inset 0 -1px rgb(255 255 255 / 12%);
}

.gallery-banner::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: url("vendor/parloa/refraction-glass-alpha.webp") center 54% / cover no-repeat;
  opacity: .3;
}

.gallery-banner p {
  margin: 0;
  font-size: clamp(14px, 1.2vw, 16px);
  line-height: 1.4;
  text-align: center;
}

.gallery-banner-cta {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid #fff5;
  border-radius: 8px;
  background: #0004;
  color: inherit;
  text-decoration: none;
}

.gallery-banner-cta:hover,
.gallery-banner-cta:focus-visible {
  background: #fff2;
}

.footer {
  bottom: 0;
}

/* Grid column assignments */
.nav-section {
  grid-column: 1 / span 3;
}

.values-section {
  grid-column: 5 / span 2;
}

.location-section {
  grid-column: 7 / span 2;
}

.contact-section {
  grid-column: 9 / span 2;
}

.social-section {
  grid-column: 11 / span 2;
  text-align: right;
}

/* Bottom bar */
.coordinates-section {
  grid-column: 1 / span 3;
  font-family: "TheGoodMonolith", monospace;
}

.info-section {
  grid-column: 9 / span 4;
  text-align: right;
}

/* Memorial gallery navigation */
.nav-section {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 1rem 0 0 1.5rem;
}

.gallery-back {
  display: grid;
  place-items: center;
  flex: 0 0 44px;
  height: 44px;
  color: var(--color-text);
  border-radius: 50%;
  background: #0009;
}

.gallery-back:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
}

.gallery-signature {
  display: block;
  width: min(100%, 9rem);
  min-width: 0;
  height: auto;
}

@media (max-width: 640px) {
  .nav-section {
    grid-column: 1 / -1;
    margin-bottom: 0.5rem;
  }
}

/* Key hint styling */
.key-hint {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  border: 1px solid var(--color-text);
  border-radius: 3px;
  font-size: 12px;
  margin: 0 3px;
  min-width: 20px;
  height: 20px;
}

/* Footer text styling */
.footer p {
  font-family: "TheGoodMonolith", monospace;
}

/* Global link styling */
a {
  position: relative;
  cursor: pointer;
  color: var(--color-text);
  padding: 0;
  display: inline-block;
  z-index: 1;
  text-decoration: none;
  font-size: var(--font-size-base);
  opacity: 1;
  transition: color var(--transition-medium);
  font-weight: 700;
}

a::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 100%;
  background-color: var(--color-text);
  z-index: -1;
  transition: width 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

a:hover::after {
  width: 100%;
}

a:hover {
  color: black;
  mix-blend-mode: difference;
  opacity: 1;
}

p {
  display: block;
  text-decoration: none;
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01rem;
  -webkit-font-smoothing: antialiased;
}

ul {
  list-style: none;
}

h3 {
  font-size: 14px;
  margin-bottom: var(--spacing-base);
  font-weight: 600;
  color: #fff;
}

.viewport {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  z-index: 1;
  opacity: 0;
}

.canvas-wrapper {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
  will-change: transform;
  isolation: isolate;
}

.grid-container {
  position: relative;
  width: 100%;
  height: 100%;
}

.grid-item {
  position: absolute;
  width: 320px;
  height: 320px;
  background: #000;
  cursor: pointer;
  will-change: transform, opacity;
  z-index: 1;
  opacity: 1;
  transition: opacity 0.6s ease;
}

.grid-item.out-of-view {
  opacity: 0.1;
}

.grid-item.selected {
  z-index: 2 !important;
}

.grid-item img {
  width: 100%;
  height: 100%;
  -o-object-fit: cover;
     object-fit: cover;
  display: block;
  -webkit-user-select: none;
     -moz-user-select: none;
          user-select: none;
  pointer-events: none;
}

/* Split Screen Layout */
.split-screen-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  z-index: 2;
  opacity: 0;
  pointer-events: none;
}

.split-screen-container.active {
  opacity: 1;
  pointer-events: all;
}

.split-left {
  position: relative;
  width: 50vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1;
  cursor: pointer;
}

.split-right {
  position: relative;
  width: 50vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1;
  cursor: pointer;
}

/* Image target - BEHIND the scaling image */
.zoom-target {
  width: 100%;
  height: 100%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

/* Image title overlay - positioned at bottom left */
.image-title-overlay {
  position: absolute;
  bottom: 40px;
  left: 40px;
  transform: none;
  color: white;
  z-index: 4;
  opacity: 0;
  pointer-events: none;
}

.image-title-overlay.active {
  opacity: 0;
}

.image-slide-number {
  position: relative;
  width: 400px;
  height: 20px;
  margin-bottom: 0.5em;
  clip-path: polygon(0% 0%, 100% 0%, 100% 100%, 0% 100%);
  overflow: hidden;
}

.image-slide-number span {
  position: absolute;
  top: 0;
  left: 0;
  color: white;
  font-family: "TheGoodMonolith", monospace;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.5;
  transform: translateY(0px);
  will-change: transform;
  margin: 0;
  padding: 0;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.image-slide-title {
  position: relative;
  width: 400px;
  height: 60px;
  margin-bottom: 1em;
  clip-path: polygon(0% 0%, 100% 0%, 100% 100%, 0% 100%);
  overflow: hidden;
}

.image-slide-title h1 {
  position: absolute;
  top: 0;
  left: 0;
  color: white;
  font-family: "PPNeueMontreal", sans-serif;
  font-size: 48px;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.2;
  transform: translateY(0px);
  will-change: transform;
  margin: 0;
  padding: 0;
}

.image-slide-description {
  position: relative;
  width: 400px;
  min-height: 80px;
  clip-path: polygon(0% 0%, 100% 0%, 100% 100%, 0% 100%);
  overflow: hidden;
}

.description-line {
  position: relative;
  display: block;
  color: rgba(255, 255, 255, 0.8);
  font-family: "PPNeueMontreal", sans-serif;
  font-size: 16px;
  font-weight: 300;
  line-height: 1.4;
  transform: translateY(0px);
  will-change: transform;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

@media (max-width: 900px) {
  .image-title-overlay {
    bottom: 20px;
    left: 20px;
  }

  .image-slide-number {
    width: 300px;
    height: 18px;
  }

  .image-slide-number span {
    font-size: 10px;
  }

  .image-slide-title {
    width: 300px;
    height: 50px;
  }

  .image-slide-title h1 {
    font-size: 36px;
  }

  .image-slide-description {
    width: 300px;
    min-height: 70px;
  }

  .description-line {
    font-size: 14px;
  }
}

/* Hide placeholder when active */
.split-screen-container.active .zoom-target::before {
  display: none;
}

.zoom-target::before {
  content: "IMAGE TARGET";
  color: rgba(255, 255, 255, 0.5);
  font-family: "TheGoodMonolith", monospace;
  font-size: 0.75em;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.controls-container {
  position: fixed;
  bottom: 1.25em;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  z-index: 6;
  opacity: 0;
  transition: left 1.2s cubic-bezier(0.87, 0, 0.13, 1);
}

.controls-container.visible {
  opacity: 1;
}

.controls-container.split-mode {
  left: 75%;
}

.percentage-indicator {
  background-color: #f0f0f0;
  background-image: radial-gradient(rgba(0, 0, 0, 0.015) 1px, transparent 0);
  background-size: 0.44em 0.44em;
  background-position: -0.06em -0.06em;
  padding: 0.625em 1.25em;
  border-radius: 0.25em;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "TheGoodMonolith", monospace;
  font-size: 0.75em;
  font-weight: 400;
  text-transform: uppercase;
  color: #333;
  min-width: 5em;
  white-space: nowrap;
}

.switch {
  display: flex;
  gap: 1.25em;
  background-color: #222;
  background-image: radial-gradient(
    rgba(255, 255, 255, 0.015) 1px,
    transparent 0
  );
  background-size: 0.44em 0.44em;
  background-position: -0.06em -0.06em;
  padding: 0.625em 1.25em;
  border-radius: 0.25em;
  transition: padding 0.3s ease-in-out;
}

.sound-toggle {
  background-color: #f0f0f0;
  background-image: radial-gradient(rgba(0, 0, 0, 0.015) 1px, transparent 0);
  background-size: 0.44em 0.44em;
  background-position: -0.06em -0.06em;
  padding: 0.5em 0.75em;
  border-radius: 0.25em;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  min-width: 3.75em;
  position: relative;
  border-color: transparent;
}

.sound-wave-canvas {
  width: 2em;
  height: 1em;
  border: none !important;
  outline: none !important;
  background: none !important;
}

.sound-toggle.active .sound-wave-canvas {
  opacity: 1;
}

.sound-toggle:hover .sound-wave-canvas {
  opacity: 0.8;
}

.switch-button {
  background: none;
  border: none;
  border-color: transparent;
  color: #666;
  cursor: pointer;
  font-family: "TheGoodMonolith", monospace;
  font-size: 0.75em;
  font-weight: 400;
  text-transform: uppercase;
  padding: 5px 10px;
  position: relative;
  transition: all 0.3s ease-in-out;
  white-space: nowrap;
}

.switch-button-current {
  color: #f0f0f0;
}

.indicator-dot {
  position: absolute;
  width: 5px;
  height: 5px;
  background-color: #f0f0f0;
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.3s ease-in-out;
  top: 50%;
  transform: translateY(-50%);
  left: -8px;
}

.switch-button:hover .indicator-dot {
  opacity: 1;
}

/* Simple 64px white arrow button */
.close-button {
  position: fixed;
  top: 50%;
  right: 20px;
  width: 64px;
  height: 64px;
  background: none;
  border: none;
  border-color: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  opacity: 0;
  pointer-events: none;
  transform: translate(40px, -50%);
}

.close-button.active {
  pointer-events: all;
}

.close-button:hover {
  opacity: 0.7;
}

.close-button svg {
  width: 64px;
  height: 64px;
  transform: rotate(180deg);
}

/* Scaling image overlay */
.scaling-image-overlay {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 3;
  pointer-events: none;
  will-change: transform;
  opacity: 1 !important;
}

.scaling-image-overlay img {
  width: 100%;
  height: 100%;
  -o-object-fit: cover;
     object-fit: cover;
  display: block;
}

/* Page vignette effect */
.page-vignette-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9998;
}

.page-vignette-extreme {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  mix-blend-mode: overlay;
  background: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.9) 0%,
    rgba(0, 0, 0, 0.5) 20%,
    transparent 40%
  );
}

/* Memorial media additions. The Pen’s tile and split layout are unchanged. */
.gallery-play {
  position: absolute;
  right: 14px;
  bottom: 14px;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding-left: 2px;
  border-radius: 50%;
  color: white;
  background: #000c;
  font-size: 18px;
  pointer-events: none;
}
.scaling-image-overlay video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  pointer-events: auto;
}
.scaling-image-overlay video.is-buffering-video { opacity: 0; pointer-events: none; }

.grid-item:focus-visible { outline: 3px solid #fff; outline-offset: 6px; }
.grid-item[data-kind="gif"] .gallery-play { font-size: 12px; font-weight: 700; letter-spacing: .04em; padding-left: 0; }
