/* ==========================================================================
 * share.css  —  styling for the free-alkhalidi.org share mechanism
 * --------------------------------------------------------------------------
 * Uses the site design tokens (system.css :root vars) with hard-coded fallbacks
 * so the component renders correctly even if loaded before/without system.css.
 * Visual language matches the existing .share-btn / .btn--secondary controls.
 * ========================================================================== */

/* ---- trigger button --------------------------------------------------- */
.fa-share { display: inline-flex; }

.fa-share-btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  min-height: 34px;
  padding: .45rem .8rem;
  background: transparent;
  color: var(--color-text, #EDEFF3);
  border: 1px solid var(--color-border-strong, rgba(237, 239, 243, .18));
  border-radius: var(--radius-sm, 6px);
  font-family: var(--font-sans, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .07em;
  text-transform: uppercase;
  line-height: 1;
  cursor: pointer;
  transition: border-color .18s ease, color .18s ease, transform .18s ease;
}
.fa-share-btn:hover { border-color: var(--color-highlight, #C5A572); color: var(--color-highlight, #C5A572); transform: translateY(-1px); }
.fa-share-btn:focus-visible { outline: 2px solid var(--color-focus, #d9bd8e); outline-offset: 2px; }
.fa-share-btn .fa-share-ic { display: inline-flex; }
.fa-share-btn .fa-share-ic svg { width: 17px; height: 17px; display: block; }

/* compact (icon-only) variant: add class fa-share-btn--icon on a custom trigger */
.fa-share-btn--icon .fa-share-btn-lbl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.fa-share-btn--icon { min-height: 32px; width: 32px; height: 32px; padding: 0; justify-content: center; }
.fa-share-btn--icon .fa-share-ic svg { width: 15px; height: 15px; }

/* ---- overlay + menu --------------------------------------------------- */
.fa-share-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal, 400);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(4, 8, 16, .62);
  opacity: 0;
  transition: opacity .2s ease;
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}
.fa-share-overlay.is-open { opacity: 1; }

.fa-share-menu {
  width: min(360px, 100%);
  max-height: 86vh;
  overflow: auto;
  background: var(--color-surface, #0F1928);
  border: 1px solid var(--color-border-strong, rgba(237, 239, 243, .18));
  border-radius: var(--radius-md, 12px);
  box-shadow: var(--shadow-3, 0 12px 32px rgba(0, 0, 0, .45));
  transform: translateY(10px) scale(.985);
  transition: transform .2s var(--ease-standard, cubic-bezier(.2, 0, 0, 1));
  color: var(--color-text, #EDEFF3);
  font-family: var(--font-sans, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif);
}
.fa-share-overlay.is-open .fa-share-menu { transform: translateY(0) scale(1); }

.fa-share-menu-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  padding: .85rem 1rem;
  border-bottom: 1px solid var(--color-border, rgba(237, 239, 243, .08));
}
.fa-share-menu-title { font-size: .78rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--color-text-dim, #8B96A8); }
.fa-share-menu-close {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; padding: 0; cursor: pointer;
  background: transparent; border: 0; border-radius: 8px;
  color: var(--color-text-dim, #8B96A8);
}
.fa-share-menu-close:hover { color: var(--color-text, #EDEFF3); background: var(--color-border, rgba(237, 239, 243, .08)); }
.fa-share-menu-close:focus-visible { outline: 2px solid var(--color-focus, #d9bd8e); outline-offset: 2px; }
.fa-share-menu-close svg { width: 18px; height: 18px; display: block; }

.fa-share-menu-list { display: flex; flex-direction: column; padding: .5rem; gap: 2px; }

.fa-share-item {
  display: flex;
  align-items: center;
  gap: .8rem;
  width: 100%;
  padding: .7rem .8rem;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--color-text, #EDEFF3);
  font: inherit;
  font-size: .95rem;
  font-weight: 600;
  text-align: start;
  text-decoration: none;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}
.fa-share-item:hover { background: var(--color-border, rgba(237, 239, 243, .08)); }
.fa-share-item:focus-visible { outline: 0; border-color: var(--color-highlight, #C5A572); background: var(--color-border, rgba(237, 239, 243, .08)); }

.fa-share-ic {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; flex: 0 0 auto;
  border-radius: 9px;
  background: var(--color-surface-raised, #1A2942);
  color: var(--color-text, #EDEFF3);
}
.fa-share-ic svg { width: 19px; height: 19px; display: block; }

/* brand tinting on hover, kept subtle to match the restrained palette */
.fa-share-item:hover .fa-ic--x        { background: #000;      color: #fff; }
.fa-share-item:hover .fa-ic--facebook { background: #1877F2;   color: #fff; }
.fa-share-item:hover .fa-ic--whatsapp { background: #25D366;   color: #fff; }
.fa-share-item:hover .fa-ic--telegram { background: #229ED9;   color: #fff; }
.fa-share-item:hover .fa-ic--linkedin { background: #0A66C2;   color: #fff; }
.fa-share-item--copy.is-copied { color: var(--color-success, #2ea043); }
.fa-share-item--copy.is-copied .fa-share-ic { background: var(--color-success, #2ea043); color: #fff; }

/* ---- mobile bottom sheet --------------------------------------------- */
@media (max-width: 560px) {
  .fa-share-overlay { align-items: flex-end; padding: 0; }
  .fa-share-menu {
    width: 100%;
    max-height: 80vh;
    border-radius: 16px 16px 0 0;
    transform: translateY(100%);
  }
  .fa-share-overlay.is-open .fa-share-menu { transform: translateY(0); }
  .fa-share-menu-list { padding-bottom: max(.5rem, env(safe-area-inset-bottom)); }
}

/* ---- RTL -------------------------------------------------------------- */
[dir="rtl"] .fa-share-menu-title,
.fa-share-menu[dir="rtl"] .fa-share-menu-title { letter-spacing: 0; }
.fa-share-menu[dir="rtl"] .fa-share-item { text-align: start; }

/* ---- visually-hidden live region ------------------------------------- */
.fa-share-live { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- reduced motion --------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .fa-share-overlay, .fa-share-menu, .fa-share-btn { transition: none; }
  .fa-share-menu { transform: none; }
}

/* ---- full-card anchor wrapper + floating control --------------------- */
/* A whole-card <a>/<button> cannot nest an interactive control, so share.js
 * wraps it and floats a subtle icon-only button as a sibling. The wrapper is a
 * thin flex shell so the card keeps filling its grid cell at equal height. */
.fa-sharewrap { position: relative; display: flex; }
.fa-sharewrap > :not(.fa-share) { flex: 1 1 auto; width: 100%; min-width: 0; }
.fa-share--overlay {
  position: absolute;
  inset-block-start: var(--space-2, .5rem);
  inset-inline-end: var(--space-2, .5rem);
  z-index: var(--z-dropdown, 20);
  display: inline-flex;
}
.fa-share--overlay .fa-share-btn {
  background: rgba(11, 18, 32, .55);
  border-color: rgba(237, 239, 243, .22);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.fa-share--overlay .fa-share-btn:hover {
  background: rgba(11, 18, 32, .72);
  border-color: var(--color-highlight, #C5A572);
}
/* Block card: appended control sits at the trailing edge, clearly secondary. */
[data-share-card]:not([data-share-mount="overlay"]) > .fa-share {
  margin-block-start: var(--space-3, .75rem);
  margin-inline-start: auto;
}
