/* Sharing uses the same brand colors and modal lifecycle in every template. */
.share-trigger,
.share-button,
.share-channel,
.share-panel__close {
  min-width: 44px;
  min-height: 44px;
  border: 1px solid var(--brand-border);
  border-radius: var(--radius-sm);
  background: var(--brand-surface);
  color: var(--brand-text);
  font: inherit;
  line-height: 1.4;
  cursor: pointer;
}
.share-trigger {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 0.85rem;
  font-size: 0.9rem;
  font-weight: 700;
  white-space: nowrap;
  text-transform: none;
  letter-spacing: normal;
}
.share-trigger--primary { align-self: center; width: max-content; min-width: max-content; }
.share-icon { width: 1.15rem; height: 1.15rem; flex: 0 0 auto; background: currentColor; -webkit-mask: url("../images/icons/share.svg") center / contain no-repeat; mask: url("../images/icons/share.svg") center / contain no-repeat; }
.share-trigger:hover,
.share-button:hover,
.share-panel__close:hover { border-color: var(--brand-primary); }
.share-trigger:focus-visible,
.share-panel :focus-visible { outline: 3px solid var(--brand-primary); outline-offset: 3px; }
.share-panel {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgb(0 0 0 / 62%);
  overscroll-behavior: contain;
}
.share-panel__content {
  width: 552px;
  max-width: 100%;
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  padding: 1.25rem;
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--brand-border);
  border-radius: var(--radius-lg);
  background: var(--brand-panel);
  color: var(--brand-text);
  box-shadow: 0 1rem 4rem rgb(0 0 0 / 30%);
  scrollbar-gutter: stable;
  overflow-wrap: anywhere;
}
.share-panel__header { position: sticky; top: 0; z-index: 2; display: flex; align-items: flex-start; justify-content: space-between; gap: 0.75rem; margin-bottom: 0.75rem; padding-bottom: 0.5rem; background: var(--brand-panel); }
.share-panel__header h2 { min-width: 0; margin: 0.45rem 0 0; font-size: 1.2rem; line-height: 1.3; }
.share-panel__close { flex: 0 0 44px; padding: 0; font-size: 1.65rem; }
.share-preview { display: flex; align-items: flex-start; gap: 0.85rem; margin-bottom: 0.85rem; }
.share-preview__image { flex: 0 0 48px; width: 48px; height: 48px; border-radius: var(--radius-sm); object-fit: cover; background: var(--brand-surface); }
.share-preview__copy { min-width: 0; }
.share-preview h3 { margin: 0 0 0.2rem; font-size: 0.95rem; line-height: 1.4; }
.share-preview h3, .share-preview p { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.share-preview p,
.share-panel__note,
.share-panel__label,
.share-panel__status { font-size: 0.85rem; line-height: 1.5; color: var(--brand-text-muted); }
.share-panel__note { margin-bottom: 1rem; }
.share-panel__label { display: block; margin-bottom: 0.35rem; font-weight: 700; }
.share-panel__url, .share-panel__message { width: 100%; min-width: 0; min-height: 44px; padding: 0.65rem; border: 1px solid var(--brand-border); border-radius: var(--radius-sm); background: var(--brand-surface); color: var(--brand-text); font-size: 1rem; }
.share-button { display: inline-flex; width: 100%; align-items: center; justify-content: center; padding: 0.7rem; font-size: 0.9rem; font-weight: 700; text-decoration: none; text-align: center; }
.share-link-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.5rem; }
.share-link-row .share-button { width: auto; padding-inline: 0.7rem; white-space: nowrap; }
.share-button--quiet { background: transparent; border-color: transparent; font-weight: 600; }
#share-copy-message { margin-top: 0.5rem; }
.share-button--primary { background: var(--brand-primary); border-color: var(--brand-primary); color: var(--brand-primary-text); }
.share-button:disabled { cursor: wait; opacity: 0.7; }
.share-invitation { display: flex; align-items: flex-start; gap: 0.6rem; min-height: 44px; margin: 0.4rem 0; padding: 0.4rem 0; font-size: 0.85rem; line-height: 1.5; cursor: pointer; }
.share-invitation input { flex: 0 0 20px; width: 20px; height: 20px; min-height: 20px; margin-top: 0.1rem; accent-color: var(--brand-primary); }
.share-invitation strong { display: block; margin-top: 0.25rem; color: var(--brand-text); }
.share-channels { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.5rem; margin-top: 0.7rem; }
.share-channels > * { min-width: 0; }
.share-channel { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 0.3rem; padding: 0.6rem 0.25rem; text-align: center; text-decoration: none; }
.share-channel:hover { border-color: var(--brand-primary); background: var(--brand-panel); }
.share-channel__icon { display: block; flex: 0 0 28px; width: 28px; height: 28px; margin: 0.1rem 0 0.25rem; background: currentColor; -webkit-mask-position: center; mask-position: center; -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat; -webkit-mask-size: contain; mask-size: contain; }
.share-channel__name { min-width: 0; max-width: 100%; font-size: 0.75rem; font-weight: 700; line-height: 1.4; }
.share-channel__hint { min-width: 0; max-width: 100%; font-size: 0.65rem; line-height: 1.35; color: var(--brand-text-muted); }
.share-instructions { margin-top: 0.85rem; }
.share-instructions h3 { margin: 0 0 0.5rem; font-size: 1rem; }
.share-instructions > p { margin-bottom: 0.8rem; color: var(--brand-text-muted); font-size: 0.85rem; line-height: 1.5; }
.share-panel__message { display: block; min-height: 7rem; resize: vertical; font-family: inherit; line-height: 1.5; }
#share-instructions-copy { margin-top: 0.65rem; }
#share-back { margin-top: 0.3rem; }
.share-panel__status { min-height: 1.5em; margin: 0.8rem 0 0; color: var(--brand-text); }

/* Keep a single header entry reachable when desktop navigation collapses. */
.site-header__inner > .brand { min-width: 0; max-width: 100%; flex-shrink: 1; }
@media (max-width: 63.999rem) {
  body:not(.layout-editorial):not(.layout-mosaic):not(.layout-terminal):not(.layout-directory) .site-header__inner { justify-content: space-between; }
  body:not(.layout-editorial):not(.layout-mosaic):not(.layout-terminal):not(.layout-directory) .desktop-nav { display: flex; flex: 0 0 auto; min-width: 0; }
  body:not(.layout-editorial):not(.layout-mosaic):not(.layout-terminal):not(.layout-directory) .desktop-nav > :not([data-share-trigger]) { display: none; }
}
@media (max-width: 640px) {
  .share-trigger--primary { gap: 8px; padding: 10px 12px; }
  .share-trigger--primary .share-icon { width: 18px; height: 18px; }
  .share-panel { align-items: flex-end; padding: 0; }
  .share-panel__content {
    width: 100%;
    max-height: 85vh;
    max-height: 85dvh;
    padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom));
    border-bottom: 0;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }
}
@media (max-width: 360px) {
  .share-preview { gap: 0.65rem; }
  .share-preview__image { flex-basis: 48px; width: 48px; height: 48px; }
  .share-channels { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .share-link-row { grid-template-columns: minmax(0, 1fr); }
  .share-link-row .share-button { justify-self: end; }
}
@media (prefers-reduced-motion: reduce) {
  .share-trigger, .share-panel, .share-panel * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

.share-channel--whatsapp .share-channel__icon { -webkit-mask-image: url("../images/icons/share-whatsapp.svg"); mask-image: url("../images/icons/share-whatsapp.svg"); }

.share-channel--telegram .share-channel__icon { -webkit-mask-image: url("../images/icons/share-telegram.svg"); mask-image: url("../images/icons/share-telegram.svg"); }

.share-channel--facebook .share-channel__icon { -webkit-mask-image: url("../images/icons/share-facebook.svg"); mask-image: url("../images/icons/share-facebook.svg"); }

.share-channel--x .share-channel__icon { -webkit-mask-image: url("../images/icons/share-x.svg"); mask-image: url("../images/icons/share-x.svg"); }

.share-channel--messenger .share-channel__icon { -webkit-mask-image: url("../images/icons/share-messenger.svg"); mask-image: url("../images/icons/share-messenger.svg"); }

.share-channel--instagram .share-channel__icon { -webkit-mask-image: url("../images/icons/share-instagram.svg"); mask-image: url("../images/icons/share-instagram.svg"); }

.share-channel--tiktok .share-channel__icon { -webkit-mask-image: url("../images/icons/share-tiktok.svg"); mask-image: url("../images/icons/share-tiktok.svg"); }
