/**
 * RCAD Global Grid 1320
 * Canonical desktop shell: 976 + 24 + 320 = 1320px.
 * This file loads last and intentionally normalises legacy widths.
 */
:root{
  --rcad-shell-max:1320px;
  --site-width:1320px;
  --rcad-main-width:976px;
  --rcad-content-max:976px;
  --rcad-sidebar-width:320px;
  --sidebar-width:320px;
  --rcad-page-gap:24px;
  --layout-gap:24px;
  --rcad-shell-pad:24px;
}

/* Global shell: full-bleed backgrounds, centred content. */
.rcad-cms-header .rcad-cms-header__inner,
body .site-header .container,
body #masthead .container,
body .site-main > .container,
body #content-wrapper.container,
body .site-content > .container,
.rcad-home-cms-shell,
.rcad-home-outer,
.rcad-hero__inner,
.rcad-footer__inner,
.rcad-footer .container,
.site-footer > .container,
.site-footer .footer-wrap,
body.rcad-bbpress #bbpress-forums,
body.rcad-bbpress .container{
  width:min(1320px, calc(100% - 48px)) !important;
  max-width:1320px !important;
  margin-left:auto !important;
  margin-right:auto !important;
  box-sizing:border-box !important;
}

/* Header content stays at 1320; header background remains full width. */
.rcad-cms-header{width:100% !important;max-width:none !important;}
.rcad-cms-header .rcad-cms-header__inner{--rcad-header-max-width:1320px;}

/* Canonical 2-column layouts. */
@media (min-width:1181px){
  .rcad-home-cms-shell,
  body.single:not(.single-topic):not(.single-forum) .rcad-single-layout-v73,
  .rcad-ce-single.has-sidebar{
    display:grid !important;
    grid-template-columns:minmax(0,976px) 320px !important;
    column-gap:24px !important;
    row-gap:24px !important;
    align-items:start !important;
  }

  /* Generic Orbital archive/page wrappers with right sidebar. */
  body .container.flex:has(> .entry-content):has(> #secondary),
  body .container.flex:has(> .entry-content):has(> .entry-aside){
    display:grid !important;
    grid-template-columns:minmax(0,976px) 320px !important;
    gap:24px !important;
    align-items:start !important;
  }

  body .container.flex:has(> .entry-content):has(> #secondary) > .entry-content,
  body .container.flex:has(> .entry-content):has(> .entry-aside) > .entry-content{
    width:100% !important;max-width:976px !important;min-width:0 !important;
  }

  #secondary,.entry-aside,.rcad-sidebar,.rcad-home-cms-sidebar{
    width:320px !important;
    min-width:320px !important;
    max-width:320px !important;
    flex:0 0 320px !important;
    box-sizing:border-box !important;
  }

  .rcad-home-cms-main,.rcad-single-main-v73,.rcad-ce-single__main{
    width:100% !important;max-width:976px !important;min-width:0 !important;
  }
}

/* Intermediate desktop/tablet: preserve sidebar while there is room. */
@media (min-width:992px) and (max-width:1180px){
  :root{--rcad-shell-pad:20px;}
  .rcad-cms-header .rcad-cms-header__inner,
  body .site-header .container,
  body #masthead .container,
  body .site-main > .container,
  body #content-wrapper.container,
  .rcad-home-cms-shell,
  .rcad-footer__inner,
  body.rcad-bbpress #bbpress-forums,
  body.rcad-bbpress .container{
    width:calc(100% - 40px) !important;
    max-width:none !important;
  }
  .rcad-home-cms-shell,
  body.single:not(.single-topic):not(.single-forum) .rcad-single-layout-v73,
  .rcad-ce-single.has-sidebar{
    grid-template-columns:minmax(0,1fr) 300px !important;
    gap:22px !important;
  }
  #secondary,.entry-aside,.rcad-sidebar,.rcad-home-cms-sidebar{
    width:300px !important;min-width:300px !important;max-width:300px !important;
  }
}

/* Tablet: one column; sidebar moves below. */
@media (max-width:991px){
  :root{--rcad-shell-pad:16px;}
  .rcad-cms-header .rcad-cms-header__inner,
  body .site-header .container,
  body #masthead .container,
  body .site-main > .container,
  body #content-wrapper.container,
  body .site-content > .container,
  .rcad-home-cms-shell,
  .rcad-home-outer,
  .rcad-hero__inner,
  .rcad-footer__inner,
  .rcad-footer .container,
  .site-footer > .container,
  .site-footer .footer-wrap,
  body.rcad-bbpress #bbpress-forums,
  body.rcad-bbpress .container{
    width:calc(100% - 32px) !important;
    max-width:none !important;
  }
  .rcad-home-cms-shell,
  body.single:not(.single-topic):not(.single-forum) .rcad-single-layout-v73,
  .rcad-ce-single.has-sidebar,
  body .container.flex:has(> .entry-content):has(> #secondary),
  body .container.flex:has(> .entry-content):has(> .entry-aside){
    grid-template-columns:1fr !important;
    display:grid !important;
    gap:20px !important;
  }
  #secondary,.entry-aside,.rcad-sidebar,.rcad-home-cms-sidebar{
    width:100% !important;min-width:0 !important;max-width:none !important;flex-basis:auto !important;
    position:static !important;
  }
}

@media (max-width:680px){
  :root{--rcad-shell-pad:12px;}
  .rcad-cms-header .rcad-cms-header__inner,
  body .site-header .container,
  body #masthead .container,
  body .site-main > .container,
  body #content-wrapper.container,
  body .site-content > .container,
  .rcad-home-cms-shell,
  .rcad-home-outer,
  .rcad-hero__inner,
  .rcad-footer__inner,
  .rcad-footer .container,
  .site-footer > .container,
  .site-footer .footer-wrap,
  body.rcad-bbpress #bbpress-forums,
  body.rcad-bbpress .container{
    width:calc(100% - 24px) !important;
  }
}


/* v125 — Header: same design, only compact dimensions/icons. */
@media (min-width:1121px){
  .rcad-cms-header .rcad-cms-header__inner{
    width:min(1320px, calc(100% - 48px)) !important;
    max-width:1320px !important;
    --rcad-header-max-width:1320px;
  }
  .rcad-product-nav__item > a{
    padding-inline:9px !important;
    gap:5px !important;
    font-size:12.5px !important;
  }
  .rcad-cms-header .rcad-header-svg,
  .rcad-cms-header .rcad-premium-upload svg{
    width:15px !important;
    height:15px !important;
    max-width:15px !important;
    max-height:15px !important;
    flex:0 0 15px !important;
  }
  .rcad-cms-header .rcad-cms-bell{
    width:36px !important;
    height:36px !important;
    flex-basis:36px !important;
  }
  .rcad-cms-header .rcad-cms-bell svg{
    width:17px !important;
    height:17px !important;
    max-width:17px !important;
    max-height:17px !important;
  }
  .rcad-cms-header .rcad-cms-account img{
    width:26px !important;
    height:26px !important;
  }
  .rcad-cms-header .rcad-cms-account > svg{
    width:10px !important;
    height:7px !important;
    max-width:10px !important;
    max-height:7px !important;
  }
  .rcad-cms-actions .rcad-premium-upload{
    min-height:38px !important;
    padding:8px 12px !important;
    font-size:12px !important;
  }
}

/* Defensive SVG clamp for the header only: prevents legacy rules from enlarging menu icons. */
.rcad-cms-header .rcad-product-nav svg,
.rcad-cms-header .rcad-premium-actions svg,
.rcad-cms-header .rcad-premium-search svg{
  max-width:20px !important;
  max-height:20px !important;
}
