.story-photo {
  position: relative;
  isolation: isolate;
  display: block;
  overflow: hidden;
  background: #102923;
  cursor: zoom-in;
}
.story-photo > img { display: block; width: 100%; }
.story-photo:focus-visible { outline: 3px solid #e8ba47; outline-offset: -4px; }
.story-photo::after {
  content: "";
  position: absolute;
  inset: 9px;
  pointer-events: none;
  background:
    linear-gradient(#f9dc88, #f9dc88) left top/20px 1px,
    linear-gradient(#f9dc88, #f9dc88) left top/1px 20px,
    linear-gradient(#f9dc88, #f9dc88) right bottom/20px 1px,
    linear-gradient(#f9dc88, #f9dc88) right bottom/1px 20px;
  background-repeat: no-repeat;
  opacity: 0;
  transition: opacity .22s;
}
.story-expand {
  position: absolute;
  bottom: 1.05rem;
  right: 1.05rem;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  color: #fffaf0;
  background: rgb(13 35 29 / 89%);
  border: 1px solid rgb(255 246 215 / 60%);
  border-radius: 50%;
  box-shadow: 0 2px 8px #07171136;
  pointer-events: none;
  transition: background .2s, color .2s;
}
.story-expand svg { width: 17px; height: 17px; }
.story-photo:focus-visible::after { opacity: 1; }
.story-lens { display: none; }
@media (hover: hover) and (pointer: fine) {
  .story-photo:hover::after { opacity: 1; }
  .story-photo:hover .story-expand { background: #f7d67a; color: #102923; }
}
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .story-lens {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    width: clamp(94px, 30%, 164px);
    aspect-ratio: 1;
    border-radius: 50%;
    background-repeat: no-repeat;
    box-shadow: 0 0 0 1px #18271d, 0 0 0 2px #ebce81, 0 8px 26px #08130d66;
    opacity: 0;
    pointer-events: none;
    transition: opacity .16s ease;
  }
  .story-photo.is-inspecting { cursor: crosshair; }
  .story-photo.is-inspecting .story-lens { opacity: 1; }
  .story-lens::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background:
      linear-gradient(#ffebae, #ffebae) center top / 1px 8px,
      linear-gradient(#ffebae, #ffebae) center bottom / 1px 8px,
      linear-gradient(#ffebae, #ffebae) left center / 8px 1px,
      linear-gradient(#ffebae, #ffebae) right center / 8px 1px;
    background-repeat: no-repeat;
    box-shadow: inset 0 0 0 1px #fff3ccbd, inset 0 0 12px #18271d3b;
  }
}
html:has(.story-viewer[open]) { overflow: hidden; }
.story-viewer {
  position: fixed;
  inset: 0;
  width: min(94vw, 1040px);
  max-width: none;
  max-height: none;
  padding: 0;
  margin: auto;
  border: 1px solid #5b6b5d;
  border-radius: 5px;
  color: #faf8ea;
  background: #0c1a17;
  box-shadow: 0 18px 90px #0007;
}
.story-viewer:not([open]) { display: none; }
.story-viewer::backdrop { background: rgb(5 15 13 / 92%); }
.story-viewer-inner {
  display: grid;
  grid-template: auto minmax(0, 1fr) / 1fr;
  position: relative;
  height: min(88vh, 930px);
  height: min(88dvh, 930px);
}
.story-viewer-tools, .story-viewer-stage figcaption, .story-viewer-nav {
  padding-inline: clamp(.85rem, 2.4vw, 1.8rem);
}
.story-viewer-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 58px;
  border-bottom: 1px solid #33443a;
}
[data-viewer-count] { font: 500 .875rem/1.2 ui-monospace, monospace; color: #f6d788; }
.story-viewer button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  min-width: 44px;
  min-height: 44px;
  border: 1px solid transparent;
  background: transparent;
  color: #fff9eb;
  font: inherit;
  cursor: pointer;
  border-radius: 3px;
}
.story-viewer button:hover { color: #ffe294; background: #23332c; }
.story-viewer button:focus-visible { outline: 2px solid #f6d788; outline-offset: -2px; }
.story-viewer button svg { width: 19px; height: 19px; }
.story-viewer-stage { margin: 0; min-height: 0; display: grid; grid-template-rows: minmax(0,1fr) auto; }
.story-viewer-stage img { width: 100%; height: 100%; object-fit: contain; background: #091310; }
.story-viewer-stage figcaption {
  display: flex;
  align-items: center;
  min-height: 64px;
  padding-block: .65rem;
  padding-right: 140px;
  line-height: 1.35;
  border-top: 1px solid #33443a;
}
.story-viewer-nav { position: absolute; right: 0; bottom: .55rem; display: flex; gap: .3rem; }
.story-viewer-nav button { border-color: #506253; }
@media (max-width: 600px) {
  .story-viewer { width: 100%; max-height: 100%; border: 0; border-radius: 0; }
  .story-viewer-inner { height: 100vh; height: 100dvh; padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom); }
  .story-viewer-stage figcaption { padding-right: 114px; }
  .story-viewer-nav { padding-inline: .5rem; bottom: calc(.55rem + env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: reduce) {
  .story-photo::after, .story-expand { transition: none; }
}
