html.pfg-open { overflow: hidden; }

.pfg-dialog {
  --pfg-paper: #fff;
  --pfg-ink: var(--ink);
  --pfg-muted: var(--muted);
  --pfg-rule: var(--line);
  --pfg-blue: var(--blue);
  box-sizing: border-box;
  width: min(1380px, calc(100% - 5vw));
  max-width: none;
  height: min(48rem, calc(100vh - 40px), max(42rem, 54vw));
  height: min(48rem, calc(100dvh - 40px), max(42rem, 54vw));
  max-height: none;
  padding: 0;
  margin: auto;
  overflow: hidden;
  border: 1px solid var(--pfg-rule);
  border-radius: 3px;
  background: var(--pfg-paper);
  color: var(--pfg-ink);
  font: inherit;
  text-align: start;
  box-shadow: 0 20px 90px rgb(15 24 28 / 19%);
}
.pfg-dialog:not([open]) { display: none; }
.pfg-dialog::backdrop { background: rgb(21 30 34 / 53%); }
.pfg-dialog *, .pfg-dialog *::before, .pfg-dialog *::after { box-sizing: border-box; }
.pfg-dialog [hidden] { display: none !important; }
.pfg-dialog button { font: inherit; cursor: pointer; color: inherit; }
.pfg-dialog button:focus-visible { outline: 2px solid var(--pfg-blue); outline-offset: 3px; }
.pfg-frame { height: 100%; display: flex; flex-direction: column; }
.pfg-toolbar {
  padding: 12px clamp(16px, 3vw, 48px);
  min-height: 68px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--pfg-rule);
  background: var(--pfg-paper);
}
.pfg-category { margin-inline-end: auto; color: var(--pfg-muted); font-size: .94rem; font-weight: 550; }
.pfg-toolbar .language { color: var(--pfg-blue); font-size: .94rem; }
.pfg-dialog[dir='ltr'] .pfg-category { letter-spacing: .045em; }
.pfg-close {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 2px;
  background: none;
}
.pfg-close-text { font-size: .875rem; }
.pfg-close:hover, .pfg-step:hover { background: #f1f5f6; }
.pfg-close svg, .pfg-step svg { flex-shrink: 0; }

.pfg-body {
  display: grid;
  flex: 1 1 auto;
  min-height: 0;
  grid-template-columns: minmax(196px, .32fr) minmax(0, 1fr);
  padding: clamp(20px, 3.2vw, 50px);
  gap: clamp(22px, 3.4vw, 56px);
  align-items: stretch;
}
.pfg-text-only .pfg-body { grid-template-columns: minmax(0, 64ch); }
.pfg-story { align-self: start; max-height: 100%; overflow: auto; }
.pfg-title {
  margin: 0;
  font-family: inherit;
  font-size: clamp(2rem, 3.8vw, 4.5rem);
  line-height: 1.06;
  font-weight: 640;
  overflow-wrap: anywhere;
  text-wrap: balance;
}
.pfg-dialog[dir='ltr'] .pfg-title { letter-spacing: -.046em; }
.pfg-description { color: var(--pfg-muted); font-size: 1rem; line-height: 1.64; margin: 17px 0 0; max-width: 44ch; }
.pfg-facts { margin: clamp(24px, 4vw, 60px) 0 0; }
.pfg-detail { border-top: 1px solid var(--pfg-rule); padding: 12px 0; }
.pfg-detail-label { font-size: .875rem; font-weight: 580; color: var(--pfg-muted); }
.pfg-detail-value { margin: 4px 0 0; font-size: .96rem; font-weight: 500; line-height: 1.48; }

.pfg-visual { display: grid; grid-template-rows: minmax(0, 1fr) auto auto; gap: 10px; min-width: 0; min-height: 0; }
.pfg-stage { position: relative; min-width: 0; min-height: 0; overflow: hidden; background: #fafaf9; isolation: isolate; }
.pfg-dialog .pfg-hero {
  position: absolute;
  inset: 0;
  display: block;
  height: 100%;
  width: 100%;
  max-width: none;
  max-height: none;
  object-fit: contain;
  transform: none;
}
.pfg-caption { align-self: start; margin: 0; line-height: 1.45; font-size: .86rem; color: var(--pfg-muted); }
.pfg-selector { display: flex; align-items: center; gap: 12px; min-width: 0; }
.pfg-step { display: grid; flex: 0 0 42px; height: 42px; place-content: center; border: 1px solid var(--pfg-rule); background: var(--pfg-paper); border-radius: 2px; padding: 0; }
.pfg-dialog[dir='rtl'] .pfg-step svg { transform: scaleX(-1); }
.pfg-thumbnails { flex: 1; min-width: 0; display: flex; align-items: center; overflow-x: auto; padding: 5px; gap: 7px; scrollbar-width: thin; }
.pfg-thumb {
  display: block;
  flex: 0 0 62px;
  width: 62px;
  height: 45px;
  border: 2px solid transparent;
  border-radius: 1px;
  background: transparent;
  padding: 2px;
}
.pfg-thumb:hover { border-color: var(--pfg-rule); }
.pfg-thumb[aria-pressed='true'] { border-color: var(--pfg-blue); }
.pfg-dialog .pfg-thumb-image { display: block; width: 100%; height: 100%; object-fit: cover; }
.pfg-status { color: var(--pfg-muted); font-size: .875rem; white-space: nowrap; }

@media (max-width: 740px) {
  .pfg-dialog {
    width: 100%;
    height: 100vh;
    height: 100dvh;
    border: 0;
    border-radius: 0;
  }
  .pfg-frame { overflow-y: auto; overscroll-behavior: contain; }
  .pfg-toolbar { position: sticky; top: 0; z-index: 2; min-height: 56px; padding: 6px 16px; }
  .pfg-dialog .pfg-body { display: flex; flex-direction: column; flex: none; padding: 22px 16px max(24px, env(safe-area-inset-bottom)); gap: 18px; }
  .pfg-story { display: contents; }
  .pfg-title { order: 0; font-size: clamp(2.05rem, 9.3vw, 3.6rem); }
  .pfg-visual { order: 1; display: flex; flex-direction: column; gap: 8px; }
  .pfg-stage { min-height: 0; aspect-ratio: 16 / 9; }
  .pfg-description { order: 2; margin: 0; }
  .pfg-facts { order: 3; margin: 0; }
  .pfg-selector { gap: 6px; }
  .pfg-step { flex-basis: 40px; height: 42px; }
  .pfg-thumb { width: 56px; flex-basis: 56px; }
}
@media (max-height: 590px) and (min-width: 741px) {
  .pfg-dialog { width: calc(100% - 16px); height: calc(100vh - 16px); height: calc(100dvh - 16px); }
  .pfg-toolbar { min-height: 46px; padding-block: 2px; }
  .pfg-body { padding-block: 14px; }
  .pfg-title { font-size: 2.1rem; }
  .pfg-facts { margin-top: 16px; }
}
