/* Sitewide readability, spacing, form and responsive refinement pass. */
:root{
  --kecb-reading-width:72ch;
  --kecb-wide-reading-width:88ch;
  --kecb-control-height:46px;
  --kecb-section-gap:clamp(2.4rem,5vw,5rem);
}

html{scroll-padding-top:7rem}
body{overflow-x:hidden}
main h1,main h2,main h3,main h4{text-wrap:balance}
main p,main li,main dd,main figcaption{text-wrap:pretty}
main img,main svg,main video{max-width:100%}

/* Keep long-form reading comfortable without changing the author's wording. */
.chapter-content>p,
.chapter-content>ul,
.chapter-content>ol,
.chapter-main>p,
.chapter-main>ul,
.chapter-main>ol,
.kitchen-longform>p,
.kitchen-longform>ul,
.kitchen-longform>ol,
.prose-section>p,
.prose-section>ul,
.prose-section>ol,
.legal-section>p,
.legal-section>ul,
.legal-section>ol,
.article-content>p,
.article-content>ul,
.article-content>ol{
  max-width:var(--kecb-reading-width);
}
.chapter-content>p,
.chapter-main>p,
.kitchen-longform>p,
.prose-section>p,
.legal-section>p,
.article-content>p{
  line-height:1.74;
  margin-block:0 1.1rem;
}
.chapter-content>p.auto-split-paragraph,
.chapter-main>p.auto-split-paragraph,
.kitchen-longform>p.auto-split-paragraph,
.prose-section>p.auto-split-paragraph,
.legal-section>p.auto-split-paragraph,
.article-content>p.auto-split-paragraph{
  margin-top:.15rem;
}
.chapter-content>h2,
.chapter-content>h3,
.chapter-main>h2,
.chapter-main>h3,
.kitchen-longform>h2,
.kitchen-longform>h3,
.prose-section>h2,
.prose-section>h3,
.legal-section>h2,
.legal-section>h3{
  max-width:var(--kecb-reading-width);
  scroll-margin-top:7rem;
}
.chapter-content>h2:not(:first-child),
.chapter-main>h2:not(:first-child),
.kitchen-longform>h2:not(:first-child),
.prose-section>h2:not(:first-child),
.legal-section>h2:not(:first-child){margin-top:clamp(2rem,4vw,3.4rem)}
.chapter-content>ul,
.chapter-content>ol,
.chapter-main>ul,
.chapter-main>ol,
.kitchen-longform>ul,
.kitchen-longform>ol,
.prose-section>ul,
.prose-section>ol,
.legal-section>ul,
.legal-section>ol{
  padding-left:1.35rem;
  line-height:1.68;
}
.chapter-content>ul li+li,
.chapter-content>ol li+li,
.kitchen-longform>ul li+li,
.kitchen-longform>ol li+li,
.prose-section>ul li+li,
.prose-section>ol li+li,
.legal-section>ul li+li,
.legal-section>ol li+li{margin-top:.55rem}

/* Separate sections and panels so pages scan as a sequence rather than one block. */
.refined-content-page main section:not(.book-source-banner):not(.k2-hero):not(.spx-hero):not(.visual-hero):not(.section-visual-hero){scroll-margin-top:7rem}
.kitchen-panel,.prose-section,.legal-section,.chapter-section{
  border-radius:18px;
}
.kitchen-longform,.prose-section,.legal-section{
  padding:clamp(1.15rem,3vw,2rem);
}
.kitchen-longform+ .kitchen-longform,
.prose-section+ .prose-section,
.legal-section+ .legal-section{margin-top:1.15rem}

/* Compact recurring book-source panels while preserving their connection to the books. */
.book-source-banner{border-block:1px solid rgba(75,42,25,.12)}
.book-source-inner{gap:clamp(.8rem,2vw,1.4rem)!important;padding-block:clamp(.85rem,2vw,1.25rem)!important}
.book-source-copy p{max-width:62ch;line-height:1.5;margin:.2rem 0}
.book-source-copy h2{margin:.1rem 0 .25rem;font-size:clamp(1.25rem,2.2vw,1.8rem)}
.book-source-actions{gap:.5rem}

/* Controls must remain obvious, tappable and visually consistent. */
main input:not([type="checkbox"]):not([type="radio"]),
main select,
main textarea{
  min-height:var(--kecb-control-height);
  border-radius:10px;
  font:inherit;
}
main textarea{min-height:7rem;resize:vertical}
main button,
main .button,
main .spx-button,
main .kitchen-button{
  min-height:44px;
  align-items:center;
  justify-content:center;
}
main :is(input,select,textarea,button,a):focus-visible{
  outline:3px solid color-mix(in srgb,var(--accent,#9b5734) 72%,white);
  outline-offset:3px;
}

/* Prevent dense card copy and uneven cards. */
:is(.path-card,.quick-card,.collection-card,.kitchen-card,.new-tool-card,.tool-role-card,.spx-card,.k2-result,.recommend-card) p,
:is(.path-card,.quick-card,.collection-card,.kitchen-card,.new-tool-card,.tool-role-card,.spx-card,.k2-result,.recommend-card) span{
  line-height:1.52;
}
:is(.path-card,.quick-card,.collection-card,.kitchen-card,.new-tool-card,.tool-role-card,.spx-card,.k2-result,.recommend-card) strong{
  text-wrap:balance;
}

/* Long legal and safety notices remain readable without becoming a wall of text. */
.kitchen-disclaimer,.site-legal-notice,.speakeasy-warning{
  line-height:1.55;
  text-wrap:pretty;
}
.kitchen-disclaimer{
  padding:1rem max(1rem,calc((100% - 1180px)/2));
}

/* Horizontal subnavigation should not crush or wrap unpredictably. */
.k2-subnav .k2-wrap,
.spx-subnav .spx-wrap,
.speakeasy-subnav .speakeasy-wrap{
  overflow-x:auto;
  overscroll-behavior-inline:contain;
  scrollbar-width:thin;
  -webkit-overflow-scrolling:touch;
}
.k2-subnav a,.spx-subnav a,.speakeasy-subnav a{flex:0 0 auto;white-space:nowrap}

/* Remove stale search suggestion chips specifically from My Bar even before JavaScript finishes. */

@media(max-width:900px){
  html{scroll-padding-top:5.5rem}
  .book-source-inner{grid-template-columns:1fr!important}
  .book-source-actions{display:flex;flex-wrap:wrap}
  .book-source-actions .button{flex:1 1 180px}
  .editorial-grid{grid-template-columns:1fr!important}
  .editorial-rail{position:static!important;max-height:none!important}
}

@media(max-width:700px){
  :root{--kecb-control-height:48px}
  main input:not([type="checkbox"]):not([type="radio"]),main select,main textarea{font-size:16px}
  .chapter-content>p,.chapter-main>p,.kitchen-longform>p,.prose-section>p,.legal-section>p,.article-content>p{line-height:1.68}
  .kitchen-longform,.prose-section,.legal-section{padding:1rem}
  .k2-split,.spx-workspace,.updates-layout,.recipe-layout,.recipe-content-grid{grid-template-columns:1fr!important}
  .k2-actions,.spx-actions,.button-row{align-items:stretch}
  .k2-actions>* ,.spx-actions>* ,.button-row>*{width:100%}
  .site-footer-v3{padding-bottom:calc(5.5rem + env(safe-area-inset-bottom))}
}

@media(prefers-reduced-motion:reduce){
  *,*::before,*::after{scroll-behavior:auto!important;animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important}
}

@media print{
  .reading-progress,.mobile-dock,.nav-menu-toggle,.system-mode-switch,.context-help-card{display:none!important}
  .chapter-content>p,.chapter-main>p,.kitchen-longform>p,.prose-section>p,.legal-section>p,.article-content>p{max-width:none}
}

/* Compact Kitchen legal notice: retain the full notice without presenting it as a wall of text. */
details.kitchen-disclaimer.compact-disclaimer{
  padding:0;
  overflow:hidden;
}
details.kitchen-disclaimer.compact-disclaimer>summary{
  min-height:56px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:1rem;
  padding:.85rem 1rem;
  cursor:pointer;
  list-style:none;
  color:#3c2116;
  font-weight:850;
}
details.kitchen-disclaimer.compact-disclaimer>summary::-webkit-details-marker{display:none}
details.kitchen-disclaimer.compact-disclaimer>summary span{font-size:.94rem}
details.kitchen-disclaimer.compact-disclaimer>summary small{
  margin-left:auto;
  color:#745a4a;
  font-size:.76rem;
  font-weight:700;
  text-align:right;
}
details.kitchen-disclaimer.compact-disclaimer>summary::after{
  content:'Read';
  flex:0 0 auto;
  padding:.42rem .68rem;
  border:1px solid rgba(91,47,28,.25);
  border-radius:999px;
  background:#fff;
  color:#6b371e;
  font-size:.72rem;
  line-height:1;
}
details.kitchen-disclaimer.compact-disclaimer[open]>summary::after{content:'Close'}
.compact-disclaimer-body{
  padding:1rem;
  border-top:1px solid rgba(91,47,28,.16);
  max-width:90ch;
  font-size:.88rem;
  line-height:1.65;
}

@media(min-width:370px) and (max-width:650px){
  .site-footer-v3.footer-efficient{grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:1.25rem 1rem}
  .site-footer-v3.footer-efficient .footer-free,
  .site-footer-v3.footer-efficient .footer-bottom{grid-column:1/-1}
  .site-footer-v3.footer-efficient .footer-bottom{grid-template-columns:repeat(2,minmax(0,1fr))}
  .site-footer-v3.footer-efficient .footer-bottom p{grid-column:1/-1}
}

@media(max-width:520px){
  details.kitchen-disclaimer.compact-disclaimer>summary{align-items:flex-start;flex-wrap:wrap}
  details.kitchen-disclaimer.compact-disclaimer>summary small{order:3;width:100%;margin:0;text-align:left}
}

/* Long callouts and table-cell notes use the same readable paragraph rhythm as chapters. */
.chapter-content td>p,
.chapter-main td>p,
.tool-page td>p,
.tool-suite-main td>p,
.tool-specific-notice>p,
.tool-disclaimer-dialog-content>p{line-height:1.68}
.chapter-content td>p.auto-split-paragraph,
.chapter-main td>p.auto-split-paragraph,
.tool-page td>p.auto-split-paragraph,
.tool-suite-main td>p.auto-split-paragraph,
.tool-specific-notice>p.auto-split-paragraph,
.tool-disclaimer-dialog-content>p.auto-split-paragraph{margin-top:.85rem}
