/*
 * Page layouts for the site's pages: the home page, the text pages, the 404.
 *
 * 🔴 No colour is written here — only var(--…). The values, the fonts and the
 * rules every page shares (the brand, the button, the badges, the footer) are
 * inlined into each page from src/site/theme.ts and src/site/styles.ts, so the
 * invite page, which may not load this file, draws them the same way.
 *
 * Mobile first. Two breakpoints: 40em (two columns fit) and 64em (desktop).
 */

/* ── Corners: no header bar, two floating controls ────────────────────────── */

.corners {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px clamp(14px, 3vw, 28px);
  pointer-events: none;
}

.corners > * {
  pointer-events: auto;
}

/* Glass: the page shows through, blurred, so the controls sit over photos too. */
.corner-mark,
.language-menu summary {
  background: color-mix(in srgb, var(--card) 72%, transparent);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  backdrop-filter: blur(16px) saturate(1.4);
  box-shadow: 0 0 0 1px var(--hairline), var(--shadow-sm);
}

.corner-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
}

.corner-mark .mark {
  height: 22px;
}

.language-menu {
  position: relative;
  margin-left: auto;
}

.language-menu summary {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 999px;
  list-style: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.language-menu summary::-webkit-details-marker {
  display: none;
}

.language-menu ul {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 176px;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
}

.language-menu a {
  display: block;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  font-size: 15px;
  text-decoration: none;
}

.language-menu a:hover {
  background: var(--wash);
}

.language-menu a[aria-current="page"] {
  font-weight: 600;
}

/* ── The "Sg" mark ───────────────────────────────────────────────────────── */

/* The icon's letters as a mask (theme.ts → --mark): whatever paints the box shows through them. */
.mark {
  display: block;
  aspect-ratio: var(--mark-ratio);
  -webkit-mask: var(--mark) center / contain no-repeat;
  mask: var(--mark) center / contain no-repeat;
  background: linear-gradient(180deg, var(--ink), var(--muted));
}

/* Now and then a light crosses the letters, as it crosses the app's Pro badge. */
.mark-sheen {
  position: relative;
  overflow: hidden;
}

.mark-sheen::after {
  content: "";
  position: absolute;
  inset: 0 -80%;
  background: linear-gradient(105deg, transparent 42%, var(--sheen) 50%, transparent 58%);
  transform: translateX(-60%);
}

@keyframes sheen {
  0% { transform: translateX(-60%); }
  24%, 100% { transform: translateX(60%); }
}

/* ── Type ────────────────────────────────────────────────────────────────── */

.eyebrow {
  margin: 0 0 16px;
  font-size: 12px;
  line-height: 16px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.display {
  max-width: 14ch;
  margin: 0;
  font-size: clamp(40px, 7.2vw, 76px);
  line-height: 1.02;
  font-weight: 700;
  letter-spacing: -0.04em;
  text-wrap: balance;
}

.lede {
  max-width: 34rem;
  margin: 20px auto 0;
  font-size: clamp(17px, 1.6vw, 20px);
  line-height: 1.5;
  color: var(--accent);
  text-wrap: pretty;
}

/* ── Home: the photo band ────────────────────────────────────────────────── */

.band {
  position: relative;
  overflow: hidden;
  padding-top: 8px;
}

/*
 * Each row holds its photos BAND_COPIES times (home.ts); moving it by one set
 * lands the next copy exactly where the first began. Spacing is a margin, not
 * `gap`, so a set is a whole number of tiles.
 */
.band-row {
  display: flex;
  width: max-content;
  margin-bottom: 8px;
  animation: band-drift 160s linear infinite;
}

.band-row-reverse {
  animation-direction: reverse;
}

.band-row img {
  flex: none;
  width: clamp(104px, 15vw, 184px);
  aspect-ratio: 1;
  margin-right: 8px;
  object-fit: cover;
  border-radius: var(--r-lg);
}

/* One set: -100% / BAND_COPIES (test/unit/band.test.ts keeps the two in step). */
@keyframes band-drift {
  to {
    transform: translateX(-25%);
  }
}

/* The photos melt into the page: a painted fade, the paywall's own technique. */
.band::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    to bottom,
    transparent 28%,
    color-mix(in srgb, var(--canvas) 86%, transparent) 72%,
    var(--canvas) 100%
  );
}

/* ── Home: hero ──────────────────────────────────────────────────────────── */

/* The words rise into the band's fade, under the "Sg". */
.hero {
  position: relative;
  margin-top: clamp(-170px, -13vw, -84px);
  text-align: center;
}

.hero-mark {
  height: clamp(84px, 10vw, 132px);
  margin: 0 auto 22px;
}

.hero-inner,
.hero-copy {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hero .store-badges {
  justify-content: center;
  margin-top: 32px;
}

.hero-screen {
  margin-top: clamp(48px, 7vw, 80px);
}

/* A screenshot as a plain rounded card — never a drawn device (assets-src/README.md). */
.screen {
  --screen-width: min(320px, 76vw);
  display: block;
  width: var(--screen-width);
  height: auto;
  border-radius: calc(var(--screen-width) * 0.14);
  box-shadow: 0 0 0 1px var(--hairline), var(--shadow-lg);
}

/* ── Home: sections ──────────────────────────────────────────────────────── */

.section {
  padding-top: clamp(80px, 11vw, 140px);
}

.section-title {
  max-width: 22ch;
  margin: 0 0 clamp(28px, 4vw, 48px);
  font-size: clamp(28px, 4.2vw, 48px);
  line-height: 1.06;
  font-weight: 700;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

/* ── Home: the group chat, and the same day in a gallery ───────────────────── */

.before-after {
  display: grid;
  gap: 16px;
}

.panel {
  min-width: 0;
  padding: 18px;
  border-radius: var(--r-xl);
}

.panel-label {
  margin: 0 0 14px;
  font-size: 12px;
  line-height: 16px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.panel-chat {
  background: var(--wash);
}

.bubbles {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.bubble {
  justify-self: start;
  max-width: 82%;
  padding: 9px 14px;
  background: var(--card);
  border-radius: 18px 18px 18px 6px;
  font-size: 15px;
  line-height: 1.35;
}

.bubble small {
  display: block;
  margin-bottom: 2px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.bubble.is-mine {
  justify-self: end;
  background: var(--ink);
  color: var(--on-ink);
  border-radius: 18px 18px 6px 18px;
}

.bubble-photos {
  display: flex;
  gap: 4px;
  padding: 4px;
}

/* What the chat delivers: three small, soft copies. */
.bubble-photos img {
  width: 56px;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 14px;
  filter: blur(1.4px) saturate(0.75);
}

.panel-gallery {
  background: var(--card);
  border: 1px solid var(--hairline);
}

.gallery-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 12px;
  margin-bottom: 12px;
}

.gallery-head b {
  font-size: 20px;
  letter-spacing: -0.03em;
}

.gallery-head span {
  font-size: 14px;
  color: var(--muted);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 3px;
  margin: 0;
  padding: 0;
  overflow: hidden;
  list-style: none;
  border-radius: var(--r-md);
}

/* `--i` is each tile's place in the grid (home.ts), for the motion's stagger. */
.gallery-grid li {
  --i: 0;
}

.gallery-grid img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}

.mini-steps {
  display: grid;
  gap: 18px;
  margin: 40px 0 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.mini-steps li {
  position: relative;
  padding-left: 40px;
  counter-increment: step;
}

.mini-steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--on-ink);
  font-size: 14px;
  font-weight: 700;
}

.mini-steps b {
  display: block;
  font-size: 17px;
  line-height: 28px;
  letter-spacing: -0.01em;
}

.mini-steps span {
  display: block;
  font-size: 15px;
  line-height: 1.5;
  color: var(--accent);
}

/* ── Home: features, beside two screenshots ────────────────────────────────── */

.features {
  display: grid;
  gap: 32px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.feature .icon {
  display: block;
  width: 28px;
  height: 28px;
  margin-bottom: 12px;
  color: var(--ink);
}

.feature h3 {
  margin: 0;
  font-size: 18px;
  line-height: 1.3;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.feature p {
  margin: 6px 0 0;
  font-size: 15px;
  line-height: 1.5;
  color: var(--accent);
}

.feature-screens {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 48px;
}

.feature-screens .screen {
  --screen-width: min(240px, 42vw);
}

.feature-screens .screen:nth-child(2) {
  margin-top: 40px;
}

/* ── Home: Pro ─────────────────────────────────────────────────────────────── */

.pro-section {
  padding-bottom: clamp(80px, 11vw, 140px);
}

.pro-intro {
  display: grid;
  gap: 32px;
  align-items: center;
}

/* The app's Pro badge; it carries `.night`, so these are the night's values in both themes. */
.pro-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px 5px 8px;
  border-radius: 999px;
  background: var(--canvas);
  box-shadow: 0 0 0 1px var(--hairline);
  color: var(--ink);
  font-size: 12px;
  line-height: 15px;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.pro-text h2 {
  max-width: 20ch;
  margin: 16px 0 0;
  font-size: clamp(28px, 4.2vw, 48px);
  line-height: 1.06;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

.pro-text p {
  max-width: 34rem;
  margin: 14px 0 0;
  font-size: 17px;
  color: var(--accent);
}

.pro-card {
  justify-self: center;
  width: 100%;
  max-width: 360px;
  overflow: hidden;
  background: var(--card);
  border-radius: var(--r-xl);
  box-shadow: 0 0 0 1px var(--hairline), var(--shadow-lg);
}

.pro-card-cover {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
}

.pro-card-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 16px;
}

.pro-card-body b {
  display: block;
  font-size: 17px;
  letter-spacing: -0.02em;
}

.pro-card-faces {
  display: flex;
  margin-top: 8px;
}

.pro-card-faces span {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  margin-right: -5px;
  border-radius: 50%;
  background: var(--muted);
  box-shadow: 0 0 0 2px var(--card);
  color: var(--card);
  font-size: 11px;
  font-weight: 600;
}

.pro-card-faces span.is-pro {
  background: var(--ink);
  box-shadow: 0 0 0 2px var(--card), 0 0 0 3.5px var(--faint);
}

.pro-card-limit {
  display: grid;
  justify-items: end;
  gap: 2px;
  text-align: right;
}

.pro-card-limit s {
  font-size: 13px;
  color: var(--muted);
}

.pro-card-limit b {
  font-size: 30px !important;
  line-height: 1;
}

.pro-card-limit small {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.plans {
  display: grid;
  gap: 16px;
  margin-top: clamp(40px, 6vw, 64px);
}

.plan {
  min-width: 0;
  padding: 22px 22px 8px;
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: var(--r-xl);
  color: var(--ink);
}

/* The Pro column is the paywall's night in both themes (theme.ts → .night). */
.plan-pro {
  background: var(--canvas);
  border-color: var(--hairline);
}

/*
 * On a dark page that night is the page's own ground, and Free's lighter card
 * would draw the eye first; a lighter edge keeps Pro ahead (project owner,
 * 2026-10-14).
 */
@media (prefers-color-scheme: dark) {
  .plan-pro {
    border-color: var(--faint);
  }
}

.plan h3 {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  min-height: 26px;
  margin: 0;
  font-size: 20px;
  letter-spacing: -0.02em;
}

.plan h3 span:not(.pro-badge) {
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--accent);
}

.plan dl {
  margin: 14px 0 0;
}

.plan dl div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-top: 1px solid var(--hairline);
  font-size: 15px;
}

.plan dt {
  color: var(--accent);
}

.plan dd {
  margin: 0;
  font-weight: 600;
  text-align: right;
}

/* ── Text pages ──────────────────────────────────────────────────────────── */

/* Clear of the corner controls. */
.doc {
  padding-top: clamp(80px, 9vw, 112px);
  padding-bottom: clamp(56px, 8vw, 104px);
}

.doc-single {
  max-width: 48rem;
}

.doc-head h1 {
  margin: 0;
  font-size: clamp(32px, 5vw, 48px);
  line-height: 1.08;
  letter-spacing: -0.03em;
  text-wrap: balance;
}

.updated {
  margin: 12px 0 0;
  font-size: 15px;
  color: var(--muted);
}

.doc-intro {
  max-width: 44rem;
  margin-top: 28px;
  font-size: 18px;
  color: var(--accent);
}

.doc-intro p {
  margin: 0 0 12px;
}

.contents {
  max-width: 44rem;
  margin-top: 28px;
  padding: 20px 24px 14px;
  background: var(--wash);
  border-radius: var(--r-xl);
}

.contents h2 {
  margin: 0 0 10px;
  font-size: 12px;
  line-height: 16px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.contents ol {
  margin: 0;
  padding-left: 1.5em;
  font-size: 15px;
  color: var(--accent);
}

.contents li + li {
  margin-top: 4px;
}

.contents a {
  color: var(--ink);
  text-decoration: none;
}

.contents a:hover {
  text-decoration: underline;
}

.doc-body {
  max-width: 44rem;
}

.doc-body h2 {
  margin: 48px 0 12px;
  font-size: 24px;
  line-height: 1.25;
  letter-spacing: -0.02em;
  scroll-margin-top: 24px;
}

.doc-body h3 {
  margin: 0 0 8px;
  font-size: 18px;
  line-height: 1.35;
  letter-spacing: -0.01em;
  scroll-margin-top: 24px;
}

.doc-body p,
.doc-body ul,
.doc-body ol {
  margin: 0 0 14px;
}

.doc-body ul,
.doc-body ol {
  padding-left: 1.3em;
}

.doc-body li + li {
  margin-top: 6px;
}

.doc-body strong {
  font-weight: 600;
}

.contact-card {
  margin-top: 32px;
  padding: 4px 24px 10px;
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: var(--r-xl);
}

.contact-card h2 {
  margin-top: 20px;
}

.faq-item {
  padding-top: 20px;
  border-top: 1px solid var(--hairline);
}

.faq-item + .faq-item {
  margin-top: 8px;
}

/* ── Footer: the brand (site pages only; the shared footer rules are in styles.ts) ── */

/* Two classes, to outrank styles.ts's `.site-footer a`. */
.site-footer .footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
}

.footer-brand .mark {
  height: 22px;
}

/* ── 404 ─────────────────────────────────────────────────────────────────── */

/* At least as far down as the text pages' heading: clear of the corner controls. */
.not-found {
  padding: clamp(80px, 12vw, 160px) 0 clamp(64px, 12vw, 160px);
  text-align: center;
}

.not-found h1 {
  margin: 0;
  font-size: clamp(32px, 5vw, 48px);
  line-height: 1.08;
  letter-spacing: -0.03em;
}

.not-found p {
  margin: 12px 0 0;
  color: var(--accent);
}

.not-found .button {
  margin-top: 16px;
}

/* ── Two columns ─────────────────────────────────────────────────────────── */

@media (min-width: 40em) {
  .before-after {
    grid-template-columns: 1fr 1fr;
  }

  .mini-steps {
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
  }

  .features {
    grid-template-columns: repeat(2, 1fr);
    gap: 40px 32px;
  }

  .plans {
    grid-template-columns: 1fr 1fr;
  }
}

/* ── Desktop ─────────────────────────────────────────────────────────────── */

@media (min-width: 64em) {
  .panel {
    padding: 24px;
  }

  /* The features on the left, the two screenshots on the right. */
  .features-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: 72px;
    align-items: start;
  }

  .features-layout .section-title {
    grid-column: 1;
  }

  .features-layout .features {
    grid-column: 1;
  }

  .features-layout .feature-screens {
    grid-column: 2;
    grid-row: 1 / span 2;
    margin-top: 0;
  }

  .pro-intro {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
    gap: 64px;
  }

  /*
   * The policy's contents become a sticky column beside the text. The markup
   * keeps reading order (heading, intro, contents, sections) for every reader;
   * only the grid moves the contents.
   */
  .doc:not(.doc-single) {
    display: grid;
    grid-template-columns: 15rem minmax(0, 44rem);
    grid-template-areas:
      "contents head"
      "contents intro"
      "contents body";
    column-gap: 64px;
    justify-content: center;
    align-items: start;
  }

  .doc:not(.doc-single) .doc-head {
    grid-area: head;
  }

  .doc:not(.doc-single) .doc-intro {
    grid-area: intro;
  }

  .doc:not(.doc-single) .doc-body {
    grid-area: body;
  }

  .doc:not(.doc-single) .contents {
    grid-area: contents;
    position: sticky;
    top: 24px;
    max-height: calc(100vh - 48px);
    margin-top: 8px;
    overflow: auto;
    padding: 0;
    background: none;
    border-radius: 0;
  }

  .doc:not(.doc-single) .contents ol {
    padding-left: 0;
    list-style: none;
  }

  .doc:not(.doc-single) .contents li + li {
    margin-top: 10px;
  }

  .doc:not(.doc-single) .contents a {
    color: var(--accent);
  }

  .doc:not(.doc-single) .contents a:hover {
    color: var(--ink);
  }
}

/* ── Motion ──────────────────────────────────────────────────────────────── */

/*
 * Two kinds, both only for readers who have not asked for less motion, and the
 * page is complete without either:
 *
 *   - the opening: the hero's lines rise in once, as the page loads;
 *   - the story: as a section scrolls into view its pieces arrive — the chat's
 *     bubbles one by one, then the gallery filling, then the limit giving way.
 *     Scroll-driven (`animation-timeline`), so it follows the reader's finger
 *     and needs no script; a browser without it shows every piece at rest.
 *
 * Only `transform` and `opacity` move.
 */
@keyframes rise {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}

@keyframes bubble-in {
  from { opacity: 0; transform: translateY(14px) scale(0.94); }
  to { opacity: 1; transform: none; }
}

@keyframes tile-in {
  from { opacity: 0; transform: scale(0.8); }
  to { opacity: 1; transform: none; }
}

@keyframes pop-in {
  from { opacity: 0; transform: scale(0.6); }
  to { opacity: 1; transform: none; }
}

@keyframes give-way {
  from { opacity: 1; }
  to { opacity: 0.45; }
}

@keyframes float-up {
  from { transform: translateY(56px); }
  to { transform: translateY(-28px); }
}

@media (prefers-reduced-motion: no-preference) {
  .hero-copy > *,
  .hero-screen {
    animation: rise 760ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
  }

  .hero-copy > :nth-child(2) { animation-delay: 110ms; }
  .hero-copy > :nth-child(3) { animation-delay: 200ms; }
  .hero-copy > :nth-child(4) { animation-delay: 290ms; }
  .hero-copy > :nth-child(5) { animation-delay: 380ms; }
  .hero-screen { animation-delay: 480ms; }

  .mark-sheen::after {
    animation: sheen 6s cubic-bezier(0.45, 0, 0.2, 1) 1.6s infinite;
  }

  @supports (animation-timeline: view()) {
    .section-title,
    .mini-steps li,
    .feature,
    .pro-text,
    .plan {
      animation: rise linear both;
      animation-timeline: view();
      animation-range: entry 0% entry 70%;
    }

    /* The chat, then the gallery: one timeline for both panels. */
    .before-after {
      view-timeline: --chat block;
    }

    .bubbles > li {
      animation: bubble-in linear both;
      animation-timeline: --chat;
    }

    .bubbles > li:nth-child(1) { animation-range: cover 6% cover 13%; }
    .bubbles > li:nth-child(2) { animation-range: cover 12% cover 19%; }
    .bubbles > li:nth-child(3) { animation-range: cover 18% cover 25%; }
    .bubbles > li:nth-child(4) { animation-range: cover 24% cover 31%; }
    .bubbles > li:nth-child(5) { animation-range: cover 30% cover 37%; }

    .gallery-grid li {
      animation: tile-in linear both;
      animation-timeline: --chat;
      animation-range: cover calc(30% + var(--i) * 1.6%) cover calc(36% + var(--i) * 1.6%);
    }

    /* The limit gives way to ∞ as the card comes up. */
    .pro-card {
      view-timeline: --card block;
    }

    .pro-card-limit s {
      animation: give-way linear both;
      animation-timeline: --card;
      animation-range: cover 22% cover 32%;
    }

    .pro-card-limit b,
    .pro-card-limit small {
      animation: pop-in linear both;
      animation-timeline: --card;
      animation-range: cover 28% cover 40%;
    }

    .feature-screens .screen {
      animation: float-up linear both;
      animation-timeline: view();
      animation-range: cover 0% cover 100%;
    }
  }
}
