:root {
  --page-bg: #ffffff;
  --ink: #000000;
  --ink-muted: rgba(0, 0, 0, 0.36);
  --thumb-blue: #9dcff2;
  --thumb-line: #000000;
  --page-pad-x: clamp(42px, 4vw, 84px);
  --page-pad-y: clamp(38px, 5vw, 66px);
  --grid-gap-x: clamp(28px, 4vw, 118px);
  --grid-gap-y: clamp(72px, 8vh, 126px);
  --media-size: clamp(158px, 10vw, 230px);
  --cell-height: clamp(166px, 17vh, 224px);
}

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

html {
  background: var(--page-bg);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--page-bg);
  font-family:
    "SF Pro Text",
    "SF Pro Display",
    -apple-system,
    BlinkMacSystemFont,
    "Helvetica Neue",
    Arial,
    sans-serif;
  font-size: 16px;
  line-height: 1;
  text-transform: uppercase;
}

button {
  border: 0;
  border-radius: 0;
  padding: 0;
  color: inherit;
  background: transparent;
  font: inherit;
  text-transform: inherit;
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

button:focus-visible {
  outline: 1px solid var(--ink);
  outline-offset: 6px;
}

.portfolio-page {
  width: 100%;
  min-height: 100vh;
  padding: var(--page-pad-y) var(--page-pad-x) 54px;
}

.grid-view {
  min-height: calc(100vh - var(--page-pad-y) - 54px);
}

.zoom-toggle {
  position: fixed;
  top: var(--page-pad-y);
  left: var(--page-pad-x);
  z-index: 4;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  font-size: 50px;
  font-weight: 300;
  line-height: 1;
}

.portfolio-header {
  position: sticky;
  top: var(--page-pad-y);
  z-index: 3;
  width: max-content;
  margin: 0 auto clamp(74px, 8vh, 116px);
}

.portfolio-tabs {
  display: flex;
  align-items: center;
  gap: 32px;
}

.tab-button {
  min-height: 34px;
  color: var(--ink);
  font-size: clamp(18px, 1.4vw, 24px);
  font-weight: 600;
  letter-spacing: 0;
}

.tab-button:not(.is-active) {
  opacity: 0.34;
}

.portfolio-grid {
  width: min(100%, 90vw, 1720px);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(6, minmax(88px, 1fr));
  column-gap: var(--grid-gap-x);
  row-gap: var(--grid-gap-y);
  align-items: start;
}

.portfolio-item {
  min-height: var(--cell-height);
  display: grid;
  justify-items: center;
  align-content: center;
  gap: clamp(12px, 1vw, 18px);
  text-align: center;
}

.portfolio-media {
  position: relative;
  width: var(--media-size);
  height: var(--media-size);
  display: grid;
  place-items: center;
}

.portfolio-media::before {
  content: "";
  width: 72%;
  height: 72%;
  border: 2px solid var(--thumb-line);
  border-radius: 10px;
  background: var(--thumb-blue);
  transform: rotate(45deg);
}

.portfolio-media[data-kind="videos"]::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 10px solid var(--ink);
  transform: translate(-38%, -50%);
}

.portfolio-media img,
.portfolio-media video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.portfolio-media:has(img)::before,
.portfolio-media:has(video)::before {
  display: none;
}

.portfolio-label {
  margin: 0;
  color: var(--ink);
  font-size: clamp(12px, 0.9vw, 16px);
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1;
}

.portfolio-page.is-zoomed {
  --grid-gap-x: clamp(70px, 7vw, 140px);
  --grid-gap-y: clamp(84px, 9vh, 150px);
  --media-size: clamp(210px, 15vw, 300px);
  --cell-height: clamp(218px, 24vh, 314px);
}

.portfolio-page.is-zoomed .portfolio-grid {
  width: min(100%, 76vw, 1320px);
  grid-template-columns: repeat(3, minmax(190px, 1fr));
}

.portfolio-page.is-zoomed .portfolio-label {
  font-size: clamp(22px, 1.8vw, 30px);
}

.item-view {
  position: relative;
  min-height: calc(100vh - var(--page-pad-y) - 54px);
  display: grid;
  grid-template-columns: minmax(44px, 1fr) minmax(0, 1180px) minmax(44px, 1fr);
  align-items: center;
  gap: 24px;
}

.item-back {
  position: fixed;
  top: var(--page-pad-y);
  left: var(--page-pad-x);
  z-index: 4;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  font-size: 28px;
  font-weight: 300;
  line-height: 1;
}

.item-stage {
  grid-column: 2;
  min-width: 0;
  display: grid;
  justify-items: center;
  align-content: center;
}

.item-arrow {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  justify-self: center;
  font-size: 24px;
  font-weight: 300;
  line-height: 1;
}

.item-arrow-prev {
  grid-column: 1;
}

.item-arrow-next {
  grid-column: 3;
}

.item-arrow[hidden],
.design-carousel[hidden],
.video-stage[hidden] {
  display: none;
}

.design-carousel {
  width: min(76vw, 820px);
  display: flex;
  gap: 44px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}

.design-carousel::-webkit-scrollbar {
  display: none;
}

.design-slide {
  flex: 0 0 100%;
  margin: 0;
  min-height: clamp(430px, 68vh, 720px);
  display: grid;
  place-items: center;
  overflow: hidden;
  scroll-snap-align: center;
}

.design-slide img {
  width: min(100%, 760px);
  max-height: min(68vh, 720px);
  object-fit: contain;
  transform-origin: var(--zoom-x, 50%) var(--zoom-y, 50%);
  transition: transform 0.16s ease;
  will-change: transform;
}

.design-slide.has-zoom img {
  cursor: zoom-in;
}

.design-slide.is-zooming img {
  transform: scale(2.15);
}

.design-placeholder {
  width: min(56vw, 420px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
}

.design-placeholder::before {
  content: "";
  width: 72%;
  height: 72%;
  border: 1px solid var(--thumb-line);
  border-radius: 9px;
  background: var(--thumb-blue);
  transform: rotate(45deg);
}

.video-stage {
  width: min(100%, 1180px);
  display: grid;
  place-items: center;
}

.video-player,
.video-placeholder,
.video-poster-preview {
  width: min(82vw, 1100px);
  aspect-ratio: 16 / 9;
}

.video-player,
.video-poster-preview {
  display: block;
  object-fit: contain;
  background: transparent;
}

.video-poster-preview {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.video-poster-preview img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.video-poster-preview .play-symbol {
  position: relative;
  z-index: 1;
}

.video-placeholder {
  display: grid;
  place-items: center;
  border: 2px dashed var(--ink);
  border-radius: 22px;
  background:
    repeating-linear-gradient(45deg, rgba(0, 0, 0, 0.1) 0 1px, transparent 1px 7px),
    repeating-linear-gradient(-45deg, rgba(255, 197, 71, 0.5) 0 1px, transparent 1px 7px),
    rgba(255, 224, 138, 0.34);
}

.play-symbol {
  width: 0;
  height: 0;
  border-top: 12px solid transparent;
  border-bottom: 12px solid transparent;
  border-left: 18px solid var(--ink);
}

.media-counter,
.item-label {
  margin: 0;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1;
}

.media-counter {
  min-height: 11px;
  margin-top: 8px;
  color: var(--ink-muted);
  font-size: 10px;
}

.item-label {
  margin-top: 5px;
  font-size: 12px;
}

@media (max-width: 1180px) {
  .portfolio-page.is-zoomed .portfolio-grid {
    width: min(100%, 82vw);
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }
}

@media (max-width: 760px) {
  :root {
    --page-pad-x: 20px;
    --page-pad-y: 18px;
    --grid-gap-x: 18px;
    --grid-gap-y: 22px;
    --media-size: 50px;
    --cell-height: 88px;
  }

  .zoom-toggle {
    font-size: 30px;
  }

  .portfolio-header {
    top: 18px;
    margin-bottom: 30px;
  }

  .portfolio-grid {
    grid-template-columns: repeat(3, minmax(70px, 1fr));
  }

  .portfolio-page.is-zoomed {
    --grid-gap-x: 24px;
    --grid-gap-y: 32px;
    --media-size: 86px;
    --cell-height: 136px;
  }

  .portfolio-page.is-zoomed .portfolio-grid {
    grid-template-columns: repeat(2, minmax(118px, 1fr));
  }

  .portfolio-page.is-zoomed .portfolio-label {
    font-size: 15px;
  }

  .item-view {
    min-height: calc(100vh - var(--page-pad-y) - 54px);
    grid-template-columns: 34px minmax(0, 1fr) 34px;
    gap: 8px;
  }

  .item-arrow {
    width: 34px;
    height: 44px;
    font-size: 20px;
  }

  .design-carousel {
    width: min(100%, 620px);
    gap: 28px;
  }

  .design-slide {
    min-height: 340px;
  }

  .design-slide img {
    max-height: 340px;
  }

  .video-player,
  .video-placeholder,
  .video-poster-preview {
    width: min(100%, 520px);
  }
}

@media (max-width: 380px) {
  .portfolio-tabs {
    gap: 14px;
  }

  .tab-button {
    font-size: 11px;
  }
}
