/* =========================================================
   AOSE Child Page
   Story / Knowledge shared UI
========================================================= */

.aose-child-page {
  --aose-child-wide: 1200px;
  --aose-child-content: 800px;
  --aose-child-narrow: 680px;
  --aose-child-gutter: 18px;
  color: var(--aose-color-text, #272522);
}

.aose-child-wide {
  width: min(
    calc(100% - (var(--aose-child-gutter) * 2)),
    var(--aose-child-wide)
  );
  margin-inline: auto;
}

.aose-child-content {
  width: min(
    calc(100% - (var(--aose-child-gutter) * 2)),
    var(--aose-child-content)
  );
  margin-inline: auto;
}

.aose-child-narrow {
  width: min(
    calc(100% - (var(--aose-child-gutter) * 2)),
    var(--aose-child-narrow)
  );
  margin-inline: auto;
}

.aose-child-page h2 {
  margin: 0 0 22px;
  font-size: clamp(27px, 3vw, 41px);
  line-height: 1.45;
  font-weight: 500;
}

.aose-child-page p {
  line-height: 2;
}

/* HERO */

.aose-child-hero {
  position: relative;
  width: 100vw;
  height: clamp(330px, 28vw, 420px);
  margin-left: calc(50% - 50vw);
  overflow: hidden;
}

.aose-child-hero > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.aose-child-hero__shade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(
      90deg,
      rgba(17,16,14,.66),
      rgba(17,16,14,.18) 70%
    );
}

.aose-child-hero__content {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: min(calc(100% - 36px), 1200px);
  margin: auto;
  color: #fff;
}

.aose-child-hero__content h1 {
  margin: 0 0 14px;
  color: inherit;
  font-size: clamp(36px, 4vw, 56px);
  font-weight: 500;
}

.aose-child-hero__content > p:last-child {
  margin: 0;
  font-size: clamp(18px, 2vw, 25px);
}

/* LEAD */

.aose-child-lead {
  padding: clamp(70px, 8vw, 115px) 0;
}

.aose-child-lead__large {
  margin-bottom: 30px !important;
  font-size: clamp(22px, 2.3vw, 31px);
  line-height: 1.75 !important;
}

/* SECTION */

.aose-child-section {
  padding: clamp(65px, 8vw, 110px) 0;
}

.aose-child-section--soft {
  background: #f7f5f1;
}

.aose-child-media {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(45px, 7vw, 90px);
}

.aose-child-media--reverse figure {
  order: -1;
}

.aose-child-media__body {
  max-width: 540px;
}

.aose-child-media figure {
  margin: 0;
}

.aose-child-media img {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
}

.aose-child-heading {
  max-width: 800px;
  margin: 0 auto 45px;
  text-align: center;
}

/* PROCESS */

.aose-process-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

.aose-process-card {
  background: #fff;
  padding-bottom: 22px;
}

.aose-process-card img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.aose-process-card > span {
  display: block;
  margin: 18px 20px 4px;
  font-size: 11px;
  letter-spacing: .12em;
  opacity: .55;
}

.aose-process-card h3 {
  margin: 0 20px 8px;
  font-size: 19px;
  font-weight: 500;
}

.aose-process-card p {
  margin: 0 20px;
  font-size: 13px;
  line-height: 1.8;
}

/* STORY */

.aose-child-storybox {
  padding: clamp(90px, 10vw, 150px) 0;
  text-align: center;
}

.aose-child-storybox h2 {
  margin-bottom: 30px;
}

/* LINK GRID */

.aose-child-link-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

.aose-child-link-grid a {
  background: #fff;
  color: inherit;
  text-decoration: none;
}

.aose-child-link-grid img {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
}

.aose-child-link-grid h3 {
  margin: 0;
  padding: 18px 18px 20px;
  font-size: 18px;
  font-weight: 500;
}

/* CTA */

.aose-child-cta {
  padding: clamp(70px, 8vw, 110px) 0;
}

.aose-child-cta > div {
  position: relative;
  min-height: 430px;
  overflow: hidden;
}

.aose-child-cta img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.aose-child-cta > div::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(
      90deg,
      rgba(21,18,15,.78),
      rgba(21,18,15,.35) 55%,
      rgba(21,18,15,.08)
    );
}

.aose-child-cta__body {
  position: relative;
  z-index: 1;
  max-width: 600px;
  padding: clamp(55px, 7vw, 90px);
  color: #fff;
}

.aose-child-cta__body h2 {
  color: inherit;
}

.aose-child-cta__body a {
  display: inline-flex;
  margin-top: 12px;
  padding: 13px 27px;
  border: 1px solid rgba(255,255,255,.72);
  border-radius: 999px;
  color: #fff;
  text-decoration: none;
}

/* RELATED */

.aose-child-related {
  padding: clamp(70px, 8vw, 110px) 0;
  background: #f7f5f1;
}

/* RESPONSIVE */

@media (max-width: 900px) {

  .aose-process-grid,
  .aose-child-link-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 767px) {

  .aose-child-hero {
    height: clamp(330px, 92vw, 400px);
  }

  .aose-child-hero__shade {
    background: rgba(17,16,14,.4);
  }

  .aose-child-media {
    grid-template-columns: 1fr;
    gap: 34px;
  }

  .aose-child-media figure,
  .aose-child-media--reverse figure {
    order: -1;
  }

  .aose-process-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .aose-process-card h3 {
    margin-inline: 14px;
  }

  .aose-process-card p,
  .aose-process-card > span {
    margin-inline: 14px;
  }

  .aose-child-link-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .aose-child-cta > div {
    min-height: 500px;
  }

  .aose-child-cta > div::after {
    background: rgba(21,18,15,.48);
  }

  .aose-child-cta__body {
    padding: 48px 24px;
  }
}
/* SWELL container integration for registered AOSE child pages. */
.aose-page-type--child #content {width:100%;max-width:none;padding-inline:0;}
.aose-page-type--child #main_content {width:100%;max-width:none;margin-inline:0;padding-top:0;}
.aose-page-type--child #main_content .l-mainContent__inner {width:100%;max-width:none;}
.aose-page-type--child #main_content .post_content {max-width:none;padding-inline:0;}
.aose-page-type--child #main_content .c-pageTitle {display:none;}
.aose-child-page .aose-child-hero {width:100%;margin-inline:0;}
.aose-child-page .aose-child-hero > img {height:100% !important;}
.aose-child-page > p:empty, .aose-child-media > p:empty {display:none;}
/* wpautop splits legacy image links into image/title/empty siblings. */
.aose-child-link-grid > p {margin:0;}
.aose-child-link-grid > p:nth-child(3n) {display:none;}
.aose-child-link-grid > p > a > br {display:none;}
.aose-child-link-grid {row-gap:0;}
.aose-child-link-grid > p:nth-child(3n+1) {grid-row:1;}
.aose-child-link-grid > a {grid-row:2;}
@media(max-width:900px){
.aose-child-link-grid > p:nth-child(7), .aose-child-link-grid > p:nth-child(10){grid-row:3;margin-top:20px;}
.aose-child-link-grid > a:nth-child(8), .aose-child-link-grid > a:nth-child(11){grid-row:4;}
}

.aose-page-type--child #content {padding-top:0;}
.aose-page-type--child #main_content .post_content {margin-top:0;}
.aose-page-type--child #main_content .post_content > p:empty {display:none;}

/* AOSE child H2: plain headings, without SWELL left accent. */
.aose-page-type--child .post_content .aose-child-page h2 {
  border-left:0;
  padding-left:0;
}

/* Story / Knowledge section labels; process-card spans stay unchanged. */
.aose-child-story .aose-child-section .aose-section-label,
.aose-child-story .aose-child-storybox .aose-section-label {font-size:clamp(15px,1.2vw,18px);font-weight:600;letter-spacing:.14em;margin-bottom:10px;color:var(--aose-color-accent);}
.aose-child-related .aose-related {display:flex;flex-wrap:wrap;justify-content:center;gap:20px;}
.aose-child-related .aose-journal__latest-item {display:block;flex:0 0 calc((100% - 60px) / 4);min-width:0;background:#fff;color:inherit;text-decoration:none;}
.aose-child-related .aose-journal__latest-item > img {display:block;width:100%;height:auto !important;aspect-ratio:3 / 2;object-fit:cover;}
.aose-child-related .aose-journal__latest-item > div {padding:18px;}
.aose-child-related .aose-journal__latest-meta {display:flex;flex-wrap:wrap;gap:10px;font-size:12px;opacity:.7;}
.aose-child-related .aose-journal__latest-item h3 {font-size:18px;line-height:1.7;margin:10px 0 0;overflow-wrap:anywhere;}
.aose-child-related .aose-journal__latest-arrow {display:block;padding:0 18px 18px;text-align:right;}
@media(max-width:1023px){.aose-child-related .aose-journal__latest-item {flex-basis:calc((100% - 20px) / 2);}}
@media(max-width:599px){.aose-child-related .aose-journal__latest-item {flex-basis:100%;}}

/* TYPE B shell: existing semantic markup, shared across recipe guides. */
.aose-child--howto{color:var(--aose-color-text,#272522);overflow-wrap:anywhere;}
.aose-child--howto :is(.aose-container,.aose-step__body,.aose-split__body){min-width:0;}
.aose-child--howto p{line-height:2;}
.aose-child--howto h2{font-size:clamp(26px,3vw,40px);line-height:1.5;margin:0 0 24px;}
.aose-child--howto h3{font-size:clamp(22px,2.2vw,29px);line-height:1.6;margin:0 0 20px;}
.aose-child--howto .aose-section-heading{margin-bottom:36px;}
.aose-child--howto .aose-section-number{color:var(--aose-color-brown,#715039);font-size:14px;letter-spacing:.15em;margin:0 0 12px;}
.aose-child--howto .aose-child-hero{width:100%;margin-inline:0;height:clamp(330px,32vw,440px);}
.aose-child--howto .aose-child-hero__media,.aose-child--howto .aose-child-hero__overlay{position:absolute;inset:0;}
.aose-child--howto .aose-child-hero__media img{display:block;width:100%;height:100%!important;object-fit:cover;}
.aose-child--howto .aose-child-hero__overlay{background:linear-gradient(90deg,rgba(25,20,15,.67),rgba(25,20,15,.16));}
.aose-child--howto .aose-child-hero__content{z-index:1;}
.aose-child--howto .aose-child-hero__eyebrow{font-size:13px;letter-spacing:.18em;margin:0 0 16px;}
.aose-child--howto .aose-child-hero__lead{font-size:clamp(19px,2vw,25px);}
.aose-child--howto .aose-child-intro{font-size:19px;}
.aose-child--howto :is(.aose-text-block,.aose-story-block){margin-block:40px;}
.aose-child--howto .aose-subsection-heading{margin-top:44px;}
.aose-child--howto .aose-figure{margin:32px 0;}
.aose-child--howto .aose-figure img{width:100%;height:auto!important;border-radius:6px;}
.aose-child--howto .aose-figure--ratio img{object-fit:contain;}
.aose-child--howto .aose-story-quote{margin:32px 0;padding:24px;border:0;background:var(--aose-color-koji-white,#f8f6f0);font-size:23px;text-align:center;}
.aose-child--howto .aose-split{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:48px;align-items:center;}
.aose-child--howto .aose-split__media img{display:block;width:100%;height:auto!important;aspect-ratio:3/2;object-fit:cover;}
.aose-child--howto .aose-child-back{padding:40px 18px;text-align:center;}
.aose-child--howto :is(.aose-section,.aose-container,.aose-step,.aose-split)>p:empty{display:none;}
.aose-child--howto .aose-related{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:20px;}
.aose-child--howto .aose-journal__latest-item{display:flex;flex-direction:column;background:#fff;color:inherit;text-decoration:none;min-width:0;}
.aose-child--howto .aose-journal__latest-item>img{width:100%;height:auto!important;aspect-ratio:3/2;object-fit:cover;}
.aose-child--howto .aose-journal__latest-item>div{padding:18px;}
.aose-child--howto .aose-journal__latest-meta{display:flex;gap:10px;flex-wrap:wrap;font-size:12px;}
.aose-child--howto .aose-journal__latest-item h3{font-size:18px;margin:12px 0 0;}
.aose-child--howto .aose-journal__latest-arrow{margin-top:auto;text-align:right;padding:0 18px 18px;}
@media(max-width:1023px){.aose-child--howto .aose-related{grid-template-columns:repeat(2,minmax(0,1fr));}}
@media(max-width:767px){.aose-child--howto .aose-split,.aose-child--howto .aose-related{grid-template-columns:minmax(0,1fr);gap:24px;}.aose-child--howto .aose-child-hero{height:360px;}.aose-child--howto .aose-child-hero__content h1{font-size:clamp(28px,8vw,38px);}.aose-child--howto .aose-child-intro{font-size:17px;}.aose-child--howto .aose-story-quote{font-size:20px;}}

/* TYPE B spacing: preserve gaps against SWELL first/last-child resets. */
.post_content .aose-child--howto .aose-subsection-heading{margin-block:clamp(44px,5vw,64px) 32px!important;}
.post_content .aose-child--howto .aose-figure{margin-block:clamp(40px,5vw,64px)!important;}
.post_content .aose-child--howto :is(.aose-aging-timeline,.aose-custom-grid){margin-block:clamp(40px,5vw,64px)!important;gap:32px;}
.post_content .aose-child--howto :is(.aose-aging-timeline__item,.aose-info-card){display:flex;flex-direction:column;gap:12px;}
.post_content .aose-child--howto :is(.aose-aging-timeline__item,.aose-info-card)>:is(p,h3){margin-block:0!important;}
@media(max-width:767px){.post_content .aose-child--howto :is(.aose-aging-timeline,.aose-custom-grid){gap:24px;}}

/* TYPE B shared finishing: spacing, compact cards and notices */
.post_content .aose-child--howto .aose-section{padding-block:clamp(40px,4.5vw,58px);}
.post_content .aose-child--howto .aose-child-intro{padding-bottom:24px;}
.post_content .aose-child--howto .aose-child-intro+.aose-section{padding-top:24px;}
.post_content .aose-child--howto .aose-section-heading{margin-bottom:24px!important;}
.post_content .aose-child--howto :is(.aose-howto-flow,.aose-ingredients,.aose-next-grid,.aose-faq){margin-top:32px!important;}
.post_content .aose-child--howto .aose-howto-flow__item{display:flex;flex-direction:column;gap:12px;}
.post_content .aose-child--howto .aose-howto-flow__item>:is(h3,p){margin:0!important;}
.post_content .aose-child--howto .aose-custom-grid--three{grid-template-columns:repeat(3,minmax(0,1fr));max-width:1000px;margin-inline:auto;gap:24px;}
.post_content .aose-child--howto .aose-note{margin-top:24px!important;}
.post_content .aose-child--howto .aose-note--important{padding:24px;background:#f6efe2;border-left:4px solid #8b6240;border-radius:6px;}
.post_content .aose-child--howto .aose-note--important p+p{margin-top:12px!important;}
.post_content .aose-child--howto .aose-container>p:has(>.aose-button){margin-top:32px!important;text-align:center;}
.post_content .aose-child--howto .aose-button{text-align:center;white-space:normal;}
.post_content .aose-child--howto .aose-step--simple{display:block;}
.post_content .aose-child--howto .aose-step--simple .aose-step__body{max-width:800px;margin-inline:auto;}
@media(max-width:767px){
 .post_content .aose-child--howto .aose-section-heading{margin-bottom:20px!important;}
 .post_content .aose-child--howto .aose-custom-grid--three{grid-template-columns:minmax(0,1fr);gap:20px;}
 .post_content .aose-child--howto .aose-note--important{padding:20px;}
}

/* TYPE B native FAQ */
.post_content .aose-child--howto .aose-faq__item{border-top:1px solid #ded9d0;}
.post_content .aose-child--howto .aose-faq__item:last-child{border-bottom:1px solid #ded9d0;}
.post_content .aose-child--howto .aose-faq__item summary{padding:20px 12px;cursor:pointer;font-weight:600;line-height:1.8;}
.post_content .aose-child--howto .aose-faq__item[open] summary{color:#805b3c;}
.post_content .aose-child--howto .aose-faq__answer{padding:0 12px 24px;}
.post_content .aose-child--howto .aose-journal__latest-item{border:1px solid #e2ddd5;border-radius:6px;overflow:hidden;}

/* TYPE B comparison spacing: retain the existing shared component styles */
.post_content .aose-child--howto .aose-compare-grid{margin-block:32px!important;}
.post_content .aose-child--howto .aose-branch-flow{margin-block:40px!important;}
.post_content .aose-child--howto .aose-compare-card__catch{margin-bottom:24px!important;}

/* TYPE B component colors remain visible when legacy tokens are absent */
.post_content .aose-child--howto .aose-compare-card{border:1px solid #ded9d0;background:#f8f5ee;}
.post_content .aose-child--howto .aose-branch-flow__origin strong{border:1px solid #ded9d0;background:#f8f5ee;}
.post_content .aose-child--howto .aose-branch-flow__branches>div{border:1px solid #ded9d0;background:#f8f5ee;}

/* TYPE B compact two-ingredient cards */
.post_content .aose-child--howto .aose-ingredients--compact{grid-template-columns:repeat(2,minmax(0,1fr));max-width:500px;margin-inline:auto;}
@media(max-width:767px){.post_content .aose-child--howto .aose-ingredients--compact{grid-template-columns:minmax(0,1fr);}}
