/* CSS Reset & Custom Font */
@font-face {
  font-family: 'TWKLausanne';
  src: url('../fonts/TWKLausanne-350.ttf') format('truetype');
  font-weight: 350;
  font-style: normal;
}

@font-face {
  font-family: 'TWKLausanne';
  src: url('../fonts/TWKLausanne-350Italic.ttf') format('truetype');
  font-weight: 350;
  font-style: italic;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

[hidden] {
  display: none !important;
}

body {
  font-family: 'TWKLausanne', -apple-system, BlinkMacSystemFont, sans-serif;
  background: #F2F2F2;
  color: #222222;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  width: 100%;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Exhibition Detail Page overrides */
body.exhibition-page {
  overflow-y: auto;
  height: auto;
}

.exhibition-shell {
  width: 100%;
  padding: 0 clamp(8px, 3vw, 24px) 110px; /* Responsive Padding wie app-shell */
}

.exh-title {
  font-size: 22px;
  font-weight: 350;
  color: #151515;
  line-height: 1.15;
  margin: 28px 0 12px;
  padding: 0 clamp(8px, 1.5vw, 12px);
}

.exh-artists {
  font-size: 18px;
  font-weight: 350;
  color: #151515;
  line-height: 1.2;
  margin: 0 0 12px;
  padding: 0 clamp(8px, 1.5vw, 12px);
}

.exh-date {
  font-size: 18px;
  font-weight: 350;
  color: #151515;
  line-height: 1.2;
  margin: 0 0 24px;
  padding: 0 clamp(8px, 1.5vw, 12px);
}

.exh-body p {
  font-size: 16px;
  font-weight: 350;
  color: #222222;
  line-height: 1.35;
  margin: 0 0 16px;
  padding: 0 clamp(8px, 1.5vw, 12px);
}

/* Screens Container */
.screens-container {
  position: relative;
  flex: 1;
  width: 100%;
  overflow: hidden;
}

/* Screen Container */
.screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: #F2F2F2;
  opacity: 0;
  transform: translateX(100%) translateZ(0);
  transition: transform 0.3s ease-out, opacity 0.3s ease-out;
  -webkit-transition: -webkit-transform 0.3s ease-out, opacity 0.3s ease-out;
  pointer-events: none;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-top: 20px;
  box-sizing: border-box;
  will-change: transform, opacity;
  -webkit-transform: translateX(100%) translateZ(0);
}

.screen.active {
  opacity: 1;
  transform: translateX(0) translateZ(0);
  -webkit-transform: translateX(0) translateZ(0);
  transition: transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94), opacity 0.35s ease;
  -webkit-transition: -webkit-transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94), opacity 0.35s ease;
  pointer-events: all;
  z-index: 10;
}

/* iOS-Style Slide Transitions: Alte und neue Seite gleiten gleichzeitig */

/* Exit-Animationen: Alte Seite gleitet mit (keine opacity-Änderung) */
.screen.exit-left {
  transform: translateX(-30%) translateZ(0);
  -webkit-transform: translateX(-30%) translateZ(0);
  opacity: 1;
  transition: transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94), opacity 0.35s ease;
  -webkit-transition: -webkit-transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94), opacity 0.35s ease;
  z-index: 9;
}

.screen.exit-right {
  transform: translateX(0) translateZ(0);
  -webkit-transform: translateX(0) translateZ(0);
  opacity: 1;
  transition: transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94), opacity 0.35s ease;
  -webkit-transition: -webkit-transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94), opacity 0.35s ease;
  z-index: 9;
}

/* Eintritts-Animationen: Neue Seite schiebt sich drüber */
.screen.enter-right {
  transform: translateX(100%) translateZ(0);
  -webkit-transform: translateX(100%) translateZ(0);
  opacity: 1;
  transition: transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94), opacity 0.35s ease;
  -webkit-transition: -webkit-transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94), opacity 0.35s ease;
  z-index: 10;
}

.screen.enter-right.active {
  transform: translateX(0) translateZ(0);
  -webkit-transform: translateX(0) translateZ(0);
  opacity: 1;
  transition: transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94), opacity 0.35s ease;
  -webkit-transition: -webkit-transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94), opacity 0.35s ease;
}

.screen.enter-left {
  transform: translateX(-100%) translateZ(0);
  -webkit-transform: translateX(-100%) translateZ(0);
  opacity: 1;
  transition: transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94), opacity 0.35s ease;
  -webkit-transition: -webkit-transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94), opacity 0.35s ease;
  z-index: 10;
}

.screen.enter-left.active {
  transform: translateX(0) translateZ(0);
  -webkit-transform: translateX(0) translateZ(0);
  opacity: 1;
  transition: transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94), opacity 0.35s ease;
  -webkit-transition: -webkit-transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94), opacity 0.35s ease;
}

/* Header */
.app-shell {
  width: 100%;
  padding: 0 clamp(8px, 3vw, 24px); /* Responsive Padding: 8px min, 3vw fluid, 24px max */
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start; /* Logo-Oberkante bündig mit Menü-Button */
  padding: 24px clamp(8px, 2vw, 16px) 12px;
  position: relative;
  z-index: 10;
  margin-bottom: 20px; /* mehr Abstand vor der Sektion */
}

.logo {
  font-size: 24px;
  font-weight: 350;
  color: #000;
  line-height: 1.05;
}

.burger-menu {
  width: 30px;
  height: 30px;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.burger-menu img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Section Title */
.section-title {
  font-size: 18px;
  font-weight: 350;
  color: #222222;
  padding: 0 clamp(8px, 2vw, 16px);
  margin: 8px 0 12px; /* zusätzlicher Abstand zum Logo-Bereich */
}

/* Image Slider */
.image-slider {
  position: relative;
  width: 100%;
  padding: 0 clamp(6px, 1.5vw, 12px);
  margin-bottom: 28px;
}

.slider-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 26px;
  height: 27px;
  border: none;
  background: transparent;
  cursor: pointer;
  z-index: 5;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.85;
}

.slider-arrow-left {
  left: 0;
}

.slider-arrow-right {
  right: 0;
}

.slider-arrow img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.slider-container {
  width: 304px;
  height: 209px;
  margin: 0 auto;
  background: #D9D9D9;
  border-radius: 0;
  overflow: hidden;
  touch-action: pan-y; /* Erlaubt vertikales Scrollen, aber blockt horizontales für saubere Swipes */
  position: relative;
}

.slider-track {
  display: flex;
  width: 100%;
  height: 100%;
  transition: transform 0.3s ease;
}

.slider-item {
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.slider-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 0;
}

/* Dot Indicators */
.slider-dots {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #c4c4c4;
}

.dot.active {
  background: #666;
}

.intro-text {
  font-size: 18px;
  line-height: 1.35;
  color: #222222;
  padding: 0 clamp(8px, 2vw, 16px) 24px;
}

/* Tab Navigation */
.tab-navigation {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 76px;
  background: #DFDFDF;
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 6px 12px 7px;
  z-index: 1000; /* Über alles */
  box-sizing: border-box;
}

.tab-button {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 4px;
  transition: opacity 0.2s;
}

.tab-button img {
  width: 29px;
  height: 29px;
  object-fit: contain;
}

.tab-button span {
  font-size: 14px;
  color: #222222;
  font-weight: 350;
  text-align: center;
}

/* ====== CAMERA SCREEN ====== */

.scan-title {
  font-size: 22px;
  font-weight: 350;
  color: #222222;
  text-align: center;
  line-height: 1.2;
  margin: 32px auto 24px;
  padding: 0 clamp(12px, 2vw, 16px);
  transform: translateY(5vh);
}

.camera-box {
  width: 312px;
  height: 369px;
  margin: 0 auto 16px;
  background: #D9D9D9;
  border-radius: 5px;
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: translateY(5vh);
}

#videoElement {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#canvasElement {
  display: none;
}

/* Artwork Info (unter dem Kamera-Kasten) */
.artwork-info {
  width: 312px;
  margin: 0 auto;
  text-align: center;
  min-height: 40px;
  transform: translateY(5vh);
}

.artwork-text {
  font-size: 14px;
  font-weight: 350;
  color: #222222;
  line-height: 1.6;
  white-space: pre-line; /* Erlaubt Zeilenumbrüche */
}

/* ====== NUMBER SCREEN ====== */

.number-screen {
  width: 100%;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 114px clamp(16px, 5vw, 32px) 100px;
  transform: translateY(-5vh);
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: pan-x pan-y;
}

.number-results-heading {
  position: absolute;
  top: 20px;
  left: 0px;
  font-size: 16px;
  font-weight: 350;
  color: #8C8C8C;
  line-height: 25px;
  margin: 0;
  text-align: left;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.number-results-heading.visible {
  opacity: 1;
  pointer-events: auto;
}

.number-shell {
  width: 100%;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  padding: 0 clamp(8px, 2.5vw, 16px);
}

.number-heading {
  font-size: 22px;
  font-weight: 350;
  color: #222222;
  line-height: 1.1;
  margin: 0;
}

.number-results {
  width: 323px;
  height: 113px;
  padding: 0;
  position: relative;
  transform: translateY(5vh);
}

.number-state {
  width: 100%;
  height: 100%;
}

.number-state-empty {
  display: flex;
  align-items: center;
  justify-content: center;
}

.number-state-found {
  display: flex;
  align-items: center;
  height: 100%;
}

.number-results::before,
.number-results::after {
  content: '';
  position: absolute;
  left: -3%;
  width: 106%;
  height: 1px;
  background: #C8C8C8;
}

.number-results::before {
  top: 0;
}

.number-results::after {
  bottom: 0;
}

.number-result-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 17px;
  padding: 15px 0 21px;
}

.number-result-thumb {
  width: 105px;
  height: 77px;
  border-radius: 4px;
  overflow: hidden;
  flex-shrink: 0;
}

.number-result-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.number-result-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  gap: 4px;
  padding-top: 2px;
}

.number-result-artist,
.number-result-title {
  font-size: 18px;
  line-height: 25px;
  font-weight: 350;
  color: #222222;
  margin: 0;
}

.number-display {
  width: 287px;
  font-size: 40px;
  font-weight: 400;
  letter-spacing: 0.18em;
  line-height: 1;
  text-align: center;
  margin-top: calc(74px + 5vh);
  transition: color 0.2s ease;
}

.number-display-empty {
  color: #343434;
}

.number-display-filled {
  color: #222222;
}

.number-pad {
  width: 216.2px; /* 188px * 1.15 */
  display: grid;
  grid-template-columns: repeat(3, 59.225px); /* 51.5px * 1.15 */
  grid-auto-rows: 57.914px; /* 50.36px * 1.15 */
  column-gap: 16.25px;
  row-gap: 16.25px;
  margin-top: 45px;
}

.number-key,
.number-action {
  width: 100%;
  height: 100%;
  border-radius: 11.5px; /* 10px * 1.15 */
  border: 1px solid #979797;
  background: #F2F2F2;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 34.5px; /* 30px * 1.15 */
  font-weight: 350;
  color: #000000;
  cursor: pointer;
  transition: transform 0.12s ease;
}

.number-key:active,
.number-action:active {
  transform: scale(0.96);
}

.number-action[aria-disabled="true"] {
  cursor: default;
  opacity: 0.35;
}


.number-action img {
  width: 36.8px; /* 32px * 1.15 */
  height: 36.8px;
  object-fit: contain;
}

.number-action[data-action="delete"] img {
  width: 25.3px; /* 22px * 1.15 */
  height: 25.3px;
}

/* ====== LAGEPLAN SCREEN ====== */
.lageplan-screen {
  width: 100%;
  max-width: 340px;
  margin: 0 auto;
  padding: 83px 5px 120px 6px;
}

.lageplan-screen img {
  width: 329px;
  height: 508px;
  display: block;
  object-fit: contain;
}

/* Responsive Adjustments */
@media (min-width: 480px) {
  .slider-container {
    width: 308px;
    height: 196px;
  }
  .tab-button span {
    font-size: 12px;
  }
}

@media (min-width: 768px) {
  /* Vergrößere Text um ~50% auf Tablets */
  .logo {
    font-size: 36px;
  }
  
  .section-title {
    font-size: 27px;
  }
  
  .exh-title {
    font-size: 33px;
  }
  
  .exh-artists {
    font-size: 27px;
  }
  
  .exh-date {
    font-size: 27px;
  }
  
  .exh-body p {
    font-size: 24px;
  }
  
  .intro-text {
    font-size: 27px;
  }
  
  .scan-title {
    font-size: 33px;
  }
  
  .artwork-text {
    font-size: 21px;
  }
  
  /* UI-Elemente größer */
  .tab-button span {
    font-size: 16px;
  }
  
  .tab-button img {
    width: 40px;
    height: 40px;
  }
  
  .slider-arrow {
    width: 32px;
    height: 32px;
  }
  
  .tab-navigation {
    height: 88px;
  }
  
  /* Content Größer */
  .screen {
    padding-top: 30px;
  }
  
  .header {
    padding: 32px clamp(12px, 3vw, 20px) 16px;
  }
  
  .slider-container {
    width: 340px;
    height: 227px;
  }
  
  .camera-box {
    width: 360px;
    height: 427px;
  }
  
  .burger-menu {
    width: 40px;
    height: 40px;
  }

  .lageplan-screen {
    max-width: 400px;
    padding: 96px 12px 140px;
  }

  .lageplan-screen img {
    width: 360px;
    height: 556px;
  }
}
