/*
 * Compact editorial layout for the Wynnum Manly child theme.
 * Scoped to the existing home and single-post templates.
 */

/* Give the site a little more usable width without making text lines too long. */
.home .wm-wrap {
  width: min(1240px, calc(100% - 40px));
}

.home .wm-main {
  padding-block: 30px 52px;
}

.home .wm-section {
  margin-bottom: 40px;
}

.home .wm-lead-grid {
  align-items: start;
  gap: 18px;
  margin-bottom: 40px;
}

/* The lead image is fully visible instead of being forced into a tall crop. */
.home .wm-feature-story {
  grid-template-columns: minmax(0, 1.08fr) minmax(300px, .92fr);
  min-height: 0;
}

.home .wm-feature-image {
  aspect-ratio: 4 / 3;
  min-height: 0;
  background: #edf4f4;
}

.home .wm-feature-image img {
  object-fit: contain;
}

.home .wm-feature-copy {
  padding: clamp(24px, 3vw, 32px);
}

/*
 * Current feed pattern: one visual lead, two text-only briefs, then three
 * illustrated stories. This composition removes the two large empty cards.
 */
@media (min-width: 981px) {
  .home .wm-news-grid {
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 18px;
  }

  .home .wm-news-grid > .wm-card:first-child {
    grid-column: span 6;
  }

  .home .wm-news-grid > .wm-card:nth-child(2),
  .home .wm-news-grid > .wm-card:nth-child(3) {
    grid-column: span 6;
  }

  .home .wm-news-grid > .wm-card:nth-child(n + 4) {
    grid-column: span 4;
  }

  .home .wm-news-grid > .wm-card:nth-child(2) .wm-card-body,
  .home .wm-news-grid > .wm-card:nth-child(3) .wm-card-body {
    padding: 22px 24px;
  }
}

.home .wm-card-image {
  aspect-ratio: 16 / 10;
}

.home .wm-card--text-only {
  min-height: 0;
}

/* Five normal-length events now fit in a single responsive row on desktop. */
.home .wm-event-grid {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.home .wm-event-card {
  min-height: 0;
}

/* Directory cards size to their content instead of creating unused interiors. */
.home .wm-community-grid {
  align-items: start;
}

.home .wm-community-card {
  min-height: 0;
}

.home .wm-area-callout {
  margin-top: 20px;
}

/*
 * Story template: pair the featured image with the headline on wide screens.
 * The body remains a calm reading column below it.
 */
.single-post .ct-container-full {
  padding-block: clamp(28px, 4vw, 52px);
}

.single-post article.post {
  display: grid;
  grid-template-columns: minmax(260px, .78fr) minmax(0, 1.22fr);
  column-gap: clamp(26px, 4vw, 48px);
  row-gap: 28px;
  align-items: center;
  width: min(100%, 1040px) !important;
  max-width: none !important;
  margin-inline: auto !important;
}

.single-post article.post > .ct-featured-image {
  grid-column: 1;
  grid-row: 1;
  justify-self: center;
  width: 100%;
  max-width: 420px;
  margin: 0;
}

.single-post article.post > .ct-featured-image .ct-media-container {
  aspect-ratio: auto !important;
  background: transparent;
}

.single-post article.post > .ct-featured-image img {
  display: block;
  width: 100%;
  height: auto !important;
  max-height: 420px;
  aspect-ratio: auto !important;
  border-radius: 14px;
  object-fit: contain !important;
}

.single-post article.post > .hero-section {
  grid-column: 2;
  grid-row: 1;
  width: 100%;
  margin: 0 !important;
}

.single-post article.post > .entry-content {
  grid-column: 1 / -1;
  width: min(100%, 760px);
  margin-inline: auto;
}

.single-post .entry-header .page-title {
  font-size: clamp(2rem, 4vw, 3.25rem);
  line-height: 1.06;
  letter-spacing: -.035em;
}

.single-post .page-description {
  max-width: 640px;
}

.single-post .entry-content figure {
  margin-block: 26px;
}

.single-post .entry-content img {
  width: auto;
  max-width: 100%;
  max-height: 620px;
  object-fit: contain;
}

@media (max-width: 980px) {
  .home .wm-news-grid {
    align-items: start;
    gap: 16px;
  }

  .home .wm-card {
    min-height: 0;
  }

  .home .wm-event-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 780px) {
  .single-post article.post {
    grid-template-columns: 1fr;
    row-gap: 22px;
    width: min(100% - 32px, 760px) !important;
  }

  .single-post article.post > .ct-featured-image,
  .single-post article.post > .hero-section,
  .single-post article.post > .entry-content {
    grid-column: 1;
  }

  .single-post article.post > .ct-featured-image {
    grid-row: 1;
    max-width: 360px;
  }

  .single-post article.post > .hero-section {
    grid-row: 2;
  }

  .single-post article.post > .entry-content {
    grid-row: 3;
  }

  .single-post article.post > .ct-featured-image img {
    max-height: 330px;
  }
}

@media (max-width: 680px) {
  .home .wm-wrap {
    width: min(100% - 24px, 1240px);
  }

  .home .wm-main {
    padding-block: 24px 40px;
  }

  .home .wm-section,
  .home .wm-lead-grid {
    margin-bottom: 32px;
  }

  .home .wm-feature-story {
    grid-template-columns: 1fr;
  }

  .home .wm-feature-image {
    aspect-ratio: 4 / 3;
  }

  .home .wm-card-image {
    aspect-ratio: 16 / 9;
  }

  .home .wm-event-grid {
    grid-template-columns: 1fr;
  }

  .single-post .ct-container-full {
    padding-block: 22px 36px;
  }

  .single-post .entry-header .page-title {
    font-size: clamp(1.9rem, 9vw, 2.45rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  .home .wm-card,
  .home .wm-card img {
    transition: none;
    transform: none;
  }
}

/*
 * Local News index. Both slugs are supported because recent news currently uses
 * WordPress's default category while the historic archive uses local-news.
 */
body:is(.category-local-news, .category-uncategorized) .ct-container {
  width: min(1180px, calc(100% - 40px));
  padding-block: 38px 56px;
}

body:is(.category-local-news, .category-uncategorized) .hero-section {
  margin-bottom: 26px;
}

body:is(.category-local-news, .category-uncategorized) .page-title {
  color: var(--wm-navy);
  font-size: clamp(2rem, 4vw, 3.15rem);
  line-height: 1.05;
  letter-spacing: -.035em;
}

body:is(.category-local-news, .category-uncategorized) .entries {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
}

body:is(.category-local-news, .category-uncategorized) .entry-card {
  display: flex;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  flex-direction: column;
  padding: 0 !important;
  border: 1px solid var(--wm-line);
  border-radius: var(--wm-radius);
  background: #fff;
  box-shadow: var(--wm-shadow);
  transition: transform .2s ease, box-shadow .2s ease;
}

body:is(.category-local-news, .category-uncategorized) .entry-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 15px 36px rgba(14, 48, 65, .14);
}

body:is(.category-local-news, .category-uncategorized) .entry-card > .ct-media-container {
  order: 1;
  width: 100%;
  height: auto;
  margin: 0 !important;
  aspect-ratio: 16 / 10 !important;
  border-radius: 0;
  background: var(--wm-sky);
}

body:is(.category-local-news, .category-uncategorized) .entry-card > .ct-media-container img {
  display: block;
  width: 100%;
  height: 100%;
  aspect-ratio: auto !important;
  object-fit: contain !important;
  transition: transform .45s ease;
}

body:is(.category-local-news, .category-uncategorized) .entry-card:hover > .ct-media-container img {
  transform: scale(1.018);
}

body:is(.category-local-news, .category-uncategorized) .entry-card > .entry-title {
  order: 2;
  margin: 0;
  padding: 19px 20px 0;
  color: var(--wm-navy);
  font-size: 1.22rem;
  line-height: 1.28;
  letter-spacing: -.018em;
}

body:is(.category-local-news, .category-uncategorized) .entry-card > .entry-excerpt {
  order: 3;
  flex: 1;
  padding: 0 20px;
  color: var(--wm-muted);
  font-size: .91rem;
  line-height: 1.55;
}

body:is(.category-local-news, .category-uncategorized) .entry-card > .entry-excerpt p {
  margin-block: 11px 16px;
}

body:is(.category-local-news, .category-uncategorized) .entry-card > .entry-meta[data-id="meta_1"] {
  display: none;
}

body:is(.category-local-news, .category-uncategorized) .entry-card > .entry-meta[data-id="meta_2"] {
  order: 4;
  margin: auto 20px 0;
  padding: 13px 0 18px;
  border-top: 1px solid var(--wm-line);
  color: var(--wm-muted);
  font-size: .78rem;
}

body:is(.category-local-news, .category-uncategorized) .entry-card .meta-author {
  display: none;
}

/* Do not expose the default category label on individual stories. */
.single-post .meta-categories:has(a[href*="/category/uncategorized/"]) {
  display: none;
}

@media (max-width: 980px) {
  body:is(.category-local-news, .category-uncategorized) .entries {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
  }
}

@media (max-width: 620px) {
  body:is(.category-local-news, .category-uncategorized) .ct-container {
    width: min(100% - 24px, 1180px);
    padding-block: 26px 40px;
  }

  body:is(.category-local-news, .category-uncategorized) .hero-section {
    margin-bottom: 20px;
  }

  body:is(.category-local-news, .category-uncategorized) .entries {
    grid-template-columns: 1fr;
  }

  body:is(.category-local-news, .category-uncategorized) .entry-card > .ct-media-container {
    aspect-ratio: 16 / 9 !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  body:is(.category-local-news, .category-uncategorized) .entry-card,
  body:is(.category-local-news, .category-uncategorized) .entry-card img {
    transition: none;
    transform: none;
  }
}
