/*
 * The pages people arrive at from a shared link: a story's page (/s/<id>,
 * written by tools/stories.mjs) and the family invitation (/invite).
 * Loaded after site.css.
 *
 * One bedtime card under the header, as the hero and the closing card wear it
 * in both appearances; the store badges are drawn for that dark card. The
 * story card puts the cover beside the text from 860px, the invitation stays
 * one centred column.
 */

.share { padding-block: 4px clamp(56px, 7vw, 96px); }

.share__card {
  position: relative;
  isolation: isolate;
  display: grid;
  gap: clamp(24px, 4vw, 56px);
  width: min(100% - 2 * var(--gutter), var(--max));
  margin-inline: auto;
  padding: clamp(20px, 4.4vw, 56px);
  border-radius: clamp(28px, 3vw, 40px);
  overflow: hidden;
  overflow: clip;
  color: var(--on-night);
  background:
    radial-gradient(70% 55% at 50% 102%, rgba(255, 179, 138, 0.22), transparent 70%),
    radial-gradient(60% 50% at 88% 0%, rgba(140, 120, 240, 0.28), transparent 70%),
    linear-gradient(180deg, var(--night-0) 0%, var(--night-1) 52%, var(--night-2) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 30px 60px -40px rgba(20, 18, 48, 0.6);
}
@media (max-width: 599px) { .share__card { width: calc(100% - 20px); } }
:root[data-theme="dark"] .share__card { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .share__card { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08); }
}
/* The hero's faint checker. */
.share__card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: repeating-conic-gradient(rgba(255, 255, 255, 0.04) 0 25%, transparent 0 50%) 0 0 / 56px 56px;
  -webkit-mask-image: radial-gradient(70% 70% at 50% 40%, #000, transparent 75%);
  mask-image: radial-gradient(70% 70% at 50% 40%, #000, transparent 75%);
}

/* On a phone the cover stays small enough for the player to show on the first screen. */
.share__cover { justify-self: center; width: min(100%, 260px); }
@media (min-width: 600px) { .share__cover { width: min(100%, 340px); } }
.share__cover img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: var(--r-3);
  background: var(--night-1);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3), 0 34px 60px -28px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.share__body {
  display: grid;
  justify-items: center;
  gap: 14px;
  min-width: 0;
  text-align: center;
}
.share__body > * { margin: 0; }
.share .eyebrow { color: var(--peach); }
.share .eyebrow .icon { color: var(--peach); }
.share__title { font-size: clamp(32px, 26px + 1.8vw, 48px); line-height: 1.18; }
.share__by { color: var(--on-night-3); font-size: 15px; font-weight: 600; line-height: 1.4; }
.share__lead, .share__more { max-width: 34em; color: var(--on-night-2); }
.share__fine { max-width: 34em; color: var(--on-night-3); font-size: 13px; line-height: 1.5; }
.share__card a:not(.store, .pill) { color: var(--on-night); }

/* The minute of the story: a glass panel with the browser's own player. */
.share__listen {
  width: 100%;
  max-width: 520px;
  margin-block: 6px;
  padding: 16px;
  border-radius: var(--r-2);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16);
}
.share__listen h2 { font-size: var(--fs-feature); font-weight: 600; line-height: 1.3; }
.share__listen audio {
  display: block;
  width: 100%;
  height: 44px;
  margin-top: 12px;
  border-radius: 999px;
  color-scheme: dark;
}

.share .stores { margin-top: 6px; }
.share__open {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 14px;
  color: var(--on-night-2);
}

@media (min-width: 860px) {
  .share__card--story { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); align-items: center; }
  .share__card--story .share__cover { width: min(100%, 420px); }
  .share__card--story .share__body { justify-items: start; text-align: left; }
  .share__card--story .stores, .share__card--story .share__open { justify-content: flex-start; }
}

/* ---------- The invitation ---------- */

.share__card--invite { justify-items: center; padding-block: clamp(40px, 7vw, 80px); }
.share__steps {
  display: grid;
  gap: 12px;
  max-width: 32em;
  margin-block: 6px;
  list-style: none;
  counter-reset: step;
  text-align: left;
}
.share__steps li {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  align-items: start;
  gap: 12px;
  color: var(--on-night-2);
  counter-increment: step;
}
.share__steps li::before {
  content: counter(step);
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: var(--on-night);
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
}
.share__steps li > span { padding-top: 3px; }

@media print {
  .share__card { background: none; color: #000000; box-shadow: none; }
  .share__listen, .share__open { display: none; }
}
