/* || GENERAL & RESET || */
html {
  margin: 0;
  padding: 0;
  font-size: clamp(0.875rem, 0.5vw + 0.8rem, 1.125rem);
  scroll-behavior: smooth;
}

body {
  overflow-x: hidden;
  width: 100%;
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  width: 100%;
  overflow-x: hidden;
  flex: 1 0 auto;
}

/* || HEADER & FOOTER || */
header {
  position: -webkit-sticky !important;
  position: sticky !important;
  top: 0;
  left: 0 !important;
  right: 0 !important;
  width: 100vw !important;
  z-index: 1100 !important;
  transition: transform 0.4s ease-in-out, padding 0.3s ease;
}

.header-hidden {
  transform: translateY(calc(-100% - 1.875rem));
}

.header-scrolled {
  padding-top: 0.2rem !important;
  padding-bottom: 0.2rem !important;
  box-shadow: 0 0.125rem 0.625rem rgba(0, 0, 0, 0.1);
}

.img-header {
  width: 30vw;
  height: auto;
  max-height: 10vh;
  display: block;
  transition: transform 0.3s ease, height 0.3s ease;
  transform-origin: left center;
}

.header-scrolled .img-header {
  transform: scale(0.7);
}

/* Anchor positioning offset */
section[id] {
  scroll-margin-top: 6.25rem;
}

@media (max-width: 768px) {
  .header-scrolled .img-header {
    transform: scale(0.8);
  }
}

/* footer */
footer {
  color: black;
  font-size: 1.5vw;
  text-align: center;
  flex-shrink: 0;
}

/* || NAVBAR || */
.navbar .dropdown-toggle::after {
  display: none;
}

.navbar .dropdown-menu {
  right: 0;
  left: auto;
}

/* || HERO SECTION || */
.hero {
  min-height: 70vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 5vh 2vw;
}

.hero h1 {
  font-size: 3rem;
}

.hero .lead {
  font-size: 1.5rem;
  font-weight: 400;
}

.hero .intro-text {
  max-width: 45rem;
  font-size: 1.1rem;
  line-height: 1.6;
  margin: 0 auto;
}

/* || CARDS & LAYOUTS || */
/* INDEX PAGE CARDS */
.path-card .card-img-top {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  background-color: white;
  padding: 0.5rem;
}

.home-page .card-body {
  text-align: center;
}

/* SHELF CONTAINER */
.shelf-container {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  padding: 1rem;
  scroll-behavior: smooth;
}

.shelf-container::-webkit-scrollbar {
  display: none;
}

/* CARD WRAPPER & SHELF CARDS */
.shelf-card-wrapper,
.path-card-wrapper {
  flex: 0 0 auto;
  overflow: visible;
  position: relative;
}

.shelf-card-wrapper .card,
.path-card-wrapper .card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.shelf-card-wrapper .card {
  height: 16.25rem;
  width: auto;
  min-width: 13.75rem;
  max-width: 20rem;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  cursor: pointer;
}

.path-card-wrapper .card {
  height: 17.5rem;
  border-radius: 0.5rem;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  cursor: pointer;
  overflow: hidden;
}

.shelf-card-wrapper .card:hover,
.path-card-wrapper .card:hover {
  transform: translateY(-0.25rem);
  box-shadow: 0 0.5rem 1.25rem rgba(0, 0, 0, 0.35);
  z-index: 2;
  position: relative;
}

/* MEDIA CONTENT (Shelf) */
.media-content {
  flex: 1 1 auto;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  background: #f8f9fa;
  height: 70%;
}

.media-content img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #f8f9fa;
}

.media-content iframe {
  height: 100%;
  width: auto;
  aspect-ratio: 16 / 9;
  border: none;
  flex-shrink: 0;
}

/* CAPTION AREA */
.card-body {
  flex: 0 0 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: normal;
  padding: 0.5rem 0.75rem;
  line-height: 1.2;
}

.card-body h6 {
  font-size: 0.9rem;
  margin-bottom: 0.25rem;
}

/* NARRATIVE ITEM CARDS (Path Card Wrapper specifics) */
.path-card-wrapper .card-img-top {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  background-color: white;
  padding: 0.5rem;
}

.path-card-wrapper .card-body {
  flex: 0 0 auto;
  text-align: center;
  padding: 0.75rem;
}

.path-card-wrapper .card-title {
  margin: 0;
  font-size: 1rem;
  line-height: 1.2;
}

/* || MAP SECTION || */
#map-section .container {
  padding: 0;
}

#map-section {
  padding: 0.25rem;
}

#map {
  width: 100%;
  aspect-ratio: 29 / 12;
  height: auto;
  border: 0.3rem solid #343a40;
  border-radius: 1rem;
  overflow: hidden;
  display: block;
}

.leaflet-container {
  background: transparent !important;
  cursor: default !important;
}

/* MARKER */
.leaflet-marker-icon.item-marker {
  background-color: grey;
  border-radius: 50%;
  width: 0.8rem;
  height: 0.8rem;
  display: block;
  box-shadow: 0 0 0.2rem rgba(0, 0, 0, 0.5);
  cursor: pointer;
  transition: all 0.2s ease-in-out;
}

.item-marker.highlighted {
  width: 1.3rem;
  height: 1.3rem;
  margin-left: -0.25rem;
  margin-top: -0.25rem;
}

/* Tooltip container */
.item-custom-tooltip {
  background: white;
  border-radius: 0.5rem;
  padding: 0.6rem;
  box-shadow: 0 0.25rem 0.6rem rgba(0, 0, 0, 0.25);
  width: 12rem;
  max-width: 12rem;
  white-space: normal;
}

.leaflet-tooltip.item-custom-tooltip {
  margin: 1% !important;
}

/* Layout interno tooltip */
.item-card-hover {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.item-card-hover p {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.25;
  white-space: normal;
  text-align: center;
}

.item-card-hover img {
  width: 100%;
  max-height: 6rem;
  object-fit: contain;
  border-radius: 0.4rem;
  background: transparent;
}

/* || ITEM PAGE SPECIFICS || */
/* Wrapper Layout */
#item-image-wrapper {
  top: 2rem;
  z-index: 10;
}

#item-image {
  width: 100%;
  max-width: 25rem;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  background-color: white;
  border-radius: 0.5rem;
  display: block;
  margin: 0 auto 1rem;
}

#item-main #item-nav {
  justify-content: space-between;
  gap: 1rem;
  padding: 0 0.5rem;
}

#item-main #item-nav button {
  min-width: 7.5rem;
}

#item-text-section #text-title {
  margin-top: 1rem;
}

#item-text-section #text-content {
  margin-top: 0.5rem;
}

/* || BUTTONS & ICONS || */
.github-icon {
  width: 2%;
  border: 0.0625rem solid transparent;
  border-radius: 50%;
  transition: border 0.3s ease;
}

.github-icon:hover {
  border: 0.0625rem solid white;
}

.shelf-arrow {
  z-index: 10;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.shelf-arrow:hover {
  opacity: 1;
}

/* || UTILITIES & RESPONSIVE || */
/* Team Member Images */
.team-img {
  object-fit: cover;
  height: 15.625rem;
  width: 100%;
}

.team-email {
  text-decoration: underline;
  font-size: clamp(0.75rem, 1vw + 0.4rem, 0.95rem);
  display: block;
  word-break: break-all;
  margin-top: 0.25rem;
}

/* --- MEDIA QUERIES --- */

/* Github Icon - Mobile */
@media (max-width: 768px) {
  .github-icon {
    width: 5%;
  }
}

/* Map - Mobile */
@media (max-width: 768px) {
  #map {
    width: 100%;
    height: 100vw;
    aspect-ratio: unset;
    border-radius: 0.8rem;
  }

  .leaflet-marker-icon.item-marker {
    width: 0.6rem;
    height: 0.6rem;
  }

  .item-marker.highlighted {
    width: 1.1rem;
    height: 1.1rem;
  }
}

/* Narrative Cards - Mobile */
@media (max-width: 768px) {
  .path-card-wrapper .card-img-top {
    height: 11.25rem;
    object-fit: contain;
    background: #f0f0f0;
    padding: 0.3rem;
  }

  .path-card-wrapper .card-body {
    padding: 0.3rem !important;
    flex-grow: 0;
  }

  .path-card-wrapper .card-title {
    font-size: 1rem;
    text-align: center;
    margin: 0;
  }
}

/* Item Page Unified Margins - Mobile */
@media (max-width: 768px) {

  body .container,
  main.container {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }

  #item-header,
  #item-main {
    margin-left: 0 !important;
    margin-right: 0 !important;
  }
}

/* Item Page Metadata - Tablet/Mobile Break */
@media (max-width: 767px) {
  #item-metadata-column {
    margin-top: 3em;
  }
}

/* Smaller Mobile Padding Fix */
@media (max-width: 576px) {

  #item-text-section,
  #item-related-media {
    margin-left: 1rem;
    margin-right: 1rem;
  }
}