.ed-portfolio,
.ed-page.ed-case {
  --work-ease: cubic-bezier(.18,.68,.24,1);
  --work-rule: #cbcdc1;
}

/* The title and the introduction share a baseline above the catalogue. */
.ed-portfolio .ed-index-heading {
  align-items: end;
  padding-bottom: clamp(24px, 3.2vw, 42px);
}
.ed-portfolio .ed-index-heading h1 {
  font-size: clamp(58px, 6.7vw, 98px);
}
.ed-portfolio .ed-index-aside {
  padding-inline-start: clamp(14px, 2vw, 28px);
  border-inline-start: 1px solid var(--work-rule);
}
.ed-portfolio .ed-index-aside p,
.ed-portfolio .ed-project > p {
  font-size: clamp(15px, 1.1vw, 17px);
  line-height: 1.55;
}
.ed-portfolio .ed-filter-row {
  gap: 12px 22px;
  margin-bottom: 0;
  padding-block: 10px 20px;
}
.ed-portfolio .ed-filter-row .filter-group {
  flex-wrap: wrap;
  gap: 4px;
}
.ed-portfolio .ed-filter-row .filter-group button {
  min-height: 44px;
  padding: 5px 15px;
  border-radius: 4px;
  font-size: 13px;
}
.ed-portfolio .ed-project-grid {
  gap: clamp(32px, 3.8vw, 60px) clamp(20px, 2.8vw, 44px);
}
.ed-portfolio .ed-project {
  position: relative;
  isolation: isolate;
  container-type: inline-size;
  min-width: 0;
}
.ed-portfolio .ed-project:nth-child(even) { margin-top: 0; }
.ed-portfolio .ed-project-visual {
  height: auto;
  aspect-ratio: 1.65;
  padding: clamp(14px, 4.5cqw, 32px);
  display: grid;
  grid-template-columns: minmax(0, .76fr) minmax(0, 1.65fr);
  grid-template-rows: auto 1fr auto;
  align-items: center;
  gap: 0 clamp(8px, 2cqw, 16px);
  border: 0;
  border-radius: 6px;
  box-shadow: none;
  color: var(--ed-deep);
}
.ed-portfolio .ed-project-visual::before,
.ed-portfolio .ed-project-visual::after { content: none; }
.ed-portfolio .ed-project-number,
.ed-portfolio .ed-project-word,
.ed-portfolio .ed-project-open {
  position: static;
  grid-column: 1;
  justify-self: start;
}
.ed-portfolio .ed-project-number {
  min-height: 0;
  padding: 0;
  border: 0;
  background: none;
  backdrop-filter: none;
  color: inherit;
  font-size: 11px;
  letter-spacing: .07em;
}
.ed-portfolio .ed-project-word {
  grid-row: 2;
  max-width: 100%;
  font-size: clamp(24px, 5.9cqw, 42px);
  line-height: 1.03;
  text-wrap: balance;
}
.ed-portfolio .ed-project-open {
  grid-row: 3;
  width: 44px;
  height: 44px;
  box-shadow: none;
}
.ed-portfolio .ed-project .ed-project-visual img,
.ed-portfolio .ed-project:nth-child(even) .ed-project-visual img,
.ed-portfolio .ed-project:nth-child(3) .ed-project-visual img {
  position: relative;
  inset: auto;
  grid-column: 2;
  grid-row: 1 / 4;
  justify-self: stretch;
  width: 100%;
  height: auto;
  border: 3px solid #fffdf7;
  border-radius: 4px;
  object-fit: contain;
  transform: rotate(-2deg);
  box-shadow: 0 8px 14px -8px rgb(32 36 29 / 26%);
}
.ed-portfolio .ed-project:nth-child(even) .ed-project-visual img { transform: rotate(2deg); }
.ed-portfolio .ed-project-heading {
  flex-direction: row;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 5px 14px;
  margin-top: 15px;
}
.ed-portfolio .ed-project-heading h2 {
  font-size: clamp(24px, 4.8cqw, 34px);
  letter-spacing: -.043em;
}
.ed-portfolio .ed-project-heading h2 a::after {
  content: "";
  position: absolute;
  inset: 0;
}
.ed-portfolio .ed-project-visual,
.ed-portfolio .ed-project-links a { z-index: 1; }
.ed-portfolio .ed-tags {
  max-width: none;
  justify-content: flex-start;
  align-items: center;
  gap: 7px;
}
.ed-portfolio .ed-tags span {
  padding: 0;
  background: none;
  border: 0;
  font-size: 10px;
  letter-spacing: .045em;
}
.ed-portfolio .ed-tags span + span {
  padding-inline-start: 7px;
  border-inline-start: 1px solid var(--work-rule);
}
.ed-portfolio .ed-project-links {
  flex-direction: row;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 6px 10px;
  margin-top: 12px;
  padding-top: 12px;
}
.ed-portfolio .ed-project-links a,
.ed-case .ed-case-meta .text-link,
.ed-case .ed-back-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: fit-content;
  max-width: 100%;
  min-height: 44px;
  margin-block: 0;
  padding: 7px 14px;
  border: 1px solid var(--work-rule);
  border-radius: 4px;
  color: #2c342a;
  font-size: 13px;
  line-height: 1.3;
  text-decoration: none;
}
.ed-portfolio .ed-project-links .text-link {
  color: var(--paper);
  background: var(--ink);
  border-color: var(--ink);
}
.ed-case .ed-case-meta .text-link,
.ed-case .ed-back-link { margin-top: 9px; }
.ed-portfolio a:focus-visible,
.ed-portfolio button:focus-visible,
.ed-case a:focus-visible {
  outline: 2px solid #375741;
  outline-offset: 3px;
}

@container (max-width: 435px) {
  .ed-project .ed-project-visual {
    aspect-ratio: auto;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto auto;
    gap: 6px 10px;
    padding: 15px;
  }
  .ed-project .ed-project-word { grid-column: 1; grid-row: 2; }
  .ed-project .ed-project-open {
    grid-column: 2;
    grid-row: 1 / 3;
    align-self: center;
    justify-self: end;
  }
  .ed-portfolio .ed-project .ed-project-visual img,
  .ed-portfolio .ed-project:nth-child(even) .ed-project-visual img,
  .ed-portfolio .ed-project:nth-child(3) .ed-project-visual img {
    grid-column: 1 / -1;
    grid-row: 3;
    justify-self: center;
    width: 92%;
    margin-block: 10px 5px;
  }
}

/* Reading navigation and image plates on the five case studies. */
.ed-page.ed-case { overflow: clip; }
.ed-case .ed-case-hero .ed-case-logo-title {
  width: min(100%, 31rem);
  margin-top: clamp(16px, 2.2vw, 30px);
}
.ed-case .ed-case-logo-title img {
  max-height: clamp(78px, 9vw, 136px);
  object-position: left center;
}
.ed-case .ed-case-layout {
  grid-template-columns: minmax(160px, 230px) minmax(0, 1fr);
  gap: clamp(32px, 6vw, 104px);
}
.ed-case .ed-toc nav a {
  min-height: 44px;
  padding: 9px 6px;
  align-items: center;
  color: #495346;
}
.ed-case .ed-toc nav a[aria-current="location"] {
  background-color: #e3e8db;
  color: #19251b;
}
.ed-case .ed-toc nav a[aria-current="location"] > span { color: #2f5434; }
.ed-case .ed-case-chapter > section[id] { scroll-margin-top: 0; }
.ed-case .ed-case-chapter > section > p { max-width: 74ch; }
.ed-case :is(.case-cover, .papillon-cover, .case-gallery a, .papillon-gallery a) {
  border-radius: 5px;
}
.ed-case .ed-next-case {
  width: calc(100% - 2 * var(--pad));
  border-top: 1px solid var(--work-rule);
  border-radius: 5px;
}
.ed-case .ed-next-case img {
  border-radius: 3px;
  transform: rotate(2deg);
}

@media (max-width: 800px) {
  .ed-portfolio .ed-index-aside { margin-top: 18px; }
  .ed-portfolio .ed-filter-row { align-items: center; }
  .ed-case .ed-case-layout { grid-template-columns: minmax(0, 1fr); gap: 22px; }
  .ed-case .ed-toc { position: static; max-width: none; margin-bottom: 0; }
  .ed-case .ed-toc nav { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr)); gap: 0 14px; }
}
@media (max-width: 500px) {
  .ed-portfolio .ed-index-heading h1 { font-size: clamp(50px, 12.4vw, 62px); }
  .ed-portfolio .ed-filter-row { gap: 6px; padding-block: 12px 18px; }
  .ed-portfolio .ed-filter-row > p { padding: 0; }
  .ed-portfolio .ed-filter-row .filter-group button { padding-inline: 11px; }
  .ed-case .ed-case-hero .ed-case-logo-title { width: min(100%, 280px); }
  .ed-case .ed-toc nav { grid-template-columns: 1fr; }
}

@media (hover: hover) and (pointer: fine) {
  .ed-portfolio .ed-project-visual:is(:hover, :focus-visible) {
    transform: none;
    box-shadow: none;
  }
  .ed-portfolio .ed-project-links a:last-child:hover,
  .ed-case .ed-case-meta .text-link:hover,
  .ed-case .ed-back-link:hover { border-color: currentColor; }
}
@media (prefers-reduced-motion: no-preference) and (hover: hover) and (pointer: fine) {
  .ed-portfolio .ed-project .ed-project-visual img,
  .ed-case .ed-next-case img {
    transition: transform 420ms var(--work-ease);
  }
  .ed-portfolio .ed-project:focus-within .ed-project-visual img,
  .ed-portfolio .ed-project:hover .ed-project-visual img { transform: rotate(0deg) scale(1.025); }
  .ed-case .ed-next-case:is(:hover, :focus-visible) img { transform: rotate(0deg) scale(1.025); }
}
@media (prefers-reduced-motion: reduce), (hover: none) {
  .ed-portfolio .ed-project .ed-project-visual,
  .ed-portfolio .ed-project .ed-project-visual img,
  .ed-portfolio .ed-project .ed-project-open,
  .ed-case .ed-next-case img { transition: none; transform: none; }
}
