/* =========================================================
   Halmstad bildvisare
   Ren style.css
   Version 20260715-2
   ========================================================= */

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  min-height: 100vh;
  overflow-x: hidden;
  background: #263238;

  color: #f2f2f2;
}

body {
  font-family: Arial, Helvetica, sans-serif;
}

/* Versionstext uppe till höger */
#versionInfo {
  position: fixed;
  top: 8px;
  right: 8px;
  z-index: 9999;

  font-size: 13px;
  color: white;
  background: rgba(0, 0, 0, 0.65);

  padding: 3px 7px;
  border-radius: 4px;
}

/* Hela visaren */
.viewer {
  width: 100%;
  max-width: 100vw;
  margin: 0 auto;
  padding: 8px 12px 20px 12px;

  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Rubrik */
.viewer h1 {
  order: 0;

  margin: 4px 0 8px 0;
  padding: 0;

  text-align: center;
  font-size: clamp(20px, 2.2vw, 32px);
  line-height: 1.2;
}

/* Bildområdet */
.image-area {
  order: 1;

  width: 100%;
  max-width: 100vw;

  margin: 0 auto;
  padding: 0;

  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Själva bilden */
#mainImage {
  order: 1;

  display: block;

  width: auto;
  height: auto;

  max-width: calc(100vw - 24px);
  max-height: 58vh;

  object-fit: contain;

  margin: 0 auto;
  padding: 0;

  background: transparent;
}

/* Bildtext */
.caption {
  order: 2;

  width: 100%;
  max-width: calc(100vw - 24px);

  margin: 10px auto 6px auto;
  padding: 0 12px;

  text-align: center;
  color: #f2f2f2;

  font-size: clamp(17px, 2vw, 30px);
  line-height: 1.25;

  min-height: 24px;
}

/* Bildräknare */
.counter {
  order: 3;

  margin: 4px auto 8px auto;
  padding: 0;

  text-align: center;
  color: #ccc;

  font-size: 17px;
}

/* Filterpanelen */
.filters {
  order: 2;

  width: auto;
  max-width: calc(100vw - 24px);

  margin: 6px auto 8px auto;
  padding: 10px 14px;

  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-end;
  gap: 10px 14px;

  background: rgba(30, 30, 30, 0.95);
  border-radius: 10px;
}

/* Filteretiketter */
.filters label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;

  color: white;
  font-size: 15px;
  line-height: 1.2;
}

/* Select och knappar */
select,
button {
  font-size: 16px;
  padding: 7px 10px;

  border-radius: 6px;
  border: 1px solid #555;

  box-sizing: border-box;
}

select {
  max-width: 170px;
}

button {
  cursor: pointer;
  background: #333;
  color: white;
}

button:hover {
  background: #555;
}

/* Bläddringsknappar */
.controls {
  order: 3;

  width: 100%;
  max-width: calc(100vw - 24px);

  margin: 6px auto 0 auto;
  padding: 0;

  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;

  background: transparent;
  border: none;
}

.controls button {
  font-size: 18px;
  padding: 8px 16px;
}

/* Hjälptext */
.help {
  order: 4;

  margin: 10px auto 0 auto;
  padding: 0;

  text-align: center;
  color: #aaa;
  font-size: 14px;
}

/* Mobilanpassning */
@media (max-width: 700px) {
  .viewer {
    padding: 8px 8px 18px 8px;
  }

  .viewer h1 {
    font-size: 22px;
    margin-bottom: 8px;
  }

  #mainImage {
    max-width: calc(100vw - 16px);
    max-height: 52vh;
  }

  .caption {
    font-size: 17px;
    padding: 0 8px;
  }

  .filters {
    width: 100%;
    max-width: calc(100vw - 16px);

    flex-direction: column;
    align-items: stretch;
    gap: 8px;

    padding: 10px;
  }

  .filters label {
    width: 100%;
    align-items: stretch;
    text-align: left;
  }

  select,
  button {
    width: 100%;
    max-width: none;
  }

  .controls {
    flex-direction: column;
    width: 100%;
  }

  .controls button {
    width: 100%;
  }
}

/* Version 20260715-2
   Fast bildruta så att kontrollerna inte hoppar vid panoramabilder
*/

#imageContainer,
#imageArea,
.image-area {
  width: 100vw;
  max-width: 100vw;
  height: 58vh;
  min-height: 58vh;
  max-height: 58vh;

  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);

  display: flex;
  justify-content: center;
  align-items: center;

  overflow: hidden;
}

#mainImage {
  display: block;

  width: auto;
  height: auto;

  max-width: 100vw;
  max-height: 100%;

  object-fit: contain;

  margin-left: auto;
  margin-right: auto;
}

/* Version 20260715-2
   Fast bildyta + reserverad bildtextrad.
   Hindrar att bildtexten hamnar under sök/filter.
*/

/* Bildområde */
#imageContainer,
#imageArea,
.image-area {
  width: 100vw !important;
  max-width: 100vw !important;

  height: 58vh !important;
  min-height: 58vh !important;
  max-height: 58vh !important;

  margin-left: calc(50% - 50vw) !important;
  margin-right: calc(50% - 50vw) !important;

  display: grid !important;
  grid-template-rows: minmax(0, 1fr) auto !important;

  align-items: center !important;
  justify-items: center !important;

  overflow: visible !important;
  box-sizing: border-box !important;
}

/* Själva bilden */
#mainImage {
  display: block !important;

  width: auto !important;
  height: auto !important;

  max-width: 100vw !important;
  max-height: calc(58vh - 42px) !important;

  object-fit: contain !important;

  margin-left: auto !important;
  margin-right: auto !important;

  grid-row: 1 !important;
}

/* Bildtext/caption - egen reserverad rad */
#caption,
#imageCaption,
#captionText,
.caption,
.image-caption {
  grid-row: 2 !important;

  min-height: 32px !important;
  line-height: 1.25 !important;

  padding: 4px 12px 8px 12px !important;
  margin: 0 !important;

  text-align: center !important;
  overflow: visible !important;

  box-sizing: border-box !important;
  z-index: 3 !important;
}

/* Flytta ned sök/filter lite så de inte ligger på bildtexten */
#filters,
#filterControls,
#filterSection,
#filterBar,
.search-controls,
.filter-controls,
.filters {
  margin-top: 18px !important;
  position: relative !important;
  z-index: 1 !important;
}

/* Lite luft även ovanför knappar/kontroller */
#controls,
#navControls,
#buttonControls,
.controls,
.nav-controls {
  margin-top: 8px !important;
}

/* Minska onödig luft under Tips/hjälptext */
#help,
#tips,
.help,
.tips {
  margin-top: 8px !important;
  margin-bottom: 0 !important;
  padding-bottom: 0 !important;
}

/* Mobil: något större text, men lite lägre bildyta */
@media (max-width: 700px) {
  #imageContainer,
  #imageArea,
  .image-area {
    height: 52vh !important;
    min-height: 52vh !important;
    max-height: 52vh !important;
  }

  #mainImage {
    max-height: calc(52vh - 44px) !important;
  }

  #caption,
  #imageCaption,
  #captionText,
  .caption,
  .image-caption {
    min-height: 34px !important;
    font-size: 14px !important;
  }

  #filters,
  #filterControls,
  #filterSection,
  #filterBar,
  .search-controls,
  .filter-controls,
  .filters {
    margin-top: 12px !important;
  }

  select,
  input,
  button {
    font-size: 16px !important;
  }
}

/* Version 20260715-2
   Flyttar ned hela bildpaketet.
   Minskar bildhöjden något.
   Ger bildtexten egen plats så bokstäver inte klipps.
*/

/* Rubrik överst ska aldrig täckas av bilden */
h1,
#title,
#pageTitle,
#galleryTitle,
.gallery-title {
  position: relative !important;
  z-index: 20 !important;
  margin-bottom: 22px !important;
}

/* Fast bildpaket, men flyttat ned */
#imageContainer,
#imageArea,
.image-area {
  width: 100vw !important;
  max-width: 100vw !important;

  height: 52vh !important;
  min-height: 52vh !important;
  max-height: 52vh !important;

  margin-top: 24px !important;
  margin-left: calc(50% - 50vw) !important;
  margin-right: calc(50% - 50vw) !important;
  margin-bottom: 0 !important;

  padding: 0 0 6px 0 !important;

  display: flex !important;
  flex-direction: column !important;
  justify-content: flex-start !important;
  align-items: center !important;

  box-sizing: border-box !important;
  overflow: visible !important;

  position: relative !important;
  z-index: 1 !important;
}

/* Bilden får inte ta hela bildpaketet, texten ska också få plats */
#mainImage {
  display: block !important;

  width: auto !important;
  height: auto !important;

  max-width: 100vw !important;
  max-height: calc(52vh - 56px) !important;

  object-fit: contain !important;

  margin: 0 auto !important;
  padding: 0 !important;

  position: relative !important;
  z-index: 1 !important;

  flex: 1 1 auto !important;
  min-height: 0 !important;
}

/* Bildtext / bildnamn ska ligga under bilden, inte inne i den */
#caption,
#imageCaption,
#captionText,
#imageTitle,
#imageName,
#filename,
.caption,
.image-caption {
  display: block !important;

  position: static !important;
  transform: none !important;
  top: auto !important;
  bottom: auto !important;
  left: auto !important;
  right: auto !important;

  width: 100% !important;
  max-width: 100vw !important;

  height: auto !important;
  min-height: 40px !important;
  max-height: none !important;

  line-height: 1.35 !important;
font-size: 20px !important;
font-weight: 600 !important;


  padding: 8px 12px 4px 12px !important;
  margin: 0 !important;

  text-align: center !important;
  white-space: normal !important;
  overflow: visible !important;

  box-sizing: border-box !important;
  z-index: 5 !important;

  flex: 0 0 auto !important;
}

/* Flytta ned sök/filter lite från bildtexten */
#filters,
#filterControls,
#filterSection,
#filterBar,
.search-controls,
.filter-controls,
.filters {
  margin-top: 22px !important;
  position: relative !important;
  z-index: 2 !important;
}

/* Kontrollerna får lite luft */
#controls,
#navControls,
#buttonControls,
.controls,
.nav-controls {
  margin-top: 10px !important;
  position: relative !important;
  z-index: 2 !important;
}

/* Minska onödig luft under Tips */
#help,
#tips,
.help,
.tips {
  margin-top: 8px !important;
  margin-bottom: 0 !important;
  padding-bottom: 0 !important;
}

/* Mobil */
@media (max-width: 700px) {
  h1,
  #title,
  #pageTitle,
  #galleryTitle,
  .gallery-title {
    margin-bottom: 14px !important;
  }

  #imageContainer,
  #imageArea,
  .image-area {
    height: 48vh !important;
    min-height: 48vh !important;
    max-height: 48vh !important;
    margin-top: 16px !important;
  }

  #mainImage {
    max-height: calc(48vh - 58px) !important;
  }

  #caption,
  #imageCaption,
  #captionText,
  #imageTitle,
  #imageName,
  #filename,
  .caption,
  .image-caption {
    min-height: 42px !important;
    font-size: 16px !important;
    line-height: 1.35 !important;
  }

  select,
  input,
  button {
    font-size: 16px !important;
  }

  #filters,
  #filterControls,
  #filterSection,
  #filterBar,
  .search-controls,
  .filter-controls,
  .filters {
    margin-top: 16px !important;
  }
}
.version-label {
  position: fixed;
  top: 4px;
  right: 6px;
  font-size: 8px;
  color: rgba(255, 255, 255, 0.35);
  z-index: 9999;
  pointer-events: none;
}

