/*
 * Village Square — feed-first layout (FEATURE_SQUARE_FEED_FIRST).
 * Loaded only when the flag is on. Puts "Today", a share prompt and the feed
 * at the top on phones; every existing section stays further down the page.
 * Colours come from the theme tokens so light and dark both work.
 */

/* ── Today strip ── */
.sqc-today {
  padding: 0 0.75rem 0.25rem;
}

.sqc-today__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.6rem;
}

.sqc-today__title {
  margin: 0;
  font-family: var(--ep-serif, Georgia, serif);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-primary);
}

.sqc-today__date {
  font-size: 0.75rem;
  color: var(--sqc-fg-subtle);
}

.sqc-today__tiles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
  max-width: 36rem;
}

.sqc-today__tile {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-height: 4.75rem;
  min-width: 0;
  padding: 0.7rem 0.75rem;
  border-radius: 0.9rem;
  border: 1px solid var(--sqc-border);
  background: var(--sqc-bg);
  color: var(--sqc-fg);
  text-decoration: none;
}

a.sqc-today__tile:hover {
  border-color: var(--sqc-accent-border);
}

.sqc-today__tile svg {
  color: var(--color-primary);
}

.sqc-today__tile--brief {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--color-primary-content);
}

.sqc-today__tile--brief svg {
  color: var(--color-primary-content);
}

.sqc-today__tile-title {
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.2;
}

.sqc-today__tile-sub {
  overflow: hidden;
  font-size: 0.72rem;
  line-height: 1.3;
  color: var(--sqc-fg-muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sqc-today__tile--brief .sqc-today__tile-sub {
  color: color-mix(in oklab, var(--color-primary-content) 82%, transparent);
}

/* ── Share prompt ── */
.sqc-share {
  padding: 0.75rem 0.75rem 1rem;
}

.sqc-share__prompt {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 3rem;
  padding: 0.35rem 0.35rem 0.35rem 1rem;
  border-radius: 9999px;
  border: 1px solid var(--sqc-border);
  background: var(--sqc-bg);
  color: var(--sqc-fg-muted);
  font-size: 0.9rem;
  text-decoration: none;
}

.sqc-share__prompt:hover {
  border-color: var(--sqc-accent-border);
  color: var(--sqc-fg);
}

.sqc-share__text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sqc-share__icon {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 9999px;
  background: var(--color-primary);
  color: var(--color-primary-content);
}

/* ── Follow on post cards ── */
.sqc-feed-card__head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sqc-feed-card__head > .sqc-post-identity {
  flex: 1;
  min-width: 0;
}

.sqc-feed-follow,
.sqc-feed-card__head > .sqc-feed-follow__btn {
  flex: none;
  order: 2;
  margin: 0;
}

.sqc-feed-follow__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.25rem;
  min-width: 5rem;
  padding: 0 0.9rem;
  border-radius: 9999px;
  border: 1px solid var(--color-primary);
  background: transparent;
  color: var(--color-primary);
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
}

.sqc-feed-follow__btn:hover {
  background: var(--sqc-accent-soft);
  color: var(--color-primary);
}

.sqc-feed-follow__btn.is-following {
  border-color: var(--sqc-border);
  background: var(--sqc-bg-soft);
  color: var(--sqc-fg-muted);
}

.sqc-feed-follow__btn:focus-visible {
  outline: 2px solid var(--sqc-focus);
  outline-offset: 2px;
}

/* Tiles that used to sit above the feed now follow it. */
.sqc-feed-first-shortcuts {
  margin: 1.25rem 0 0.5rem;
}

/* ── Phones: a shorter place header so the feed starts sooner ── */
@media (max-width: 639px) {
  .sqc-feed-first .lp-place-header {
    min-height: 0;
  }

  .sqc-feed-first .lp-place-photo {
    height: 120px;
  }

  .sqc-feed-first .lp-place-copy {
    padding: 14px 16px;
  }

  .sqc-feed-first.lp-square .sqc-page-title {
    font-size: 24px !important;
  }

  .sqc-feed-first .sqc-title-actions {
    margin-top: 6px;
  }

  .sqc-feed-first #square-layout {
    padding-top: 0.75rem;
  }

  /* The card head takes the identity's slot; the identity keeps its left inset. */
  .sqc-feed-card__head {
    order: 1;
    padding: 0 20px 20px 0;
  }

  .sqc-feed-card__head > .sqc-post-identity {
    padding-right: 0;
    padding-bottom: 0;
  }
}

@media (min-width: 640px) {
  .sqc-today,
  .sqc-share {
    padding-inline: 0;
  }
}
