/* Quiet visual pauses within the guide; existing chapter typography stays intact. */
.eg-chapter-copy:has(>.eg-photo){display:flow-root}
.eg-content .eg-photo{float:left;width:min(38%,280px);margin:4px 24px 16px 0;padding:0;border:0;background:transparent;break-inside:avoid}
.eg-content .eg-photo--right{float:right;margin:4px 0 16px 24px}
.eg-photo>img{display:block;width:100%;height:auto;aspect-ratio:16/9;border-radius:4px}
.eg-photo>figcaption{position:relative;display:block;margin:12px 0 0;padding:0;color:#566861;text-align:left}
.eg-photo .eg-photo-caption{font-size:13px;line-height:1.8;font-weight:400}
@media(max-width:760px){.eg-content .eg-photo{width:min(38%,180px);margin:4px 18px 14px 0}.eg-content .eg-photo--right{margin:4px 0 14px 18px}.eg-photo .eg-photo-caption{font-size:12px}}
@media(max-width:480px){.eg-content .eg-photo,.eg-content .eg-photo--right{float:none;width:min(100%,260px);margin:0 0 20px}}
@media print{.eg-content .eg-photo{display:none}}

/* Tooltip motion tokens and base rules from transitions.dev. */
:root {
  --tt-in-dur: 150ms;
  --tt-out-dur: 50ms;
  --tt-scale: 0.98;
  --tt-delay: 80ms;
  --tt-in-ease: ease-out;
  --tt-out-ease: ease-out;
  --tt-bg: #ffffff;
  --tt-fg: #2f2f2f;
}

.t-tt-wrap {
  position: relative;
  display: inline-block;
}
.t-tt {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translate(-50%, 0) scale(var(--tt-scale));
  transform-origin: 50% 100%;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--tt-bg);
  color: var(--tt-fg);
  white-space: nowrap;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.06),
    0 2px 6px 0 rgba(0, 0, 0, 0.05),
    0 4px 42px 0 rgba(0, 0, 0, 0.06);
  opacity: 0;
  pointer-events: none;
  /* Default rule controls the LEAVE state. transition-delay
     stays unset so leaving plays without delay. */
  transition:
    opacity   var(--tt-out-dur) var(--tt-out-ease),
    transform var(--tt-out-dur) var(--tt-out-ease);
}
/* The 50ms delay belongs ONLY to the hover rule so leaving
   the trigger snaps the delay back to 0 and the disappear
   plays immediately. */
.t-tt-wrap:hover .t-tt,
.t-tt-trigger:focus-visible + .t-tt {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
  transition-duration: var(--tt-in-dur);
  transition-timing-function: var(--tt-in-ease);
  transition-delay: var(--tt-delay);
}

@media (prefers-reduced-motion: reduce) {
  .t-tt { transition: none !important; }
}


/* Source disclosure sits after the caption; anchor its panel to the photo width. */
.eg-photo .eg-photo-source{position:static;vertical-align:baseline;margin-left:4px}
.eg-photo-source .t-tt-trigger{appearance:none;display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;padding:5px;border:0;border-radius:50%;background:transparent;color:#566861;vertical-align:middle;cursor:help}
.eg-photo-source .eg-photo-info-icon{display:block;width:14px;height:14px;flex-shrink:0}
.eg-photo-source .t-tt-trigger:focus-visible,.eg-photo-source .t-tt a:focus-visible{outline:2px solid #193c35;outline-offset:3px}
.eg-photo .t-tt{z-index:5;width:100%;box-sizing:border-box;white-space:normal;font-size:11px;line-height:1.8;text-align:left;visibility:hidden}
.eg-photo .t-tt::after{content:"";position:absolute;inset:100% 0 auto;height:10px}
.eg-photo .t-tt strong,.eg-photo .eg-photo-source-note{display:block}
.eg-photo .t-tt a{color:#193c35;text-decoration:underline;text-underline-offset:3px}
.eg-photo-source:hover .t-tt,.eg-photo-source:focus-within .t-tt,.eg-photo-source[data-open="true"] .t-tt{visibility:visible;pointer-events:auto;opacity:1;transform:translate(-50%,0) scale(1);transition-duration:var(--tt-in-dur);transition-timing-function:var(--tt-in-ease);transition-delay:var(--tt-delay)}
.eg-photo-source[data-dismissed="true"] .t-tt{visibility:hidden;pointer-events:none;opacity:0;transform:translate(-50%,0) scale(var(--tt-scale));transition-duration:var(--tt-out-dur);transition-delay:0ms}
