.material-symbols-rounded {
  /* transform: translate(0%, 50%); */
  vertical-align: -0.15em;
  font-display: block;
  font-variation-settings:
  'FILL' 0,
  'wght' 400,
  'GRAD' 0,
  'opsz' 48
}

.material-symbols-rounded.fill {
  font-variation-settings:
  'FILL' 1
}

/* General Reset */
body, html {
  margin: 0;
  padding: 0;
  font-family: "Jost", Arial, sans-serif;
  height: 100%;
  color: #232323;
  background-color: #f2f2f2;
  overflow: hidden;
  touch-action: none; /* Prevent default touch actions */
  user-select: none;
  -moz-user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent; /* Clear touch highlighting - Chrome and Android */
}

svg {
  vertical-align: -0.15em; /* Same as icons - same as Y-10% */
  display: inline-block;
}

img {
  filter: contrast(80%) sepia(.15) hue-rotate(-10deg) saturate(80%);
}

header {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  background-color: inherit;
  margin: auto;
  top: 0;
  left: 0;
  right: 0;
  height: 116px;
  z-index: 1030;
}

h1 {
  margin: 0;
  font-size: 1.5em;
}

.header-container {
  display: flex;
  justify-content: space-evenly;
  align-items: center;
  width: 100%;
}

/* Applies to all instances */
.icon-button {
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
  color: inherit;
  width: 2em;
  margin: auto;
}

.icon-button:active {
  filter: invert(1);
}

main {
  display: block;
  position: relative;
  height: calc(100% - 116px);
  width: 100%;
  background-color: #12122c; /* #12122c 0e0e3f */
  cursor: grab;
}

main:active {
  cursor: grabbing;
}

.map-buttons {
  display: flex;
  flex-direction: column;
  justify-content:end;
  align-items: center;
  gap: 2em;
  position: absolute;
  right: 32px;
  bottom: 64px;
  z-index: 1000;
}

.round-button {
  background-color: #f2f2f2;
  color: inherit;
  padding: 16px;
  border: none;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
}

.round-button:active {
  filter: invert(1);
}

.map-themes {
  display: none;
}

#themes {
  display: block;
}

#zoom-in,
#zoom-out {
  display: none;
}

.card-container {
  position: fixed;
  bottom: 0;
  width: 100%;
  height: 100%;
  z-index: 1010;
  overflow-y: scroll; /* Enable scrolling for the container */
  pointer-events: none;
  scrollbar-width: none;  /* Chrome, Firefox */
}

.card-container::-webkit-scrollbar { 
  display: none;  /* Safari and Chrome */
}

.card {
  position: relative;
  margin: auto;
  margin-top: 100vh;
  margin-bottom: 32px;
  width: 80%;
  display: flex;
  flex-direction: column;
  gap: 1em;
  background-color: #f2f2f2;
  border-radius: 8px;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.2);
  padding: 32px;
  cursor: grab;
  pointer-events: auto;
}

.card hr {
  border: none;
  height: 8px;
}

.card figure {
  margin: 0;
  width: 100%;
}

.card figcaption {
  /* margin-right: 16px;
  text-align: right; */
  font-size: 0.8em;
  font-style: oblique;
  color: darkGray;
}

.card img {
  width: 100%;
  height: 320px;
  object-fit: cover;
  border-radius: 8px;
}

.card .card-title {
  text-align: center;
}

.card:active {
  cursor: grabbing;
}

.hidden {
  display: none;
}

.card-section .material-symbols-rounded {
  font-size: 1em; /* Downscale in-text symbols */
}

.card-section button {
  background-color: #f2f2f2;
  border: 2px solid #232323;
  border-radius: 8px;
  padding: 16px;
  margin-top: 1em;
  margin-bottom: 1em;
  cursor: pointer;
  color: inherit;
  font-weight: bold;
  font-size: inherit;
  font-family: inherit;
}

.card-section button:active {
  background-color: #232323;
  color: #f2f2f2;
}

/* Inverted active style! */
.card-section button.filter-button:active {
  background-color: #f2f2f2;
  color: #232323;
}

.card-section button.filter-button.selected {
  background-color: #232323;
  color: #f2f2f2;
}

.card-section button.filter-button.selected .hidden {
  display: inline-block; /* Invert hidden on selected */
}

#theme-section ul {
  margin: 0;
  padding: 0;
  list-style-type: none;
}

#theme-section li {
  margin-top: 1em;
  margin-bottom: 1em; /* Aid for touchscreen */
  display: flex;
  flex-direction: row;
  gap: 1em;
  align-items: center;
  justify-content: start;
}

/* Override card button attributes */
#theme-section button {
  margin: 0;
  padding: 0;
  border: none;
  font-family: "Material Symbols Rounded";
  font-size: 1.5em;
}

/* Override card button attributes */
#theme-section button:active {
  background-color: inherit;
  color: inherit;
}

.card-section-button-container {
  display: flex;
  flex-flow: row wrap;
  justify-content: left;
  gap: 1em;
  margin-top: 2em;
  margin-bottom: 2em;
}

/* No need for single button placement margins (upper and lower) within container */
.card-section-button-container button {
  margin: 0;
}

.map-legend {
  margin: 0;
  list-style-type: none;
}

.map-legend svg {
  margin-right: 1em;
}

#keyword-search {
  width: 80%;
  background-color: #f2f2f2;
  border: 2px solid #232323;
  border-radius: 8px;
  padding: 16px;
  font-family: inherit;
  font-weight: normal;
  font-size: inherit;
}

#keyword-search:focus {
  outline: 3px solid #ff8c00;
}

input::placeholder {
  color: inherit;
  font-style: italic;
}

a {
  color: inherit;
}

a:hover {
  color: darkGray;
}

.label {
  color: #f2f2f2;
  text-align: center;
  opacity: 0; /* Start fully transparent */
  visibility: hidden; /* Hidden by default */
  transition: opacity 0.5s ease-in-out, visibility 0.5s ease-in-out; /* Smooth transition */
}

.label.visible {
  opacity: 1; /* Fully visible */
  visibility: visible; /* Make visible */
}

.label-theme {
  color: #f2f2f2;
  text-align: center;
  cursor: pointer;
  opacity: 0; /* Start fully transparent */
  visibility: hidden; /* Hidden by default */
  background-color: rgba(15, 15, 15, 0.5);
  padding: 10px;
  border-radius: 8px;
  transition: opacity 0.5s ease-in-out, visibility 0.5s ease-in-out, background-color 0.25s ease-in-out, color 0.25s ease-in-out; /* Smooth transition */
  max-width: 128px;
}

.label-theme.visible {
  opacity: 1;
  visibility: visible;
}

.icon-wrapper {
  position: relative;
}

.popup {
  display: none;
}

.kiosk {
  pointer-events: none;
  color: darkGray;
}

.fade-in {
  animation: fade-in 0.25s ease-in;
}

.fade-out {
  animation: fade-out 0.25s ease-out;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes fade-out {
  from {
    opacity: 1;
  }

  to {
    opacity: 0;
  }
}

/* Media Query for Tablet Screens */
@media (min-width: 600px) {
  .card {
    margin-top: 100vh; /* This margin pushes the card with content to sit just below screen, so jump-scroll up always brings it up to sit on bottom-margin - neatly aligning the content - but not so far as to allow it to be scrolled off entirely */
    width: 60%;
  }
}

/* Media Query for Desktop Screens */
@media (min-width: 1080px) and (orientation: landscape) {
  .material-symbols-rounded {
    font-size: 2em;
  }

  h1 {
    font-size: 2em;
  }

  .header-container {
    width: 50%;
    gap: 6em;
  }

  #title {
    order: 1;
    flex-grow: 1;
  }

  #menu-icon,
  #help-icon {
    order: 2;
  }

  .map-buttons {
    right: 64px;
    bottom: 32px;
  }

  .map-themes {
    display: block;
    position: absolute;
    left: 64px;
    bottom: 32px;
    background-color: #f2f2f2;
    border-radius: 8px;
    padding: 16px;
    z-index: 1000;
  }

  .map-themes h2 {
    margin-top: 0;
  }

  .map-themes ul {
    margin: 0;
    padding: 0;
    list-style-type: none;
  }

  /* This structure takes advantage of 2em material icons for spacing */
  .map-themes li {
    display: flex;
    flex-direction: row;
    gap: 1em;
    align-items: center;
    justify-content: start;
  }

  .map-themes button {
    border: none;
    cursor: pointer;
  }

  #themes {
    display: none;
  }

  #zoom-in,
  #zoom-out {
    display: block;
  }

  .card {
    margin-top: 100vh; /* This margin pushes the card with content to sit just below screen, so jump-scroll up always brings it up to sit on bottom-margin - neatly aligning the content - but not so far as to allow it to be scrolled off entirely */
    width: 40%;
  }

  .card img {
    height: 400px;
  }
  
  .card .card-section {
    margin: auto;
    width: 80%;
  }
}

/* Mouse only features */
@media(hover: hover) and (pointer: fine) {
  .label-theme.visible:hover {
    background-color: #f2f2f2;
    padding: 10px;
    color: #232323;
    border-radius: 8px;
    z-index: 1001;
  }

  /* Tooltips */
  .popup {
    display: block;
    position: absolute;
    visibility: hidden;
    width: 200px;
    padding: 16px;
    background: #0f0f0f;
    color: #f2f2f2;
    border-radius: 8px;
    opacity: 0;
    z-index: 1010; /* Ensure it appears above other elements */
    pointer-events: none; /* Prevent interaction when invisible */
    transition: opacity 0.25s ease-in-out, visibility 0.25s ease-in-out; /* Smooth fade-in and fade-out */
    box-sizing: border-box;
  }

  .popup h3 {
    margin-top: 0;
  }
  
  .popup p {
    margin: 0;
  }

  .popup-top {
    /* left: calc(50% - 47.4219px); */
    /* left: clamp(0px, 50%, 100vw - 100px); Keep within screen bounds */
    left: 50%;
    top: 150%; /* Adjust as needed */
    transform: translateX(-50%);
  }
  
  .popup-bottom {
    right: 150%;
    bottom: 0%; /* Adjust as needed */
  }
  
  .icon-wrapper:hover .popup {
    visibility: visible;
    opacity: 1;
    pointer-events: auto; /* Allow interactions */
    transition-delay: 0.8s; /* Delay before appearing */
    /* animation: fade-out 0.25s ease-out 6s 1 forwards; name, duration, timine, delay, iteration, fill mode */
  }
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
  body, html {
    color: #f2f2f2;
    background-color: #1e1e26; /* #232323 */
  }

  .round-button {
    background-color: #1e1e26;
  }

  .map-themes {
    background-color: inherit;
  }

  .map-themes button {
    background-color: inherit;
    color: inherit;
  }
    
  .card {
    background-color: #1e1e26;
  }

  .card-section button {
    background-color: #1e1e26;
    border: 2px solid #f2f2f2;
  }
  
  .card-section button:active {
    background-color: #f2f2f2;
    color: #232323;
  }
  
  /* Inverted active style! */
  .card-section button.filter-button:active {
    background-color: #1e1e26;
    color: #f2f2f2;
  }
  
  .card-section button.filter-button.selected {
    color: #1e1e26;
    background-color: #f2f2f2;
  }
  
  #keyword-search {
    background-color: #1e1e26;
    border: 2px solid #f2f2f2;
    color: #f2f2f2;
  }
}