.case-gallery,
.home-refine .case-gallery {
  --cg-line: #eacfb9;
  --cg-accent: #a83b05;
  padding: 0 0 clamp(44px, 5vw, 76px);
  background: #fffbf7;
  color: #2b211c;
  scroll-margin-top: 90px;
}
.case-gallery .cg-intro {
  padding: clamp(26px, 3.5vw, 48px) 0 clamp(22px, 2.5vw, 32px);
  background: linear-gradient(105deg, #ff7019 0%, #ff8836 62%, #ffae59 100%);
  color: #29160c;
}
.case-gallery .cg-groups { padding-top: clamp(24px, 3vw, 42px); }
.case-gallery .cg-wrap {
  width: min(1200px, calc(100% - 64px));
  margin-inline: auto;
}
.case-gallery .cg-heading,
.case-gallery .cg-subhead {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px 24px;
}
.case-gallery .cg-heading h2 {
  margin: 0;
  color: #29160c;
  font-size: clamp(40px, 4.2vw, 62px);
  font-weight: 800;
  letter-spacing: -.035em;
  line-height: 1.1;
}
.case-gallery .cg-heading p,
.case-gallery .cg-subhead p,
.case-gallery .cg-actions {
  margin: 0;
  color: #69594d;
  font-size: 14px;
  line-height: 1.6;
}
.case-gallery .cg-heading p { color: #4b2510; font-weight: 650; }
.case-gallery .cg-index {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin: 20px 0 0;
}
.case-gallery .cg-index a {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 9px 14px;
  border: 1px solid #ffedda;
  border-radius: 9px;
  background: #fffaf5;
  color: #432313;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.45;
  text-decoration: none;
}
.case-gallery .cg-index a span,
.case-gallery .cg-group h3 span {
  color: var(--cg-accent);
  font: 650 12px/1.1 ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
}
.case-gallery .cg-index a span {
  display: inline-grid;
  place-items: center;
  min-width: 26px;
  height: 26px;
  border-radius: 5px;
  background: #ba4106;
  color: #fff;
}
.case-gallery .cg-index a:hover,
.case-gallery .cg-index a:focus-visible { background: #fff; border-color: #743314; }
.case-gallery .cg-group { scroll-margin-top: 96px; }
.case-gallery .cg-group + .cg-group { margin-top: 44px; }
.case-gallery .cg-group h3 {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 0;
  font-size: 23px;
  line-height: 1.4;
}
.case-gallery .cg-subhead {
  border-bottom: 1px solid var(--cg-line);
  padding-bottom: 12px;
  margin-bottom: 16px;
}
.case-gallery .cg-subhead p { margin-top: 5px; }
.case-gallery .cg-actions { display: flex; align-items: center; gap: 14px; }
.case-gallery .cg-toggle {
  min-height: 38px;
  padding: 5px 12px;
  background: #fff;
  color: var(--cg-accent);
  border: 1px solid var(--cg-line);
  border-radius: 7px;
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.5;
  cursor: pointer;
}
.case-gallery [hidden] { display: none !important; }
.case-gallery .cg-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.case-gallery .cg-grid, .case-gallery .cg-cycle {
  list-style: none;
  margin: 0;
  padding: 0;
}
.case-gallery .cg-card {
  min-width: 0;
  overflow: hidden;
  border: 4px solid white;
  border-radius: 10px;
  background: white;
  box-shadow: 0 3px 11px #62311415;
}
.case-gallery .cg-card a {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  color: #532b16;
  text-decoration: none;
}
.case-gallery .cg-card img {
  display: block;
  width: 100%;
  aspect-ratio: 1.55;
  object-fit: contain;
  background: #f2ece5;
}
.case-gallery .cg-position {
  position: absolute;
  top: 7px;
  right: 7px;
  color: white;
  background: #281b11ac;
  border-radius: 4px;
  padding: 3px 5px;
  font: 650 11px/1 ui-monospace, monospace;
}
.case-gallery .cg-name {
  display: grid;
  place-content: center;
  flex: 1;
  padding: 7px 9px;
  text-align: center;
  font-size: 14px;
  font-weight: 650;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.case-gallery a:focus-visible, .case-gallery button:focus-visible {
  outline: 3px solid #b84407;
  outline-offset: 2px;
}
.case-gallery .cg-card:focus-within { outline: 3px solid #b84407; }
.case-gallery .cg-moving {
  display: grid;
  gap: 10px;
}
.case-gallery .cg-lane { overflow: hidden; padding: 2px 0 6px; }
.case-gallery .cg-track {
  display: flex;
  width: max-content;
  animation: cg-travel 60s linear infinite;
}
.case-gallery .cg-lane:nth-child(2) .cg-track { animation-direction: reverse; }
.case-gallery .cg-moving:hover .cg-track,
.case-gallery .cg-moving:focus-within .cg-track { animation-play-state: paused; }
.case-gallery .cg-cycle { display: flex; gap: 12px; padding-right: 12px; }
.case-gallery .cg-cycle .cg-card { width: clamp(190px, 21vw, 280px); }
@keyframes cg-travel { to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) {
  .case-gallery .cg-track { animation: none; }
}
@media (max-width: 900px) {
  .case-gallery .cg-index { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .case-gallery .cg-wrap { width: calc(100% - 36px); }
  .home-refine .case-gallery, .home-refine .case-gallery .cg-group { scroll-margin-top: 145px; }
  .case-gallery .cg-index { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 14px; gap: 7px; }
  .case-gallery .cg-index a { min-height: 49px; padding: 8px 10px; gap: 7px; font-size: 13px; }
  .case-gallery .cg-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .case-gallery .cg-group h3 { font-size: 20px; }
  .case-gallery .cg-name { padding: 6px; font-size: 13px; }
  .case-gallery .cg-cycle .cg-card { width: clamp(160px, 48vw, 230px); }
}
