/*
 * Behind the Scenes - Draggable Grid
 * MIT License - Copyright (c) 2009-2024 Codrops
 * Source: https://github.com/joffreysp/draggable-grid
 */

:root {
  --color-bg: #f5f5f0;
  --color-text: #313131;
  --color-link: #000;
  --color-link-hover: #ff0e0e;
  --page-padding: 2rem;
}

* {
  padding: 0;
  margin: 0;
  box-sizing: border-box;
}

html.js {
  overflow: hidden;
  height: 100%;
}

html, body {
  max-width: 100vw;
  overflow-x: hidden;
  font-family: 'Inter', sans-serif;
  color: var(--color-text);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
}

/* Loading Animation */
@media (scripting: enabled) {
  .loading::before,
  .loading::after {
    content: '';
    position: fixed;
    z-index: 10000;
  }

  .loading::before {
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--color-bg);
  }

  .loading::after {
    top: 50%;
    left: 50%;
    width: 100px;
    height: 1px;
    margin: 0 0 0 -50px;
    background: var(--color-link);
    animation: loaderAnim 1.5s ease-in-out infinite alternate forwards;
  }
}

@keyframes loaderAnim {
  0% {
    transform: scaleX(0);
    transform-origin: 0% 50%;
  }
  50% {
    transform: scaleX(1);
    transform-origin: 0% 50%;
  }
  50.1% {
    transform: scaleX(1);
    transform-origin: 100% 50%;
  }
  100% {
    transform: scaleX(0);
    transform-origin: 100% 50%;
  }
}

a {
  text-decoration: none;
  color: var(--color-link);
  outline: none;
  cursor: pointer;
}

a:hover {
  text-decoration: underline;
  color: var(--color-link-hover);
}

/* Header Frame */
.frame {
  display: grid;
  z-index: 1000;
  grid-row-gap: 1rem;
  grid-column-gap: 2rem;
  pointer-events: none;
  justify-items: start;
  align-content: start;
  padding: var(--page-padding);
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto 1fr;
  grid-template-areas:
    'title title'
    'back ...'
    '... ...';
}

.frame a, .frame button {
  pointer-events: auto;
}

.frame__title {
  grid-area: title;
  font-size: 1rem;
  margin: 0;
  font-weight: 600;
}

.frame__title span {
  display: block;
  font-size: 0.85rem;
  font-weight: 400;
  opacity: 0.6;
  margin-top: 0.25rem;
}

.frame__back {
  grid-area: back;
  justify-self: start;
}

/* Draggable Container */
.container {
  position: fixed;
  width: 100vw;
  height: 100vh;
  top: 0;
  left: 0;
  transform-origin: center center;
  will-change: transform;
}

.container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #000;
  z-index: 2;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.45s ease-in-out;
}

.grid {
  position: absolute;
  width: max-content;
  height: max-content;
  display: flex;
  gap: 10vw;
  padding: 20px;
}

.--is-loaded {
  overflow: hidden;
}

.--is-loaded .grid {
  transition: transform 0.45s cubic-bezier(0.33, 1, 0.68, 1);
  cursor: grab;
}

.column {
  display: flex;
  flex-direction: column;
  gap: 10vw;
}

.column:nth-child(even) {
  margin-top: 15vw;
}

.product {
  position: relative;
  width: 15vw;
  aspect-ratio: 1 / 1;
}

.product div {
  width: 15vw;
  aspect-ratio: 1 / 1;
}

.product img {
  position: absolute;
  width: 100%;
  height: 100%;
  object-fit: cover;
  will-change: transform;
  transition: transform 300ms ease-in-out;
  border-radius: 8px;
}

.product:hover img {
  transform: scale(1.05);
}

/* Details Panel */
.details {
  position: fixed;
  top: 0;
  right: 0;
  width: 50vw;
  height: 100vh;
  padding: 3vw 4vw;
  background-color: #f1f1f1;
  transform: translate3d(50vw, 0, 0);
  z-index: 6;
  overflow-y: auto;
}

@media (max-width: 600px) {
  .details {
    width: 90%;
    padding: 8vw 7vw;
    transform: translate3d(90%, 0, 0);
  }
}

.details__title {
  margin-bottom: 4vw;
  position: relative;
  display: grid;
}

@media (max-width: 600px) {
  .details__title {
    margin-bottom: 8vw;
  }
}

.details__title p {
  grid-area: 1 / -1;
  overflow: hidden;
  font-size: 3vw;
  font-weight: 600;
}

@media (max-width: 600px) {
  .details__title p {
    font-size: 2rem;
  }
}

.details__body {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 2vw;
}

.details__texts {
  position: relative;
  height: 100%;
  line-height: 1.5;
  display: grid;
  max-width: 25rem;
}

.details__texts span {
  display: block;
  font-size: 1.5rem;
  margin-bottom: 1rem;
  font-weight: 600;
}

.details__texts [data-text] {
  grid-area: 1 / -1;
  bottom: 0;
  left: 0;
}

.details__thumb {
  position: relative;
  width: 25vw;
  aspect-ratio: 1 / 1;
  z-index: 3;
  will-change: transform;
  border-radius: 8px;
  overflow: hidden;
}

@media (max-width: 600px) {
  .details__thumb {
    width: 100%;
  }
}

.details__thumb div,
.details__thumb img {
  position: absolute;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

p {
  font-size: 0.95rem;
  margin-bottom: 1vw;
  line-height: 1.6;
}

/* Close Cursor (X Icon) */
.cross {
  position: fixed;
  width: 3vw;
  height: 3vw;
  transform: translate(-50%, -50%) scale(0);
  z-index: 5;
  pointer-events: none;
}

.cross svg {
  width: 3vw;
  height: 3vw;
}

.--is-details-showing {
  cursor: pointer;
}

.--is-details-showing .grid {
  pointer-events: none;
}

.--is-details-showing .container::before {
  opacity: 0.35;
}

.--is-showing {
  opacity: 1;
}

/* Mobile Adjustments */
@media (max-width: 768px) {
  .product {
    width: 30vw;
  }
  
  .product div {
    width: 30vw;
  }
  
  .column {
    gap: 12vw;
  }
  
  .grid {
    gap: 12vw;
  }
}
