/**
 * FlatCMS - Flat-File Content Management System
 * Copyright (C) 2026 Alain BROYE
 * SPDX-License-Identifier: AGPL-3.0-or-later
 *
 * ALTO SÉQUANAIS — contextual share dropdown.
 * Similar interaction to ARTS Immobilier, with ALTO palette and restrained radius.
 */
.posts-grid > .card .card-image .alto-post-share {
  position: absolute;
  top: 13px;
  right: 64px;
  z-index: 20;
}
/* Pair both controls with a real gap: the favorite count can widen. */
.posts-grid > .card .card-image .alto-post-actions {
  position: absolute;
  top: 13px;
  right: 13px;
  z-index: 20;
  display: flex;
  flex-direction: row-reverse;
  align-items: center;
  gap: 9px;
}
.posts-grid > .card .card-image .alto-post-actions > .alto-post-favorite,
.posts-grid > .card .card-image .alto-post-actions > .alto-post-share {
  position: relative;
  inset: auto;
  margin: 0;
  flex: 0 0 auto;
}
.alto-post-share-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .85);
  border-radius: 50%;
  background: rgba(255,255,255,.98);
  color: #23314a;
  box-shadow: 0 2px 12px rgba(30,40,55,.15);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: color .2s ease, transform .2s ease, background-color .2s ease;
}
.alto-post-share-trigger:hover,
.alto-post-share-trigger[aria-expanded="true"] {
  color: var(--color-primary, #9f1f63);
  background: white;
}
.alto-post-share-trigger:focus-visible,
.alto-post-share-option:focus-visible {
  outline: 3px solid var(--color-primary, #9f1f63);
  outline-offset: 2px;
}
.alto-post-share-dropdown {
  position: absolute;
  top: 51px;
  right: -51px;
  z-index: 50;
  display: flex;
  flex-direction: column;
  width: 224px;
  max-width: calc(100vw - 44px);
  padding: 6px;
  border: 1px solid #e6e2e7;
  border-radius: 9px;
  background: #fff;
  box-shadow: 0 18px 36px rgba(17,19,24,.15);
}
.alto-post-share-dropdown[hidden] {
  display: none !important;
}
.alto-post-share-option {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  border: none;
  border-radius: 5px;
  background: transparent;
  color: #263249;
  font: inherit;
  font-size: .9rem;
  font-weight: 500;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.alto-post-share-option:hover {
  background: #f8f2f5;
  color: var(--color-primary, #9f1f63);
  text-decoration: none;
}
.alto-post-share-option > svg,
.alto-post-share-option > i.fa-brands {
  flex: 0 0 18px;
  width: 18px;
  text-align: center;
  color: #805c73;
}
.alto-post-share-option > i.fa-brands {
  font-size: 18px;
  line-height: 1;
}

/* The dropdown is allowed outside the media container without hiding the image crop. */
.posts-grid > .card.alto-share-open {
  position: relative;
  z-index: 5;
  overflow: visible;
}
.posts-grid > .card.alto-share-open .card-image {
  overflow: visible;
}
.posts-grid > .card.alto-share-open .card-image > a {
  overflow: hidden;
  border-top-left-radius: 8px;
  border-top-right-radius: 8px;
}
.alto-detail-favorite {
  align-items: center;
  gap: 8px;
}
.alto-post-share--detail {
  position: relative;
  display: inline-flex;
}
.alto-post-share--detail .alto-post-share-trigger {
  border-color: #e1dce1;
  box-shadow: none;
}
.alto-post-share--detail .alto-post-share-dropdown {
  right: 0;
  top: 49px;
}
@media (max-width: 640px) {
  .posts-grid > .card .card-image .alto-post-share {
    right: 62px;
  }
  .alto-post-share-dropdown {
    right: -52px;
    width: min(220px, calc(100vw - 56px));
  }
}
@media (prefers-reduced-motion: reduce) {
  .alto-post-share-trigger {
    transition: none;
  }
}

/* Override editorial .prose a rules inside the share popover. */
.prose .alto-post-share-dropdown a.alto-post-share-option,
.prose .alto-post-share-dropdown a.alto-post-share-option:visited {
  color: #263249;
  text-decoration: none;
  text-underline-offset: 0;
}
.prose .alto-post-share-dropdown a.alto-post-share-option:hover,
.prose .alto-post-share-dropdown a.alto-post-share-option:focus-visible {
  color: var(--color-primary, #9f1f63);
  text-decoration: none;
}

/* Legacy clipboard fallback: no inline style attributes (CSP-safe). */
.alto-share-temp-copy {
  position: fixed;
  top: -1000px;
  left: -1000px;
  width: 1px;
  height: 1px;
  opacity: 0;
}
