/* Remove tap highlight on mobile devices */
* {
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}

/* Red text selection highlight */
::selection {
  background-color: red;
  color: white;
}

::-moz-selection {
  background-color: red;
  color: white;
}

/* Disable text selection only on interactive elements */
.dot,
.liste-row,
#drop-here,
.tab-button,
button,
.k-button {
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

/* Allow text selection for content areas */
#content-display,
.liste-content-display,
input,
textarea {
  -webkit-user-select: text;
  -khtml-user-select: text;
  -moz-user-select: text;
  -ms-user-select: text;
  user-select: text;
}

.main-container {
  position: relative;
  width: 100%;
  height: calc(100dvh - 100px);
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  z-index: 1;
}

.main-container.main-container-top {
  z-index: 450 !important;
}

.view-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 0.5s ease-in-out, pointer-events 0s linear 0.5s;
  pointer-events: none;
}

.view-container.active {
  opacity: 1;
  pointer-events: all;
  transition: opacity 0.5s ease-in-out, pointer-events 0s linear;
}

/* Movement view styles - Desktop only */
@media screen and (min-width: 769px) {
  .movement-container {
    display: flex;
    width: 100%;
    height: 100%;
    padding: 20px;
    box-sizing: border-box;
  }

  #dot-container {
    position: relative;
    flex: 1;
    height: 100%;
  }

  #dropzone-container {
    position: relative;
    width: 30%;
    max-width: 400px;
    min-width: 300px;
    height: 80%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    border: 1px solid #ddd;
    border-radius: 20px;
    background: white;
    padding: 20px;
    margin-top: 50px;
    align-self: flex-start;
    box-sizing: border-box;
    overflow: hidden;
  }
}

/* Base styles for all screen sizes */
#dot-container {
  position: relative;
}

#dropzone-container {
  display: none;
  /* Hidden - using unified content box instead */
}

.dropzone {
  border: 1px solid black;
  border-radius: 99px;
}

.dropzone-tabs {
  display: flex;
  flex-shrink: 0;
  background: #fff;
  z-index: 310 !important;
  position: relative;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.tab-content {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}



/* CSS is loading correctly */

.drophere-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

#drop-here {
  position: relative;
  z-index: 320 !important;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #999;
  flex-shrink: 0;
  /* Ensure it's interactive on touch devices */
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  width: 24px;
  height: 24px;
}

#content-display {
  margin-top: 10px;
  padding: 0 10px 10px 10px;
  box-sizing: border-box;
  /* Hide scrollbar for the movement-mode content display */
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  /* Hide scrollbars across browsers */
  -ms-overflow-style: none;
  /* IE and Edge */
  scrollbar-width: none;
  /* Firefox */
  flex: 1 1 auto;
  max-height: 100%;
}

#content-display::-webkit-scrollbar {
  display: none;
  /* WebKit */
}

.dot {
  position: absolute;
  width: 24px;
  height: 24px;
  background: black;
  border-radius: 50%;
  cursor: pointer;
  transition: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  z-index: 200;
  transform-origin: center center;
}

.dot-hidden {
  opacity: 0;
  transform: scale(0.5);
  pointer-events: none;
}

.dot-visited {
  background: #F5FFD3;
  box-shadow: 0 2px 8px rgb(174, 183, 143);
}

.dot:hover {
  box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.1);
}

.dot.can-drop {
  opacity: 1.0;
  /* Keep full opacity when dragging over dropzone for better visibility */
}

.dot-in-dropzone {
  position: absolute !important;
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) !important;
  z-index: 315 !important;
  /* above tabs but below drop-zone */
  /* Reset any dragging transforms */
  margin: 0 !important;
  pointer-events: auto;
}

.drop-active {
  border-color: red;
  transition: background-color 0.3s ease, border-color 0.3s ease;
  background-color: rgba(255, 0, 0, 0.3) !important;
  border-width: 2px !important;
}

.drop-target {
  background-color: red !important;
  transition: background-color 0.3s ease;
  border-color: red;
  border-style: solid;
}

.dropzone-has-dot {
  background-color: red !important;
  transition: background-color 0.3s ease;
}

.content-box-drop-target {
  /* Red border to indicate invalid drop area */
  transition: box-shadow 0.3s ease;
}

.loading {
  text-align: center;
  padding: 40px;
  color: #666;
}

.error {
  text-align: center;
  padding: 40px;
  color: #c00;
}

#drop-here::selection {
  color: inherit;
  background: transparent;
}

/* Hide dropzone text when a dot is dropped */
#drop-here:has(.dot)>span {
  visibility: hidden;
}



/* After drag ends */
.dot {
  transition: transform 0.2s ease-out;
  touch-action: none;
  /* Recommended for interact.js draggable elements */
  user-select: none;
  /* Recommended for interact.js draggable elements */
}

.dot-dragging {
  z-index: 1000 !important;
  /* Ensure dragging dots appear above everything else */
  opacity: 1.0 !important;
  /* Ensure full opacity when dragging */
}

#trail-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  /* Allows clicks to pass through to elements below */
  z-index: 999;
  /* Ensure it's above other content if needed, or below draggable items */
}

/* Liste view styles */
.liste-container {
  padding: 0;
  display: flex;
  justify-content: center;
  align-items: stretch;
  min-height: 100%;
  height: 100%;
}

.liste-layout {
  display: flex;
  width: 100%;
  height: 100%;
}

.liste-table-container {
  flex: 1;
  /* padding: 2rem; */
  padding-bottom: 0 !important;
  overflow-y: auto;
  display: flex;
  justify-content: flex-start;
  align-items: flex-start;
  padding-right: 2rem;
  /* Keep scrolling but hide scrollbars */
  -ms-overflow-style: none;
  /* IE & Edge */
  scrollbar-width: none;
  /* Firefox */
}

.liste-table-container::-webkit-scrollbar {
  display: none;
  /* Chrome, Safari, WebKit */
}

.liste-view {
  width: 100%;
  max-width: none;
  /* Make table full width */
  margin-top: 2rem;
}

.liste-row {
  display: grid;
  grid-template-columns: 2fr minmax(80px, 0.8fr) minmax(120px, 1fr) minmax(120px, 1fr) calc(min(35%, 500px) + 40px);
  /* Responsive column widths: Title, Year, Kind, Location + empty column for unified content box space */
  align-items: center;
  padding: 1.2rem 0;
  padding-left: 2rem;
  border-bottom: 1px solid #000;
  gap: 2rem;
  transition: color 0.2s ease;
  cursor: pointer;
  font-size: 1.3rem;
  color: rgba(0, 0, 0, 0.4)
}

.liste-row:last-child {
  border-bottom: none;
}


.liste-row:hover:not(.active) .liste-title,
.liste-row:hover:not(.active) .liste-year,
.liste-row:hover:not(.active) .liste-kind,
.liste-row:hover:not(.active) .liste-location {
  color: #111;
  /* Very dark grey, almost black */
}


.liste-row.active .liste-title,
.liste-row.active .liste-year,
.liste-row.active .liste-kind,
.liste-row.active .liste-location {
  color: #000;
}

.liste-title {
  font-weight: 400;
  /* Very dark grey for excellent readability */
  transition: color 0.2s ease;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.liste-year {
  text-align: left;
  transition: color 0.2s ease;
  font-size: 1rem;
}

.liste-kind {
  text-align: left;
  white-space: nowrap;
  transition: color 0.2s ease;
  font-size: 1rem;
}

.liste-location {
  text-align: left;
  transition: color 0.2s ease;
  font-size: 1rem;
}

.liste-content-container {
  display: none;
  /* Hidden - using unified content box instead */
}

.liste-content-container.visible {
  display: none;
  /* Hidden - using unified content box instead */
}

.liste-content-box {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 20px;
  position: relative;
}

.liste-content-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.1);
  display: none;
  /* Hidden by default */
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 20px;
  color: #333;
  z-index: 10;
}

.liste-content-close:hover {
  background: rgba(0, 0, 0, 0.2);
}

.liste-content-display {
  flex: 1;
  overflow-y: auto;
  margin-top: 1rem;
  /* Enable momentum scrolling on iOS/Touch devices */
  -webkit-overflow-scrolling: touch;
  /* Ensure the container can always expand to its parent's height for proper scrolling */
  max-height: 100%;
  /* Hide scrollbars but keep scrolling */
  -ms-overflow-style: none;
  /* IE and Edge */
  scrollbar-width: none;
  /* Firefox */
}

/* Hide WebKit scrollbars */
.liste-content-display::-webkit-scrollbar {
  display: none;
}



/* Mobile and Tablet Responsive Styles */
@media screen and (max-width: 768px) {

  /* Ensure mobile viewport constraints */
  * {
    box-sizing: border-box;
  }

  /* Additional mobile resets to prevent white space */
  html {
    height: 100%;
    height: 100dvh;
    min-height: 100%;
    min-height: 100dvh;
  }

  body {
    min-height: 100%;
    min-height: 100dvh;
  }

  /* CSS custom property fallback for older browsers */
  :root {
    --viewport-height: 100vh;
    --liste-mode-height: 65vh;
    --movement-mode-expanded-height: 75vh;
  }

  @supports (height: 100dvh) {
    :root {
      --viewport-height: 100dvh;
      --movement-mode-expanded-height: 75dvh;
    }
  }

  /* Small device adjustments (iPhone 12 mini and similar) */
  @media screen and (max-width: 390px) {
    :root {
      --liste-mode-height: 55vh;
    }
  }

  html,
  body {
    width: 100%;
    max-width: 100vw;
    height: 100vh;
    height: 100dvh;
    /* Dynamic viewport height for mobile browsers */
    max-height: 100vh;
    max-height: 100dvh;
    overflow: hidden;
    /* Prevent all scrolling */
    margin: 0;
    padding: 0;
    position: fixed;
    /* Prevent address bar issues */
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
  }

  /* Header adjustments for mobile */
  .header {
    padding: 0.5rem;
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
    overflow-x: hidden;
    height: 70px !important;
    flex-shrink: 0;
    position: relative;
    z-index: 10;
    padding-top: 0.25rem !important;
  }

  .menu {
    gap: 0.5rem;
  }

  .switch-label {
    font-size: 1em;
  }

  .menu-links a {
    padding: 0.4rem;
    font-size: 0.8rem;
  }

  /* Main container adjustments */
  .main-container {
    top: 70px !important;
    height: calc(100dvh - 70px) !important;
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    /* overflow: hidden; */
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
  }

  /* Movement view for mobile */
  .movement-container {
    padding: 5px;
    gap: 5px;
    position: relative !important;
  }

  #dot-container {
    position: absolute !important;
    top: 0;
    left: 0;
    right: 0;
    bottom: 40vh;
    /* Leave space for unified content box (40vh) */
  }

  .movement-container #dot-container {
    width: 100%;
    height: calc(70vh - 70px) !important;
    /* Available space: 60vh (100vh - 40vh unified box) minus header height */
    min-height: 0;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    transform: none !important;
    bottom: auto !important;
  }

  #drop-here {
    height: 24px !important;
    min-height: 24px !important;
    width: 24px !important;
    min-width: 24px !important;
    font-size: 15px;
    flex-shrink: 0;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
  }

  #content-display {
    font-size: 15px;
    line-height: 1.4;
    overflow-y: auto;
    box-sizing: border-box;
    -webkit-overflow-scrolling: touch;
  }

  /* Dot adjustments for mobile */
  .dot {
    width: 18px;
    height: 18px;
    touch-action: none;
    /* Prevent browser zoom on double-tap */
  }

  /* Liste view for mobile */
  .liste-container {
    min-height: calc(100vh - 100px);
    min-height: calc(100dvh - 100px);
    /* Dynamic viewport height */
  }

  .liste-layout {
    flex-direction: column;
    height: calc(100vh - 100px);
    height: calc(100dvh - 100px);
    /* Dynamic viewport height */
  }

  .liste-table-container {
    flex: 1;
    padding: 0.5rem 1rem;
  }

  /* Add padding in list mode to allow scrolling behind unified content box on mobile */
  body.liste-mode-active .liste-table-container {
    padding-bottom: var(--liste-mode-height) !important;
    /* Match the unified content box height in list mode */
  }

  .liste-view {
    max-width: 100%;
    margin-top: 0;
  }

  .liste-row {
    padding: 0.6rem 0;
    gap: 0.5rem;
    grid-template-columns: 1fr auto;
    color: black;
    padding-left: 0.5rem;
  }

  .liste-row.active {
    color: #F5FFD3 !important;
  }

  .liste-title {
    font-size: 1.1rem;
    color: inherit !important;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .liste-year {
    font-size: 1.1rem;
    padding-right: 2rem;
    color: inherit !important;
    text-align: right;
    min-width: auto;
  }

  .liste-kind,
  .liste-location {
    display: none;
  }

  .liste-content-container {
    width: 100%;
    max-width: none;
    min-width: 0;
    border: 1px solid #ddd;
    border-radius: 20px;
    background: white;
    margin: 10px;
    position: relative;
  }

  .liste-content-container.visible {
    height: 50%;
    /* Take up 50% of the screen */
  }

  .liste-layout:has(.liste-content-container.visible) .liste-table-container {
    height: 50%;
    /* Table takes other 50% */
  }

  .liste-content-box {
    padding: 0.75rem;
    height: 100%;
    display: flex;
    flex-direction: column;
  }

  .liste-content-close {
    display: none;
    /* Hide close button on mobile */
  }



  /* Trail canvas adjustments */
  #trail-canvas {
    /* Reduce performance impact on mobile */
    will-change: auto;
  }

  /* WebKit/Safari specific fixes for viewport issues */
  @supports (-webkit-touch-callout: none) {

    html,
    body {
      height: -webkit-fill-available;
    }

    .main-container {
      height: calc(-webkit-fill-available - 100px);
    }
  }

  /* Keep content box above dots */
  #unified-content-box {
    position: fixed !important;
    bottom: 0 !important;
    right: 0 !important;
    left: 0 !important;
    top: auto !important;
    transform: none !important;
    width: 94% !important;
    max-width: none !important;
    min-width: 0 !important;
    border-radius: 20px 20px 0 0 !important;
    padding-bottom: 0;
    margin: 0 3%;
    height: 35vh !important;
    /* Default mobile height for movement mode */
    transition: height 0.4s cubic-bezier(0.4, 0, 0.2, 1),
      border-radius 0.4s cubic-bezier(0.4, 0, 0.2, 1),
      box-shadow 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
    will-change: height;
    z-index: 250 !important;
    /* keep above dots but below drop canvas */
  }

  /* Mobile height adjustments for different states */
  /* Liste mode: 50% height on mobile */
  body.liste-mode-active #unified-content-box {
    height: var(--liste-mode-height) !important;
  }

  /* Movement mode with dot: 80% height on mobile */
  body:not(.liste-mode-active) #unified-content-box.has-dot {
    height: var(--movement-mode-expanded-height) !important;
  }

  /* Mobile expanded state for smoother animation */
  #unified-content-box.mobile-expanded {
    height: var(--movement-mode-expanded-height) !important;
  }

  /* Small mobile device dot container adjustments for different states */
  /* Liste mode */
  body.liste-mode-active .movement-container #dot-container {
    height: calc(50vh - 70px) !important;
  }

  /* Movement mode with dot active */
  body.dot-active:not(.liste-mode-active) .movement-container #dot-container {
    height: calc(20vh - 70px) !important;
  }

  /* Fix dot positioning in dropzone on mobile */
  #unified-content-box #drop-here {
    position: relative;
  }

  #unified-content-box #drop-here .dot-in-dropzone {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.6);
    width: 25px;
    height: 25px;
  }

  /* Adjust dot container height based on unified content box state */
  /* Liste mode: unified box is 50vh, so dots get 50vh - header space */
  body.liste-mode-active .movement-container #dot-container {
    height: calc(50vh - 70px) !important;
  }

  /* Movement mode with dot: unified box is 80vh, so dots get 20vh - header space */
  body.dot-active:not(.liste-mode-active) .movement-container #dot-container {
    height: calc(20vh - 70px) !important;
  }

  /* Also update the #dot-container general rule for different states */
  /* Liste mode: leave space for 50vh unified content box */
  body.liste-mode-active #dot-container {
    bottom: 50vh !important;
  }

  /* Movement mode with dot: leave space for 80vh unified content box */
  body.dot-active:not(.liste-mode-active) #dot-container {
    bottom: 80vh !important;
  }

  /* Landscape orientation adjustments for mobile */
  @media (orientation: landscape) {
    .main-container {
      height: calc(100vh - 80px);
      height: calc(100dvh - 80px);
      /* Dynamic viewport height */
    }

    .movement-container {
      display: grid !important;
      grid-template-columns: 30% 1fr;
      grid-template-areas: "dropzone dots";
      padding: 5px;
      align-items: stretch;
      gap: 10px;
    }

    .movement-container #dot-container {
      grid-area: dots;
      width: auto;
    }

    .movement-container #dropzone-container {
      grid-area: dropzone;
      width: 100% !important;
      min-width: 250px;
      height: 90% !important;
    }

    .movement-container #dropzone-container.expanded {
      grid-area: dropzone;
      width: 100% !important;
    }

    /* Change grid layout when expanded in landscape */
    .movement-container:has(#dropzone-container.expanded) {
      grid-template-columns: 50% 1fr;
    }
  }
}





/* Touch interaction improvements */
@media (hover: none) and (pointer: coarse) {

  /* Better touch targets */
  .dot {
    /* Increase touch area without changing visual size */
    position: relative;
  }

  .dot:before {
    content: '';
    position: absolute;
    top: -10px;
    left: -10px;
    right: -10px;
    bottom: -10px;
    /* Invisible larger touch area */
  }

  /* Remove hover effects on touch devices */
  .dot:hover {
    /* .dot-visited: hover */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  }

  .liste-row:hover {
    background-color: transparent;
  }

  /* Make entire rows clickable on mobile */
  .liste-row {
    cursor: pointer;
  }

  /* Touch active state: change text color instead of background */
  .liste-row:active .liste-title,
  .liste-row:active .liste-year,
  .liste-row:active .liste-kind,
  .liste-row:active .liste-location {
    color: #111;
  }
}

/* Unified Content Box Styles */
#unified-content-box {
  position: fixed;
  right: 20px;
  top: 10%;
  /* Changed from 50% to 20% */
  transform: none;
  /* Removed translateY(-50%) */
  width: 35%;
  max-width: 500px;
  min-width: 300px;
  height: 80vh;
  /* Restored desktop height */
  max-height: 800px;
  background: white;
  /* border: 1px solid #ddd; */
  border-radius: 20px;
  /* padding: 20px 15px 30px 20px; */
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);

  display: flex;
  flex-direction: column;
  overflow: hidden;

  /* Add transition for smooth height changes */
  transition: height 0.3s ease-in-out;

  /* Raised above .main-container (z-index: 1) but still below .dot (z-index: 200) */
  z-index: 150 !important;
}

/* Desktop keeps original height behavior - no special height adjustments */

/* Higher z-index when a dot is in the dropzone */
#unified-content-box.has-dot {
  z-index: 300 !important;
}

/* Tab buttons container */
#unified-content-box .dropzone-tabs {
  flex-shrink: 0;
  display: flex !important;
  gap: 0;
  z-index: 310 !important;
  position: relative;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  background: linear-gradient(to bottom, white 50%, #F5FFD3 50%);
}

/* Tab buttons specific to unified box */
#unified-content-box .dropzone-tabs .tab-button {
  /* border: none; */
  cursor: pointer;
  font-size: 20px;
  font-family: inherit;
  transition: border-color 0.3s, background-color 0.3s;
  color: #000;
  padding: 15px 10px;
  flex: 1 1 33.333%;
  width: 33.333%;
  min-width: 0;
  text-align: center;
  height: 100%;
  background-color: white;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Make only the variable tab (Here) larger on desktop */
#unified-content-box .dropzone-tabs .tab-button.variable-tab {
  font-size: 29px;
}

@media screen and (max-width: 400px) {
  #unified-content-box .dropzone-tabs .tab-button {
    font-size: 16px;
  }
}

@media screen and (max-width: 400px) {
  #unified-content-box .dropzone-tabs .tab-button {
    font-size: 16px;
  }
}

/* Active tab styling for both modes */
#unified-content-box .dropzone-tabs .tab-button.active {
  background-color: #F5FFD3 !important;
}

/* Inactive tabs stay white */
#unified-content-box .dropzone-tabs .tab-button:not(.active) {
  background-color: white !important;
}

/* Movement mode specific styling */
body:not(.liste-mode-active) #unified-content-box .dropzone-tabs .tab-button.active {
  border-radius: 10px 10px 0 0 !important;
}

body:not(.liste-mode-active) #unified-content-box .dropzone-tabs .tab-button:not(.active) {
  border-radius: 0 !important;
}

/* Apply radius to the bottom-left of the tab immediately AFTER the active one in movement mode */
body:not(.liste-mode-active) #unified-content-box .dropzone-tabs .tab-button.active+.tab-button:not(.active) {
  border-radius: 0 0 0 20px !important;
}

/* Apply radius to the bottom-right of the tab immediately BEFORE the active one in movement mode */
body:not(.liste-mode-active) #unified-content-box .dropzone-tabs .tab-button:not(.active):has(+ .tab-button.active) {
  border-radius: 0 0 20px 0 !important;
}

/* Tab content area with white background */
#unified-content-box .tab-content {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}



/* Mode-specific content visibility */
.mode-content {
  width: 100%;
  height: 100%;
  background: white;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* Add smooth transitions for mode switching */
#movement-content,
#liste-content {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
}

#movement-content.active,
#liste-content.active {
  opacity: 1;
  visibility: visible;
}



/* Content display adjustments */
#unified-content-box #content-display {
  flex: 1;
  overflow-y: auto;
  /* Hide scrollbar for the unified-box variant as well */
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  /* Hide scrollbars across browsers */
  -ms-overflow-style: none;
  /* IE and Edge */
  scrollbar-width: none;
  /* Firefox */
}

/* Paragraph styling with intro label - only for variable tab content - specifically for text content paragraphs */
body:not(.about-tab-active):not(.impressum-tab-active) #unified-content-box #content-display .project .text p {
  margin-left: 60px;
  /* Indent all paragraphs */
  margin-bottom: 1em;
  position: relative;
}

body:not(.about-tab-active):not(.impressum-tab-active) #unified-content-box #content-display .project .text p:first-of-type::before {
  content: "Intro";
  position: absolute;
  left: -60px;
  top: 0;
  font-weight: normal;
  color: #000;
  font-size: 0.8em;
  line-height: inherit;
}

.project-title {
  font-size: 40px;
  font-family: 'DenimINK-Medium', sans-serif;
}

@media screen and (max-width: 768px) {
  .project-title {
    font-size: 37px;
  }
}

.project.text {
  font-size: 18px;
  line-height: 130%;
}

@media screen and (max-width: 768px) {
  .project.text {
    font-size: 15px;
  }
}

/* Links in project text (but not inside figures) */
.project.text a:not(figure a) {
  opacity: 0.8;
  text-decoration: none;
}

.project.text a:not(figure a):hover {
  text-decoration: underline;
}

.project.text a:not(figure a)::after {
  content: "";
  display: inline-block;
  width: 0.85em;
  height: 0.85em;
  margin-left: 0.25em;
  vertical-align: -0.1em;
  background-color: currentColor;
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M20,6a9.9272,9.9272,0,0,0-3.9968.8394,9.9758,9.9758,0,0,1,2.2451,1.36,8,8,0,1,1,0,15.6016,9.9758,9.9758,0,0,1-2.2451,1.36A9.9976,9.9976,0,1,0,20,6Z'/%3E%3Cpath d='M12,16a8.01,8.01,0,0,0,6.2483,7.8008,9.9858,9.9858,0,0,0,0-15.6016A8.01,8.01,0,0,0,12,16Z'/%3E%3Cpath d='M10,16a10.0105,10.0105,0,0,1,6.0032-9.1606,10,10,0,1,0,0,18.3212A10.0105,10.0105,0,0,1,10,16Z'/%3E%3C/svg%3E");
  mask-size: contain;
  mask-repeat: no-repeat;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M20,6a9.9272,9.9272,0,0,0-3.9968.8394,9.9758,9.9758,0,0,1,2.2451,1.36,8,8,0,1,1,0,15.6016,9.9758,9.9758,0,0,1-2.2451,1.36A9.9976,9.9976,0,1,0,20,6Z'/%3E%3Cpath d='M12,16a8.01,8.01,0,0,0,6.2483,7.8008,9.9858,9.9858,0,0,0,0-15.6016A8.01,8.01,0,0,0,12,16Z'/%3E%3Cpath d='M10,16a10.0105,10.0105,0,0,1,6.0032-9.1606,10,10,0,1,0,0,18.3212A10.0105,10.0105,0,0,1,10,16Z'/%3E%3C/svg%3E");
  -webkit-mask-size: contain;
  -webkit-mask-repeat: no-repeat;
}

/* Project meta styling - only for variable tab content */
body:not(.about-tab-active):not(.impressum-tab-active) #unified-content-box #content-display .project-meta {
  margin: 0 auto 20px auto !important;
  text-align: center;
  font-size: 1em;
  line-height: 1.2;
  opacity: 0.5;
}

@media screen and (max-width: 768px) {
  body:not(.about-tab-active):not(.impressum-tab-active) #unified-content-box #content-display .project-meta {
    font-size: 13px;

  }
}


/* Project credits styling - only for variable tab content */
body:not(.about-tab-active):not(.impressum-tab-active) #unified-content-box #content-display .project-credits {
  margin-top: 2em;
  margin-bottom: 1em;
}

body:not(.about-tab-active):not(.impressum-tab-active) #unified-content-box #content-display .credits-intro {
  position: relative;
}

body:not(.about-tab-active):not(.impressum-tab-active) #unified-content-box #content-display .credits-label {
  position: absolute;
  left: 0;
  top: 5px;
  font-weight: normal;
  color: #000;
  font-size: 0.8em;
  line-height: inherit;
}

body:not(.about-tab-active):not(.impressum-tab-active) #unified-content-box #content-display .credits-content {
  margin-left: 60px;
}

@media screen and (max-width: 768px) {
  body:not(.about-tab-active):not(.impressum-tab-active) #unified-content-box #content-display .credits-content {
    font-size: 14px;
  }
}

body:not(.about-tab-active):not(.impressum-tab-active) #unified-content-box #content-display .credit-entry {
  margin-bottom: 1em;
}

body:not(.about-tab-active):not(.impressum-tab-active) #unified-content-box #content-display .credit-name {
  font-weight: normal;
  line-height: 1.4;
}

body:not(.about-tab-active):not(.impressum-tab-active) #unified-content-box #content-display .credit-name a {
  text-decoration: none;
}

body:not(.about-tab-active):not(.impressum-tab-active) #unified-content-box #content-display .credit-name a:hover {
  text-decoration: underline;
}

body:not(.about-tab-active):not(.impressum-tab-active) #unified-content-box #content-display .credit-name a::after {
  content: "";
  display: inline-block;
  width: 0.85em;
  height: 0.85em;
  margin-left: 0.25em;
  vertical-align: -0.1em;
  background-color: currentColor;
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M20,6a9.9272,9.9272,0,0,0-3.9968.8394,9.9758,9.9758,0,0,1,2.2451,1.36,8,8,0,1,1,0,15.6016,9.9758,9.9758,0,0,1-2.2451,1.36A9.9976,9.9976,0,1,0,20,6Z'/%3E%3Cpath d='M12,16a8.01,8.01,0,0,0,6.2483,7.8008,9.9858,9.9858,0,0,0,0-15.6016A8.01,8.01,0,0,0,12,16Z'/%3E%3Cpath d='M10,16a10.0105,10.0105,0,0,1,6.0032-9.1606,10,10,0,1,0,0,18.3212A10.0105,10.0105,0,0,1,10,16Z'/%3E%3C/svg%3E");
  mask-size: contain;
  mask-repeat: no-repeat;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M20,6a9.9272,9.9272,0,0,0-3.9968.8394,9.9758,9.9758,0,0,1,2.2451,1.36,8,8,0,1,1,0,15.6016,9.9758,9.9758,0,0,1-2.2451,1.36A9.9976,9.9976,0,1,0,20,6Z'/%3E%3Cpath d='M12,16a8.01,8.01,0,0,0,6.2483,7.8008,9.9858,9.9858,0,0,0,0-15.6016A8.01,8.01,0,0,0,12,16Z'/%3E%3Cpath d='M10,16a10.0105,10.0105,0,0,1,6.0032-9.1606,10,10,0,1,0,0,18.3212A10.0105,10.0105,0,0,1,10,16Z'/%3E%3C/svg%3E");
  -webkit-mask-size: contain;
  -webkit-mask-repeat: no-repeat;
}

body:not(.about-tab-active):not(.impressum-tab-active) #unified-content-box #content-display .credit-role {
  font-weight: normal;
  line-height: 1.4;
  margin-bottom: 0;
  opacity: 0.5;
}

/* Project meta styling for liste content - only for variable tab */
body:not(.about-tab-active):not(.impressum-tab-active) #unified-content-box .liste-content-display .project-meta {
  margin: 0 auto !important;
}

body:not(.about-tab-active):not(.impressum-tab-active) #unified-content-box .liste-content-display .project-meta-line {
  margin: 0 auto;
  position: relative;
  font-weight: normal;
}


/* Project credits styling for liste content - only for variable tab */
body:not(.about-tab-active):not(.impressum-tab-active) #unified-content-box .liste-content-display .project-credits {
  margin-top: 2em;
  margin-bottom: 1em;
}

body:not(.about-tab-active):not(.impressum-tab-active) #unified-content-box .liste-content-display .credits-intro {
  position: relative;
}

body:not(.about-tab-active):not(.impressum-tab-active) #unified-content-box .liste-content-display .credits-label {
  position: absolute;
  left: 0;
  top: 0;
  font-weight: normal;
  color: #000;
  font-size: 0.8em;
  line-height: inherit;
}

body:not(.about-tab-active):not(.impressum-tab-active) #unified-content-box .liste-content-display .credits-content {
  margin-left: 60px;
}

body:not(.about-tab-active):not(.impressum-tab-active) #unified-content-box .liste-content-display .credit-entry {
  margin-bottom: 1em;
}

body:not(.about-tab-active):not(.impressum-tab-active) #unified-content-box .liste-content-display .credit-name {
  font-weight: normal;
  line-height: 1.4;
}

body:not(.about-tab-active):not(.impressum-tab-active) #unified-content-box .liste-content-display .credit-name a {
  text-decoration: none;
}

body:not(.about-tab-active):not(.impressum-tab-active) #unified-content-box .liste-content-display .credit-name a:hover {
  text-decoration: underline;
}

body:not(.about-tab-active):not(.impressum-tab-active) #unified-content-box .liste-content-display .credit-name a::after {
  content: "";
  display: inline-block;
  width: 0.85em;
  height: 0.85em;
  margin-left: 0.25em;
  vertical-align: -0.1em;
  background-color: currentColor;
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M20,6a9.9272,9.9272,0,0,0-3.9968.8394,9.9758,9.9758,0,0,1,2.2451,1.36,8,8,0,1,1,0,15.6016,9.9758,9.9758,0,0,1-2.2451,1.36A9.9976,9.9976,0,1,0,20,6Z'/%3E%3Cpath d='M12,16a8.01,8.01,0,0,0,6.2483,7.8008,9.9858,9.9858,0,0,0,0-15.6016A8.01,8.01,0,0,0,12,16Z'/%3E%3Cpath d='M10,16a10.0105,10.0105,0,0,1,6.0032-9.1606,10,10,0,1,0,0,18.3212A10.0105,10.0105,0,0,1,10,16Z'/%3E%3C/svg%3E");
  mask-size: contain;
  mask-repeat: no-repeat;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M20,6a9.9272,9.9272,0,0,0-3.9968.8394,9.9758,9.9758,0,0,1,2.2451,1.36,8,8,0,1,1,0,15.6016,9.9758,9.9758,0,0,1-2.2451,1.36A9.9976,9.9976,0,1,0,20,6Z'/%3E%3Cpath d='M12,16a8.01,8.01,0,0,0,6.2483,7.8008,9.9858,9.9858,0,0,0,0-15.6016A8.01,8.01,0,0,0,12,16Z'/%3E%3Cpath d='M10,16a10.0105,10.0105,0,0,1,6.0032-9.1606,10,10,0,1,0,0,18.3212A10.0105,10.0105,0,0,1,10,16Z'/%3E%3C/svg%3E");
  -webkit-mask-size: contain;
  -webkit-mask-repeat: no-repeat;
}

body:not(.about-tab-active):not(.impressum-tab-active) #unified-content-box .liste-content-display .credit-role {
  font-weight: normal;
  line-height: 1.4;
  margin-bottom: 0.1em;
}

/* === Mobile quick fixes (2024-06-18) === */
/* duplicate 2024-06-18 quick-fix block removed – rules consolidated above */

/* === Rules migrated from inline <style> block in home.php === */


#unified-project-display {
  display: block !important;
  height: 100%;
  position: relative;
  padding: 10px 10px;
  background-color: #F5FFD3;
}

/* About and Impressum content styling */
body.about-tab-active #content-display,
body.impressum-tab-active #content-display {
  background: #F5FFD3 !important;
  border-radius: 10px;
}

/* About page avatar styling */
body.about-tab-active #content-display .about-avatar {
  margin: 0 0 1.5rem 0;
  padding: 0;
}

body.about-tab-active #content-display .about-avatar img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 10px;
  object-fit: cover;
  filter: grayscale(1) contrast(0.7) sepia(0.3) hue-rotate(120deg) saturate(0.8);
}

/* Style impressum title to match project titles */
body.impressum-tab-active #content-display h1 {
  font-size: 40px;
  font-family: 'DenimINK-Medium', sans-serif;
}

@media screen and (max-width: 768px) {
  body.impressum-tab-active #content-display h1 {
    font-size: 37px;
  }
}

/* Unified content display styling for loading and error states */
#content-display .loading {
  text-align: center;
  color: #666;
  font-style: italic;
  padding: 20px;
}

#content-display .error {
  text-align: center;
  color: #d32f2f;
  font-style: italic;
  padding: 20px;
}

/* Hide dropzone in Liste mode */
body.liste-mode-active #drop-here {
  display: none !important;
}

/* Placeholder text when no project selected in Liste mode */
body.liste-mode-active #content-display:empty::before {
  content: var(--liste-placeholder, "Select a project from the list to view details");
  display: block;
  text-align: center;
  font-size: 1.2rem;
  color: #666;
  padding: 20px;
}

/* Placeholder text when no dot dragged in Movement mode */
body:not(.liste-mode-active) #content-display:empty::before {
  content: var(--movement-placeholder, "Drag a dot from the map to view project details");
  display: block;
  text-align: center;
  font-size: 1.2rem;
  color: #3f3f3f;
  padding: 20px;
}

body:not(.liste-mode-active) .variable-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 20px 0 20px !important;
  min-height: 48px;
  max-height: 48px;
  height: 48px;
  position: relative;
  top: 0;
  transition: top 0.3s ease-in-out;
  border-radius: 10px;
  transition: top 0.3s ease-in-out;
}

/* Ensure variable tab has consistent height in List mode too */
body.liste-mode-active .variable-tab {
  min-height: 48px;
  max-height: 48px;
  height: 48px;
  padding-top: 6px !important;
}

.hier-text {
  font-weight: normal;
}

/* Variable tab content background in list mode */
body.liste-mode-active #variable-tab {
  background-color: #F5FFD3 !important;
}

/* Variable tab content background in movement mode */
body:not(.liste-mode-active) #variable-tab.active {
  background-color: #F5FFD3 !important;
}

/* Image styling in content display - only for variable tab */
body:not(.about-tab-active):not(.impressum-tab-active) #unified-content-box #content-display img {
  width: 85% !important;
  max-width: 85%;
  height: auto;
  margin-left: 0;
  display: block;
  border-radius: 10px;
  /* Convert to grayscale, reduce contrast, add sepia tone to add back some color (tint won't work without this), shift to green hue, adjust saturation */
  filter: grayscale(1) contrast(0.7) sepia(0.3) hue-rotate(120deg) saturate(0.8) !important;
}

/* Lightbox links for images in variable tab - content display */
body:not(.about-tab-active):not(.impressum-tab-active) #unified-content-box #content-display a:has(img) {
  text-decoration: none;
}

body:not(.about-tab-active):not(.impressum-tab-active) #unified-content-box #content-display a img {
  cursor: zoom-in;
}

/* GLightbox: no z-index overrides needed — default container z-index (999999) already above all site layers */
.glightbox-container .gslide-media {
  overflow: hidden !important;
}

.glightbox-clean .gclose,
.glightbox-clean .gnext,
.glightbox-clean .gprev {
  z-index: 99999 !important;
}

/* Hide arrows when lightbox has only one image */
body.glightbox-single .glightbox-clean .gprev,
body.glightbox-single .glightbox-clean .gnext {
  display: none !important;
}

/* Let images fill the viewport, leaving room for nav arrows */
.glightbox-clean .ginner-container {
  max-width: calc(100vw - 120px) !important;
}

.glightbox-container .gslide-media img {
  max-width: calc(100vw - 120px) !important;
  max-height: calc(100vh - 60px) !important;
  width: auto;
  height: auto;
  object-fit: contain !important;
  filter: none !important;
}

/* Mobile: full-width images with bottom navigation arrows */
@media (max-width: 768px) {
  .glightbox-clean .ginner-container {
    max-width: 100vw !important;
  }

  .glightbox-container .gslide-media img {
    max-width: 100vw !important;
    max-height: calc(100vh - 120px) !important;
  }

  .glightbox-clean .gprev,
  .glightbox-clean .gnext {
    display: flex !important;
    position: fixed !important;
    top: auto !important;
    bottom: 30px !important;
    width: 50px !important;
    height: 50px !important;
    transform: none !important;
  }

  .glightbox-clean .gprev {
    left: calc(50% - 70px) !important;
    right: auto !important;
  }

  .glightbox-clean .gnext {
    right: calc(50% - 70px) !important;
    left: auto !important;
  }
}

.tab-button.active.variable-tab {
  border-radius: 20px 20px 0 0;
}

.tab-button.active.about-tab {
  border-radius: 0 20px 20px 0;
}

.dropzone-tabs:has(.tab-button.active.about-tab) .tab-button.variable-tab {
  border-radius: 0 0 0 20px;
}

.dropzone-tabs:has(.tab-button.active.impressum-tab) .tab-button.variable-tab {
  border-radius: 0 0 20px 0;
}

.dropzone-tabs:has(.tab-button.active.variable-tab) .tab-button.about-tab {
  border-radius: 0 0 20px 0;
}

.dropzone-tabs:has(.tab-button.active.variable-tab) .tab-button.impressum-tab {
  border-radius: 0 0 0 20px;
}
