.profile-gallery {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(190px, 1fr);
  gap: 10px;
  height: 430px;
  overflow: visible;
  border-radius: 0;
  background: transparent;
}

.profile-gallery-main,
.profile-gallery-viewport,
.profile-gallery-track,
.profile-gallery-slide {
  width: 100%;
  height: 100%;
}

.profile-gallery-main {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: var(--ink);
}

.profile-gallery-viewport {
  overflow: hidden;
}

.profile-gallery-track {
  display: flex;
  transition: transform .48s cubic-bezier(.22, .61, .36, 1);
  cursor: grab;
  touch-action: pan-y;
  user-select: none;
  will-change: transform;
}

.profile-gallery-track.is-dragging,
.profile-gallery-track.is-resetting {
  transition: none;
}

.profile-gallery-track.is-dragging {
  cursor: grabbing;
}

.profile-gallery-slide {
  flex: 0 0 100%;
  margin: 0;
}

.profile-gallery-slide img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.profile-gallery .profile-gallery-shade {
  z-index: 1;
  pointer-events: none;
}

.profile-gallery .profile-gallery-title {
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 14px;
  pointer-events: none;
}

.profile-gallery .profile-gallery-title h1 {
  display: block;
  margin: 0;
}

.profile-gallery-thumbs {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 9px;
  overflow-x: hidden;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
}

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

.profile-gallery-thumbs button {
  flex: 0 0 calc((100% - 18px) / 2.45);
  min-height: 0;
  padding: 0;
  overflow: hidden;
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--line);
  cursor: pointer;
  opacity: .68;
  scroll-snap-align: start;
  transition: border-color .2s ease, opacity .2s ease, transform .2s ease;
}

.profile-gallery-thumbs button:hover,
.profile-gallery-thumbs button[aria-current="true"] {
  border-color: var(--pink);
  opacity: 1;
}

.profile-gallery-thumbs button[aria-current="true"] {
  transform: scale(.985);
}

.profile-gallery-thumbs img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-gallery:focus-visible {
  outline: 3px solid rgba(227, 92, 62, .28);
  outline-offset: 4px;
}

.profile-case-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  height: auto;
}

.profile-case-grid img {
  height: auto;
  aspect-ratio: 4 / 3;
}

.profile-review-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 24px;
}

.profile-review-card {
  display: flex;
  min-width: 0;
  flex-direction: column;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
}

.profile-review-card header {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.profile-review-avatar {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 50%;
  background: #fff0eb;
  color: var(--pink);
  font-size: 14px;
  font-weight: 800;
}

.profile-review-card h3 {
  margin: 0;
  font-size: 12px;
}

.profile-review-author {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 8px;
  align-items: center;
  margin-bottom: 3px;
}

.profile-review-card header p {
  margin: 0;
  color: var(--muted-soft);
  font-size: 9px;
}

.profile-review-source {
  padding: 5px 8px;
  border-radius: var(--radius-pill);
  background: #fff7e0;
  color: #b68000;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.profile-review-stars {
  color: #e3a800;
  font-size: 11px;
  letter-spacing: 1px;
  white-space: nowrap;
}

.profile-review-copy {
  flex: 1;
  margin: 15px 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.7;
}

.profile-review-reply {
  margin: 0 0 16px 46px;
  padding: 14px 16px;
  border-left: 3px solid var(--pink);
  border-radius: 0 7px 7px 0;
  background: #fff8f5;
}

.profile-review-reply > div {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 9px;
  align-items: baseline;
}

.profile-review-reply strong {
  color: var(--ink);
  font-size: 10px;
}

.profile-review-reply span {
  color: var(--muted-soft);
  font-size: 8px;
}

.profile-review-reply p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.7;
}

.profile-review-card > a {
  align-self: flex-start;
  color: var(--text);
  font-size: 9px;
  font-weight: 700;
  text-decoration: none;
}

.profile-review-card > a span {
  margin-left: 4px;
  color: var(--pink);
}

.profile-rating-picker {
  margin: 0 0 5px;
  padding: 0;
  border: 0;
}

.profile-rating-picker legend {
  padding: 0;
  font-size: 11px;
  font-weight: 700;
}

/* DOM 은 5>1 순서로 두고 화면만 뒤집는다. 그래야 :checked ~ label 로 왼쪽 별을 채울 수 있다. */
.profile-rating-buttons {
  display: flex;
  flex-direction: row-reverse;
  justify-content: flex-end;
  gap: 2px;
  margin-top: 4px;
}

.profile-rating-buttons input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.profile-rating-buttons label {
  padding: 2px;
  color: var(--line);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  transition: color .15s ease, transform .15s ease;
}

.profile-rating-buttons input:checked ~ label,
.profile-rating-buttons label:hover,
.profile-rating-buttons label:hover ~ label {
  color: #e3a800;
}

.profile-rating-buttons label:hover {
  transform: scale(1.1);
}

.profile-rating-buttons input:focus-visible + label {
  outline: 2px solid var(--pink);
  outline-offset: 2px;
  border-radius: 4px;
}


@media (max-width: 900px) {
  .profile-gallery {
    grid-template-columns: minmax(0, 4fr) minmax(145px, 1fr);
    height: 380px;
  }
}

@media (max-width: 640px) {
  .profile-review-reply {
    margin-left: 20px;
  }

  .profile-review-card header {
    grid-template-columns: 38px minmax(0, 1fr);
  }

  .profile-review-source {
    grid-column: 2;
    justify-self: start;
  }

  .profile-case-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .profile-case-grid img,
  .profile-case-grid img:first-child {
    grid-column: auto;
    height: auto;
  }

  .profile-gallery {
    display: block;
    height: auto;
  }

  .profile-gallery-main {
    height: 350px;
  }

  .profile-gallery .profile-gallery-title {
    left: 20px;
    right: 20px;
    bottom: 20px;
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .profile-gallery .profile-gallery-title h1 {
    font-size: 30px;
  }

  .profile-gallery-thumbs {
    height: 78px;
    flex-direction: row;
    gap: 8px;
    margin-top: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
  }

  .profile-gallery-thumbs button {
    flex: 0 0 104px;
    height: 78px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .profile-gallery-track { transition: none; }
}
