
/*
Theme Name: NeXt Chapter Recovery
File: v1.6.0 front-end conflict hardening
Purpose: final late-loading layout normalizer for WP core, WooCommerce, blocks, shortcodes, archives, search, cart, checkout, account and portal pages.
*/

:root{
  --ncr-fix-bg:#fff3e5;
  --ncr-fix-bg2:#f8ddbd;
  --ncr-fix-surface:#fffaf3;
  --ncr-fix-ink:#1f1712;
  --ncr-fix-muted:#725545;
  --ncr-fix-rust:#a8321b;
  --ncr-fix-orange:#e86f1d;
  --ncr-fix-gold:#f2a541;
  --ncr-fix-border:rgba(122,47,20,.16);
  --ncr-fix-shadow:0 20px 55px rgba(34,18,9,.10);
  --ncr-fix-radius:24px;
  --ncr-fix-container:min(1180px, calc(100% - 2rem));
}
html[data-theme="dark"]{
  --ncr-fix-bg:#120c09;
  --ncr-fix-bg2:#21130d;
  --ncr-fix-surface:#19110d;
  --ncr-fix-ink:#fff1df;
  --ncr-fix-muted:rgba(255,241,223,.72);
  --ncr-fix-border:rgba(255,178,102,.20);
  --ncr-fix-shadow:0 20px 55px rgba(0,0,0,.34);
}

/* Stop default WP template leaks from showing raw widgets/unstyled content. */
body{
  background:linear-gradient(180deg,var(--ncr-fix-bg),#fff8ef 54%,var(--ncr-fix-bg)) !important;
  color:var(--ncr-fix-ink) !important;
  overflow-x:hidden;
}
html[data-theme="dark"] body{
  background:linear-gradient(180deg,#100906,#1a100c 54%,#100906) !important;
}
#page,
.site,
.site-content,
.content-area,
#content,
main,
.site-main{
  max-width:none;
}
.site-main > *:first-child{
  margin-top:0;
}
.ncr-site-main,
.ncr-page-wrap,
.ncr-woo-wrap,
.ncr-archive-wrap,
.ncr-search-wrap,
.ncr-index-wrap,
.woocommerce .ncr-woo-wrap{
  width:var(--ncr-fix-container) !important;
  max-width:var(--ncr-fix-container) !important;
  margin-inline:auto !important;
  padding:clamp(2rem,5vw,4.5rem) 0 !important;
  box-sizing:border-box;
}

/* Universal card shell for content pages. */
.ncr-content-card,
.ncr-woo-card,
.ncr-default-card,
.ncr-archive-card,
.ncr-search-card,
.ncr-index-card,
.woocommerce div.product,
.woocommerce-cart .woocommerce,
.woocommerce-checkout .woocommerce,
.woocommerce-account .woocommerce,
.entry-content > .woocommerce,
.wp-block-group,
.ncr-hub-public,
.ncr-portal-shell,
.ncr-portal-card,
.ncr-support-card,
.ncr-reading-card,
.ncr-meeting-card{
  box-sizing:border-box;
}
.ncr-content-card,
.ncr-woo-card,
.ncr-default-card,
.ncr-archive-card,
.ncr-search-card,
.ncr-index-card{
  background:var(--ncr-fix-surface) !important;
  border:1px solid var(--ncr-fix-border) !important;
  border-radius:var(--ncr-fix-radius) !important;
  box-shadow:var(--ncr-fix-shadow) !important;
  padding:clamp(1.15rem,3vw,2.35rem) !important;
}

/* Global heading scale guard. */
body:not(.home) h1,
.ncr-page-title,
.entry-title,
.page-title,
.woocommerce-products-header__title,
.woocommerce div.product .product_title{
  color:var(--ncr-fix-ink) !important;
  font-size:clamp(1.85rem,3.25vw,3.15rem) !important;
  line-height:1.08 !important;
  letter-spacing:-.04em !important;
  margin:0 0 1rem !important;
}
body:not(.home) h2,
.entry-content h2,
.woocommerce-Tabs-panel h2,
.ncr-content-card h2,
.ncr-portal-card h2{
  color:var(--ncr-fix-ink) !important;
  font-size:clamp(1.35rem,2.2vw,2.15rem) !important;
  line-height:1.16 !important;
  letter-spacing:-.025em !important;
  margin:1.6rem 0 .75rem !important;
}
body:not(.home) h3,
.entry-content h3,
.ncr-content-card h3,
.ncr-portal-card h3{
  color:var(--ncr-fix-ink) !important;
  font-size:clamp(1.12rem,1.55vw,1.48rem) !important;
  line-height:1.22 !important;
  margin:1.25rem 0 .55rem !important;
}
.entry-content p,
.ncr-content-card p,
.ncr-default-card p,
.woocommerce div.product div.summary,
.woocommerce-Tabs-panel,
.ncr-hub-public p{
  color:var(--ncr-fix-muted);
  font-size:clamp(1rem,1vw,1.08rem);
  line-height:1.75;
}
.entry-content img,
.ncr-content-card img,
.woocommerce img{
  max-width:100%;
  height:auto;
}

/* Fix raw lists/widgets. */
.widget,
.wp-block-latest-posts,
.wp-block-categories,
.wp-block-archives{
  background:rgba(255,255,255,.58);
  border:1px solid var(--ncr-fix-border);
  border-radius:18px;
  padding:1rem;
}
html[data-theme="dark"] .widget,
html[data-theme="dark"] .wp-block-latest-posts,
html[data-theme="dark"] .wp-block-categories,
html[data-theme="dark"] .wp-block-archives{
  background:rgba(255,255,255,.06);
}
.widget h2,
.widget-title,
.wp-block-heading{
  font-size:1.05rem !important;
  letter-spacing:0 !important;
}
.widget ul,
.wp-block-categories,
.wp-block-archives{
  list-style:none;
  padding-left:0;
  margin:0;
}
.widget li,
.wp-block-categories li,
.wp-block-archives li{
  padding:.35rem 0;
  border-bottom:1px solid rgba(122,47,20,.08);
}
.widget li:last-child,
.wp-block-categories li:last-child,
.wp-block-archives li:last-child{
  border-bottom:0;
}

/* Links and buttons. */
.entry-content a:not(.button):not(.wp-element-button),
.ncr-content-card a:not(.button):not(.wp-element-button),
.ncr-sidebar a,
.woocommerce a:not(.button){
  color:var(--ncr-fix-rust);
  font-weight:800;
  text-underline-offset:3px;
}
button,
input[type="submit"],
.wp-element-button,
.wp-block-button__link,
.ncr-btn-pro,
.woocommerce a.button,
.woocommerce button.button,
.woocommerce input.button,
.woocommerce #respond input#submit{
  border-radius:999px !important;
  background:linear-gradient(135deg,var(--ncr-fix-rust),var(--ncr-fix-orange)) !important;
  border:0 !important;
  color:#fff !important;
  font-weight:900 !important;
  min-height:44px;
  padding:.78rem 1.15rem !important;
  text-decoration:none !important;
  box-shadow:0 14px 30px rgba(168,50,27,.16);
}

/* Form and checkbox conflict hardening. */
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="url"],
input[type="password"],
input[type="search"],
input[type="number"],
input[type="date"],
select,
textarea,
.woocommerce input.input-text,
.woocommerce textarea,
.woocommerce select{
  width:100%;
  min-height:46px;
  border:1px solid rgba(122,47,20,.22) !important;
  border-radius:15px !important;
  background:#fff !important;
  color:#1f1712 !important;
  padding:.78rem .95rem !important;
  box-sizing:border-box;
  box-shadow:none !important;
}
textarea{
  min-height:130px;
}
input:focus,
select:focus,
textarea:focus{
  outline:3px solid rgba(232,111,29,.18) !important;
  border-color:var(--ncr-fix-orange) !important;
}
input[type="checkbox"],
input[type="radio"]{
  appearance:auto !important;
  -webkit-appearance:auto !important;
  width:18px !important;
  min-width:18px !important;
  height:18px !important;
  min-height:18px !important;
  display:inline-block !important;
  opacity:1 !important;
  visibility:visible !important;
  position:static !important;
  pointer-events:auto !important;
  margin:0 .55rem 0 0 !important;
  vertical-align:middle !important;
  accent-color:var(--ncr-fix-rust);
}
label:has(input[type="checkbox"]),
label:has(input[type="radio"]),
.ncr-checkbox-row,
.ncr-consent-row,
.woocommerce-form__label-for-checkbox{
  display:flex !important;
  align-items:flex-start !important;
  gap:.55rem !important;
  cursor:pointer !important;
  line-height:1.45;
}
label:has(input[type="checkbox"]) span,
label:has(input[type="radio"]) span,
.woocommerce-form__label-for-checkbox span{
  display:inline !important;
}

/* WooCommerce full layout fix. */
.woocommerce div.product{
  background:var(--ncr-fix-surface) !important;
  border:1px solid var(--ncr-fix-border) !important;
  border-radius:28px !important;
  box-shadow:var(--ncr-fix-shadow) !important;
  padding:clamp(1rem,2.5vw,2.2rem) !important;
}
.woocommerce div.product div.images{
  border-radius:24px;
  overflow:hidden;
}
.woocommerce div.product .summary{
  padding:0 clamp(.25rem,1vw,1rem);
}
.woocommerce div.product p.price,
.woocommerce div.product span.price{
  color:var(--ncr-fix-rust) !important;
  font-size:clamp(1.35rem,2vw,1.8rem) !important;
  font-weight:950 !important;
}
.woocommerce div.product form.cart{
  display:flex;
  flex-wrap:wrap;
  gap:.75rem;
  align-items:center;
}
.woocommerce div.product form.cart .quantity{
  margin:0 !important;
}
.woocommerce .quantity .qty{
  width:86px !important;
  border-radius:999px !important;
  text-align:center;
}
.woocommerce div.product .woocommerce-tabs ul.tabs{
  padding:0 !important;
  margin:2rem 0 1rem !important;
}
.woocommerce div.product .woocommerce-tabs ul.tabs::before{
  display:none !important;
}
.woocommerce div.product .woocommerce-tabs ul.tabs li{
  border:1px solid var(--ncr-fix-border) !important;
  background:rgba(255,255,255,.7) !important;
  border-radius:999px !important;
  margin:0 .35rem .5rem 0 !important;
}
html[data-theme="dark"] .woocommerce div.product .woocommerce-tabs ul.tabs li{
  background:rgba(255,255,255,.08) !important;
}
.woocommerce div.product .woocommerce-tabs ul.tabs li a{
  color:var(--ncr-fix-ink) !important;
  font-weight:900;
}
.woocommerce div.product .woocommerce-tabs .panel{
  background:rgba(255,255,255,.62) !important;
  border:1px solid var(--ncr-fix-border) !important;
  border-radius:22px !important;
  padding:1.5rem !important;
}
html[data-theme="dark"] .woocommerce div.product .woocommerce-tabs .panel{
  background:rgba(255,255,255,.06) !important;
}
.woocommerce ul.products{
  display:grid !important;
  grid-template-columns:repeat(4,minmax(0,1fr)) !important;
  gap:1.15rem !important;
}
.woocommerce ul.products::before,
.woocommerce ul.products::after{
  display:none !important;
}
.woocommerce ul.products li.product{
  float:none !important;
  width:auto !important;
  margin:0 !important;
  padding:1rem !important;
  background:var(--ncr-fix-surface) !important;
  border:1px solid var(--ncr-fix-border) !important;
  border-radius:22px !important;
  box-shadow:0 14px 34px rgba(34,18,9,.08);
}
.woocommerce ul.products li.product .woocommerce-loop-product__title{
  font-size:1.05rem !important;
  line-height:1.25 !important;
  letter-spacing:0 !important;
}
.woocommerce-cart .woocommerce,
.woocommerce-checkout .woocommerce,
.woocommerce-account .woocommerce{
  width:var(--ncr-fix-container);
  margin-inline:auto;
  background:var(--ncr-fix-surface);
  border:1px solid var(--ncr-fix-border);
  border-radius:var(--ncr-fix-radius);
  box-shadow:var(--ncr-fix-shadow);
  padding:clamp(1rem,2.5vw,2rem);
}

/* Shortcode and portal pages. */
.ncr-hub-public,
.ncr-portal-shell,
.ncr-portal-dashboard,
.ncr-mobile-hub,
.ncr-sober-calendar,
.ncr-response-hub,
.ncr-service-payments{
  width:100%;
  max-width:1180px;
  margin-inline:auto;
}
.ncr-hub-public > *,
.ncr-portal-shell > *,
.ncr-mobile-hub > *,
.ncr-service-payments > *{
  box-sizing:border-box;
}
.ncr-portal-card,
.ncr-support-card,
.ncr-reading-card,
.ncr-meeting-card,
.ncr-mobile-card,
.ncr-sober-card{
  background:var(--ncr-fix-surface) !important;
  border:1px solid var(--ncr-fix-border) !important;
  border-radius:22px !important;
  box-shadow:0 14px 36px rgba(34,18,9,.08) !important;
  padding:clamp(1rem,2vw,1.5rem) !important;
}

/* Clean up notices without breaking grids. */
.ncr-notice,
.woocommerce-message,
.woocommerce-info,
.woocommerce-error,
div.notice{
  border-radius:16px !important;
  border:1px solid rgba(168,50,27,.18) !important;
  background:rgba(255,255,255,.82) !important;
  color:var(--ncr-fix-ink) !important;
  padding:1rem 1.15rem !important;
  box-shadow:0 12px 28px rgba(34,18,9,.07);
}
html[data-theme="dark"] .ncr-notice,
html[data-theme="dark"] .woocommerce-message,
html[data-theme="dark"] .woocommerce-info,
html[data-theme="dark"] .woocommerce-error{
  background:rgba(255,255,255,.08) !important;
}

/* Hide front-end admin/dev language if older shortcode output still has it. */
.ncr-admin-note,
.ncr-dev-note,
.ncr-debug,
.ncr-debug-output,
.ncr-system-note,
.ncr-home-admin-note,
.ncr-shortcode-debug,
.ncr-admin-only-front{
  display:none !important;
}

/* Mobile safety. */
@media(max-width:1024px){
  .ncr-default-grid{
    grid-template-columns:1fr !important;
  }
  .woocommerce ul.products{
    grid-template-columns:repeat(2,minmax(0,1fr)) !important;
  }
}
@media(max-width:760px){
  .ncr-site-main,
  .ncr-page-wrap,
  .ncr-woo-wrap,
  .ncr-archive-wrap,
  .ncr-search-wrap,
  .ncr-index-wrap{
    width:min(100% - 1rem,1180px) !important;
    padding:1.35rem 0 !important;
  }
  .ncr-content-card,
  .ncr-woo-card,
  .ncr-default-card,
  .ncr-archive-card,
  .ncr-search-card,
  .ncr-index-card,
  .woocommerce div.product,
  .woocommerce-cart .woocommerce,
  .woocommerce-checkout .woocommerce,
  .woocommerce-account .woocommerce{
    border-radius:18px !important;
    padding:1rem !important;
  }
  body:not(.home) h1,
  .ncr-page-title,
  .entry-title,
  .page-title,
  .woocommerce-products-header__title,
  .woocommerce div.product .product_title{
    font-size:clamp(1.55rem,8vw,2.25rem) !important;
  }
  .woocommerce ul.products{
    grid-template-columns:1fr !important;
  }
  .woocommerce div.product form.cart{
    flex-direction:column;
    align-items:stretch;
  }
  .woocommerce div.product form.cart .button,
  .woocommerce .quantity .qty{
    width:100% !important;
  }
}
