html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background-color: black;
}

body.inactive {
  cursor: none;
}

body.inactive #artwork-container,
body.inactive #keyword-interface {
  cursor: none;
}

a {
  color: antiquewhite;
}

#artwork-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: auto;
}

img.pic {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  z-index: 1;
  opacity: 0; /* Start invisible for fade-in on first load */
  transition: opacity 0.5s ease-in-out;
}

.info-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: flex-end; /* Align to bottom */
  align-items: flex-start; /* Align to left */
  padding: 2em;
  box-sizing: border-box;
  color: antiquewhite;
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.7);
  pointer-events: none; /* Allow clicks to pass through to the container */
}

.basic-info {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  background-color: rgba(0, 0, 0, 0.7);
  padding: 1em 1.5em;
  border-radius: 8px;
  width: auto;
  max-width: 50%;
  text-align: left;
  pointer-events: auto; /* Re-enable pointer events for the info box itself */
  position: relative; /* For pin button positioning */
}

/* Mobile portrait mode adjustments */
@media screen and (max-width: 768px) and (orientation: portrait),
       screen and (max-height: 768px) and (orientation: portrait) {
  .info-overlay {
    padding: 1em;
    padding-bottom: 1em;
    /* Prevent content from going below viewport */
    justify-content: flex-end;
    align-items: flex-start;
  }
  
  .basic-info {
    /* Use fixed positioning relative to viewport to ensure visibility */
    position: fixed;
    bottom: calc(80px + env(safe-area-inset-bottom, 0px)); /* Position above browser UI and safe area */
    left: 1em;
    right: 1em;
    width: calc(100% - 2em);
    max-width: calc(100% - 2em);
    padding: 0.8em 1em;
    z-index: 10;
    margin: 0;
    /* Limit height to ensure it stays visible - leave 120px from bottom */
    max-height: calc(100vh - 120px);
    max-height: calc(100dvh - 120px); /* Use dynamic viewport height if supported */
    overflow-y: auto;
    box-sizing: border-box;
  }
  
  /* Ensure visibility on mobile portrait when not inactive or when visible class is present */
  body:not(.inactive) .basic-info,
  .basic-info.visible {
    opacity: 1 !important;
    transform: translateY(0) !important;
  }
  
  /* Also ensure visibility on mobile portrait even when inactive if visible class exists */
  body.inactive .basic-info.visible {
    opacity: 1 !important;
    transform: translateY(0) !important;
  }
  
  .art-title {
    font-size: 1.5em;
  }
  
  .art-author {
    font-size: 1.2em;
  }
  
  .art-date, .art-inventory, .art-collection {
    font-size: 1em;
  }
  
  .museum-name {
    font-size: 1em;
  }
  
  #keyword-interface {
    min-width: auto;
    width: calc(100% - 40px);
    right: 20px;
    left: 20px;
  }
}

#pin-button {
  background: none;
  border: none;
  color: antiquewhite;
  cursor: pointer;
  font-size: 16px;
  padding: 0.25em;
  line-height: 1;
  transition: opacity 0.2s, transform 0.2s;
  opacity: 0.5;
  flex-shrink: 0; /* Prevent pin button from shrinking */
}

#pin-button:hover {
  opacity: 1;
  transform: scale(1.1);
}

#pin-button::before {
  content: '📌'; /* Pushpin icon */
}

#pin-button {
  opacity: 0.3; /* Inactive/unpinned state */
}

#pin-button.pinned {
  opacity: 1; /* Active/pinned state */
  color: #ffd700; /* Gold color for pinned state */
}

.basic-info.visible {
  opacity: 1;
  transform: translateY(0);
}

.art-title {
  font-size: 2.2em;
  font-weight: bold;
}

.art-author, .art-date, .art-inventory, .art-collection {
  margin: 0;
  padding: 0.1em 0;
}

.art-author {
  font-size: 1.6em;
  font-style: italic;
  margin-bottom: 1em;
}

.art-date, .art-inventory, .art-collection {
  font-size: 1.2em;
  color: #ccc;
}

.museum-info {
  display: flex;
  align-items: center;
  margin-top: 1em;
  flex-wrap: wrap;
  gap: 0.5em;
}

.museum-logo {
  height: 2em; /* Adjust size as needed */
  margin-right: 0.5em;
  display: block;
  filter: invert(1);
}

.museum-name {
  font-size: 1.2em;
  color: #ccc;
  margin: 0;
}

a.title-link, a.title-link:visited {
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}

#keyword-interface {
  position: fixed;
  top: 20px;
  left: auto;
  right: 20px;
  z-index: 3;
  background-color: rgba(45, 35, 30, 0.9); /* Dark, warm background */
  padding: 15px;
  border-radius: 4px; /* Sharper corners for a classic look */
  color: antiquewhite;
  min-width: 350px;
  transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out;
  opacity: 1;
  transform: translateY(0);
  cursor: auto;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5); /* Deeper shadow for depth */
}

#keyword-interface.hidden {
  opacity: 0;
  transform: translateY(-10px);
  pointer-events: none;
}

#keyword-input-container {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}

#keyword-input {
  flex: 1;
  padding: 8px 12px;
  border-radius: 2px;
  background-color: rgba(0, 0, 0, 0.4);
  color: antiquewhite;
  font-size: 14px;
  font-family: 'Georgia', serif; /* More elegant font */
  border: none;
}

#keyword-input::placeholder {
  color: #c9b78a;
  opacity: 0.7;
}

#keyword-help {
  margin-bottom: 15px; /* More space */
  font-size: 11px;
  color: #ccc;
  opacity: 0.8;
  font-style: italic;
}

#add-keyword {
  padding: 8px 16px;
  background-color: #8c3838; /* Deep red */
  color: white;
  border-radius: 2px;
  cursor: pointer;
  font-size: 14px;
  font-weight: bold;
  transition: background-color 0.2s;
  border: none;
}

#add-keyword:hover {
  background-color: #a84e4e; /* Lighter red on hover */
}

#keyword-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.keyword-tag {
  display: inline-flex;
  align-items: center;
  background-color: #c9b78a; /* Gold background */
  color: #3d2c1d; /* Dark brown text */
  padding: 4px 10px;
  border-radius: 2px;
  font-size: 13px;
  font-weight: bold;
  gap: 6px;
  border: 1px solid #8c7a51;
  text-shadow: 0 1px 1px rgba(255, 255, 255, 0.1);
}

.keyword-tag .remove-keyword {
  background: none;
  border: none;
  color: #3d2c1d;
  cursor: pointer;
  font-size: 16px;
  font-weight: bold;
  padding: 0 0 2px 0;
  line-height: 1;
  transition: color 0.2s;
}

.keyword-tag .remove-keyword:hover {
  color: #8c3838; /* Deep red for remove hover */
}
