/* ========== Base Styles ========== */
:root {
  --panel-width: 25vw;
}
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
body {
  margin: 0;
  padding: 0;
  font-family: "Montserrat", sans-serif;
  background: #000;
  color: #fff;
  height: 100vh;
  opacity: 1;
  transition: opacity 0.5s ease-in-out;
}
body.fade-out {
  opacity: 0;
  transition: opacity 0.3s ease-in-out;
}
body.page-loading {
  opacity: 0;
}

/* ========== Layout Containers ========== */
.page-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* ========== Header ========== */
.header {
  flex: 0 0 auto;
  background: #000;
  padding: 3rem 3rem 1.5rem 2rem;
  z-index: 1000;
  display: grid;
  grid-template-columns: 38.2% 61.8%;
  align-items: center;
}
.header h1 {
  font-size: clamp(28px, 3.5vw, 42px);
  font-weight: 700;
  color: #fff;
  text-transform: uppercase;
  margin: 0;
  font-family: "Montserrat", sans-serif;
}
.header h1 a {
  color: #fff;
  text-decoration: none;
  transition: opacity 0.3s ease;
}
.header h1 a:hover {
  opacity: 0.7;
}
.header .subtitle {
  font-size: clamp(28px, 3.5vw, 42px);
  font-weight: 700;
  color: #E8AE1E;
  text-transform: uppercase;
  font-family: "Montserrat", sans-serif;
  margin: 0;
  padding-left: 0;
}

/* ========== Gallery ========== */
.gallery-section {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.gallery-section::-webkit-scrollbar {
  display: none;
}
.gallery-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 20px;
  align-items: center;
}
.image-wrapper {
  width: 100%;
  max-width: 90vw;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0;
  margin: 0;
  position: relative;
}
.gallery-image {
  width: 100%;
  height: auto;
  max-height: 70vh;
  object-fit: contain;
  display: block;
}

/* Spinner (injected by JS, but style here for clarity) */
.img-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ========== Footer ========== */
.footer {
  flex: 0 0 auto;
  background: #000;
  padding: 1rem 2rem;
  text-align: left;
  z-index: 1000;
}
.back-link {
  color: #E8AE1E;
  font-weight: 600;
  text-decoration: none;
  font-size: 1rem;
  transition: opacity 0.3s ease;
}
.back-link:hover {
  opacity: 0.7;
}

/* ========== Landscape/Portrait Responsive ========== */
.landscape-footer,
.landscape-title,
.landscape-header {
  display: none;
}

@media (orientation: landscape) {
  .page-container {
    position: relative;
    overflow: hidden;
  }
  .header {
    display: none;
  }
  .gallery-section {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    overflow-x: auto;
    overflow-y: hidden;
    z-index: 0;
  }
  
  /* Adjust gallery width in landscape when panel is expanded */
  body.panel-open .gallery-section {
    width: calc(100vw - var(--panel-width));
    margin-right: 0;
  }
  

  .gallery-container {
    flex-direction: row;
    height: 100vh;
    gap: 20px;
    padding: 0 20px;
    align-items: center;
  }
  .footer {
    display: none;
  }
  .landscape-footer {
    display: block;
    position: fixed;
    bottom: 20px;
    left: 2rem;
    z-index: 1000;
  }
  .landscape-footer .back-link {
    color: #E8AE1E;
    font-weight: 600;
    text-decoration: none;
    font-size: 1rem;
    transition: opacity 0.3s ease;
    font-family: "Montserrat", sans-serif;
  }
  .landscape-footer .back-link:hover {
    opacity: 0.7;
  }
  .landscape-title {
    display: block;
    position: fixed;
    bottom: 14px;
    right: 0px;
    padding: 5px 30px;
    z-index: 1000;
    color: #E8AE1E;
    background-color: #000000b2;
    font-weight: 700;
    font-size: clamp(20px, 2.8vw, 32px);
    text-transform: uppercase;
    font-family: "Montserrat", sans-serif;
    cursor: pointer;
  }
  
  /* Hide landscape title when info panel is open */
  body.panel-open .landscape-title {
    display: none;
  }
  
  .landscape-title.clickable {
    cursor: pointer !important;
    transition: opacity 0.3s ease;
  }
  
  .landscape-title.clickable:hover {
    opacity: 0.7;
  }
  .landscape-header {
    display: block;
    position: fixed;
    top: 3rem;
    left: 2rem;
    right: 2rem;
    z-index: 1000;
    font-size: clamp(28px, 3.5vw, 42px);
    font-weight: 700;
    color: #E8AE1E;
    text-transform: uppercase;
    font-family: "Montserrat", sans-serif;
    transition: opacity 0.5s ease-in-out;
  }
  .landscape-header a {
    color: #E8AE1E;
    text-decoration: none;
    transition: opacity 0.3s ease;
  }
  .landscape-header a:hover {
    opacity: 0.7;
  }
  .landscape-header.fade-out {
    opacity: 0;
  }
  .image-wrapper {
    flex: 0 0 auto;
    height: 100%;
    max-width: none;
    justify-content: flex-start;
    align-items: center;
    width: auto;
  }
  .gallery-image {
    height: 100%;
    width: auto;
    max-height: none;
    object-fit: contain;
    display: block;
    margin: 0;
    padding: 0;
    flex-shrink: 0;
  }
  .landscape-scrollbar {
    display: block;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: 14px;
    background: #222;
    z-index: 1100;
    width: 100vw;
    pointer-events: none;
  }
  .landscape-scrollbar-thumb {
    position: absolute;
    top: 2px;
    left: 0;
    height: 10px;
    background: #E8AE1E;
    border-radius: 5px;
    transition: none;
    pointer-events: auto;
  }

  /* Shrink scrollbar width when panel is open in landscape */
  body.panel-open .landscape-scrollbar {
    width: calc(100vw - var(--panel-width));
    transition: none;
  }
}

@media (max-width: 768px) {
  .header {
    padding: 2rem 1rem 1rem 1rem;
    grid-template-columns: 1fr;
    gap: 0.5rem;
    text-align: center;
  }
  .header h1 {
    font-size: clamp(20px, 2.5vw, 28px);
  }
  .header .subtitle {
    font-size: clamp(20px, 2.5vw, 28px);
  }
  .gallery-container {
    gap: 15px;
    padding: 15px;
  }
  .footer {
    padding: 0.8rem 1rem;
  }
}
@media (max-width: 480px) {
  .header {
    padding: 1.5rem 0.75rem 0.75rem 1rem;
  }
  .header h1 {
    font-size: clamp(18px, 2em, 28px);
  }
  .header .subtitle {
    font-size: clamp(18px, 2em, 28px);
  }
  .gallery-container {
    gap: 10px;
    padding: 10px;
  }
  .footer {
    padding: 0.8rem 1rem;
  }
}
@media (orientation: portrait) {
  .landscape-scrollbar {
    display: none;
  }
  /* In portrait, make the panel full-screen and hide gallery when open */
  body.panel-open .gallery-section {
    display: none;
    margin-right: 0;
  }
  /* In portrait, hide the footer when the panel is open */
  body.panel-open .footer {
    display: none;
  }
  /* Stretch the panel to full viewport width/height in portrait */
  body.panel-open .info-panel {
    left: 0;
    right: 0;
    width: 100vw;
    align-items: stretch;
    transform: none;
    background: #fff;
  }
  .info-panel .panel-content {
    width: 100%;
    height: 100vh;
    box-shadow: none;
  }
  /* Ensure no right gap: fix panel content to viewport when open */
  body.panel-open .info-panel .panel-content {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100dvw;
    height: 100dvh;
    max-width: 100dvw;
    max-height: 100dvh;
  }
}

/* ========== Collapsible Info Panel ========== */
.info-panel {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: var(--panel-width);
  z-index: 2000;
  display: flex;
  align-items: stretch;
  justify-content: flex-end;
  pointer-events: none;
  background: #fff;
  transform: translateX(100%);
  transition: none;
}

/* .panel-toggle removed */


.info-panel .panel-content {
  width: var(--panel-width);
  height: 100vh;
  background: transparent;
  overflow-y: auto;
  box-shadow: -2px 0 10px rgba(0, 0, 0, 0.3);
  pointer-events: auto;
}

.info-panel.expanded {
  transform: none;
}

/* When collapsed, ensure the panel doesn't block scroll/taps */
.info-panel:not(.expanded) {
  width: 0;
}

/* Adjust gallery when panel is expanded (portrait/default) */
body.panel-open .gallery-section {
  margin-right: var(--panel-width);
}





.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2rem 2rem 1rem 2rem;
  border-bottom: 1px solid #E8AE1E;
}

.panel-header h2 {
  color: #E8AE1E;
  font-size: clamp(24px, 3vw, 32px);
  font-weight: 700;
  text-transform: uppercase;
  margin: 0;
  font-family: "Montserrat", sans-serif;
}

.panel-close {
  background: none;
  border: none;
  color: #E8AE1E;
  font-size: 2rem;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.3s ease;
  position: relative;
  z-index: 2100;
}

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

.panel-body {
  padding: 1rem 2rem 2rem 2rem;
}

.panel-subtitle {
  color: #E8AE1E;
  font-style: italic;
  font-size: 1.1rem;
  margin-bottom: 1.5rem;
  font-family: "Montserrat", sans-serif;
}

.panel-body p {
  color: #333;
  margin-bottom: 1rem;
  font-family: "Montserrat", sans-serif;
  font-size: clamp(14px, 1.1vw, 18px);
  line-height: 1.7;
  text-align: justify;
}

.panel-body .p-strong {
  font-weight: bold;
}

.panel-body p:last-child {
  margin-bottom: 0;
}

.panel-body hr {
  margin: 2rem 0;
  border: none;
  border-top: 1px solid #e0e0e0;
}

/* Clickable subtitle styling */
.header .subtitle.clickable {
  cursor: pointer !important;
  transition: opacity 0.3s ease;
}

.header .subtitle.clickable:hover {
  opacity: 0.7;
}

/* Ensure cursor pointer works in all cases */
.subtitle.clickable {
  cursor: pointer !important;
}

/* Force cursor pointer for clickable elements */
.clickable {
  cursor: pointer !important;

}


/* Mobile responsive */
@media (max-width: 768px) {
  .popup-content {
    width: 95vw;
    max-width: 95vw;
  }
  
  .popup-header {
    padding: 1.5rem 1.5rem 1rem 1.5rem;
  }
  
  .popup-body {
    padding: 1rem 1.5rem 1.5rem 1.5rem;
  }
  
  .popup-header h2 {
    font-size: clamp(20px, 2.5vw, 28px);
  }
}