/* ============================================
   RESPONSIVE & FONT SIZE STYLES
   durrerarchitekten.ch
   ============================================ */

/* Global font-size overrides removed — now mobile-only (see @media below) */

/* ============================================
   DESKTOP: Fast scroll cursor for image gallery
   ============================================ */
@media screen and (min-width: 1025px) {
  #images .scroll_container {
    cursor: grab !important;
  }
  #images .scroll_container:active {
    cursor: grabbing !important;
  }
}

/* ============================================
   LIGHTBOX STYLES (all screens)
   ============================================ */

#images .images .image,
#images .images .image img {
  cursor: pointer;
}

.lightbox-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  /* JS sets an explicit pixel height (window.innerHeight) on open; these are
     fallbacks. 100dvh tracks the dynamic viewport (excludes the mobile toolbar)
     so the image is always vertically centred in the visible area. */
  height: 100vh;
  height: 100dvh;
  background: rgba(0, 0, 0, 0.92);
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.25s ease;
  user-select: none;
  -webkit-user-select: none;
}

.lightbox-overlay.active {
  display: flex;
  opacity: 1;
}

.lightbox-image-wrapper {
  position: relative;
  max-width: 92vw;
  max-height: 88vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-image-wrapper img {
  max-width: 92vw;
  max-height: 88vh;
  object-fit: contain;
  display: block;
  border: none;
  box-shadow: none;
  transition: opacity 0.2s ease;
}

.lightbox-close {
  position: fixed;
  top: 16px;
  right: 20px;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  font-size: 28px;
  font-weight: 300;
  cursor: pointer;
  z-index: 10001;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding: 0;
  font-family: Helvetica, Arial, sans-serif;
  transition: color 0.15s ease;
}

.lightbox-close:hover {
  color: #fff;
}

.lightbox-nav {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  font-size: 32px;
  font-weight: 300;
  cursor: pointer;
  z-index: 10001;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-family: Helvetica, Arial, sans-serif;
  transition: color 0.15s ease;
}

.lightbox-nav:hover {
  color: #fff;
}

.lightbox-nav.prev {
  left: 12px;
}

.lightbox-nav.next {
  right: 12px;
}

.lightbox-counter {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.5);
  font-size: 12px;
  font-family: Helvetica, Arial, sans-serif;
  letter-spacing: 1px;
  z-index: 10001;
}

/* ============================================
   TABLET & MOBILE: up to 1024px
   ============================================ */
@media screen and (max-width: 1024px) {

  /* --- CORE: Clean mobile foundation --- */
  html, body {
    -webkit-overflow-scrolling: touch !important;
  }

  body {
    position: relative !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    -webkit-text-size-adjust: 100% !important;
    font-size: 16px !important;
  }

  p {
    font-size: 16px !important;
    line-height: 22px !important;
  }

  #page {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow-x: hidden !important;
    overflow-y: visible !important;
    position: relative !important;
  }

  #view {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    position: relative !important;
  }

  .box {
    position: relative !important;
    left: auto !important;
    top: auto !important;
    right: auto !important;
    bottom: auto !important;
    width: 100% !important;
    border: none !important;
  }

  /* ---- MENU ---- */
  #menu {
    order: 1 !important;
    position: relative !important;
    left: auto !important;
    top: auto !important;
    right: auto !important;
    width: 100% !important;
    height: auto !important;
    min-height: auto !important;
    z-index: 99 !important;
    border-bottom: none !important;
    border-top: none !important;
    padding-bottom: 12px !important;
    background-color: #fff !important;
  }

  /* Dark Mode: Menü-Hintergrund dunkel (überschreibt das #fff !important oben) */
  body.dark-mode #menu {
    background-color: #1e1e1e !important;
  }

  #menu .menu_box {
    position: relative !important;
    top: auto !important;
    width: 100% !important;
  }

  body.dark-mode #menu .menu_box {
    background-color: #1e1e1e !important;
  }

  /* Logo (schwarz auf transparent) im Dark Mode invertieren -> weiß */
  body.dark-mode #pagetitle img {
    filter: invert(1) brightness(2);
  }

  #menu .scroll_container {
    display: none !important;
    width: auto !important;
    margin-left: 20px !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }

  #menu .scroll_container.menu-open {
    display: block !important;
  }

  #menu .scroll_container .jspContainer {
    width: 100% !important;
    height: auto !important;
    overflow: visible !important;
  }

  #menu .scroll_container .jspPane {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    width: 100% !important;
    padding: 0 !important;
  }

  #menu .jspVerticalBar,
  #menu .jspHorizontalBar {
    display: none !important;
  }

  #menu ul {
    font-size: 14px !important;
    font-family: 'Lucida Grande', 'Lucida Sans Unicode', Verdana, Arial, sans-serif !important;
    font-weight: 400 !important;
    margin-left: 20px !important;
    margin-right: 20px !important;
    text-align: left !important;
  }

  #contents {
    font-size: 16px !important;
  }

  #menu ul ul {
    margin-left: 20px !important;
  }

  #menu ul li {
    margin-bottom: 2px !important;
    line-height: 1.5em !important;
  }

  #menu ul li a {
    display: inline-block !important;
    -webkit-tap-highlight-color: rgba(0,0,0,0.1) !important;
    word-spacing: 0 !important;
    letter-spacing: normal !important;
    white-space: nowrap !important;
  }

  .menuScroller {
    max-height: none !important;
  }

  #pagetitle {
    padding: 15px 10px 8px 10px !important;
    text-align: center !important;
  }

  /* ---- IMAGES: Native horizontal scroll ---- */
  #images {
    order: 2 !important;
    position: relative !important;
    left: auto !important;
    top: auto !important;
    right: auto !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    border-top: none !important;
    border-bottom: none !important;
    overflow: hidden !important;
  }

  /* The scroll_container IS the native scroll viewport on mobile */
  #images .scroll_container {
    width: 100% !important;
    height: auto !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    scroll-behavior: auto !important;
    cursor: default !important;
    -ms-overflow-style: none !important;
    scrollbar-width: none !important;
  }

  /* Hide native scrollbar on webkit */
  #images .scroll_container::-webkit-scrollbar {
    display: none !important;
    height: 0 !important;
  }

  /* Hide ALL jScrollPane chrome on mobile */
  #images .jspHorizontalBar,
  #images .jspVerticalBar,
  #images .jspTrack,
  #images .jspDrag,
  #images .jspCap {
    display: none !important;
  }

  /* jspContainer: pass-through, no clipping */
  #images .jspContainer {
    width: auto !important;
    height: auto !important;
    overflow: visible !important;
  }

  /* jspPane: static, flex row, no left offset */
  #images .jspPane {
    position: relative !important;
    left: 0 !important;
    top: 0 !important;
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    width: fit-content !important;
    height: auto !important;
    transform: none !important;
  }

  /* .allImgs wrapper becomes transparent */
  #images .allImgs {
    display: contents !important;
  }

  /* Each project container: hidden by default, shown via .mobile-active */
  #images .images {
    position: relative !important;
    left: auto !important;
    top: auto !important;
    height: auto !important;
    display: none !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    flex-shrink: 0 !important;
    gap: 5px !important;
    width: fit-content !important;
    margin-bottom: 0 !important;
  }

  /* Only active project is visible */
  #images .images.mobile-active {
    display: flex !important;
  }

  #images .images .image {
    height: auto !important;
    flex-shrink: 0 !important;
    cursor: pointer !important;
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  /* Images: auto height based on container, no fixed pixel height */
  #images .images .image img {
    height: 50vw !important;
    width: auto !important;
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    -webkit-user-drag: none !important;
    user-select: none !important;
    touch-action: pan-x !important;
  }

  /* ---- CONTENTS ---- */
  #contents {
    order: 3 !important;
    position: relative !important;
    left: auto !important;
    top: auto !important;
    right: auto !important;
    width: 100% !important;
    height: auto !important;
    min-height: 100px !important;
    z-index: 9 !important;
    border-bottom: none !important;
    resize: none !important;
  }

  #contents,
  #contents .scroll_container {
    width: 100% !important;
    height: auto !important;
    overflow: visible !important;
  }

  #contents .jspContainer {
    width: 100% !important;
    height: auto !important;
    overflow: visible !important;
  }

  #contents .jspPane {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    width: 100% !important;
  }

  #contents .content {
    width: auto !important;
    max-width: none !important;
    margin: 15px 20px !important;
    position: relative !important;
  }

  #contents .jspVerticalBar,
  #contents .jspHorizontalBar,
  #contents .jspTrack,
  #contents .jspDrag {
    display: none !important;
  }

  #contents p {
    line-height: 22px !important;
    font-size: 16px !important;
    margin-bottom: 6px !important;
  }

  #contents .content p.empty-line {
    min-height: 22px !important;
    line-height: 22px !important;
  }

  #contents .content p.project-title-heading,
  #contents .content p.project-title-heading + p.empty-line {
    display: block !important;
  }
  #contents .content p.project-title-heading {
    font-size: 16px !important;
    line-height: 22px !important;
    font-weight: 700;
  }

  #contents .content .title {
    font-size: 18px !important;
    line-height: 24px !important;
  }

  /* Lightbox mobile adjustments */
  .lightbox-nav {
    font-size: 26px;
    width: 40px;
    height: 40px;
  }

  .lightbox-nav.prev {
    left: 6px;
  }

  .lightbox-nav.next {
    right: 6px;
  }

  .lightbox-close {
    top: 10px;
    right: 12px;
    font-size: 24px;
  }
}

/* ---- Mobile: up to 768px ---- */
@media screen and (max-width: 768px) {

  body {
    font-size: 16px !important;
  }

  #menu {
    padding-bottom: 10px !important;
  }

  #menu ul {
    font-size: 14px !important;
    font-family: 'Lucida Grande', 'Lucida Sans Unicode', Verdana, Arial, sans-serif !important;
    font-weight: 400 !important;
    margin-left: 15px !important;
    margin-right: 15px !important;
  }

  #menu .scroll_container {
    margin-left: 15px !important;
  }

  #pagetitle {
    padding: 12px 8px 6px 8px !important;
  }

  /* Images: 50vw height (about 190px on 375px screen, 384px on 768px screen) */
  #images .images .image img {
    height: 55vw !important;
  }

  #contents .content {
    margin: 12px 15px !important;
  }

  #contents p {
    line-height: 22px !important;
    font-size: 16px !important;
  }
}

/* ---- Small mobile: up to 480px ---- */
@media screen and (max-width: 480px) {

  #pagetitle {
    padding: 10px 6px 4px 6px !important;
  }

  #pagetitle img {
    width: 160px !important;
    height: auto !important;
  }

  #menu ul {
    font-size: 16px !important;
    margin-left: 12px !important;
    margin-right: 12px !important;
  }

  #menu .scroll_container {
    margin-left: 12px !important;
  }

  /* Images: 60vw height (about 225px on 375px screen) */
  #images .images .image img {
    height: 60vw !important;
  }

  #contents .content {
    margin: 10px 12px !important;
  }

  #contents p {
    line-height: 22px !important;
    font-size: 16px !important;
  }
}
