/* ──────────────────────────────────────────────────────────────────────────
   Win-moment share component — scoped "pcshare-" classes ONLY.
   Reads the design tokens from styles.css (plus a few component-scoped chip
   tokens defined on .pcshare-row itself), so dark mode + reduced-motion come
   for free. NOT a popup/banner: a quiet caption + one filled primary and three
   always-visible channel affordances, shown only AFTER the download succeeded.
   See marketing/share-ux-spec-2026-06-28.md.
   ────────────────────────────────────────────────────────────────────────── */

/* ── Component-scoped colour tokens ──────────────────────────────────────────
   The chips need a surface DISTINCT from the row they sit in. In light the row
   is --surface-2 (#fafafa) so the chip goes white; in dark the row is #1c1c1f so
   the chip must step UP to #26262b (using --surface #141416 would make the chip
   darker than its own container — backwards elevation). Same raised-dark-surface
   value as the ownAd card precedent. */
.pcshare-row {
  --pcshare-chip-bg: #ffffff;
  --pcshare-chip-bg-hover: #f2f2f3;
  --pcshare-chip-border: #d4d4d4;
  --pcshare-chip-border-hover: #8f8f8f;
  --pcshare-ok: #15803d;      /* 5.0:1 on white, 4.75:1 on --pcshare-ok-bg */
  --pcshare-ok-bg: #ecfdf3;
}
@media (prefers-color-scheme: dark) {
  .pcshare-row {
    --pcshare-chip-bg: #26262b;
    --pcshare-chip-bg-hover: #34343b;
    --pcshare-chip-border: #43434b;
    --pcshare-chip-border-hover: #6f6f7a;
    --pcshare-ok: #4ade80;    /* 8.9:1 on --pcshare-ok-bg */
    --pcshare-ok-bg: #10291b;
  }
}

.pcshare-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  margin-top: 20px;
  padding: 16px 18px;
  min-width: 0;
  background: var(--surface-2, #f4f4f5);
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: 14px;
}

/* Relocated into .dl-media-grid: span every column; min-width:0 so a long
   unbroken caption can never blow the grid track out. */
.pcshare-inline { grid-column: 1 / -1; min-width: 0; }

.pcshare-caption {
  margin: 0;
  flex: 1 1 240px;
  min-width: 0;
  overflow-wrap: anywhere;   /* long zh-TW / RU captions must wrap, not overflow */
  font-size: 14.5px;
  line-height: 1.45;
  color: var(--text);
  font-weight: 500;
}

.pcshare-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  flex: 0 0 auto;
  margin-left: auto;
}
.pcshare-icons {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Filled primary. Only appears AFTER the download succeeded, so it never
   competes with the real Download CTA.
   --on-primary, NOT #fff: --primary inverts to white in dark mode. */
.pcshare-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 11px 20px;
  font-size: 14.5px;
  font-weight: 600;
  font-family: inherit;
  color: var(--on-primary, #fff);
  background: var(--primary);
  border: 1px solid var(--primary);
  border-radius: 10px;
  cursor: pointer;
  touch-action: manipulation;
  transition: background-color .18s ease, border-color .18s ease, transform .12s ease;
}
.pcshare-btn:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}
.pcshare-btn:active { transform: translateY(1px); }

.pcshare-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  color: var(--text);
  background: var(--pcshare-chip-bg);
  border: 1px solid var(--pcshare-chip-border);
  border-radius: 10px;
  cursor: pointer;
  touch-action: manipulation;
  transition: background-color .18s ease, border-color .18s ease, color .18s ease, transform .12s ease;
}
.pcshare-icon:hover {
  background: var(--pcshare-chip-bg-hover);
  border-color: var(--pcshare-chip-border-hover);
}
.pcshare-icon:active { transform: translateY(1px); }

/* Icon slot: both glyphs stack in ONE grid cell → swap is a cross-fade with zero
   reflow and a fixed box. Geometry only — never set fill/stroke here; the share
   arrow is stroke-based and CSS would beat its fill="none". */
.pcshare-glyph {
  position: relative;
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 18px;
  height: 18px;
}
.pcshare-glyph svg {
  grid-area: 1 / 1;
  width: 100%;
  height: 100%;
  display: block;
  transition: opacity .14s ease, transform .14s ease;
}
.pcshare-icon--x    .pcshare-glyph { width: 17px; height: 17px; }
.pcshare-icon--copy .pcshare-glyph { width: 19px; height: 19px; }
.pcshare-btn        .pcshare-glyph { width: 17px; height: 17px; }

.pcshare-ico-ok { opacity: 0; transform: scale(.8); }
.is-copied .pcshare-ico    { opacity: 0; transform: scale(.8); }
.is-copied .pcshare-ico-ok { opacity: 1; transform: scale(1); }
.pcshare-icon.is-copied {
  color: var(--pcshare-ok);
  border-color: var(--pcshare-ok);
  background: var(--pcshare-ok-bg);
}
.pcshare-icon.is-failed { border-color: var(--pcshare-chip-border-hover); }

/* --text-secondary, not --text-muted (#a3a3a3 was 2.4:1 light, #6f6f76 3.4:1
   dark — both failed AA for text). */
.pcshare-dismiss {
  min-height: 44px;
  padding: 6px 8px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text-secondary);
  background: none;
  border: none;
  cursor: pointer;
}
.pcshare-dismiss:hover { text-decoration: underline; color: var(--text); }

/* The 2px offset is required: in dark mode the ring is white on a white primary,
   and the gap showing the dark row is what reveals it. */
.pcshare-btn:focus-visible,
.pcshare-icon:focus-visible,
.pcshare-dismiss:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 2px;
}

.pcshare-sr {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Viewport-driven, NOT .pcshare-native-driven: Windows Chrome and Edge expose
   navigator.share on wide desktops too, and those must not get a full-width
   mobile button across a 1200px row. */
@media (max-width: 720px) {
  .pcshare-row { padding: 14px; gap: 10px 12px; }
  .pcshare-actions {
    flex: 1 1 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    margin-left: 0;
  }
  .pcshare-btn { width: 100%; min-height: 48px; }
  .pcshare-icons { justify-content: center; width: 100%; gap: 12px; }
  .pcshare-icon { width: 48px; height: 48px; }
  .pcshare-dismiss { align-self: center; margin-inline: auto; }
}

/* Entrance: fade+rise, then ONE soft attention pulse so it gets noticed. */
.pcshare-reveal {
  animation: pcshare-fade-rise 220ms ease-out both,
             pcshare-attention 1400ms ease-out 240ms 1;
}
@keyframes pcshare-fade-rise {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes pcshare-attention {
  0%   { box-shadow: 0 0 0 0 rgba(0, 0, 0, 0.22); }
  100% { box-shadow: 0 0 0 14px rgba(0, 0, 0, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .pcshare-reveal { animation: pcshare-fade-only 200ms ease-out both; }
  @keyframes pcshare-fade-only {
    from { opacity: 0; }
    to   { opacity: 1; }
  }
  .pcshare-btn,
  .pcshare-icon,
  .pcshare-glyph svg { transition: none; }
  .pcshare-btn:active,
  .pcshare-icon:active { transform: none; }
}
