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

@font-face {
  font-family: 'Hanken Grotesk';
  src: url('./Hanken_Grotesk/static/HankenGrotesk-Bold.ttf') format('woff2'),
       url('./fonts/HankenGrotesk-Regular.woff') format('woff');
  font-weight: 400;
  font-style: normal;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "San Francisco", "Helvetica Neue", sans-serif;
  background: #f0f0f3;
  margin: 0;
  padding: 0;
  overflow: visible;
  font-size: clamp(14px, 1.5vw, 18px);
}

.header-container {
  margin-bottom: 30px;
  width: 100%;
}

.layout-container {
  width: 100%;
  padding-left: clamp(16px, 5vw, 45px);
  padding-right: clamp(16px, 5vw, 45px);
}

.top-buttons {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  margin-top: 20px;
  padding-left: clamp(16px, 5vw, 45px);
  padding-right: clamp(16px, 5vw, 45px);
  width: 100%;
}

.top-buttons .menu-item {
  margin-top: 0;
  font-size: clamp(18px, 2vw, 24px);
  font-family: 'Hanken Grotesk', sans-serif;
  cursor: pointer;
  color: #0303ff;
  text-transform: uppercase;
  transition: color 0.2s ease;
}

.top-buttons .menu-item:hover {
  color: #000000;
  transform: scale(1.08);
  transition: transform 0.3s ease, color 0.3s ease;
}

.menu {
  display: flex;
  flex-wrap: nowrap;
  justify-content: space-between;
  gap: clamp(20px, 4vw, 60px);
}

.menu-item {
  color: #0303ff;
  font-size: clamp(14px, 2vw, 20px);
  font-family: 'Hanken Grotesk', sans-serif;
  cursor: pointer;
  text-align: center;
  margin-top: clamp(10px, 5vw, 20px);
  transition: color 0.2s ease;
  text-transform: uppercase;
}

.menu-item:hover {
  color: #000000;
  transform: scale(1.08);
  transition: transform 0.3s ease, color 0.3s ease;
}

.menu-item.active {
  color: #000000;
}

.menu-wrapper.layout-container {
  padding-left: clamp(16px, 5vw, 45px);
  padding-right: clamp(16px, 5vw, 45px);
}

.category-explanation {
  text-align: left;
  max-width: 800px;
  margin: 0 0 30px 0;
  font-size: clamp(14px, 1.2vw, 16px);
  color: #000000;
  padding-left: clamp(16px, 5vw, 45px);
  padding-right: clamp(8px, 2vw, 10px);
  line-height: 1.6;
  font-family: 'Hanken Grotesk', sans-serif;
}

#image-grid {
  position: relative;
  width: 100%;
}

.macbook-tile {
  position: absolute;
  width: 140px;
  height: 160px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  transform-origin: center center;
  transition: transform 0.3s ease;
  will-change: transform;
  z-index: 1;
}

.macbook-tile.hidden-until-positioned {
  visibility: hidden;
}

.macbook-tile img {
  max-width: 96px;
  max-height: 96px;
  width: auto;
  height: auto;
  border-radius: 5px;
  border: 4px solid white;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.08),
    0 2px 6px rgba(0, 0, 0, 0.15);
  background: white;
  margin-bottom: 8px;
  transition: max-width 0.3s ease, max-height 0.3s ease;
}

.macbook-tile.hover-zoom img {
  max-width: 240px !important;
  max-height: 240px !important;
  border-width: 2px !important;
}

.macbook-tile figcaption {
  text-align: center;
  font-size: clamp(10px, 1vw, 12px);
  color: #000000;
  margin-top: 4px;
  user-select: none;
  max-width: 110px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gallery-image.dim {
  filter: grayscale(100%);
  opacity: 0.4;
  transition: opacity 0.3s ease;
}

.gallery-image.highlight {
  filter: none;
  opacity: 1;
  transition: opacity 0.3s ease;
}

body.image-hover-active .macbook-tile:not(.hover-zoom) {
  filter: blur(5px) brightness(0.6);
  z-index: 0;
  pointer-events: none;
  transition: filter 0.3s ease;
}

.macbook-tile.hover-zoom {
  z-index: 999 !important;
}

.hover-hitbox {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: auto;
  background: transparent;
  z-index: 2;
}

.category-description {
  font-family: 'Hanken Grotesk', sans-serif;
  font-size: clamp(14px, 1.5vw, 16px);
  color: #0303ff;
  max-width: 800px;
  padding-left: clamp(16px, 5vw, 45px);
  padding-right: clamp(16px, 5vw, 45px);
  margin-top: 10px;
  margin-bottom: 30px;
  line-height: 1.6;
  text-align: left;
  display: none;
}

.top-buttons-with-description:hover:has(#left-button:hover) .category-description {
  display: block;
  transition: filter 0.3s ease;
}

.about-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  backdrop-filter: blur(8px) brightness(1);
  background-color: rgba(255, 255, 255, 0.631);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 40px 0;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 1000;
  transition: opacity 0.3s ease;
}

.about-overlay.hidden {
  display: none;
}

.about-content {
  background-color: transparent;
  padding: 20px clamp(16px, 5vw, 40px);
  max-width: 800px;
  width: 100%;
  overflow: visible;
  border-radius: 0;
  text-align: left;
  font-family: 'Hanken Grotesk', sans-serif;
  color: #0303ff;
  position: relative;
  box-shadow: none;
}

.about-content h2 {
  margin-top: 0;
  font-size: clamp(20px, 2.5vw, 28px);
  color: #0303ff;
}

.about-content p {
  font-size: clamp(14px, 1.5vw, 16px);
  line-height: 1.6;
  margin-bottom: 1em;
  font-style: normal;
}

.about-author p {
  font-size: clamp(14px, 1.5vw, 16px);
  line-height: 1.6;
  margin-bottom: 1em;
  font-style: normal;
  align-items: center;
  align-content: center;
  margin-left: auto;
  margin-right: auto;
  max-width: 800px;
  text-align: left;
}

.about-close {
  position: fixed;
  top: 20px;
  right: clamp(16px, 5vw, 45px);
  font-size: clamp(24px, 3vw, 32px);
  cursor: pointer;
  color: #0303ff;
  z-index: 1102;
}

body.about-active .macbook-tile,
body.about-active #image-grid,
body.about-active .menu-wrapper {
  filter: blur(10px) brightness(1);
  pointer-events: none;
  user-select: none;
  transition: filter 0.3s ease;
}

#left-button {
  position: relative;
  z-index: 1101;
}

.about-gif-wrapper {
  width: 100%;
  overflow: visible;
  margin-top: 40px;
  height: 480px; /* Adjusted manually for scaled GIF (assuming 300px image height × 1.6 scale) */
  position: relative;
}

.about-content .about-gif {
  display: block;
  width: 100%;
  height: auto;
  object-fit: cover;
  border-radius: 8px;
  pointer-events: none;
  transform: scale(1.6);
  transform-origin: center;
  position: absolute;
  top: 0;
  left: 50%;
  transform-origin: top center;
  transform: translateX(-50%) scale(1.6);
  margin: 0;
}

.about-gif:first-of-type {
  margin-top: 0 !important;
}

.about-gif-stack {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-top: 20px;
}

.about-content .about-gif:nth-of-type(odd) {
  margin-left: 0;
  margin-right: auto;
}

.about-content .about-gif:nth-of-type(even) {
  margin-left: auto;
  margin-right: 0;
}

@media (max-width: 600px) {
  .menu {
    flex-direction: column;
    gap: 20px;
    align-items: flex-start;
    padding-left: 0;
    margin-left: 0;
  }

  .menu-item {
    margin-top: 8px;
    font-size: clamp(16px, 2vw, 20px);
    width: auto;
  }

  .macbook-tile {
    width: 100px;
    height: 120px;
  }

  .macbook-tile img {
    max-width: 72px;
    max-height: 72px;
  }

  .macbook-tile.hover-zoom img {
    max-width: 160px !important;
    max-height: 160px !important;
  }

  .about-gif-wrapper {
    height: auto; /* Let it scale naturally on mobile */
  }

  .about-content .about-gif {
    position: static;
    transform: none;
    width: 100%;
    height: auto;
  }
  
}
