.work-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 34px;
}

.work-card {
  display: flex;
  min-width: 0;
  flex-direction: column;
  padding: 0;
  border: 1px solid var(--line);
  background: var(--paper);
  text-align: left;
}

.work-card:focus-visible,
.work-card:hover {
  border-color: var(--teal);
}

.work-card[aria-pressed="true"] {
  border-color: var(--teal);
  background: var(--sage);
  box-shadow: inset 0 -2px var(--teal);
}

.work-card img {
  width: 100%;
  height: auto;
  aspect-ratio: 65 / 44;
  object-fit: cover;
}

.work-card-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 16px 17px;
}

.work-card-title {
  color: var(--ink);
  font: clamp(19px, 2.15vw, 27px) / 1.12 var(--serif);
}

.work-card-type {
  color: #626e63;
  font-size: 12px;
  line-height: 1.45;
}

.work-panel {
  padding: clamp(16px, 3vw, 34px);
  border: 1px solid var(--line);
}

.work-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px 32px;
  margin-bottom: 21px;
}

.work-panel-header h3 {
  color: var(--teal);
  font-size: clamp(26px, 3.2vw, 39px);
  letter-spacing: -.025em;
}

.work-panel-header p {
  max-width: 640px;
  margin-top: 9px;
  color: #626e63;
  font-size: 14px;
}

.work-panel-header .case-result {
  flex: 0 1 207px;
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px solid var(--teal);
  color: var(--ink);
  font-size: 13px;
}

.room-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0 23px;
  margin-bottom: 17px;
  border-bottom: 1px solid var(--line);
}

.room-options button {
  min-height: 44px;
  margin-bottom: -1px;
  padding: 9px 0;
  border-bottom: 1px solid transparent;
  font-size: 13px;
}

.room-options button[aria-pressed="true"] {
  border-color: var(--teal);
  color: var(--teal);
  font-weight: 600;
}

.case-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 10px 18px;
  max-width: 900px;
  margin-inline: auto;
}

.case-pair-mixed {
  grid-template-columns: minmax(0, .76fr) minmax(0, 1.24fr);
}

.case-board {
  max-width: 900px;
  margin-inline: auto;
}

.case-pair figure {
  min-width: 0;
}

.case-pair figcaption,
.case-board figcaption {
  margin-top: 8px;
  color: #626e63;
  font-size: 12px;
}

.photo-open {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  background: var(--sage);
}

.photo-open img {
  width: 100%;
  height: auto;
}

.photo-expand {
  position: absolute;
  right: 9px;
  bottom: 9px;
  display: grid;
  width: 29px;
  height: 29px;
  place-items: center;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--teal);
  font-size: 19px;
}

.photo-open:hover .photo-expand {
  border-color: var(--teal);
}

.work-panel .project-layout {
  gap: clamp(25px, 5vw, 70px);
}

.project-copy .room-options {
  margin-bottom: 42px;
}

/* Room photos are portrait (3:4); a taller frame keeps ceiling and floor in view. */
.comparison-tall {
  height: auto;
  aspect-ratio: 4 / 5;
  max-width: 560px;
  margin-inline: auto;
}

/* The "before" photos were framed differently from their "after" versions.
   These nudges line up the fixed parts of each room (ceiling, window, door)
   so the divider does not jump between the two halves. */
#apartment-living .before-layer > img {
  transform: translate(10%, 0) scale(1.33);
}

#work-bedroom .before-layer > img {
  transform: translate(1.5%, -3.5%) scale(1.08);
}

@media (min-width: 681px) and (max-width: 900px) {
  .menu-toggle {
    display: flex;
    width: 24px;
    height: 44px;
    padding: 14px 0;
    flex-direction: column;
    justify-content: space-between;
  }

  .menu-toggle > span {
    width: 24px;
    height: 1px;
    background: var(--teal);
  }

  .mobile-nav {
    position: absolute;
    top: 100%;
    right: 0;
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 190px;
    padding: 22px;
    border: 1px solid var(--line);
    background: var(--paper);
  }
}

@media (max-width: 680px) {
  .work-cards {
    gap: 9px;
    margin-bottom: 19px;
  }

  .work-card-label {
    padding: 9px 9px 12px;
  }

  .work-panel-header {
    flex-direction: column;
    margin-bottom: 14px;
  }

  .work-panel-header .case-result {
    flex: none;
  }

  .case-pair {
    gap: 8px;
  }

  .project-copy .room-options {
    margin-bottom: 25px;
  }
}

@media (max-width: 520px) {
  .work-cards {
    grid-template-columns: minmax(0, 1fr);
  }

  .work-card {
    flex-direction: row;
    align-items: center;
  }

  .work-card img {
    width: 84px;
    flex: none;
  }

  .work-card-label {
    padding: 8px 12px;
  }

  .work-card[aria-pressed="true"] {
    box-shadow: inset -2px 0 var(--teal);
  }

  .room-options {
    gap: 0 13px;
  }

  .photo-expand {
    right: 5px;
    bottom: 5px;
    width: 23px;
    height: 23px;
    font-size: 16px;
  }
}
