/* ==========================================================================
   Krannon Archaeology Theme — v1.4.7.5
   Editorial layout consistency patch

   Purpose:
   1. Keep the global site shell centered with equal left/right viewport gutters.
   2. Keep long-form reading content in the Customizer Content Max Width column.
   3. Center the reading column on every normal page, post and inner hero.
   4. Leave the homepage hero rules untouched.
   ========================================================================== */

:root {
  --krannon-page-gutter: clamp(28px, 7vw, 112px);
  --krannon-site-shell-width: min(var(--krannon-container, 1180px), calc(100vw - (2 * var(--krannon-page-gutter))));
  --krannon-reading-width: min(var(--krannon-content-width, 760px), calc(100vw - (2 * var(--krannon-page-gutter))));
}

/* Global shell: header, menus, breadcrumbs, sections and footer share one centered axis. */
.krannon-container,
.krannon-site-header .krannon-container,
.krannon-local-nav .krannon-container,
.krannon-breadcrumb-bar .krannon-container,
.krannon-footer .krannon-container {
  width: var(--krannon-site-shell-width) !important;
  max-width: var(--krannon-container, 1180px) !important;
  margin-left: auto !important;
  margin-right: auto !important;
}

/* The reading column: centered, stable and governed by Content max width. */
.krannon-container-narrow,
.krannon-entry,
body.page:not(.home) .krannon-section .krannon-rich,
body.page:not(.home) .krannon-entry-content,
body.single .krannon-entry-content,
body.single .krannon-post-meta,
body.search .krannon-entry,
body.archive .krannon-entry {
  width: var(--krannon-reading-width) !important;
  max-width: var(--krannon-content-width, 760px) !important;
  margin-left: auto !important;
  margin-right: auto !important;
}

/* Default page headers follow the same editorial column as the text below. */
body:not(.home) .krannon-page-header > .krannon-container {
  width: var(--krannon-reading-width) !important;
  max-width: var(--krannon-content-width, 760px) !important;
  margin-left: auto !important;
  margin-right: auto !important;
}

body:not(.home) .krannon-page-header p,
body:not(.home) .krannon-page-title {
  max-width: 100% !important;
}

/* Inner heroes: background remains full-bleed, text column is centered. */
body:not(.home) .krannon-section-hero > .krannon-container,
body:not(.home) .krannon-page-hero > .krannon-container {
  width: var(--krannon-site-shell-width) !important;
  max-width: var(--krannon-container, 1180px) !important;
  margin-left: auto !important;
  margin-right: auto !important;
  display: flex;
  justify-content: center;
}

body:not(.home) .krannon-section-hero-inner,
body:not(.home) .krannon-page-hero--left .krannon-section-hero-inner,
body:not(.home) .krannon-page-hero--center .krannon-section-hero-inner {
  width: var(--krannon-reading-width) !important;
  max-width: var(--krannon-content-width, 760px) !important;
  margin-left: auto !important;
  margin-right: auto !important;
}

body:not(.home) .krannon-page-hero--left .krannon-section-hero-inner,
body:not(.home) .krannon-section-hero-inner {
  text-align: left;
}

body:not(.home) .krannon-page-hero--center .krannon-section-hero-inner {
  text-align: center;
}

body:not(.home) .krannon-section-hero-lead {
  max-width: 100% !important;
}

/* Standard text rhythm: equal margins, no accidental left anchoring. */
body.page:not(.home) .krannon-section.krannon-bg-white > .krannon-container.krannon-container-narrow,
body.page:not(.home) .krannon-section.krannon-bg-soft > .krannon-container.krannon-container-narrow,
body.single .krannon-content > .krannon-container.krannon-entry {
  width: var(--krannon-reading-width) !important;
  max-width: var(--krannon-content-width, 760px) !important;
}

/* Lists and bibliography pages keep readable line length inside the centered column. */
.krannon-entry-content ul,
.krannon-entry-content ol,
.krannon-rich ul,
.krannon-rich ol {
  max-width: 100%;
}

/* Wide components retain the site shell, while their headings keep editorial alignment. */
.krannon-grid,
.krannon-child-cards,
.krannon-editorial-cards-grid,
.krannon-publications-list,
.krannon-bibliography-list,
.krannon-map-wrap,
.krannon-gallery,
.krannon-partner-logos {
  margin-left: auto;
  margin-right: auto;
}

/* iPad / small screens: predictable gutters and full readable width. */
@media (max-width: 900px) {
  :root {
    --krannon-page-gutter: clamp(20px, 5vw, 36px);
  }
}

@media (max-width: 560px) {
  :root {
    --krannon-page-gutter: 20px;
  }

  .krannon-container,
  .krannon-container-narrow,
  .krannon-entry,
  body:not(.home) .krannon-page-header > .krannon-container,
  body:not(.home) .krannon-section-hero > .krannon-container,
  body:not(.home) .krannon-page-hero > .krannon-container,
  body:not(.home) .krannon-section-hero-inner,
  body.page:not(.home) .krannon-section .krannon-rich,
  body.page:not(.home) .krannon-entry-content,
  body.single .krannon-entry-content {
    width: calc(100vw - 40px) !important;
    max-width: calc(100vw - 40px) !important;
  }
}
