/**
 * Force full-width layout for all single posts (including CPTs) and Full Width page template
 * Overrides Newspack's default 65% width when sidebar is removed
 */
#primary {
  max-width: 100vw;
}
.entry-content p{
  margin-block-start:0;
}

/* Ensure all single posts and search pages use full width layout */
.post-template-single-wide .main-content,
.page-template-page-full-width .main-content,
.page-template-magazine_archive_page .main-content,
.page-template-current_issue_template .main-content,
.search-full-width .main-content {
  width: 100% !important;
  max-width: 100% !important;
}

/* Prevent flex layout that reserves sidebar space */
.post-template-single-wide.single #main,
.page-template-page-full-width #main,
.page-template-magazine_archive_page #main,
.page-template-current_issue_template #main,
.search-full-width #main {
  display: block !important;
}

/* Force content-area and main to be 100% width when no sidebar */
.search-full-width .content-area,
.search-full-width #primary {
  width: 100% !important;
  max-width: 100% !important;
}

.search-full-width #main,
.search-full-width .site-main {
  width: 100% !important;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
}

/* Hide sidebar area completely */
.post-template-single-wide #secondary,
.page-template-page-full-width #secondary,
.page-template-magazine_archive_page #secondary,
.page-template-current_issue_template #secondary,
.search-full-width #secondary {
  display: none !important;
}

@media (min-width: 782px) {
  /* Ensure content area is full width */

  .page-template-page-full-width #primary,
  .page-template-magazine_archive_page #primary,
  .search-full-width #primary {
    max-width: 1200px;
    width: 100%;
  }
  .page-template-current_issue_template #primary,
  .post-template-single-wide #primary {
    max-width: 750px;
    width: 100%;
  }
}

/* Constrain entry content to readable max-width while centered */
.post-template-single-wide .entry-content,
.page-template-page-full-width .entry-content,
.page-template-magazine_archive_page .entry-content,
.page-template-current_issue_template .entry-content {
  max-width: var(--wp--style--global--content-size, 1100px);
  margin-left: auto;
  margin-right: auto;
  padding-left: 1.25rem;
  padding-right: 1.25rem;
}

/* Author bio should respect max-width */
@media (min-width: 782px) {
  .post-template-single-wide .author-bio {
    margin-left: auto;
    margin-right: auto;
    max-width: var(--wp--style--global--content-size, 1200px);
    width: 100%;
    padding-left: 1.25rem;
    padding-right: 1.25rem;
  }
}

/* Entry header should also respect max-width for Full Width pages */
.page-template-page-full-width .entry-header,
.page-template-magazine_archive_page .entry-header,
.page-template-current_issue_template .entry-header {
  max-width: var(--wp--style--global--content-size, 1200px);
  margin-left: auto;
  margin-right: auto;
  padding-left: 1.25rem;
  padding-right: 1.25rem;
}
.page-template-current_issue_template .entry-header {
  text-align: center;
  margin: 2rem auto;
}
.page-template-current_issue_template .wp-block-media-text>.wp-block-media-text__media {
  align-self: flex-start;
}
.page-template-current_issue_template .entry-content .featured-image-grid img {
    aspect-ratio: 3/2;
    object-fit: cover;
}

.page-template-current_issue_template .entry-subtitle {
  font-size: clamp(1.25rem, 3vw, 1.75rem);
  color: inherit;
  margin-top: 0.5rem;
  font-weight: 400;
}

/* Remove top margin from site-content on full-width pages with hero */
body.page-template-page-full-width.has-hero-header .site-content,
body.page-template-magazine_archive_page.has-hero-header .site-content {
  margin-top: 0;
}

body.page-template-page-full-width.has-hero-header #primary,
body.page-template-magazine_archive_page.has-hero-header #primary {
  padding-top: 0;
}

/* Hero section for Full Width pages with featured images */
.page-template-page-full-width .page-hero,
.page-template-magazine_archive_page .page-hero {
  position: relative;
  width: 100vw;
  left: 50%;
  right: 50%;
  margin-left: -50vw;
  margin-right: -50vw;
  margin-bottom: 2rem;
  margin-top: 0;
}

.page-template-page-full-width .page-hero .hero-wrap,
.page-template-magazine_archive_page .page-hero .hero-wrap {
  position: relative;
  height: 100vh;
  min-height: 500px;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Adjust hero height when header is overlaying */
body.has-hero-header.page-template-page-full-width .page-hero .hero-wrap,
body.has-hero-header.page-template-magazine_archive_page .page-hero .hero-wrap,
.page.has-hero-header .featured-image-behind 
{
  height: 50vh;
  min-height:300px;
}

.page-template-page-full-width .page-hero .hero-overlay,
.page-template-magazine_archive_page .page-hero .hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0),
    rgba(0, 0, 0, 0.3)
  );
  opacity: 0.7;
  z-index: 1;
}
.featured-image-behind::before {
  background: linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0),
    rgba(0, 0, 0, 0.5)
  );
  opacity: 0.7;
}

.page-template-page-full-width .page-hero .hero-content,
.page-template-magazine_archive_page .page-hero .hero-content {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 2rem;
  max-width: var(--wp--style--global--wide-size, 1100px);
  width: 100%;
}

.page-template-magazine_archive_page .entry-title {
  text-align: center;
}
.page-template-page-full-width .page-hero .entry-title,
.page-template-magazine_archive_page .page-hero .entry-title {
  color: #fff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
  margin: 0;
  font-size: clamp(2rem, 5vw, 3.5rem);
  line-height: 1.2;
}

.page-template-page-full-width .page-hero .wp-caption-text,
.page-template-magazine_archive_page .page-hero .wp-caption-text {
  max-width: var(--wp--style--global--content-size, 1100px);
  margin: 0.5rem auto 0;
  padding: 0 1.25rem;
  font-size: 0.875rem;
  color: #666;
  text-align: center;
}

/* Also hide primary navigation row on full-width pages with hero */
body.page-template-page-full-width.has-hero-header .bn-primary-row,
body.page-template-magazine_archive_page.has-hero-header .bn-primary-row {
  display: none;
}

/* Title positioned below hero */
.page-template-page-full-width .entry-header-below-hero,
.page-template-magazine_archive_page .entry-header-below-hero {
  max-width: var(--wp--style--global--content-size, 1100px);
  margin: 3rem auto 2rem;
  padding-left: 1.25rem;
  padding-right: 1.25rem;
  text-align: center;
}

.page .entry-header .entry-title {
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1.2;
  margin: 0;
  color: inherit;
  text-shadow: none;
  text-align: center;
}
.page.has-hero-header .entry-header .entry-title{
  text-shadow:0 1px 3px rgba(0,0,0,0.6)
}

@media (max-width: 782px) {
  .page-template-page-full-width .entry-header-below-hero,
  .page-template-magazine_archive_page .entry-header-below-hero {
    margin: 2rem auto 1.5rem;
  }

  .page-template-page-full-width .entry-header-below-hero .entry-title,
  .page-template-magazine_archive_page .entry-header-below-hero .entry-title {
    font-size: clamp(1.5rem, 6vw, 2.5rem);
  }
}

/* Mobile adjustments for hero */
@media (max-width: 782px) {
  .page-template-page-full-width .page-hero .hero-wrap,
  .page-template-magazine_archive_page .page-hero .hero-wrap {
    height: 70vh;
    min-height: 300px;
  }

  .page-template-page-full-width .page-hero .entry-title,
  .page-template-magazine_archive_page .page-hero .entry-title {
    font-size: clamp(1.5rem, 6vw, 2.5rem);
  }

  .page-template-page-full-width .page-hero .hero-content,
  .page-template-magazine_archive_page .page-hero .hero-content {
    padding: 1rem;
  }
}

/* ========================================
   Search Results Full Width Styles
   ======================================== */

/* Search results container */
.search-full-width .search-wrap {
  max-width: var(--wp--style--global--wide-size, 1200px);
  margin: 0 auto;
  padding: 2rem 1.25rem;
}

.search-full-width .search-term {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  line-height: 1.2;
  margin-bottom: 2rem;
  text-align: center;
}

/* Search results grid */
.search-full-width .search-results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}

@media (max-width: 768px) {
  .search-full-width .search-results {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
}

/* Individual search result items */
.search-full-width .search-results article {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.search-full-width .search-results article figure {
  margin: 0 0 1rem 0;
  overflow: hidden;
  border-radius: 4px;
}

.search-full-width .search-results article figure img {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.search-full-width .search-results article figure a:hover img {
  transform: scale(1.05);
}

.search-full-width .search-results .entry-header {
  margin-bottom: 0.5rem;
}

.search-full-width .search-results .entry-title {
  font-size: 1.25rem;
  line-height: 1.3;
  margin: 0 0 0.5rem 0;
}

.search-full-width .search-results .entry-title a {
  text-decoration: none;
  color: inherit;
}

.search-full-width .search-results .entry-title a:hover {
  color: var(--newspack-theme-color-primary, #0073aa);
}

.search-full-width .search-results .entry-meta {
  font-size: 0.875rem;
  color: #666;
  margin-bottom: 0.75rem;
}

.search-full-width .search-results .entry-content {
  font-size: 0.95rem;
  line-height: 1.5;
  flex-grow: 1;
}

/* Pagination for search results */
.search-full-width .pagination {
  max-width: var(--wp--style--global--wide-size, 1200px);
  margin: 3rem auto 2rem;
  padding: 0 1.25rem;
  text-align: center;
}

/* No results message */
.search-full-width .no-results {
  max-width: var(--wp--style--global--content-size, 800px);
  margin: 3rem auto;
  padding: 2rem 1.25rem;
  text-align: center;
}

.search-full-width .no-results .page-title {
  font-size: clamp(1.5rem, 3vw, 2rem);
  margin-bottom: 1rem;
}

.search-full-width .no-results .page-content p {
  font-size: 1.125rem;
  margin-bottom: 2rem;
}

/* ========================================
   Archive Hero Styles
   ======================================== */

/* Remove top margin/padding to allow header overlay */
body.archive.has-hero-header .site-content {
  margin-top: 0;
}

body.archive.has-hero-header #primary {
  padding-top: 0;
}

/* Hero container styling */
.archive.has-hero-header .featured-image-behind {
  position: relative;
  margin-bottom: 10px;
  margin-top: 0;
  min-height: 400px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background-color: #333;
}

/* Hero image */
.archive.has-hero-header .featured-image-behind .post-thumbnail {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  margin: 0;
}

.archive.has-hero-header .featured-image-behind .post-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Overlay gradient */
.archive.has-hero-header .featured-image-behind::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0.6) 100%);
  opacity: 0.5;
  z-index: 1;
}

/* Content wrapper */
.archive.has-hero-header .featured-image-behind .wrapper {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: var(--wp--style--global--wide-size, 1200px);
  padding: 0 1.25rem;
  text-align: center;
}

/* Typography */
.archive.has-hero-header .featured-image-behind .entry-title {
  color: #ffffff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
  font-size: 2.8rem;
  line-height: 1.2;
  margin: 0 0 1rem 0;
}
.archive.has-hero-header .featured-image-behind .entry-title .page-description {
  color: #ffffff;
  margin: 1rem auto 0 auto;
  font-weight: 400;
}
.archive.has-hero-header .featured-image-behind .entry-title .page-subtitle {
  color: #ffffff;
  font-size: 1rem;
}
.archive.has-hero-header .featured-image-behind a{
  color: #ffffff;
}
.archive.has-hero-header .featured-image-behind a:hover{
  text-decoration: underline;
}

.archive.has-hero-header .featured-image-behind .taxonomy-description,
.archive.has-hero-header .featured-image-behind .newspack-post-subtitle {
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
  font-size: 1.125rem;
  max-width: 800px;
  margin: 0 auto;
}

.archive.has-hero-header .featured-image-behind .taxonomy-description p,
.archive.has-hero-header .featured-image-behind .newspack-post-subtitle p {
  margin-bottom: 0.5rem;
}

/* Ensure entry header inside hero doesn't have conflicting margins */
.archive.has-hero-header .featured-image-behind .entry-header {
  margin: 0;
  padding: 8rem 0 2rem;
  max-width: 100%;
}

/* Styles for content moved below hero */
.archive.has-hero-header .archive-hero-meta {
  color: #000000;
}

.archive.has-hero-header .archive-hero-meta .newspack-post-subtitle {
  color: #000000;
  font-size: 1.125rem;
  line-height: 1.6;
}

.archive.has-hero-header .archive-hero-meta .newspack-post-subtitle p {
  margin-bottom: 1rem;
  font-style: normal;
}
.archive.has-hero-header .archive-hero-meta .newspack-post-subtitle a {
    color: var(--newspack-theme-color-text-light);
}
.archive.has-hero-header .archive-hero-meta .newspack-post-subtitle a:hover {
    color: black;
}
