/* Responsive additions: loaded after the original theme to preserve desktop styling. */
/* BUILD MARKER: responsive-fix-r18 (removed 2px overhang; everything matches nav exactly) */

/*
 * menu.png and bottom.png are a flat #f6f6f6 fill with a 1px #d6d6d6 hairline
 * and a rounded corner baked into the image pixels themselves. That rounding
 * showed up as a mismatched "notch" against contentContainer's square
 * corners. Since there's no gradient or pattern being lost, replacing the
 * image with the same flat color + hairline (and box-sizing so the box stays
 * the same overall height) gives an identical look with genuinely square
 * corners at every width, on every page.
 */
#navigationContainer {
  background-image: none;
  background-color: #f6f6f6;
  border-top: 1px solid #d6d6d6;
  border-top-left-radius: 8px;
  border-top-right-radius: 8px;
  box-sizing: border-box;
}
#contentBottom {
  background-image: none;
  background-color: #f6f6f6;
  border-bottom: 1px solid #d6d6d6;
  border-bottom-left-radius: 8px;
  border-bottom-right-radius: 8px;
  box-sizing: border-box;
}
/*
 * page_header.jpg is literally a 1px-wide, 12px-tall strip (flat #ededed
 * fill with a 1px darker line top and bottom), tiled horizontally via
 * background-repeat. A flat color + two hairline borders reproduces it
 * exactly, without the fragile "negative margin sized to match whatever
 * the padding happens to be this breakpoint" arithmetic that image tiling
 * required — and it was that arithmetic being wrong at desktop widths
 * (no override existed there at all) that caused the overhang.
 */
#pageHeader {
  background-image: none;
  background-color: #ededed;
  border-top: 1px solid #d6d6d6;
  border-bottom: 1px solid #d6d6d6;
  box-sizing: border-box;
}
/*
 * content_bg.png has a barely-visible transparent sliver baked into its
 * left edge (intended as a subtle vignette in the original fixed-width
 * design). #header's own background is normally invisible — the banner
 * image covers almost all of it — except for a ~5px gap between the image
 * (345px tall) and header's own box (350px tall), where that sliver shows
 * up as a small notch. Same fix as nav/footer/pageHeader: flat color.
 */
#header {
  background-image: none;
  background-color: #f6f6f6;
}
/*
 * content_bg.png (the same asset behind the earlier #header notch bug) is
 * also #contentContainer's background on every page — this is what was
 * causing the blurry edge along the main content box: a thin tiling strip
 * being stretched horizontally, with a near-transparent sliver baked into
 * its edge. A flat color removes the blur entirely, at every width.
 */
#contentContainer, #contentContainer2 {
  background-image: none;
  background-color: #f6f6f6;
}
/*
 * contact.html's journal-cover images had no width set anywhere (only an
 * inconsistent height attribute, missing on one entirely), so each one
 * rendered at its own native resolution — far wider than the 292px sidebar
 * — and just stacked, ragged and oversized. Scoped to this specific grid
 * (journalCoverGrid, added to that page's markup) so it doesn't touch the
 * "Latest News" thumbnails elsewhere, which already size themselves via an
 * explicit width="130" attribute and work fine as-is.
 */
.journalCoverGrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.journalCoverGrid .smallPostImg {
  float: none;
  margin: 0;
  width: 100%;
  height: auto;
  display: block;
}
img, video { max-width: 100%; height: auto; }

/* Align the legacy desktop fader's 966/960/954px layers to one frame. */
@media (min-width: 981px) {
  #header { width: 960px; margin-left: 0; padding-left: 0; }
  #header .fadeWrapper { width: 960px; left: 0; }
  #header .imageHolder { width: 960px; left: 0; }
  #header .imageHolder img { display: block; width: 960px; height: 345px; }
  #navigationContainer { width: 960px; margin-left: 0; }
  #contentContainer, #contentContainer2 {
    box-sizing: border-box;
    /* Now matches nav/header/footer exactly — no more intentional overhang. */
    width: 960px;
    margin-left: 0;
    padding-left: 30px;
    padding-right: 30px;
  }
  #contentBottom { width: 960px; left: 0; }
  #pageHeader { width: calc(100% + 60px); margin-left: -30px; margin-top: -30px; }

  /*
   * Any page with a sidebar (currently the homepage and the contact page)
   * gets an explicit 580px article + 320px sidebar grid (=900px, matching
   * the 900px left inside the 960px container above) so float rounding
   * cannot send the sidebar below the article, regardless of what precedes
   * #contentContainer on that particular page.
   */
  #contentContainer.hasSidebar {
    display: grid;
    grid-template-columns: 580px 320px;
    column-gap: 0;
    /* Without this, grid's default "stretch" makes the shorter column's
       box (and content's own border-right divider line) extend all the
       way down to match the taller one, running the divider through a
       stretch of empty space instead of stopping where its real content
       ends. */
    align-items: start;
  }
  /* Some pages also have an empty #pageHeader strip before #content; give it
     its own full-width row so it can't steal a column from content/sidebar.
     No width override needed here anymore — now that content's own 900px
     inner width matches the grid's 580+320 column sum exactly, the general
     #pageHeader rule above already lands on the right value. */
  #contentContainer.hasSidebar > #pageHeader { grid-column: 1 / -1; }
  #contentContainer.hasSidebar > #content {
    grid-column: 1;
    float: none;
    width: auto;
    box-sizing: border-box;
  }
  #contentContainer.hasSidebar > #sidebar {
    grid-column: 2;
    float: none;
    width: auto;
    box-sizing: border-box;
  }
}

@media (max-width: 980px) {
  #mainContainer { min-width: 0; }
  .center { width: auto; margin: 0 24px; }
  #logoContainer, #navigationContainer, #header, #header2,
  .fadeWrapper, .imageHolder,
  #contentBottom, #contentContainer, #contentContainer2 { width: 100%; }
  #logoContainer { float: none; }
  #logoContainer a {
    width: 100%;
    max-width: 940px;
    background-size: contain;
    background-position: left center;
  }
  #navigationContainer { margin-left: 0; }
  /* Search is removed at responsive widths so the original menu bar can span cleanly. */
  #search { display: none; }

  /*
   * The home-page fader positions every slide absolutely. Give its complete
   * stack an explicit responsive frame so hidden slides retain the same size.
   */
  #header {
    height: auto;
    aspect-ratio: 960 / 345;
    padding-left: 0;
    float: none;
    overflow: hidden;
  }
  #header2 { height: auto; min-height: 345px; padding-left: 0; float: none; }
  #header #wrapper, #header .fadeWrapper, #header .imageHolder {
    width: 100% !important;
    height: 100% !important;
  }
  #header .fadeWrapper, #header .imageHolder { left: 0; }
  #header .imageHolder a { display: block; width: 100%; height: 100%; }
  #header .imageHolder img {
    display: block;
    width: 100% !important;
    max-width: none;
    height: 100% !important;
    object-fit: cover;
  }
  .imageHolder2 { width: 100%; }
  #header2 .imageHolder2 img { display: block; width: 100%; height: auto; }

  #contentContainer, #contentContainer2 {
    box-sizing: border-box;
    padding: 28px;
  }
  #contentBottom { left: 0; }
  #pageHeader {
    /* content now matches nav's width exactly, same as the desktop rule. */
    width: calc(100% + 56px);
    margin-left: -28px;
    margin-top: -28px;
  }
  #content { width: calc(100% - 352px); box-sizing: border-box; }
  #content2 { width: 100%; box-sizing: border-box; }
  #sidebar { width: 320px; }
  .sidebarBox { width: auto; margin-left: 25px; }
  .sidebarMenu { width: auto; }

  #portfolio, #portfolioNavButtons, #portfolioCategories { width: 100%; box-sizing: border-box; margin-left: 0; }
  .portfolioItem { max-width: calc(33.333% - 30px); box-sizing: border-box; }
  .portfolioItemInfo { width: calc(100% - 18px); }
  #footerMenu ul { display: flex; flex-wrap: wrap; row-gap: 8px; }
}

@media (max-width: 720px) {
  body { font-size: 15px; }
  .center { margin: 0 12px; }
  #logoContainer { width: 100%; height: 78px; float: none; }
  #logoContainer a { max-width: calc(100% - 20px); background-size: contain; background-position: left center; }

  /* The menu asset is 962px wide; fitting it avoids a cropped separator bar. */
  #navigationContainer { height: 64px; margin-left: 0; float: none; position: relative; }
  #menu { float: none; width: 100%; height: 64px; overflow-x: auto; overflow-y: hidden; }
  #menu ul { margin: 16px 0 0 10px; width: max-content; white-space: nowrap; }
  #menu ul li a { padding: 0 9px; font-size: 12px; }

  #header, #header2 { min-height: 0; }
  #contentContainer, #contentContainer2 {
    padding: 22px 18px;
  }
  #pageHeader {
    width: calc(100% + 36px);
    height: 12px;
    margin-left: -18px;
    margin-top: -22px;
  }
  #content, #content2, #sidebar { width: 100%; float: none; padding-right: 0; border-right: 0; }
  #sidebar { margin-top: 28px; padding-top: 22px; border-top: 1px solid #d8d8d8; }
  .sidebarBox { margin-left: 0; }

  .servicesImg, .servicesImg2 { float: none; display: block; margin: 0 auto 16px; }
  .portfolioItem { width: calc(50% - 30px); max-width: none; box-sizing: border-box; }
  #portfolio img { width: 100%; }
  #portfolioCategories { height: auto; line-height: 1.5; padding: 10px; }
  #footer { height: auto; min-height: 100px; }
  #footer p { float: none; margin: 14px 15px; }
  #footerMenu { margin-left: 0; }
  #footerMenu ul li { padding: 0 10px; }
}

@media (max-width: 420px) {
  .center { margin: 0 8px; }
  #contentContainer, #contentContainer2 { padding: 18px 12px; }
  #pageHeader { width: calc(100% + 24px); margin-left: -12px; margin-top: -18px; }
  h1 { font-size: 24px; }
  h2 { font-size: 21px; }
  .portfolioItem { width: 100%; margin: 0 0 20px; }
  .portfolioItemInfo { width: calc(100% - 18px); }
}
