/* ============================================================================
   share.css — the share card and its preview modal
   ============================================================================= */

/* --- The card ----------------------------------------------------------- */
/* Rendered off-screen at exactly 1200×630 so html-to-image captures it
   at full social-card size. Never visible to the user directly. The markup
   carries data-theme="light" so the exported PNG always uses the light
   palette, even when the page is in dark mode. */
.share-card {
  position: fixed;
  left: 0;
  top: 0;
  // z-index: -1;
  // opacity: 0.001;
  clip-path: inset(100%);
  pointer-events: none;
  width: 1200px;
  height: 630px;
  background: var(--paper);
  color: var(--ink);
  padding: 80px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: var(--font-body);
}

.share-card__inner {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.share-card__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 48px;
}

.share-card__brand {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 600;
  font-variation-settings: 'opsz' 96;
  letter-spacing: -0.025em;
  color: var(--ink);
  line-height: 1;
}

.share-card__brand span {
  color: var(--oxblood-text);
}

.share-card__mark svg {
  width: 40px;
  height: 40px;
  display: block;
}

.share-card__title {
  font-family: var(--font-display);
  font-size: 56px;
  font-weight: 400;
  font-variation-settings: 'opsz' 144, 'WONK' 1;
  line-height: 1.06;
  letter-spacing: -0.03em;
  color: var(--ink);
  margin: 0 0 28px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.share-card__excerpt {
  font-family: var(--font-display);
  font-size: 24px;
  line-height: 1.5;
  color: var(--ink-soft);
  margin: 0 auto 0 0;
  max-width: 900px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.share-card__footer {
  margin-top: auto;
  padding-top: 32px;
  border-top: 1px solid var(--rule);
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 40px;
}

.share-card__byline {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.share-card__author {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.share-card__meta {
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--ink-muted);
}

.share-card__url {
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 500;
  color: var(--oxblood-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 520px;
  text-align: right;
}

/* --- Card button (secondary share action) ------------------------------- */
.share-btn--card {
  /* Same base style as .share-btn, just visually distinguished slightly. */
}

/* --- Modal -------------------------------------------------------------- */
.share-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(var(--scrim-rgb), 0.55);
  z-index: 400;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}

.share-modal-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

.share-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.96);
  width: min(90vw, 640px);
  background: var(--paper);
  border: 1px solid var(--rule);
  z-index: 410;
  padding: 1.5rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  max-height: 92vh;
  overflow-y: auto;
}

@media (min-width: 768px) {
  .share-modal { padding: 2rem; }
}

.share-modal.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}

.share-modal__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 1.25rem;
}

.share-modal__title {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 500;
  font-variation-settings: 'opsz' 96, 'WONK' 1;
  color: var(--ink);
  letter-spacing: -0.02em;
}

.share-modal__close {
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--ink-muted);
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  -webkit-tap-highlight-color: transparent;
  transition: color .15s ease;
}

.share-modal__close:hover { color: var(--ink); }

.share-modal__preview {
  width: 100%;
  aspect-ratio: 1200 / 630;
  background: var(--paper-deep);
  border: 1px solid var(--rule);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  margin-bottom: 1.5rem;
  position: relative;
}

.share-modal__preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.share-modal__loading {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 0.95rem;
  color: var(--ink-muted);
}

.share-modal__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: flex-end;
}

.share-modal__hint {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 0.85rem;
  color: var(--ink-muted);
  margin-right: auto;
  align-self: center;
}
