.portal-preview {
  display: block;
  position: relative;
  width: 100%;
  padding: 0;
  overflow: hidden;
  border: 0;
  background: #91d8e0;
  text-align: left;
}

.portal-preview .project-picture {
  display: grid;
  align-items: center;
  padding: 5% 0 10% 5%;
  background: linear-gradient(145deg, #c9eef0, #81cdd8);
}

.portal-project .project-picture img {
  width: 111%;
  max-width: none;
  height: auto;
  border: 1px solid #2a241b;
  border-radius: 3px 0 0 3px;
  box-shadow: 0 .65rem 1.6rem -.35rem #15485655;
  transform: none;
  transform-origin: 0 50%;
}

.portal-preview:hover .project-picture img,
.portal-preview:focus-visible .project-picture img {
  transform: scale(1.025);
}

.portal-expand {
  position: absolute;
  right: .75rem;
  bottom: .75rem;
  padding: .35rem .65rem;
  background: #161713;
  color: white;
  font-size: .82rem;
  font-weight: 550;
  border-radius: 2px;
}

.portal-expand::before { content: "+"; margin-inline-end: .4rem; }
.portal-project:hover h3 { text-decoration: none; }
.portal-description { max-width: 39ch; margin: .52rem 0 0; color: var(--muted); font-size: 1rem; line-height: 1.5; }
.portal-live { display: inline-block; margin-top: .8rem; font-weight: 560; text-decoration: underline; text-underline-offset: .22em; }
.portal-live:hover { color: #086779; }

.portal-dialog {
  width: min(88rem, calc(100% - 3rem));
  max-width: none;
  max-height: calc(100dvh - 2rem);
  margin: auto;
  padding: 0;
  border: 1px solid #97978c;
  border-radius: 5px;
  background: var(--paper, #f4f3ed);
  color: var(--ink, #1a1b17);
  box-shadow: 0 1.5rem 5rem #0006;
}

.portal-dialog::backdrop { background: rgb(13 14 12 / 78%); }
body:has(.portal-dialog[open]) { overflow: hidden; }
.portal-dialog-head, .portal-dialog-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .8rem;
  padding: .75rem 1.2rem;
}

.portal-dialog-head h2 { margin: 0; font-size: clamp(1.25rem, 2.4vw, 1.85rem); line-height: 1.15; letter-spacing: -.055em; }
.portal-dialog-actions { background: var(--paper, #f4f3ed); color: var(--ink, #1a1b17); }
.portal-dialog button, .portal-dialog-actions a {
  min-height: 2.75rem;
  padding: .5rem .85rem;
  border: 1px solid #a4a499;
  border-radius: 3px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: .9rem;
  font-weight: 540;
  cursor: pointer;
}

.portal-dialog button:hover { background: #e4e2d9; }
.portal-dialog .portal-close { min-width: 2.75rem; padding: .25rem .6rem; font-size: 1.4rem; line-height: 1; }
.portal-dialog-actions a { display: inline-flex; align-items: center; gap: .4rem; color: white; border-color: #1b1c18; background: #1b1c18; text-decoration: none; }
.portal-dialog-actions a:hover { background: #393a33; }
.portal-scroller {
  width: 100%;
  overflow: auto;
  background: #292b27;
  border-block: 1px solid #b3b1a6;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.portal-scroller:focus-visible { outline-offset: -3px; }
.portal-scroller img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: calc(100dvh - 12rem);
  margin-inline: auto;
  cursor: zoom-in;
  user-select: none;
}

.portal-scroller.is-zoomed { height: min(68dvh, 54rem); }
.portal-scroller.is-zoomed img { max-width: none; max-height: none; cursor: zoom-out; }
.portal-dialog button:focus-visible, .portal-dialog a:focus-visible { outline-offset: 1px; }

@media (max-width: 600px) {
  .portal-dialog { width: calc(100% - 1rem); }
  .portal-dialog-head, .portal-dialog-actions { padding: .6rem .7rem; gap: .4rem; }
  .portal-scroller.is-zoomed { height: 63dvh; }
}

@media (prefers-reduced-motion: reduce) {
  .portal-project .project-picture img { transition: none; }
}
