/* Step 2 review: enlarge the photograph already shown in this profile.
   All selectors are scoped to the photo-review body class. Reading layout
   remains unchanged when the existing dialog is not in photo mode. */
body.atlas-guide.profile-photo-review .profile-photo-trigger {
  position: relative;
  display: block;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  max-width: none;
  margin: 0;
  border: 0;
  border-radius: 0;
  padding: 0;
  appearance: none;
  background: transparent;
  color: var(--atlas-forest);
  font: inherit;
  line-height: normal;
  text-align: left;
  cursor: zoom-in;
}

body.atlas-guide.profile-photo-review .profile-photo-trigger .detail-photo-frame {
  margin: 0;
}

body.atlas-guide.profile-photo-review .profile-photo-badge {
  position: absolute;
  right: .7rem;
  bottom: .7rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  min-height: 26px;
  border: 1px solid #fff9e99e;
  border-radius: 2px;
  padding: .25rem .45rem;
  background: #fffaf0e6;
  color: #233d32;
  box-shadow: 0 1px 4px #152d2714;
  font: 500 .7rem/1.3 system-ui, sans-serif;
  letter-spacing: .005em;
  pointer-events: none;
}

body.atlas-guide.profile-photo-review .profile-photo-trigger:hover:not(:disabled) .profile-photo-badge {
  border-color: #e9d8ae;
  background: #fffdf7eb;
}

body.atlas-guide.profile-photo-review .profile-photo-trigger:focus-visible {
  outline: 3px solid var(--atlas-focus);
  outline-offset: 3px;
}

body.atlas-guide.profile-photo-review .profile-photo-trigger:disabled {
  cursor: wait;
}

body.atlas-guide.profile-photo-review .profile-photo-trigger:disabled .profile-photo-badge {
  opacity: .6;
}

body.atlas-guide.profile-photo-review .profile-photo-badge[hidden] {
  display: none;
}

body.atlas-guide.profile-photo-review .profile-photo-viewer[hidden] {
  display: none;
}

body.atlas-guide.profile-photo-review #atlas-window.profile-photo-mode .atlas-window {
  grid-template-rows: auto minmax(0, 1fr);
}

body.atlas-guide.profile-photo-review #atlas-window.profile-photo-mode .atlas-scroll,
body.atlas-guide.profile-photo-review #atlas-window.profile-photo-mode .atlas-pager {
  display: none;
}

body.atlas-guide.profile-photo-review #atlas-window.profile-photo-mode .profile-photo-viewer {
  grid-row: 2;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #1d332c;
}

body.atlas-guide.profile-photo-review #atlas-window.profile-photo-mode .profile-photo-viewer[hidden] {
  display: none;
}

body.atlas-guide.profile-photo-review .profile-photo-stage {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #9eaf99 #1d332c;
  background: #1d332c;
  -webkit-overflow-scrolling: touch;
}

body.atlas-guide.profile-photo-review .profile-photo-stage:focus-visible {
  outline: 3px solid #dac18a;
  outline-offset: -4px;
}

body.atlas-guide.profile-photo-review .profile-photo-canvas {
  display: flex;
  box-sizing: border-box;
  align-items: center;
  justify-content: center;
  min-width: 100%;
  min-height: 100%;
  margin: 0;
}

body.atlas-guide.profile-photo-review .profile-photo-stage[data-photo-size="fit"] .profile-photo-canvas {
  width: 100%;
  height: 100%;
  padding: clamp(.7rem, 1.8vw, 1.4rem);
}

body.atlas-guide.profile-photo-review .profile-photo-image {
  display: block;
  flex: none;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  margin: 0;
  border: 0;
  border-radius: 0;
  padding: 0;
  background: transparent;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}

/* Actual-size dimensions are provided inline from the loaded image's
   natural pixels. Native overflow handles scrolling in both directions. */
body.atlas-guide.profile-photo-review .profile-photo-stage[data-photo-size="actual"] .profile-photo-canvas {
  padding: 0;
}

body.atlas-guide.profile-photo-review .profile-photo-stage[data-photo-size="actual"] .profile-photo-image {
  max-width: none;
  max-height: none;
}

body.atlas-guide.profile-photo-review .profile-photo-footer {
  display: grid;
  grid-template-columns: minmax(190px, .75fr) minmax(0, 1.25fr);
  align-items: start;
  gap: .8rem 1.5rem;
  box-sizing: border-box;
  max-height: 28dvh;
  min-width: 0;
  overflow: auto;
  overscroll-behavior: contain;
  border-top: 1px solid var(--atlas-line);
  padding: .9rem 1.4rem 1rem;
  background: var(--atlas-surface);
  color: var(--atlas-ink);
  scrollbar-width: thin;
  scrollbar-color: #9aa88e transparent;
}

body.atlas-guide.profile-photo-review .profile-photo-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  align-content: start;
  gap: 0;
  min-width: 0;
}

body.atlas-guide.profile-photo-review .profile-photo-tools button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  box-sizing: border-box;
  min-width: 72px;
  min-height: 44px;
  margin: 0;
  border: 1px solid #9da992;
  border-radius: 0;
  padding: .6rem .95rem;
  background: #fffdf7;
  color: var(--atlas-forest);
  font: 500 .85rem/1.25 system-ui, sans-serif;
  cursor: pointer;
}

body.atlas-guide.profile-photo-review .profile-photo-tools button[data-photo-fit] {
  border-radius: 3px 0 0 3px;
}

body.atlas-guide.profile-photo-review .profile-photo-tools button[data-photo-actual] {
  margin-left: -1px;
  border-radius: 0 3px 3px 0;
}

body.atlas-guide.profile-photo-review .profile-photo-tools button[aria-pressed="true"] {
  position: relative;
  z-index: 1;
  border-color: var(--atlas-forest);
  background: var(--atlas-forest);
  color: #fff8e9;
}

body.atlas-guide.profile-photo-review .profile-photo-tools button:hover:not([aria-pressed="true"]):not(:disabled) {
  background: #e9eddf;
}

body.atlas-guide.profile-photo-review .profile-photo-tools button:disabled {
  opacity: .55;
  cursor: wait;
}

body.atlas-guide.profile-photo-review .profile-photo-tools button:focus-visible,
body.atlas-guide.profile-photo-review .profile-photo-credits a:focus-visible {
  position: relative;
  z-index: 2;
  outline: 3px solid var(--atlas-focus);
  outline-offset: 3px;
}

body.atlas-guide.profile-photo-review .profile-photo-size-note {
  flex-basis: 100%;
  margin: .5rem 0 0;
  color: #62705c;
  font: .75rem/1.5 system-ui, sans-serif;
  overflow-wrap: anywhere;
}

body.atlas-guide.profile-photo-review .profile-photo-credits {
  min-width: 0;
  color: #596851;
  font: .78rem/1.65 system-ui, sans-serif;
  overflow-wrap: anywhere;
}

body.atlas-guide.profile-photo-review .profile-photo-credits p,
body.atlas-guide.profile-photo-review .profile-photo-credits .credit {
  margin: .05rem 0 .35rem;
  color: inherit;
  font: inherit;
}

body.atlas-guide.profile-photo-review .profile-photo-credits p:last-child {
  margin-bottom: 0;
}

body.atlas-guide.profile-photo-review .profile-photo-credits a {
  color: #365d48;
  text-decoration-thickness: 1px;
  text-underline-offset: .2em;
}

body.atlas-guide.profile-photo-review .profile-photo-credits a:hover {
  color: #163d29;
}

body.atlas-guide.profile-photo-review #atlas-window.profile-photo-mode .profile-photo-back {
  align-self: flex-start;
  min-width: 158px;
  min-height: 44px;
  gap: .55rem;
  white-space: nowrap;
}

body.atlas-guide.profile-photo-review .profile-photo-back-arrow {
  font: 1.3rem/1 Georgia, serif;
}

body.atlas-guide.profile-photo-review .profile-photo-back-short {
  display: none;
}

@media (max-width: 700px) {
  body.atlas-guide.profile-photo-review .profile-photo-badge {
    right: .65rem;
    bottom: .65rem;
    padding: .25rem .45rem;
    font-size: .7rem;
  }

  body.atlas-guide.profile-photo-review .profile-photo-stage[data-photo-size="fit"] .profile-photo-canvas {
    padding: .5rem;
  }

  body.atlas-guide.profile-photo-review .profile-photo-footer {
    grid-template-columns: minmax(0, 1fr);
    gap: .7rem;
    max-height: 30dvh;
    padding: .75rem 1rem max(.8rem, env(safe-area-inset-bottom));
  }

  body.atlas-guide.profile-photo-review .profile-photo-tools button {
    min-width: 72px;
    min-height: 44px;
  }

  body.atlas-guide.profile-photo-review .profile-photo-size-note {
    margin-top: .4rem;
    font-size: .73rem;
  }

  body.atlas-guide.profile-photo-review .profile-photo-credits {
    font-size: .76rem;
    line-height: 1.65;
  }

  body.atlas-guide.profile-photo-review #atlas-window.profile-photo-mode .profile-photo-back {
    min-width: 72px;
    min-height: 44px;
    gap: .4rem;
  }

  body.atlas-guide.profile-photo-review .profile-photo-back-full {
    display: none;
  }

  body.atlas-guide.profile-photo-review .profile-photo-back-short {
    display: inline;
  }
}

/* Give the photograph useful space on a landscape phone. This applies only
   while the photograph is enlarged; the reading window keeps its layout. */
@media (max-height: 500px) {
  body.atlas-guide.profile-photo-review #atlas-window.profile-photo-mode {
    inset: 0;
    width: 100vw;
    max-width: none;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0;
    border: 0;
    border-radius: 0;
  }

  body.atlas-guide.profile-photo-review #atlas-window.profile-photo-mode .atlas-window {
    height: 100dvh;
    max-height: 100dvh;
  }

  body.atlas-guide.profile-photo-review #atlas-window.profile-photo-mode .atlas-dialog-header {
    align-items: center;
    gap: .75rem;
    min-height: 64px;
    padding: .5rem max(.9rem, env(safe-area-inset-right)) .5rem max(.9rem, env(safe-area-inset-left));
  }

  body.atlas-guide.profile-photo-review #atlas-window.profile-photo-mode .atlas-kicker {
    display: none;
  }

  body.atlas-guide.profile-photo-review #atlas-window.profile-photo-mode #atlas-title {
    font-size: 1.6rem;
    line-height: 1.1;
  }

  body.atlas-guide.profile-photo-review #atlas-window.profile-photo-mode #atlas-latin {
    margin-top: .2rem;
    font-size: .85rem;
    line-height: 1.2;
  }

  body.atlas-guide.profile-photo-review #atlas-window.profile-photo-mode .profile-photo-back {
    align-self: center;
    min-height: 44px;
  }

  body.atlas-guide.profile-photo-review #atlas-window.profile-photo-mode .profile-photo-stage[data-photo-size="fit"] .profile-photo-canvas {
    padding: .5rem;
  }

  body.atlas-guide.profile-photo-review #atlas-window.profile-photo-mode .profile-photo-footer {
    grid-template-columns: minmax(0, 1fr);
    gap: .45rem 1rem;
    max-height: 28dvh;
    padding: .45rem max(.9rem, env(safe-area-inset-right)) max(.45rem, env(safe-area-inset-bottom)) max(.9rem, env(safe-area-inset-left));
  }

  body.atlas-guide.profile-photo-review #atlas-window.profile-photo-mode .profile-photo-tools button {
    min-height: 44px;
    padding-block: .5rem;
  }

  body.atlas-guide.profile-photo-review #atlas-window.profile-photo-mode .profile-photo-size-note {
    margin-top: .25rem;
    font-size: .7rem;
    line-height: 1.4;
  }

  body.atlas-guide.profile-photo-review #atlas-window.profile-photo-mode .profile-photo-credits {
    font-size: .74rem;
    line-height: 1.5;
  }
}

@media (max-height: 500px) and (min-width: 600px) {
  body.atlas-guide.profile-photo-review #atlas-window.profile-photo-mode .profile-photo-footer {
    grid-template-columns: minmax(190px, .75fr) minmax(0, 1.25fr);
  }
}
