/*
 * Totemia GIS — one photo's byline and actions (gis-photo-actions.js): the
 * poster line, the "More" menu (download / report / remove) and the report
 * form, plus the gallery's entrance. Flat surfaces on the GIS tokens; menus
 * are separated by a border, not a depth shadow.
 */

/* ── Byline: avatar, name, then System ID · when ──────────────────────── */

.gis-photo-byline {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.gis-photo-face {
  display: inline-flex;
  flex: 0 0 auto;
  color: inherit;
  text-decoration: none;
}

.gis-photo-face img,
.gis-photo-face .gis-photo-initial {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
}

.gis-photo-byline-text {
  display: grid;
  min-width: 0;
}

.gis-photo-name {
  overflow: hidden;
  color: var(--gis-ink);
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

a.gis-photo-name:hover {
  text-decoration: underline;
}

.gis-photo-meta {
  color: var(--gis-muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.gis-photo-byline.is-dark .gis-photo-name {
  color: #ffffff;
}

.gis-photo-byline.is-dark .gis-photo-meta {
  color: rgba(255, 255, 255, 0.72);
}

/* ── More button and menu ─────────────────────────────────────────────── */

.gis-photo-actions {
  position: relative;
  flex: 0 0 auto;
}

.gis-photo-more {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--gis-ink);
  cursor: pointer;
  transition:
    background var(--duration-fast) var(--ease-out),
    transform var(--duration-fast) var(--ease-out);
}

.gis-photo-more[aria-expanded="true"] {
  background: rgba(127, 127, 127, 0.16);
}

.gis-photo-more:active {
  transform: scale(0.94);
}

.gis-photo-more:focus-visible,
.gis-photo-menu-item:focus-visible,
.gis-photo-reason:focus-visible,
.gis-photo-reportpanel button:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 3px rgba(196, 152, 31, 0.32);
}

.gis-photo-actions.is-dark .gis-photo-more {
  color: #ffffff;
}

/* Grows out of the button that opened it. */
.gis-photo-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 6;
  min-width: 200px;
  padding: 6px;
  border: 1px solid var(--gis-line);
  border-radius: 12px;
  background: var(--gis-paper);
  transform-origin: top right;
  transition:
    opacity var(--duration-fast) var(--ease-out),
    transform var(--duration-fast) var(--ease-out);
}

@starting-style {
  .gis-photo-menu {
    opacity: 0;
    transform: scale(0.96);
  }
}

.gis-photo-menu[hidden] {
  display: none;
}

/* In the viewer the actions sit at the bottom of the screen: open upward. */
.gis-photo-actions.is-dark .gis-photo-menu {
  top: auto;
  bottom: calc(100% + 6px);
  border-color: rgba(255, 255, 255, 0.12);
  background: #1c2024;
  transform-origin: bottom right;
}

.gis-photo-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  box-sizing: border-box;
  width: 100%;
  min-height: 40px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--gis-ink);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out);
}

.gis-photo-menu-item:focus-visible {
  background: var(--gis-ivory);
}

.gis-photo-menu-item.is-danger {
  color: var(--gis-red);
}

.gis-photo-menu-item.is-armed {
  background: rgba(159, 47, 36, 0.1);
  font-weight: 800;
}

.gis-photo-menu-item:disabled {
  cursor: progress;
  opacity: 0.6;
}

.gis-photo-menu-sep {
  height: 1px;
  margin: 6px 4px;
  background: var(--gis-line);
}

.gis-photo-actions.is-dark .gis-photo-menu-item {
  color: #ffffff;
}

.gis-photo-actions.is-dark .gis-photo-menu-item.is-danger {
  color: #ff8a7d;
}

.gis-photo-actions.is-dark .gis-photo-menu-item:focus-visible {
  background: rgba(255, 255, 255, 0.08);
}

.gis-photo-actions.is-dark .gis-photo-menu-sep {
  background: rgba(255, 255, 255, 0.12);
}

/* ── Report form, opened in place under the photo ─────────────────────── */

.gis-photo-reportpanel {
  display: grid;
  gap: 12px;
  margin-top: 12px;
  padding: 14px;
  border-radius: 12px;
  background: var(--gis-ivory);
  color: var(--gis-ink);
  transition:
    opacity var(--duration) var(--ease-out),
    transform var(--duration) var(--ease-out);
}

@starting-style {
  .gis-photo-reportpanel {
    opacity: 0;
    transform: translateY(-4px);
  }
}

.gis-photo-reportpanel[hidden] {
  display: none;
}

.gis-photo-reportpanel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.gis-photo-reportpanel-head h4 {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
}

.gis-photo-reportpanel-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--gis-muted);
  cursor: pointer;
}

.gis-photo-reasons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.gis-photo-reason {
  min-height: 36px;
  padding: 0 12px;
  border: 2px solid var(--gis-line);
  border-radius: 8px;
  background: var(--gis-paper);
  color: var(--gis-ink);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition:
    border-color var(--duration-fast) var(--ease-out),
    background var(--duration-fast) var(--ease-out),
    color var(--duration-fast) var(--ease-out),
    transform var(--duration-fast) var(--ease-out);
}

.gis-photo-reason:active {
  transform: scale(0.97);
}

.gis-photo-reason[aria-checked="true"] {
  border-color: var(--gis-green);
  background: var(--gis-green);
  color: #ffffff;
}

.gis-photo-reportpanel-field {
  display: grid;
  gap: 6px;
}

.gis-photo-reportpanel-field > span {
  color: var(--gis-muted);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.gis-photo-reportpanel-field textarea {
  box-sizing: border-box;
  width: 100%;
  padding: 10px 12px;
  border: 2px solid var(--gis-line);
  border-radius: 10px;
  background: var(--gis-paper);
  color: var(--gis-ink);
  font-family: var(--gis-font);
  font-size: 16px;
  font-weight: 600;
  resize: none;
  transition: border-color var(--duration-fast) var(--ease-out), box-shadow var(--duration-fast) var(--ease-out);
}

.gis-photo-reportpanel-field textarea:focus {
  outline: 0;
  border-color: var(--gis-green);
  box-shadow: 0 0 0 3px rgba(18, 60, 50, 0.14);
}

.gis-photo-reportpanel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.gis-photo-reportpanel-send,
.gis-photo-reportpanel-cancel {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease-out), transform var(--duration-fast) var(--ease-out), opacity var(--duration-fast) var(--ease-out);
}

.gis-photo-reportpanel-send {
  background: var(--gis-green);
  color: #ffffff;
}

.gis-photo-reportpanel-send:disabled {
  cursor: default;
  opacity: 0.45;
}

.gis-photo-reportpanel-cancel {
  background: transparent;
  color: var(--gis-ink);
}

.gis-photo-reportpanel-send:not(:disabled):active,
.gis-photo-reportpanel-cancel:active {
  transform: scale(0.97);
}

/* ── Gallery and viewer layout ─────────────────────────────────────────── */

/* The gallery slides over the place from the right and leaves the same way. */
.gis-photo-gallery {
  transition:
    opacity var(--duration) var(--ease-drawer),
    transform var(--duration) var(--ease-drawer);
}

@starting-style {
  .gis-photo-gallery {
    opacity: 0;
    transform: translateX(24px);
  }
}

.gis-photo-gallery.is-leaving {
  opacity: 0;
  transform: translateX(24px);
  transition-duration: var(--duration-fast);
  pointer-events: none;
}

/* Photos fade in as they arrive instead of popping in. */
.gis-photo-item-image img {
  opacity: 0;
  transition: opacity var(--duration) var(--ease-out);
}

.gis-photo-item-image.is-loaded img {
  opacity: 1;
}

.gis-photo-item-meta {
  margin-top: 10px;
}

.gis-photo-viewer-foot {
  flex-direction: column;
  align-items: stretch;
}

.gis-photo-viewer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.gis-photo-add.is-busy svg {
  animation: gis-photo-add-pulse 1.2s var(--ease-out) infinite;
}

@keyframes gis-photo-add-pulse {
  50% { opacity: 0.4; }
}

@media (hover: hover) and (pointer: fine) {
  .gis-photo-more:hover {
    background: rgba(127, 127, 127, 0.16);
  }

  .gis-photo-menu-item:hover {
    background: var(--gis-ivory);
  }

  .gis-photo-actions.is-dark .gis-photo-menu-item:hover {
    background: rgba(255, 255, 255, 0.08);
  }

  .gis-photo-reason:hover {
    border-color: var(--gis-green);
  }

  .gis-photo-reportpanel-close:hover,
  .gis-photo-reportpanel-cancel:hover {
    background: rgba(127, 127, 127, 0.14);
  }
}

@media (pointer: coarse) {
  .gis-photo-more,
  .gis-photo-reportpanel-close {
    width: 44px;
    height: 44px;
  }

  .gis-photo-menu-item,
  .gis-photo-reason {
    min-height: 44px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .gis-photo-more:active,
  .gis-photo-reason:active,
  .gis-photo-reportpanel-send:not(:disabled):active,
  .gis-photo-reportpanel-cancel:active {
    transform: none;
  }

  .gis-photo-menu,
  .gis-photo-reportpanel,
  .gis-photo-gallery,
  .gis-photo-gallery.is-leaving {
    transform: none;
    transition-property: opacity;
  }

  @starting-style {
    .gis-photo-menu,
    .gis-photo-reportpanel,
    .gis-photo-gallery {
      transform: none;
    }
  }

  .gis-photo-add.is-busy svg {
    animation: none;
  }
}
