.cases > [hidden] {
  display: none;
}

.case-list {
  padding: clamp(48px, 5vw, 80px) 0 var(--section);
  overflow-x: clip;
}

.cases {
  --lift: clamp(96px, 11vw, 176px);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 620px));
  justify-content: space-between;
  gap: clamp(72px, 7vw, 112px) clamp(32px, 5vw, 96px);
  align-items: start;
}

.cases:has(> :nth-child(even of :not([hidden])):nth-last-child(1 of :not([hidden]))) {
  padding-bottom: var(--lift);
}

.case {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.cases > :nth-child(even of :not([hidden])) {
  position: relative;
  top: var(--lift);
}

.case-media {
  position: relative;
  display: block;
  aspect-ratio: 4 / 5;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--paper-2);
  will-change: transform;
}

.case-media::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(17, 17, 17, 0.06);
  pointer-events: none;
}

.case-stage {
  position: relative;
  display: block;
  height: 118%;
}

.case-stage img {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 70%;
}

.case-stage img + img {
  position: absolute;
  inset: 0;
  opacity: 0;
}

.case-glare {
  position: absolute;
  inset: 0;
  z-index: 2;
  background: linear-gradient(105deg, rgba(255, 255, 255, 0) 30%, rgba(255, 255, 255, 0.3) 50%, rgba(255, 255, 255, 0) 70%);
  opacity: 0;
  pointer-events: none;
}

:is(.case, .case-yours-link):focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 6px;
  border-radius: var(--radius);
}

html.motion .case-media {
  clip-path: inset(12% 10% 12% 10% round 48px);
}

html.motion .case-meta > * {
  opacity: 0;
}

.case-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.case-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.case-text small {
  margin-bottom: 4px;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--ink-2);
}

.case-text b {
  font-size: 22px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.case-go {
  position: relative;
  isolation: isolate;
  flex: none;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1.5px var(--line);
  font-size: 20px;
  transition: color 0.4s var(--ease);
}

.case-go::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: var(--red);
  opacity: 0;
  transition: opacity 0.4s var(--ease);
}

.case-go i {
  transition: rotate 0.4s var(--ease);
}

.case-view {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 60;
  display: none;
  align-items: center;
  gap: 10px;
  height: 48px;
  padding: 0 6px 0 20px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 0 0 1px rgba(17, 17, 17, 0.08), inset 0 0 0 1px rgba(255, 255, 255, 0.6), 0 12px 32px -12px rgba(17, 17, 17, 0.35);
  backdrop-filter: blur(18px) saturate(1.6);
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
}

.case-view i {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  font-size: 16px;
}

.case-yours-link {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

html.motion .case-yours .case-meta > * {
  opacity: 1;
}

.case-yours-box {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 4 / 5;
  border-radius: var(--radius);
  overflow: hidden;
  background: radial-gradient(circle at 72% 28%, rgba(255, 25, 72, 0.2), transparent 55%), radial-gradient(circle at 14px 14px, rgba(255, 255, 255, 0.08) 1px, transparent 1.6px) 0 0 / 28px 28px, var(--ink);
}

.case-yours-slot {
  position: relative;
  width: 44%;
  aspect-ratio: 4 / 5;
  border: 1.5px dashed rgba(255, 255, 255, 0.3);
  border-radius: 20px;
  mask-image: conic-gradient(#000 var(--sweep, 360deg), transparent 0);
  z-index: 1;
  transition: border-color 0.3s ease, background-color 0.3s ease, translate 0.45s var(--ease);
}

.case-yours-link:focus-visible .case-yours-slot {
  border-color: var(--red);
}

@media (hover: hover) and (pointer: fine) {
  :is(.case, .case-yours-link):is(:hover, :focus-visible) .case-go {
    color: var(--paper);
  }

  :is(.case, .case-yours-link):is(:hover, :focus-visible) .case-go::before {
    opacity: 1;
  }

  html.motion :is(.case, .case-yours-link):is(:hover, :focus-visible) .case-go i {
    rotate: 45deg;
  }

  .case-yours-link:hover .case-yours-slot {
    border-color: var(--red);
    background: rgba(255, 25, 72, 0.08);
  }

  html.motion .case-yours-link:hover .case-yours-slot {
    translate: 0 -4px;
  }

  html.motion .cases.is-view .case-media {
    cursor: none;
  }

  html.motion .case-view {
    display: flex;
  }
}

@media (min-width: 1600px) {
  .cases {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    column-gap: 56px;
  }

  .cases > :nth-child(even of :not([hidden])) {
    top: 0;
  }

  .cases > :nth-child(3n+2 of :not([hidden])) {
    position: relative;
    top: var(--lift);
  }

  .cases,
  .cases:has(> :nth-child(even of :not([hidden])):nth-last-child(1 of :not([hidden]))) {
    padding-bottom: var(--lift);
  }
}

@media (max-width: 1279px) {
  .case-text b {
    font-size: 20px;
  }
}

@media (max-width: 1023px) {
  .cases {
    --lift: clamp(64px, 9vw, 96px);
    gap: 64px 28px;
  }

  .case-stage {
    translate: 0 -4.5%;
    translate: 0 round(-4.5%, 1px);
  }
}

@media (max-width: 599px) {
  .case-list .cases {
    --lift: 32px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 44px 16px;
  }

  .case-list :is(.case, .case-yours-link) {
    gap: 20px;
  }

  .case-list .cases > :nth-child(even of :not([hidden])) {
    top: var(--lift);
  }

  .case-list .cases:has(> :nth-child(even of :not([hidden])):nth-last-child(1 of :not([hidden]))) {
    padding-bottom: var(--lift);
  }

  .case-list :is(.case-media, .case-yours-box) {
    border-radius: 16px;
  }

  .case-list .case-meta {
    gap: 8px;
  }

  .case-list .case-text small {
    margin-bottom: 2px;
    overflow: hidden;
    font-size: 14px;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .case-list .case-text b {
    font-size: 16px;
  }

  .case-list .case-go {
    display: none;
  }
}

@media (max-width: 1023px) and (max-height: 500px) and (orientation: landscape) {
  .case-list .cases {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 40px 20px;
  }

  .case-list .cases > :nth-child(even of :not([hidden])) {
    top: 0;
  }

  .case-list .cases:has(> :nth-child(even of :not([hidden])):nth-last-child(1 of :not([hidden]))) {
    padding-bottom: 0;
  }

  .case-list :is(.case-media, .case-yours-box) {
    max-height: calc(100svh - 104px);
    border-radius: 16px;
  }

  .case-list .case-text b {
    font-size: 16px;
  }

  .case-go {
    display: none;
  }
}
