/* =========================
   LAYOUT
   (layout.css — structure + page layouts + responsive layout rules)
   Visual styling belongs in components.css/effects.css, etc.
========================= */

/* -------------------------
   HEADER + NAV (layout only)
------------------------- */
.site-header{
  position: sticky;
  top: 0;
  z-index: 500;
}

.header-inner{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  padding:14px 0;
  position: relative;
}

.brand{
  display:flex;
  align-items:baseline;
  gap:10px;
}

.primary-nav ul{
  display:flex;
  gap:16px;
  list-style:none;
  margin:0;
  padding:0;
}

/* Mobile nav behavior */
.nav-toggle{
  display:none;
}

@media (max-width: 900px){
  .nav-toggle{
    display:inline-flex;
  }

  .primary-nav{
    display:none;
    flex: 0 0 100%;
    width: 100%;
    position: relative;
    z-index: 600;
  }

  .primary-nav.is-open{
    display:block;
  }

  .primary-nav > ul,
  .primary-nav > .primary-menu{
    display:flex;
    flex-direction:column;
    align-items:flex-start;
    gap:6px;
    padding:10px 0;
    width:100%;
  }

  .primary-nav > ul > li,
  .primary-nav > .primary-menu > li{
    width:100%;
  }
}

/* Mobile header final wrapping (title + tagline + icons) */
@media (max-width: 520px){
  .header-inner{
    flex-wrap: wrap;
    padding-left: 16px;
    padding-right: 16px;
    align-items: center;
  }

  .brand{
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 10px;
    flex: 1 1 auto;
    min-width: 0;
  }

  .brand-title{
    flex: 0 0 auto;
    line-height: 1.1;
  }

  .brand-tag{
    flex: 0 0 100%;
    width: 100%;
    margin-top: 2px;
    order: 2;
  }

  .nav-toggle{
    margin-left: auto;
  }

  .header-social{
    flex: 0 0 100%;
    width: 100%;
    margin-top: 10px;
  }

  .header-social .social-menu{
    justify-content: flex-start;
  }

  .primary-nav{
    flex: 0 0 100%;
    width: 100%;
  }
}

/* -------------------------
   HERO (layout only)
------------------------- */
.hero{
  padding:42px 0 26px;
}

.hero-grid{
  display:grid;
  grid-template-columns: 1.1fr .9fr;
  gap:26px;
  align-items:center;
}

@media (max-width: 900px){
  .hero-grid{
    grid-template-columns: 1fr;
  }
}

/* -------------------------
   SECTIONS + GRIDS (layout)
------------------------- */
.section{
  padding:26px 0;
}

.grid3{
  display:grid;
  grid-template-columns: repeat(3, 1fr);
  gap:16px;
}

@media (max-width: 900px){
  .grid3{
    grid-template-columns: 1fr;
  }
}

/* -------------------------
   WORLD PRIMER (layout)
------------------------- */
.world-primer-inner{
  max-width: 760px;
  margin: 0 auto;
}

.world-primer-layout{
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  gap: 26px;
  align-items: center;
}

.world-primer-layout .world-primer-inner{
  max-width: 760px;
}

@media (max-width: 900px){
  .world-primer-layout{
    grid-template-columns: 1fr;
  }

  .world-primer-media{
    order: -1;
  }

  .world-primer-layout .world-primer-inner{
    max-width: 100%;
  }
}

/* -------------------------
   BOOK PAGE LAYOUT (panels)
------------------------- */
.book-narrow{
  max-width: 820px;
  margin: 0 auto;
}

.book-page{
  padding-top: 10px;
}

.book-panel{
  position: relative;
  padding: 28px;
  overflow: hidden;
}

.book-panel-hero{
  text-align: center;
  padding: 38px 28px;
}

.book-panel-main{
  margin-top: 18px;
}

.book-center{
  max-width: 760px;
  margin: 0 auto;
  text-align: left;
}

@media (max-width: 900px){
  .book-panel{
    padding: 24px;
  }
}

@media (max-width: 520px){
  .book-panel{
    padding: 20px;
  }

  .book-panel-hero{
    padding: 30px 18px;
  }
}

/* -------------------------
   BOOK 1 PAGE (layout clamp)
------------------------- */
.book1-page .container{
  max-width: 920px;
}

/* -------------------------
   CONTACT FORM 7 (layout)
------------------------- */
.wpcf7{
  max-width: 760px;
  margin: 0 auto;
}

.wpcf7 form{
  position: relative;
  overflow: hidden;
  padding: 26px;
}

@media (max-width: 520px){
  .wpcf7 form{
    padding: 20px;
  }
}

/* -------------------------
   PAGE TYPOGRAPHY WRAPPER (layout)
------------------------- */
.content{
  max-width: 760px;
  margin: 0 auto;
}

/* -------------------------
   /book (page-id-8) MOBILE WIDTH FIXES (layout)
------------------------- */
body.page-id-8 .content{
  max-width: 100%;
}

@media (max-width: 520px){
  body.page-id-8 .book-narrow{
    max-width: 100% !important;
  }
}

body.page-id-8 .book-panel-hero{
  margin-bottom: 18px;
}

body.page-id-8 .book-panel-main{
  margin-top: 0;
}

body.page-id-8 .book-panel{
  width: 100%;
  max-width: 100%;
}

@media (max-width: 520px){
  body.page-id-8 .book-center{
    max-width: 100% !important;
  }

  body.page-id-8 .book-sub,
  body.page-id-8 .book-note{
    max-width: 100% !important;
  }

  body.page-id-8 .book-panel{
    padding-left: 18px;
    padding-right: 18px;
  }
}

@media (max-width: 520px){
  body.page-id-8 .container{
    padding-left: 3px !important;
    padding-right: 3px !important;
  }

  body.page-id-8 .content,
  body.page-id-8 .book-narrow,
  body.page-id-8 .book-center{
    max-width: none !important;
    width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  body.page-id-8 .book-panel{
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
  }
}

@media (max-width: 520px){
  body.page-id-8 .book-panel-hero{
    margin-bottom: 14px !important;
  }

  body.page-id-8 .book-panel-main{
    margin-top: 0 !important;
  }
}

/* -------------------------
   STATIC PAGE HERO (layout)
------------------------- */
.page-hero{
  text-align: center;
  margin: 10px auto 28px;
  position: relative;
}

/* -------------------------
   BLOG TOP GRID (layout)
------------------------- */
.blog-top-grid{
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 18px;
  align-items: start;
}

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

@media (max-width: 900px){
  .blog-top-grid{
    grid-template-columns: 1fr;
  }
}

/* -------------------------
   GLOBAL HERO IMAGE (layout)
------------------------- */
.site-hero{
  position: relative;
  width: 100%;
  height: 450px;
  max-height: 450px;
  overflow: hidden;
  margin-top: -86px;
  padding-top: 86px;
}

.site-hero-inner{
  position: absolute;
  inset: 0;
}

.site-hero{
  pointer-events: none;
}

.site-header,
.site-header *{
  pointer-events: auto;
}

@media (max-width: 900px){
  .site-hero{
    height: 360px;
    max-height: 360px;
  }
}

@media (max-width: 520px){
  .site-hero{
    height: 280px;
    max-height: 280px;
    margin-top: -120px;
    padding-top: 120px;
  }
}

/* -------------------------
   FOOTER HERO (layout)
------------------------- */
.site-footer.footer-hero{
  position: relative;
  padding: 0;
  overflow: visible;
  z-index: 900;
}

.footer-hero-inner{
  position: relative;
  z-index: 901;
  padding: 26px 0;
  padding-bottom: calc(26px + env(safe-area-inset-bottom));
  overflow: visible;
}

.footer-inner{
  display: grid;
  grid-template-columns: 1.1fr .9fr auto;
  gap: 18px;
  align-items: start;
  position: relative;
  z-index: 902;
  overflow: visible;
}

.footer-nav{
  position: relative;
  z-index: 950;
  overflow: visible;
}

.footer-menu{
  overflow: visible;
}

.footer-menu li{
  position: relative;
  overflow: visible;
}

.footer-meta{
  grid-column: 1 / -1;
  margin-top: 10px;
  padding-top: 12px;
}

@media (max-width: 900px){
  .footer-inner{
    grid-template-columns: 1fr;
  }

  .footer-nav{
    width:100%;
  }

  .footer-nav .footer-menu{
    display:flex;
    flex-direction:row;
    flex-wrap:wrap;
    align-items:center;
    justify-content:flex-start;
    gap:14px;
  }

  .footer-social .social-menu{
    justify-content:flex-start;
  }
}

/* -------------------------
   FOOTER META LAYOUT
------------------------- */

.footer-meta{
  grid-column: 1 / -1;
  margin-top: 18px;
  padding-top: 14px;

  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 18px;
}

.footer-copyright{
  justify-self: start;
}

.footer-legal{
  justify-self: end;
}

@media (max-width: 900px){
  .footer-meta{
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .footer-legal{
    order: -1;
    justify-self: start;
  }

  .footer-copyright{
    justify-self: start;
  }
}

/* -------------------------
   DROPDOWN STACKING + MOBILE OPEN
------------------------- */
.site-main{
  position: relative;
  z-index: 1;
}

.section{
  position: relative;
  z-index: 1;
}

.primary-menu li.menu-item-has-children.is-open > .sub-menu,
.footer-menu li.menu-item-has-children.is-open > .sub-menu{
  display:block;
}

.primary-nav .sub-menu,
.footer-menu .sub-menu{
  z-index: 9999;
}

/* -------------------------
   FOOTER LEGAL MOBILE LAYOUT
------------------------- */

@media (max-width: 700px){

  .footer-meta{
    display:flex;
    flex-direction:column;
    gap:14px;
    padding-top:12px;
  }

  .footer-legal{
    display:flex;
    justify-content:center;
    flex-wrap:wrap;
    gap:14px;
    font-size:13px;
  }

  .footer-legal a{
    white-space:nowrap;
  }

  .footer-legal a:not(:last-child)::after{
    content:"|";
    margin-left:14px;
    opacity:.5;
  }

  .footer-copyright{
    text-align:left;
    font-size:13px;
  }

}