/* Site-wide share control — floating button + share sheet */

body.has-page-share .scroll-to-top {
  bottom: calc(max(1rem, env(safe-area-inset-bottom, 0px)) + 3.35rem);
}

@media (min-width: 768px) {
  body.has-page-share .scroll-to-top {
    bottom: calc(max(1.5rem, env(safe-area-inset-bottom, 0px)) + 3.65rem);
  }
}

.page-share__fab {
  position: fixed;
  right: max(1rem, env(safe-area-inset-right, 0px));
  bottom: max(1rem, env(safe-area-inset-bottom, 0px));
  z-index: 890;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  max-width: calc(100vw - 2rem);
  padding: 0.625rem 0.95rem;
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: #1d1d1f;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 9999px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06), 0 2px 6px rgba(0, 0, 0, 0.04);
  cursor: pointer;
  transition:
    background 200ms cubic-bezier(0.25, 0.1, 0.25, 1),
    color 200ms cubic-bezier(0.25, 0.1, 0.25, 1),
    box-shadow 200ms cubic-bezier(0.25, 0.1, 0.25, 1),
    transform 200ms cubic-bezier(0.25, 0.1, 0.25, 1);
}

.page-share__fab:hover {
  background: #1d1d1f;
  color: #ffffff;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.08), 0 4px 12px rgba(0, 0, 0, 0.04);
}

.page-share__fab:focus-visible {
  outline: 2px solid #1d1d1f;
  outline-offset: 2px;
}

.page-share__fab-icon {
  display: flex;
  line-height: 0;
  flex-shrink: 0;
}

@media (max-width: 479px) {
  .page-share__fab-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .page-share__fab {
    width: 2.75rem;
    height: 2.75rem;
    padding: 0;
    justify-content: center;
    border-radius: 9999px;
  }
}

@media (min-width: 768px) {
  .page-share__fab {
    right: max(1.5rem, env(safe-area-inset-right, 0px));
    bottom: max(1.5rem, env(safe-area-inset-bottom, 0px));
    font-size: 0.875rem;
    padding: 0.7rem 1.05rem;
  }
}

.page-share-modal-open {
  overflow: hidden;
}

.page-share__modal[hidden] {
  display: none !important;
}

.page-share__modal {
  position: fixed;
  inset: 0;
  z-index: 10050;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}

@media (min-width: 640px) {
  .page-share__modal {
    align-items: center;
    padding: 1rem;
  }
}

.page-share__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
}

.page-share__dialog {
  position: relative;
  width: 100%;
  max-width: 24rem;
  max-height: min(88vh, 32rem);
  overflow: auto;
  padding: 1.25rem 1.25rem 1rem;
  background: #ffffff;
  border: 1px solid var(--border-color, rgba(0, 0, 0, 0.08));
  border-radius: 1.25rem 1.25rem 0 0;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.16);
  animation: page-share-slide-up 280ms cubic-bezier(0.25, 0.1, 0.25, 1);
}

@media (min-width: 640px) {
  .page-share__dialog {
    border-radius: 1.25rem;
  }
}

@keyframes page-share-slide-up {
  from {
    opacity: 0;
    transform: translateY(1.25rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.page-share__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.page-share__title {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #1d1d1f;
}

.page-share__close {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  padding: 0;
  font-size: 1.35rem;
  line-height: 1;
  color: #6b7280;
  background: #f3f4f6;
  border: none;
  border-radius: 9999px;
  cursor: pointer;
}

.page-share__close:hover {
  background: #e5e7eb;
  color: #1d1d1f;
}

.page-share__preview {
  margin: 0 0 1rem;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: #6b7280;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.page-share__actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.page-share__option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.85rem 1rem;
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-align: left;
  color: #1d1d1f;
  background: #f9fafb;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 0.875rem;
  cursor: pointer;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    transform 160ms ease;
}

.page-share__option:hover {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.16);
  transform: translateX(2px);
}

.page-share__option--native {
  background: #1d1d1f;
  border-color: #1d1d1f;
  color: #ffffff;
}

.page-share__option--native:hover {
  background: #000000;
  border-color: #000000;
  color: #ffffff;
}

.page-share__option--success {
  background: #ecfdf5;
  border-color: #6ee7b7;
  color: #065f46;
}

.page-share__option-label {
  flex: 1;
  min-width: 0;
}

@media (prefers-reduced-motion: reduce) {
  .page-share__dialog {
    animation: none;
  }

  .page-share__option:hover {
    transform: none;
  }
}
