/* Fonts */
@font-face {
  font-family: "ZT Nature";
  src: url("fonts/ZTNature-Medium-web.woff2");
  src:
    url("fonts/ZTNature-Medium-web.woff2") format("woff2"),
    url("fonts/ZTNature-Medium.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

html {
  box-sizing: border-box;
  height: 100%;
}

*,
*::before,
*::after {
  box-sizing: inherit;
}

body {
  margin: 0;
  min-height: 100vh;
  height: 100%;
  overflow: hidden;
  font-family: "ZT Nature", Arial, Helvetica, sans-serif;
  font-size: 6px;
  color: #595959;
  background: #ffffff;
}

button,
summary {
  font: inherit;
  color: inherit;
  text-transform: uppercase;
}

button {
  border: 0;
}

/* Base Layout */
.site {
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 20px 20px 24px;
  gap: 18px;
}

.site-header {
  position: relative;
  z-index: 2;
  flex: 0 0 auto;
}

.site-home-link {
  display: none;
  padding: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

/* Navigation */
.cat-nav-desktop {
  display: none;
}

.cat-nav-mobile {
  display: flex;
  justify-content: flex-start;
}

.cat-dropdown {
  position: relative;
  display: inline-flex;
}

.cat-dropdown[open] .cat-dropdown-trigger {
  visibility: hidden;
}

.cat-dropdown-trigger {
  list-style: none;
  display: inline-flex;
  align-items: center;
  padding: 6px 12px 7px;
  font-size: 17px;
  line-height: 1;
  background: #f0f0f0;
  cursor: pointer;
}

.cat-dropdown-trigger::-webkit-details-marker {
  display: none;
}

.cat-dropdown-list {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 10;
  min-width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.96);
}

.cat-button {
  background: transparent;
  padding: 6px 12px 7px;
  font-size: 17px;
  line-height: 1;
  text-align: left;
  cursor: pointer;
}

.cat-button.is-active {
  background: #f0f0f0;
}

/* Gallery Base */
.gallery {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  gap: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  scrollbar-width: none;
  -ms-overflow-style: none;
  overscroll-behavior-x: contain;
  overscroll-behavior-y: none;
  cursor: none;
}

.gallery::-webkit-scrollbar {
  display: none;
}

.gallery * {
  cursor: none;
}

.gallery-cursor {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 20;
  display: none;
  width: 28px;
  height: 28px;
  pointer-events: none;
  transform: translate(-50%, -50%);
  object-fit: contain;
}

.gallery-cursor.is-visible {
  display: block;
}

.gallery-panel {
  flex: 0 0 100%;
  width: 100%;
  min-width: 100%;
  height: 100%;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 0 8px;
}

.panel-frame {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  align-items: center;
  justify-items: center;
  padding: 12px 0;
}

.panel-frame.is-paired {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.work {
  margin: 0;
  width: 100%;
  max-width: 100%;
  height: 100%;
  max-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 0;
}

.work-pan {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.work-image {
  display: block;
  width: auto;
  height: auto;
  max-width: min(100%, calc(100vw - 40px));
  max-height: calc(100vh - 110px);
  object-fit: contain;
}

/* Mobile Layout */
@media (max-width: 899px) {
  .site {
    position: relative;
    height: 100dvh;
    gap: 0;
  }

  .site-header {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 6;
  }

  .gallery {
    height: 100%;
    gap: 18px;
    padding-right: 18px;
  }

  .gallery-panel {
    flex: 0 0 calc(100% - 18px);
    width: calc(100% - 18px);
    min-width: calc(100% - 18px);
    padding: 0 0 12px;
  }

  .panel-frame {
    padding: 12px 0 16px;
  }

  .panel-frame.is-paired {
    grid-template-columns: 1fr;
    grid-template-rows: repeat(2, minmax(0, 1fr));
    gap: 18px;
  }

  .work-pan {
    max-height: 100%;
  }

  .work-image {
    max-width: min(100%, calc(100vw - 40px));
    max-height: 100%;
  }
}

/* Desktop Layout */
@media (min-width: 900px) {
  .site {
    flex-direction: row;
    align-items: stretch;
    width: min(100%, 1500px);
    margin: 0 auto;
    padding: 36px 40px;
    gap: 36px;
  }

  .site-header {
    width: 152px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    flex: 0 0 152px;
    justify-content: center;
  }

  .site-home-link {
    display: block;
    position: fixed;
    top: 36px;
    left: 100px;
    z-index: 8;
    width: auto;
    max-width: calc(100vw - 80px);
    font-family: "ZT Nature", Arial, Helvetica, sans-serif;
    font-size: 17px;
    line-height: 1;
    white-space: nowrap;
  }

  .menu {
    position: fixed;
    top: 128px;
    left: 100px;
    z-index: 8;
  }

  .cat-nav-mobile {
    display: none;
  }

  .cat-nav-desktop {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    width: auto;
  }

  .cat-nav-desktop .cat-button {
    align-self: flex-start;
    padding: 8px 10px 9px;
    font-family: "ZT Nature", Arial, Helvetica, sans-serif;
    font-size: 14px;
    line-height: 1;
  }

  .gallery {
    flex: 1 1 auto;
    min-width: 0;
    padding-right: 0;
    overflow: hidden;
    scroll-behavior: auto;
    scroll-snap-type: none;
  }

  .gallery-track {
    display: flex;
    flex: 0 0 100%;
    width: 100%;
    height: 100%;
    will-change: transform;
  }

  .gallery.is-desktop-interaction-locked {
    pointer-events: none;
  }

  .gallery-panel {
    padding: 0;
  }

  .panel-frame.is-paired {
    gap: 24px;
  }

  .panel-frame.is-paired .work-image {
    max-width: min(100%, calc((100vw - 304px) / 2));
  }

  .work-image {
    max-width: min(100%, calc(100vw - 304px));
    max-height: calc(100vh - 96px);
  }
}
