/* Main stylesheet for Massimo Piazza personal site */

/* Import custom fonts for the website */
@font-face {
  font-family: 'TitleDefense';
  src: url('https://fonts.gstatic.com/s/spacegrotesk/v21/V8mQoQDjQSkFtoMM3T6r8E7mF71Q-gOoraIAEj7oUXskPMZBSSJLm2E.woff') format('woff');
  font-display: swap;
}

@font-face {
  font-family: 'BodyDefense';
  src: url('https://fonts.gstatic.com/s/inter/v18/UcC73FwrK3iLTeHuS_nVMrMxCp50SjIa1ZL7W0Q5nw.woff2') format('woff2');
  font-display: swap;
}

/* Root-level CSS variables */
:root {
  --accent-rgb: 152, 0, 0;
  --accent: rgb(var(--accent-rgb));
  --accent-hover-md-url: rgb(201, 163, 161);
  --accent-hover: rgba(var(--accent-rgb), 0.10);
  --dark-hover: rgba(0, 0, 0, 0.10);
  --nav-height: 60px;
  --footer-height: 60px;
  --extra-offset: 10px;
  --accordion-width: 100%;
  --accordion-offset: 1.5rem;
  --button-size: 1.4rem;
  --accordion-gap: 4px;
  --detail-width: 100%;
  --side-margin: 2rem;
  --side-margin-mobile: 1rem;
  --content-max-width: 800px;
  --dock-max-scale: 1.5;
  --dock-min-scale: 1;
  --dock-distance: 64px;
  --spinner-size: 96px;
  /* Padding for hover overlay on accordion links */
  --hover-overlay-padding-vertical: 10px;
  --hover-overlay-padding-horizontal: 6px;
  --hover-overlay-radius: 0.5rem;
  /* Tooltip offset */
  --tooltip-distance: 16px;
  /* Image viewer configuration */
  --image-radius: 8px;
}

/* Responsive adjustments */
@media (min-width: 768px) {
  :root {
    --accordion-width: 70%;
    --detail-width: 55%;
  }
}

/* Global resets */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Body layout */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: 'BodyDefense', sans-serif;
  color: #333;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  scroll-behavior: smooth;
  overflow-x: hidden;
}

/* Wrapper for sliding */
#pageContent {
  transition: transform 0.3s ease;
  position: relative;
  width: 100%;
}

/* Navigation bar */
nav {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--nav-height);
  background: #000;
  display: flex;
  align-items: center;
  padding: 0 2rem;
  z-index: 100;
}

nav a {
  font-family: 'TitleDefense', sans-serif;
  color: #fff;
  text-decoration: none;
  margin-right: 2rem;
  position: relative;
  padding: 0.5rem 0;
}

nav a:last-child {
  margin-right: 0;
}

nav a:hover {
  opacity: 0.8;
}

nav .indicator {
  position: absolute;
  bottom: 0;
  height: 4px;
  width: 0;
  background: var(--accent);
  transition: left 0.3s, width 0.3s;
}

/* Main content area */
main {
  padding-top: var(--nav-height);
  padding-bottom: var(--footer-height);
  flex: 1;
}

section {
  max-width: var(--content-max-width);
  margin: 2rem auto;
  padding: 0 1rem;
  scroll-margin-top: calc(var(--nav-height) + var(--extra-offset));
}

/* Section headings */
h2 {
  font-family: 'TitleDefense', sans-serif;
  margin-bottom: 1rem;
  color: var(--accent);
  font-size: 2.2rem;
}

h3 {
  font-family: 'TitleDefense', sans-serif;
  margin-bottom: 0.5rem;
  color: #333;
  font-size: 1.2rem;
}

h3 .accent {
  color: var(--accent);
}


/* About section */
#about img {
  width: 150px;
  height: auto;
  border-radius: 50%;
  margin: 1rem 0;
}

.bio-para {
  margin-bottom: 1rem;
}

.bio-extra {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.5s ease;
}

.bio-extra.open {
  max-height: 1000px;
}

.toggle-bio {
  display: inline-flex;
  align-items: center;
  background: none;
  border: none;
  cursor: pointer;
  position: relative;
  z-index: 0;
  padding: var(--hover-overlay-padding-vertical) var(--hover-overlay-padding-horizontal);
}

.toggle-bio::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--dark-hover);
  border-radius: var(--hover-overlay-radius);
  opacity: 0;
  transition: opacity 0.3s ease, left 0.3s ease, width 0.3s ease;
  z-index: -1;
}

.toggle-bio:hover::before {
  opacity: 1;
}

.toggle-bio.open::before {
  left: var(--hover-overlay-padding-horizontal);
  width: 1.5rem;
}

.toggle-bio svg {
  width: 1.5rem;
  height: 1.5rem;
  stroke: var(--accent);
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.3s ease;
  transform-origin: center center;
}

.toggle-bio.open svg {
  transform: rotate(180deg);
}

.toggle-text {
  margin-left: 0.5rem;
  font-family: 'BodyDefense', sans-serif;
  font-size: 0.75rem;
  color: #333;
  text-transform: lowercase;
  transition: background-color 0.3s ease, opacity 0.3s ease;
}


.hover-accent-overlay {
  transition: background-color 0.3s ease;
}

.hover-accent-overlay:hover {
  background-color: var(--dark-hover);
}

.toggle-bio.open .toggle-text {
  opacity: 0;
}

/* Accordion for projects */
.accordion-header {
  position: relative;
  cursor: pointer;
  padding: 1rem 0;
  display: grid;
  grid-template-columns: calc(var(--accordion-width) - var(--accordion-offset)) auto;
  align-items: center;
  font-family: 'TitleDefense', sans-serif;
  transition: transform 1.0s ease;
}

.accordion-header::before {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  width: var(--accordion-width);
  border-bottom: 1px solid #ddd;
}

.accordion-header::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  width: var(--accordion-width);
  border-bottom: 1px solid #ddd;
  transform: translateY(var(--line-move, 0));
  transition: transform 0.5s ease;
}

.accordion-header span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--button-size);
  height: var(--button-size);
  font-size: var(--button-size);
  transform-origin: center center;
  color: var(--accent);
  transition: transform 0.5s ease, background-color 0.3s ease;
}

.accordion-header.open span {
  transform: rotate(45deg);
}

.accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.5s ease;
}

.accordion-content ul {
  margin-top: 0.5rem;
  list-style: disc outside;
  padding-left: var(--accordion-offset);
  margin-bottom: 0;
}

.accordion-content ul li {
  margin-bottom: 0;
}

.accordion-content ul li:last-child {
  margin-bottom: 1.25rem;
}

.accordion-content a {
  color: var(--accent);
  text-decoration: none;
}

.accordion-content a:hover {
  text-decoration: none;
}

.accordion-content a {
  position: relative;
  z-index: 0;
  display: block;
  padding: var(--hover-overlay-padding-vertical) var(--hover-overlay-padding-horizontal);
  /* Constrain width so hover overlay ends at separator line */
  max-width: calc(var(--accordion-width) - var(--accordion-offset));
}

.accordion-content a::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--dark-hover);
  border-radius: var(--hover-overlay-radius);
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: -1;
}

.accordion-content a:hover::before {
  opacity: 1;
}

/* Consulting section */
#consulting {
  margin-top: 4rem;
}

#consulting p {
  font-style: italic;
}

#consultingSummaryHeading {
  transition: opacity 0.5s ease, transform 0.5s ease;
}

#consultingSummaryHeading.consulting-summary-hidden {
  opacity: 0;
  transform: translateY(-4px);
}

#consultingSummaryHeading.consulting-fast-fade {
  transition: opacity 0.2s ease, transform 0.2s ease;
}

/* Contact form */
#contact {
  margin-top: 4rem;
}

#contact form {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: var(--accordion-width);
  margin: 0;
}

label {
  margin-bottom: 0.5rem;
  font-weight: bold;
}

#contact form input,
#contact form textarea {
  width: 100%;
  margin-bottom: 1rem;
  padding: 0.5rem;
  font-family: 'BodyDefense', sans-serif;
}

button {
  padding: 0.75rem;
  background: var(--accent);
  color: #fff;
  border: none;
  cursor: pointer;
  font-family: 'TitleDefense', sans-serif;
}

/* Contact form send button specific styling */
#contact button {
  font-size: 1rem;
  border-radius: 2rem;
  width: 25%;
  margin: 0 left;
  transition: background-color 0.3s ease, transform 0.1s ease;
}

#contact button:hover {
  transform: translateY(0px);
  filter: invert(25%);
}

/* Footer and social icons */
footer {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: var(--footer-height);
  background: #000;
  display: flex;
  justify-content: center;
  align-items: center;
}

.socials {
  display: flex;
  transition: transform 0.3s ease;
}

.socials a {
  margin: 0 0.5rem;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.0rem;
  border-radius: 50%;
  transition: background-color 0.3s ease;
}

.socials a:hover {
  background-color: rgba(0, 0, 0, 0.15);
}

.socials img {
  width: 32px;
  height: 32px;
  filter: invert(100%);
  transition: filter 0.3s ease, transform 0.1s ease;
  transform-origin: center center;
}


.socials.hovering img {
  transition: filter 0.3s ease, transform 0s ease;
}

/* Accent overlay color on hover for social icons */
@media (hover: hover) and (pointer: fine) {
  .socials a:hover img {
    /* Transform the white SVG shape into the accent color (#980000) */
    /* Transformation numerically calculated using https://codepen.io/sosuke/pen/Pjoqqp */
    /*filter: brightness(0) saturate(100%) invert(77%) sepia(16%) saturate(611%) hue-rotate(315deg) brightness(93%) contrast(74%);*/
    filter: invert(50%);
  }
}

/* Detail-view panel */
.detail-view {
  position: fixed;
  top: 0;
  right: 0;
  width: var(--detail-width);
  height: 100%;
  background: #fff;
  box-shadow: -2px 0 5px rgba(0, 0, 0, 0.3);
  transform: translateX(100%);
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 200;
}

.detail-view.open {
  transform: translateX(0);
}

.detail-header {
  display: flex;
  align-items: center;
  height: var(--nav-height);
  padding: 0 var(--side-margin);
  background: #fff;
  position: sticky;
  top: 0;
  z-index: 210;
  transition: box-shadow 0.3s ease;
}

.detail-header::after {
  content: '';
  position: absolute;
  left: var(--extra-offset);
  right: var(--extra-offset);
  bottom: 0;
  border-bottom: 1px solid #ddd;
}

.detail-header #closeDetail {
  margin-right: 1rem;
}

.detail-header #detailTitle {
  font-family: 'TitleDefense', sans-serif;
  font-size: 2rem;
  color: var(--accent);
  margin-left: 2rem;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.detail-header.scrolled {
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
}

.detail-body {
  padding: var(--extra-offset) var(--side-margin) var(--side-margin) var(--side-margin);
  overflow-y: auto;
  overscroll-behavior: contain;
  flex: 1;
}

/* Slide pageContent when detail open */
@media (min-width: 768px) {

  /* shift content so that your centered layout's left edge sits at the side margin */
  #pageContent.slide {
    transform: translateX(calc(var(--side-margin) - ((100vw - var(--content-max-width)) / 2)));
  }
}

@media (max-width: 767px) {
  #pageContent.slide {
    transform: translateX(-100%);
  }
}

/* Close button centering */
#closeDetail {
  position: absolute;
  top: calc(var(--side-margin) - 1.1rem);
  left: calc(var(--side-margin) - 1rem);
  background: #fff;
  border: 1px solid var(--accent);
  border-radius: 50%;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  cursor: pointer;
  z-index: 300;
  color: var(--accent);
}

#closeDetail:hover {
  background-color: var(--dark-hover);
}


/* Download resume alignment */

.download-resume-wrapper {
  width: var(--accordion-width);
  margin-top: 1.5rem;
  display: flex;
  justify-content: flex-end;
}

.download-resume {
  display: inline-flex;
  align-items: center;
  color: var(--accent);
  text-decoration: none;
  position: relative;
  z-index: 0;
  padding: var(--hover-overlay-padding-vertical) var(--hover-overlay-padding-horizontal);
}

.download-resume::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--dark-hover);
  border-radius: var(--hover-overlay-radius);
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: -1;
}

.download-resume:hover::before {
  opacity: 1;
}


/* Download resume alignment */
.download-resume-wrapper {
  width: var(–accordion-width);
  margin-top: 0.75rem;
  display: flex;
  justify-content: flex-end;
}

.download-resume {
  display: inline-flex;
  align-items: center;
  color: var(–accent);
  text-decoration: none;
}

/* Expand All button */
.expand-all-btn {
  border: 1.75px solid var(--accent);
  border-radius: 0.45rem;
  background: none;
  color: var(--accent);
  padding: 0.1rem 0.3rem;
  font-family: 'BodyDefense', sans-serif;
  font-size: 0.7rem;
  cursor: pointer;
  margin-left: 0.1rem;
  transition: opacity 0.3s ease;
}

.expand-all-btn.hidden {
  opacity: 0;
  pointer-events: none;
}


@media (max-width: 767px) {
  .detail-body {
    padding: var(--extra-offset) var(--side-margin-mobile) var(--side-margin) var(--side-margin-mobile);
  }
}


/* Spinner styling */
.spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  width: var(--spinner-size);
  height: var(--spinner-size);
  margin: calc(var(--spinner-size) / -2) 0 0 calc(var(--spinner-size) / -2);
  border: 4px solid rgba(0, 0, 0, 0.1);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  z-index: 999;
  display: block;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Ensure hidden spinner is hidden */
.spinner.hidden {
  display: none;
}

/***********************************/



/****************************/
/* MARKDOWN RENDERING STYLE */
/****************************/

.detail-body ul,
.detail-body ol {
  padding-left: 1.5rem;
  /* indent list levels for readability */
  margin-bottom: 1rem;
  /* add space below lists */
}

/* Add spacing between individual list items + justified text */
.detail-body li {
  margin-bottom: 0.5rem;
  text-align: justify;
}

/* Ensure paragraphs have bottom margin for proper text flow + justified text */
.detail-body p {
  margin-bottom: 1rem;
  text-align: justify;
}

/* Style fenced code blocks with background, padding, and scroll */
.detail-body pre {
  background-color: #f6f8fa;
  /* light gray background for contrast */
  padding: 1rem;
  /* inner padding for readability */
  overflow-x: auto;
  /* allow horizontal scrolling for long lines */
}

/* Style inline code snippets for emphasis */
.detail-body code {
  background-color: #f6f8fa;
  /* match code block background */
  padding: 0.2rem 0.4rem;
  /* small padding around text */
  border-radius: 3px;
  /* subtle rounded corners */
}

/* Style markdown links to use the site's accent color */
.detail-body a {
  color: var(--accent);
  /* use the defined accent color */
  text-decoration: underline;
  /* underline for clarity */
}

/* Hover state for markdown links */
.detail-body a:hover {
  color: var(--accent-hover-md-url);
  /* slight darker shade on hover */
}

/* Center figures and captions */
.detail-body figure {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 2rem 0;
}

.detail-body figure figcaption {
  margin-top: 0.5rem;
  text-align: center;
}

/* Center figures and captions */
.detail-body figure {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 2rem 0;
}

.detail-body figure figcaption {
  margin-top: 0.5rem;
  text-align: center;
}

.detail-body figure figcaption>div {
  margin: 0 auto;
}


/* Table styling for markdown tables */
.detail-body table {
  display: block;
  /* Wrap Markdown tables in a scrollable block to avoid full-page horizontal scrolling */
  width: 100%;
  overflow-x: auto;
  border-collapse: separate;
  border-spacing: 0.25rem 0.25rem;
  margin-bottom: 1rem;
  border-top: 1px solid #000;
  border-bottom: 1px solid #000;
}

.detail-body th,
.detail-body td {
  padding: 0.5rem 0.5rem;
}

.detail-body th {
  color: var(--accent);
}


/***********************************/
/* End of MARKDOWN RENDERING STYLE */

/* Everboard carousel styles */
.header_carrousel {
  width: 380px;
  aspect-ratio: 380 / 630;
  margin: 1rem 0;
  overflow: hidden;
  position: relative;
  left: 50%;
  transform: translateX(-50%);
}

.header_carrousel .c_iphone {
  width: 70%;
  height: 550px;
  margin: 0 auto;
  background-image: url('../img/everboard-carousel/iphone_frame.png');
  background-size: contain;
  background-repeat: no-repeat;
  overflow: hidden;
}

.header_carrousel .iphone_screen {
  width: 229px;
  height: 406px;
  margin-top: 65px;
  margin-left: 17px;
  overflow: hidden;
}

.header_carrousel .screen_wrapper {
  display: flex;
  transition: margin-left 1s ease;
}

.header_carrousel .screen_wrapper img {
  width: 229px;
  flex-shrink: 0;
}

.header_carrousel .c_icons {
  margin-top: 10px;
  height: 57px;
  position: relative;
  overflow: hidden;
  width: 100%;
  /* Fade icons at edges */
  -webkit-mask-image: linear-gradient(to right, transparent 0%, black 15%, black 85%, transparent 100%);
  mask-image: linear-gradient(to right, transparent 0%, black 15%, black 85%, transparent 100%);
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
}

.header_carrousel .icon_wrapper {
  display: flex;
  transition: transform 1s ease, margin-left 1s ease;
}

.header_carrousel .icon {
  width: 57px;
  height: 57px;
  border-radius: 13px;
  overflow: hidden;
  flex-shrink: 0;
  margin-left: 23.6px;
  cursor: pointer;
}

.header_carrousel .icon:first-child {
  margin-left: 0;
}

.header_carrousel .icon img {
  width: 110%;
  height: auto;
  margin-top: -2px;
  margin-left: -3px;
}

/* Video mockup container styling */
.video-mockup-container {
  /* Configurable mockup container width (% of page width) */
  --mockup-width: 50%;
  /* Configurable mockup aspect ratio (height/width) */
  --mockup-aspect: 2;
  /* adjust to your mockup image ratio */
  /* Configurable video width (% of mockup width) */
  --video-width: 80%;
  /* Configurable horizontal offset from center */
  --video-offset-x: 0px;
  /* Configurable vertical offset from center */
  --video-offset-y: 0px;

  position: relative;
  width: var(--mockup-width);
  max-width: 100%;
  height: 0;
  padding-top: calc(var(--mockup-aspect) * 95%);
  margin: 1rem auto 1rem;
  /* space below to prevent overlap */
  background: url("../img/canvas_mockup_iphone6.png") no-repeat center center;
  background-size: contain;
}

.video-mockup-container video {
  position: absolute;
  top: calc(50% + var(--video-offset-y));
  left: calc(50% + var(--video-offset-x));
  transform: translate(-50%, -50%);
  width: var(--video-width);
  height: auto;
}

.multicol-md {
  display: flex;
  align-items: flex-start;
  gap: var(--multicol-gap, 2rem);
}

.multicol-md-text {
  flex: var(--multicol-text-flex, 1.5);
  margin: var(--multicol-text-margin, 0);
  padding: var(--multicol-text-padding, 0);
}

.multicol-md-figure {
  flex: var(--multicol-figure-flex, 1);
  margin: var(--multicol-figure-margin, 0);
  padding: var(--multicol-figure-padding, 0);
}

@media (max-width: 767px) {
  .multicol-md {
    flex-direction: column;
  }

  .multicol-md-text {
    width: 100%;
  }

  .multicol-md-figure {
    width: 65%;
    margin-left: auto;
    margin-right: auto;
    margin-top: var(--multicol-figure-mobile-margin-top, -2rem);
    margin-bottom: var(--multicol-figure-mobile-margin-bottom, 2rem);
  }
}

/* Hover effect for accordion headers */
.accordion-header:hover {
  font-weight: bold;
  transform: translateY(-2px);
}

.accordion-header:hover span {
  font-weight: normal;
}

/* Tooltip for social icons on hover-capable devices */
@media (hover: hover) and (pointer: fine) {
  .socials a {
    position: relative;
  }

  .socials a::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + var(--tooltip-distance));
    left: 50%;
    transform: translateX(-50%);
    background: var(--accent);
    color: #fff;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.0s ease;
    font-size: 0.75rem;
    z-index: 100;
  }

  .socials a::before {
    content: '';
    position: absolute;
    bottom: calc(100% + var(--tooltip-distance));
    left: 50%;
    transform: translateX(-50%) translateY(5px) rotate(45deg);
    width: 16px;
    height: 16px;
    background: var(--accent);
    border-radius: 0 0 2px 0;
    z-index: 99;
    opacity: 0;
    transition: opacity 0.0s ease;
  }

  .socials a:hover::after,
  .socials a:hover::before {
    opacity: 1;
  }
}

/* Disable hover overlays on touch devices to prevent stuck overlays */
@media (hover: none) and (pointer: coarse) {

  .toggle-bio:hover::before {
    display: none !important;
  }

  #contact button:hover {
    transform: none !important;
    filter: none !important;
  }
}



/* Image Viewer Styles */
.image-viewer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1000;
  /* Above everything */
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  cursor: default;
  /* Ensure click events aren't blocked */
}

.image-viewer.visible {
  opacity: 1;
  pointer-events: auto;
}

/* Desktop default: Black transparent overlay */
.image-viewer {
  background-color: rgba(0, 0, 0, 0.9);
}

/* Viewer Track (replaces simple image container) */
.viewer-image-container {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
  padding: 0;
  /* Prevent browser navigation gestures on mobile */
  overscroll-behavior-x: none;
  z-index: 1010;
  /* Above counter, below navigation/close */
}

.viewer-track {
  position: relative;
  width: 100%;
  height: 85%;
  /* Leave room for caption */
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: pan-y;
  /* Allow vertical scroll/interactions but capture horizontal */
}

.track-item {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  will-change: transform;
}

.viewer-image {
  width: auto;
  height: auto;
  max-width: 90%;
  max-height: 100%;
  object-fit: contain;
  border-radius: var(--image-radius);
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

.viewer-caption {
  font-family: 'BodyDefense', sans-serif;
  color: #fff;
  margin-top: 1rem;
  text-align: center;
  max-width: 80%;
  font-size: 1rem;
  opacity: 0.9;
  z-index: 1020;
  /* Ensure it is above masks/backgrounds */
  position: relative;
  /* Establish stacking context */
}

.image-viewer.visible .viewer-image {
  transform: scale(1);
}

/* Image Counter */
.viewer-counter {
  position: absolute;
  /* Vertically align center with viewer-close (top: 2rem + 1.5rem center = 3.5rem) */
  top: 1.5rem;
  left: 50%;
  transform: translate(-50%, -50%);
  /* Centered on the point */
  color: #fff;
  font-family: 'TitleDefense', sans-serif;
  font-size: 1.2rem;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
  z-index: 1005;
  /* Above background, but below image container */
  pointer-events: none;
  opacity: 0.9;
}

/* Close button - similar to detail close but white/contrasting */
.viewer-close {
  position: absolute;
  top: 2rem;
  right: 2rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  width: 3rem;
  height: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.5rem;
  cursor: pointer;
  z-index: 1020;
  /* High z-index to stay on top */
  transition: background 0.3s ease;
}

.viewer-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Navigation Buttons */
.viewer-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.3);
  border: none;
  border-radius: 50%;
  /* Circle shape like show more button effectively */
  width: 3rem;
  height: 3rem;
  display: flex;
  /* Flex to center svg */
  align-items: center;
  /* Center vertically */
  justify-content: center;
  /* Center horizontally */
  cursor: pointer;
  z-index: 1020;
  /* High z-index to stay on top of image container */
  transition: background 0.3s ease;
  padding: 0.5rem;
}

.viewer-nav:hover {
  background: rgba(255, 255, 255, 0.5);
}

.viewer-prev {
  left: 2rem;
}

.viewer-next {
  right: 2rem;
}

.viewer-nav svg {
  width: 1.5rem;
  height: 1.5rem;
  stroke: #fff;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Rotate the "V" arrow to point Left/Right */
.viewer-prev svg {
  transform: rotate(90deg);
  /* Points Left */
}

.viewer-next svg {
  transform: rotate(-90deg);
  /* Points Right */
}

.viewer-nav.hidden {
  display: none;
}

/* Hover highlight for images in detail view */
.detail-body img {
  border-radius: var(--image-radius);
  /* Default rounded corners for all images */
  transition: border 0.2s ease, transform 0.2s ease;
  border: 2px solid transparent;
  /* Ensure images don't overflow */
  max-width: 100%;
  height: auto;
}

/* Only highlight border on hover for zoomable images */
@media (hover: hover) {
  .detail-body img.zoomable:hover {
    cursor: pointer;
    border-color: var(--accent);
  }

  /* Non-zoomable images should default to default cursor */
  .detail-body img:not(.zoomable) {
    cursor: default;
  }
}

/* Mobile Adjustments */
@media (max-width: 767px) {
  .image-viewer {
    background-color: #000;
    /* Solid black base */
  }

  .viewer-image-container {
    padding: 0;
    /* Full usage */
    /* Enable custom horizontal swipe handling while allowing vertical panning if needed */
    touch-action: pan-y;
  }

  .viewer-image {
    width: auto;
    /* Let aspect ratio determine width */
    height: auto;
    /* Let aspect ratio determine height */
    max-width: 100%;
    max-height: 100%;
    /* Leave space for caption */
    border-radius: 0;
    /* No rounded corners */
  }

  .viewer-close {
    top: 1rem;
    right: 1rem;
    width: 2.5rem;
    height: 2.5rem;
  }

  .viewer-prev {
    left: 0.5rem;
  }

  .viewer-next {
    right: 0.5rem;
  }
}