.work-section {
  padding-block: clamp(64px, 8vw, 112px);
  border-top: 1px solid var(--line, #292323);
  background: #0d0c0d;
}

.work-section .work-intro {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px 36px;
  margin-bottom: 32px;
}

.work-section .work-intro h2 {
  margin: 0;
  color: var(--text, #f7f3f1);
  font: 700 clamp(2.8rem, 6vw, 5rem)/.95 var(--display, sans-serif);
  letter-spacing: -.035em;
}

.work-section .work-intro em {
  color: var(--red, #ff484c);
  font-style: normal;
}

.work-section .work-intro p {
  max-width: 37ch;
  margin: 0;
  color: var(--muted, #aaa4a4);
  line-height: 1.6;
}

.work-section .work-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 15px;
}

.work-more {
  margin-top: 20px;
}

.work-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  width: fit-content;
  min-height: 44px;
  padding: 7px 8px 7px 16px;
  color: var(--text);
  background: #171415;
  border: 1px solid #643238;
  border-radius: 999px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  list-style: none;
}

.work-toggle:hover {
  border-color: var(--red);
}

.work-toggle::-webkit-details-marker,
.work-toggle-close,
.work-more[open] .work-toggle-open {
  display: none;
}

.work-more[open] .work-toggle-close {
  display: inline;
}

.work-toggle-icon {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: var(--red);
  color: #170809;
  font-size: 18px;
  line-height: 1;
}

.work-toggle-icon::before {
  content: "+";
}

.work-more[open] .work-toggle-icon::before {
  content: "−";
}

.work-more[open] .work-toggle {
  position: sticky;
  top: 12px;
  z-index: 1;
  box-shadow: 0 4px 14px #09070880;
}

.work-grid-expanded {
  margin-top: 16px;
}

.work-grid-expanded .work-project-link {
  scroll-margin-top: 68px;
}

.work-section .work-project {
  min-width: 0;
  margin: 0;
  background: #151314;
  border: 1px solid var(--line, #292323);
  border-radius: 8px;
}

.work-section .work-project {
  transition: border-color 160ms ease, background 160ms ease;
}

.work-section .work-project:focus-within,
.work-section .work-project:hover {
  background: #1b1516;
  border-color: var(--red, #ff484c);
}

.work-section .work-project-link {
  display: flex;
  height: 100%;
  flex-direction: column;
  border-radius: inherit;
  color: var(--text, #f7f3f1);
  text-decoration: none;
}

.work-section .work-preview {
  position: relative;
  aspect-ratio: 17 / 12;
  overflow: hidden;
  border-radius: 7px 7px 0 0;
  border-bottom: 1px solid var(--line, #292323);
  background: radial-gradient(ellipse at 50% 100%, #372023, #171415 75%);
}

.work-section .work-preview img {
  position: absolute;
  inset: 4px;
  width: calc(100% - 8px);
  height: calc(100% - 8px);
  object-fit: contain;
  object-position: center;
}

.work-section .work-project-caption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 1;
  min-height: 77px;
  gap: 12px;
  padding: 13px clamp(12px, 1.5vw, 19px);
}

.work-section .work-project-caption p {
  margin: 0 0 3px;
  color: var(--muted, #aaa4a4);
  font-size: .75rem;
  line-height: 1.4;
}

.work-section .work-project-caption h3 {
  margin: 0;
  color: var(--text, #f7f3f1);
  font: 650 clamp(1.2rem, 2vw, 1.55rem)/1.13 var(--display, sans-serif);
}

.work-section .work-arrow {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line, #292323);
  color: var(--red, #ff484c);
  font-size: 1rem;
}

.work-section .work-project-link:hover .work-arrow,
.work-section .work-project-link:focus-visible .work-arrow {
  color: #151314;
  border-color: var(--red, #ff484c);
  background: var(--red, #ff484c);
}

.work-section .work-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (min-width: 1040px) {
  .work-section .work-grid-expanded {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 740px) {
  .work-section .work-intro {
    align-items: start;
    flex-direction: column;
  }

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

@media (max-width: 470px) {
  .work-section .work-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .work-section .work-project {
    transition: none;
  }
}
