/*
 * Coloriage Magique - Mobile responsive overrides
 * Keeps the legacy Bootstrap 2 theme intact while providing a modern,
 * consistent mobile/tablet layout.
 */

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  overflow-x: hidden;
}

img,
video,
iframe,
svg,
canvas {
  max-width: 100%;
}

* {
  box-sizing: border-box;
}

/* Prevent responsive ad units and embedded content from forcing overflow. */
.adsbygoogle,
.entry-content,
.entry-attachment,
#Content_ID,
#content-text,
#content-info {
  max-width: 100%;
}

/* Header switches to compact navigation before the legacy desktop nav gets tight. */
@media (max-width: 1100px) {
  .row.header {
    width: 100%;
    height: 64px;
    min-height: 64px;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    z-index: 10020;
  }

  .row.header > .container {
    width: 100% !important;
    max-width: none;
    margin: 0 auto;
    padding-left: 14px;
    padding-right: 14px;
    box-sizing: border-box;
  }

  #header_content {
    min-height: 64px;
    width: 100%;
  }

  .site-branding {
    width: auto;
    max-width: calc(100% - 118px);
    flex: 0 1 auto;
  }

  .site-branding .custom-logo-link {
    display: flex;
    align-items: center;
    min-height: 64px;
  }

  img.custom-logo {
    width: auto;
    height: auto;
    max-width: 205px;
    max-height: 52px;
    object-fit: contain;
  }

  .main-navigation {
    margin-left: auto;
  }

  .hamburger-menu-toggle {
    display: block;
    position: absolute;
    top: 50%;
    right: 14px;
    width: 32px;
    height: 32px;
    transform: translateY(-50%);
    z-index: 10030;
  }

  .hamburger-menu-toggle .menu-bar {
    height: 3px;
    border-radius: 3px;
  }

  .search-wrap {
    margin: 0;
  }

  .search-wrap .mobile-search-icon {
    display: block;
    width: 30px;
    height: 30px;
    right: 62px;
    z-index: 10030;
  }

  .main-navigation .menu-primary-container {
    display: none !important;
  }

  .main-navigation .menu-primary-container.active {
    display: block !important;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    width: 100% !important;
    max-height: calc(100vh - 64px);
    overflow-y: auto;
    overscroll-behavior: contain;
    background: #fff;
    border-top: 1px solid #e5e5e5;
    box-shadow: 0 12px 28px rgba(0, 0, 0, .14);
    z-index: 10025;
  }

  .main-navigation .menu-primary-container.active ul#primary-menu {
    display: flex !important;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    margin: 0;
    padding: 6px 0 10px;
  }

  .main-navigation .menu-primary-container.active ul#primary-menu > li {
    width: 100%;
    border-bottom: 1px solid #ececec;
  }

  .main-navigation .menu-primary-container.active ul#primary-menu > li:last-child {
    border-bottom: 0;
  }

  .main-navigation .menu-primary-container.active ul#primary-menu > li > a {
    width: 100%;
    min-height: 46px;
    margin: 0;
    padding: 13px 18px;
    text-align: left;
    font-size: 16px !important;
    line-height: 20px;
  }

  .main-navigation ul#primary-menu > li > a:before {
    display: none;
  }

  .main-navigation .menu-primary-container.active ul#primary-menu ul.sub-menu {
    position: static !important;
    left: auto !important;
    float: none;
    display: none;
    width: 100%;
    margin: 0;
    padding: 0;
    box-shadow: none;
    background: #f6f9fb;
  }

  .main-navigation .menu-primary-container.active ul#primary-menu > li.submenu-open > ul.sub-menu {
    display: flex;
  }

  .main-navigation .menu-primary-container.active ul#primary-menu ul.sub-menu li a {
    width: 100%;
    min-height: 42px;
    padding: 11px 26px;
    background: transparent;
    text-align: left;
    font-size: 15px !important;
  }

  .main-navigation .menu-primary-container.active ul#primary-menu > li.menu-item-has-children > a:after {
    content: "+";
    float: right;
    font-size: 22px;
    line-height: 18px;
    color: #357fb7;
  }

  .main-navigation .menu-primary-container.active ul#primary-menu > li.menu-item-has-children.submenu-open > a:after {
    content: "−";
  }

  .search-wrap form,
  .search-wrap form input[type="search"],
  .search-wrap form input[type="submit"] {
    display: none !important;
  }

  .search-wrap form.search-form.active {
    display: flex !important;
    position: absolute;
    top: 64px;
    left: 10px;
    right: 10px;
    width: auto;
    height: auto;
    margin: 0;
    padding: 10px;
    gap: 8px;
    border: 1px solid #d9e2e8;
    background: #fff;
    box-shadow: 0 12px 28px rgba(0, 0, 0, .14);
    z-index: 10026;
  }

  .search-wrap form.search-form.active label {
    flex: 1 1 auto;
    margin: 0;
  }

  .search-wrap form.search-form.active input[type="search"] {
    display: block !important;
    width: 100%;
    max-width: none;
    height: 42px;
    margin: 0;
    padding: 8px 10px;
    border: 1px solid #bfcbd3;
    border-radius: 6px;
  }

  .search-wrap form.search-form.active input[type="submit"] {
    display: block !important;
    flex: 0 0 auto;
    height: 42px;
    margin: 0;
    padding: 0 16px;
    border-radius: 6px;
  }
}

/* Phones: reset Bootstrap 2's body padding and fixed-width custom rules. */
@media (max-width: 767px) {
  body {
    padding-left: 0 !important;
    padding-right: 0 !important;
    font-size: 15px;
    line-height: 1.55;
  }

  body > .container,
  body > .container + .container,
  .container {
    width: auto !important;
    max-width: 100%;
    margin-left: auto !important;
    margin-right: auto !important;
    padding-left: 14px;
    padding-right: 14px;
    box-sizing: border-box;
  }

  .row,
  .row.clearfix,
  .row.no-margin,
  .row.clearfix.no-margin {
    width: 100%;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  [class*="span"] {
    max-width: 100%;
  }

  p,
  li {
    overflow-wrap: anywhere;
  }

  h1,
  h1.entry-title,
  h1.top-color,
  .h1-cat {
    font-size: clamp(21px, 6vw, 26px) !important;
    line-height: 1.25;
    margin-top: 12px !important;
    margin-bottom: 14px;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  h3,
  h3.top-color {
    line-height: 1.3;
  }

  .break {
    padding-top: 12px;
  }

  #breadcrumbs {
    margin: 0 0 12px;
    padding-left: 0 !important;
    line-height: 1.45;
  }

  /* Responsive gallery: no legacy floats or hard-coded card widths. */
  .gallery-post-grid,
  #sp-new .gallery-post-grid,
  #top .gallery-post-grid,
  #content .gallery-post-grid,
  #sp-rl .gallery-post-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 10px;
    width: 100%;
    margin: 0 !important;
    padding: 0 !important;
    list-style: none;
  }

  .gallery-post-grid:before,
  .gallery-post-grid:after {
    display: none !important;
  }

  .gallery-post-grid li,
  .gallery-post-grid .gallery-item,
  li.span2.gallery-item,
  li.span3.gallery-item,
  li#galcat,
  #sp-new .gallery-post-grid li,
  #top .gallery-post-grid li,
  #content .gallery-post-grid li,
  #sp-rl .gallery-post-grid li {
    float: none !important;
    width: auto !important;
    max-width: none !important;
    min-width: 0;
    margin: 0 !important;
    padding: 0 !important;
  }

  .gallery-post-grid .gallery-item > a:first-child,
  .gallery-post-grid li > a:first-child {
    display: block;
    width: 100%;
  }

  .gallery-post-grid img,
  li#galcat img,
  .gallery-post-grid img[style] {
    display: block;
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    margin: 0 auto;
  }

  .project-details,
  span.project-details,
  .project-cat,
  span.project-cat {
    display: block;
    width: 100% !important;
    min-width: 0;
    margin: 7px 0 0;
    padding: 0 2px;
    text-align: center;
    line-height: 1.3;
    white-space: normal;
  }

  .project-details a,
  .project-cat a {
    display: block;
    font-size: 13px;
    overflow-wrap: anywhere;
  }

  #content,
  #sp-new,
  #sp-rl,
  #top,
  #content-text,
  #content-info,
  .content-text,
  .gallery-single {
    width: 100% !important;
    max-width: 100%;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  .content-text {
    padding: 0;
  }

  .content-text > [class*="span"],
  #content-text,
  #content-info {
    padding-left: 0;
    padding-right: 0;
  }

  .newpost,
  .sidebar,
  .content-w,
  #post-widget {
    float: none !important;
    width: 100% !important;
    max-width: 100%;
    margin: 16px 0 0 !important;
  }

  h3.title-news,
  h3.title-cat {
    margin-left: 0;
    padding: 7px 12px;
  }

  ul.news,
  ul.catw {
    width: 100%;
    margin-left: 0;
    padding-left: 12px;
    padding-right: 12px;
  }

  img.attachment-medium,
  .entry-attachment img,
  #Content_ID img {
    display: block;
    width: auto !important;
    height: auto !important;
    max-width: 100% !important;
    max-height: none !important;
    margin: 0 auto !important;
  }

  .attachment-header {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  #f-share,
  #attachment-counts-wrap {
    width: 100% !important;
    margin: 0 !important;
  }

  ul#share {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
    width: 100%;
    margin: 0;
    padding: 0;
  }

  ul#share li,
  ul#share li[style] {
    display: inline-flex;
    align-items: center;
    margin: 0 !important;
    padding: 0;
  }

  ul.entry-btn {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin: 16px 0 8px;
    padding: 0;
  }

  ul.entry-btn li {
    display: block;
    margin: 0 !important;
  }

  ul.entry-btn .btn,
  #btnprint,
  #btnplay {
    min-height: 44px;
    padding: 8px 18px;
  }

  ul.entry-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 12px;
    margin: 8px 0 16px;
    padding: 0;
  }

  ul.entry-meta li {
    padding: 0;
  }

  /* Pagination stays tappable and wraps rather than overflowing. */
  .pagination,
  .pagination.pull-right {
    float: none;
    width: 100%;
    margin: 18px 0;
  }

  .pagination ul {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
  }

  .pagination ul > li > a,
  .pagination ul > li > span {
    min-width: 40px;
    min-height: 40px;
    padding: 9px 11px;
    text-align: center;
  }

  /* Drawing app: canvas first, palettes below, controls never overlay the artwork. */
  .coloring-container {
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
  }

  .coloring-container .color-container {
    width: 100% !important;
    max-width: 100% !important;
    display: flex !important;
    flex-wrap: wrap;
  }

  .coloring-container .color-option:before,
  .coloring-container .pattern-toggle .container,
  .coloring-container svg {
    margin-left: 0 !important;
    margin-top: 0 !important;
  }

  .color-att {
    display: flex !important;
    flex-direction: column;
    flex-wrap: nowrap !important;
    align-items: stretch;
    gap: 12px;
    width: 100%;
  }

  .color-att > .svg-container,
  .coloring-container .svg-container {
    order: 1 !important;
    display: flex;
    width: 100% !important;
    max-width: 100%;
    min-width: 0;
    margin: 0 !important;
    padding: 0;
    align-items: center;
  }

  #canvasDiv {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    margin: 0 auto !important;
    overflow: hidden;
  }

  #canvas {
    display: block;
    max-width: 100% !important;
    height: auto !important;
    margin: 0 auto !important;
  }

  #cntr-left,
  #cntr-right,
  div#cntr-left,
  div#cntr-right {
    display: flex !important;
    flex: none !important;
    width: 100% !important;
    max-width: 100%;
    height: auto !important;
    max-height: 300px;
    margin: 0 !important;
    padding: 10px;
    overflow: hidden;
  }

  #cntr-left { order: 2 !important; }
  #cntr-right { order: 3 !important; }

  .palette-scroll {
    max-height: 235px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .palette-grid {
    gap: 7px;
  }

  .palette-color {
    min-width: 30px;
    min-height: 30px;
  }

  .svg-container .bottom-toolbar {
    position: static !important;
    left: auto !important;
    bottom: auto !important;
    transform: none !important;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    width: 100%;
    max-width: 100%;
    margin: 10px 0 2px;
    padding: 9px;
    gap: 7px;
  }

  .svg-container .tool-btn {
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
  }

  .svg-container .tool-color {
    min-height: 44px;
  }

  .svg-container .dropdown-panel {
    z-index: 10040;
  }

  /* Footer becomes centered and wraps cleanly. */
  .footer-container .container,
  .footer-container .row,
  .footer-sub,
  .footer-sub .row,
  .footer-sub [class*="span"] {
    width: 100% !important;
    max-width: 100%;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  .footer-sub {
    padding: 14px 0;
  }

  .footer-container ul#share,
  ul.ct-footer {
    float: none;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px 10px;
    width: 100%;
    margin: 0;
    padding: 0;
    text-align: center;
  }

  ul.ct-footer span {
    display: none;
  }

  ul.ct-footer li {
    display: block;
  }
}

/* Larger phones / small tablets can comfortably show three cards. */
@media (min-width: 600px) and (max-width: 767px) {
  .gallery-post-grid,
  #sp-new .gallery-post-grid,
  #top .gallery-post-grid,
  #content .gallery-post-grid,
  #sp-rl .gallery-post-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px 14px;
  }
}

/* Very small phones: retain two columns but trim spacing. */
@media (max-width: 359px) {
  .container,
  .row.header > .container {
    padding-left: 10px;
    padding-right: 10px;
  }

  .gallery-post-grid,
  #sp-new .gallery-post-grid,
  #top .gallery-post-grid,
  #content .gallery-post-grid,
  #sp-rl .gallery-post-grid {
    gap: 12px 8px;
  }

  .project-details a,
  .project-cat a {
    font-size: 12px;
  }

  img.custom-logo {
    max-width: 175px;
  }
}


/* ===============================================================
   Mobile layout refinement - 2026-11-06
   Navigation, galleries, drawing canvas, palette tabs and safe touch.
   All desktop layout rules above 1100px remain unchanged.
   =============================================================== */

/* The navigation is now made of real buttons, not a clickable UL/span. */
button.hamburger-menu-toggle,
button.mobile-search-icon,
.mobile-palette-tabs {
  display: none;
}

@media (max-width: 1100px) {
  html, body {
    width: 100%;
    max-width: 100%;
  }

  .container {
    width: auto !important;
    max-width: 100%;
    padding-inline: 16px;
    margin-inline: auto !important;
    box-sizing: border-box;
  }

  .container > .row,
  .container > .row.clearfix,
  .container > .row.no-margin {
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  .row.header > .container {
    padding-inline: 14px;
  }

  .row.header #header_content {
    position: relative;
    width: 100%;
    min-height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .row.header .site-branding {
    flex: 0 1 auto;
    min-width: 0;
    max-width: calc(100% - 110px);
  }

  .row.header img.custom-logo {
    width: auto;
    height: auto;
    max-height: 54px;
    max-width: min(210px, 100%);
    object-fit: contain;
  }

  button.hamburger-menu-toggle {
    display: block;
    position: absolute;
    right: 0;
    top: 10px;
    transform: none;
    width: 44px;
    height: 44px;
    margin: 0;
    padding: 10px;
    background: transparent;
    border: 0;
    border-radius: 8px;
    box-shadow: none;
    cursor: pointer;
    z-index: 10030;
  }

  button.hamburger-menu-toggle .menu-bar {
    position: absolute;
    display: block;
    width: 24px;
    height: 3px;
    left: 10px;
    background: #357fb7;
    border-radius: 3px;
    transition: transform .2s ease, opacity .2s ease, top .2s ease;
  }
  button.hamburger-menu-toggle .menu-bar:nth-child(1) {top: 13px;}
  button.hamburger-menu-toggle .menu-bar:nth-child(2) {top: 21px;}
  button.hamburger-menu-toggle .menu-bar:nth-child(3) {top: 29px;}
  button.hamburger-menu-toggle.active .menu-bar:nth-child(1) {top: 21px;transform: rotate(45deg);}
  button.hamburger-menu-toggle.active .menu-bar:nth-child(2) {opacity: 0;}
  button.hamburger-menu-toggle.active .menu-bar:nth-child(3) {top: 21px;transform: rotate(-45deg);}

  .row.header .search-wrap {
    margin: 0;
    padding: 0;
  }
  .row.header .search-wrap button.mobile-search-icon {
    display: block;
    position: absolute;
    width: 44px;
    height: 44px;
    top: 10px;
    right: 50px;
    transform: none;
    padding: 9px;
    border: 0;
    border-radius: 8px;
    cursor: pointer;
    background-color: transparent;
    background-image: url(../img/search-open.svg);
    background-size: 24px 24px;
    background-position: center;
    background-repeat: no-repeat;
    z-index: 10030;
  }

  .row.header button:focus-visible,
  .mobile-palette-tab:focus-visible,
  .palette-header:focus-visible,
  .tool-btn:focus-visible {
    outline: 2px solid #357fb7;
    outline-offset: 2px;
  }

  .main-navigation .menu-primary-container.active {
    top: 64px;
    left: -14px;
    right: -14px;
    width: calc(100% + 28px) !important;
    max-height: min(76vh, 650px);
  }

  .main-navigation .menu-primary-container.active ul#primary-menu > li > a {
    box-sizing: border-box;
  }

  .search-wrap form.search-form.active {
    top: 64px;
    left: 0;
    right: 0;
    max-width: 100%;
    box-sizing: border-box;
  }
  .search-wrap form.search-form.active label {
    display: block;
    min-width: 0;
  }

  /* Make sure fixed-size post content and ads never widen mobile pages. */
  .entry-attachment,
  .entry-attachment a,
  #Content_ID,
  #content,
  #content-info,
  #content-text,
  .content-text,
  .coloring-container {
    max-width: 100%;
    min-width: 0;
  }
  .entry-attachment img,
  #Content_ID img,
  .content-text img,
  #content-text img {
    max-width: 100% !important;
    height: auto !important;
  }
  .adsbygoogle {
    max-width: 100%;
    overflow: hidden;
  }

  /* Restore both palettes as tabs on narrow screens. 
     Previously the older CSS hid the palettes below 1024px. */
  #abc .color-att {
    display: flex !important;
    flex-direction: column;
    align-items: stretch;
    flex-wrap: nowrap !important;
    width: 100%;
    gap: 12px;
    margin: 0;
  }

  #abc .color-att > .svg-container {
    order: 1 !important;
    flex: 0 0 auto;
    display: flex !important;
    flex-direction: column;
    align-items: center;
    width: 100% !important;
    max-width: 100%;
    margin: 0 !important;
    padding: 0 !important;
    min-width: 0;
  }
  #abc .svg-container > div {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  #abc #canvasDiv {
    display: block;
    width: 100% !important;
    max-width: 700px !important;
    height: auto !important;
    margin: 0 auto !important;
    overflow: hidden;
  }
  #abc #canvas {
    display: block;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    margin: 0 auto !important;
    touch-action: none;
  }

  #abc .svg-container .bottom-toolbar {
    position: static !important;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 8px;
    transform: none !important;
    width: min(100%, 700px);
    max-width: 100%;
    margin: 12px auto 0;
    padding: 9px;
    box-sizing: border-box;
    border-radius: 12px;
  }
  #abc .svg-container .tool-btn {
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    touch-action: manipulation;
  }
  #abc .svg-container .tool-color {
    flex: 0 1 auto;
    margin: 0;
    padding: 0 2px;
  }
  #abc .svg-container .dropdown-panel {
    bottom: calc(100% + 10px);
    z-index: 11000;
  }
  #abc .svg-container .tool-dropdown {
    z-index: 20;
  }

  .mobile-palette-tabs {
    order: 2;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    gap: 8px;
    margin: 2px 0 0;
  }
  .mobile-palette-tab {
    min-height: 46px;
    padding: 10px 8px;
    background: #f1f5f9;
    color: #273b50;
    border: 1px solid #dbe2eb;
    border-radius: 10px;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    touch-action: manipulation;
  }
  .mobile-palette-tab.active {
    color: #fff;
    background: #357fb7;
    border-color: #357fb7;
  }

  #abc .color-att .palette-sidebar {
    order: 3;
    flex: 0 0 auto;
    width: 100% !important;
    max-width: 100%;
    height: auto !important;
    max-height: min(420px, 58vh);
    margin: 0 !important;
    padding: 12px;
    overflow: hidden;
    border-radius: 12px;
  }
  #abc .palette-sidebar:not(.is-active) {
    display: none !important;
  }
  #abc .palette-sidebar.is-active {
    display: flex !important;
    flex-direction: column;
  }
  #abc .palette-scroll {
    width: 100%;
    min-width: 0;
    min-height: 0;
    max-height: none;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }
  #abc .palette-header {
    min-height: 44px;
    touch-action: manipulation;
  }
  #abc .palette-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 8px;
  }
  #abc .palette-color {
    min-height: 36px;
    width: 100%;
    touch-action: manipulation;
  }
}

/* Tablet grids: legacy Bootstrap floats caused uneven columns/overflow. */
@media (min-width: 768px) and (max-width: 1100px) {
  .gallery-post-grid,
  #sp-new .gallery-post-grid,
  #top .gallery-post-grid,
  #content .gallery-post-grid,
  #sp-rl .gallery-post-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    width: 100%;
    padding: 0 !important;
    margin: 0 !important;
    list-style: none;
  }
  .gallery-post-grid:before,
  .gallery-post-grid:after {display: none !important;}
  .gallery-post-grid li.gallery-item,
  .gallery-post-grid li#galcat,
  #sp-new .gallery-post-grid li,
  #top .gallery-post-grid li,
  #content .gallery-post-grid li,
  #sp-rl .gallery-post-grid li {
    float: none !important;
    width: auto !important;
    min-width: 0;
    max-width: none;
    margin: 0 !important;
    padding: 0 !important;
  }
  .gallery-post-grid li > a:first-child {display:block;width:100%;}
  .gallery-post-grid img,
  .gallery-post-grid img[style] {
    display: block;
    width: 100% !important;
    max-width: 100%;
    aspect-ratio: 1 / 1;
    height: auto !important;
    object-fit: contain;
  }
  .gallery-post-grid .project-cat,
  .gallery-post-grid .project-details {
    display: block;
    width: 100% !important;
    max-width: 100%;
    min-width: 0;
    margin: 6px 0 0;
    text-align: center;
    white-space: normal;
  }
  .gallery-post-grid .project-cat a,
  .gallery-post-grid .project-details a {
    display:block;
    overflow-wrap: anywhere;
  }
}

@media (max-width: 767px) {
  .row.header .site-branding {max-width: calc(100% - 106px);}
  .row.header img.custom-logo {max-width: min(185px, 100%);}
  .row.header > .container {padding-inline: 14px;}
  .container {padding-inline: 14px;}
  #abc .palette-grid {gap: 6px;}
  .sp-des {margin-left: 0 !important;}
  .attachment-header {min-width: 0;}
  .etr-right {max-width: 100%;min-width:0;}
  .entry-btn button {max-width: 100%;}
  .footer-container .footer-col {overflow: visible;}
  .footer-container ul.ct-footer li {padding-bottom: 4px;}
}

@media (max-width: 359px) {
  .row.header img.custom-logo {max-width: min(160px, 100%);}
  #abc .svg-container .bottom-toolbar {gap: 6px;padding: 8px 5px;}
  #abc .svg-container .tool-btn {flex-basis: 42px;width:42px;height:42px;}
  #abc .palette-grid {grid-template-columns: repeat(5, minmax(0, 1fr));}
}


/* Clear, consistent gallery cards on phones and tablets only. */
@media (max-width: 1100px) {
  .gallery-post-grid > li.gallery-item {
    display: flex;
    flex-direction: column;
    border: 1px solid #e5ebf2;
    border-radius: 10px;
    background: #fff;
    overflow: hidden;
    box-shadow: 0 2px 7px rgba(30, 53, 77, .055);
  }
  .gallery-post-grid > li.gallery-item > a:first-child {
    display: block;
    width: 100%;
    min-width: 0;
  }
  .gallery-post-grid > li.gallery-item img,
  .gallery-post-grid > li#galcat img {
    display: block;
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    border: 0;
    border-radius: 0;
    background: #fff;
  }
  .gallery-post-grid > li.gallery-item .project-details,
  .gallery-post-grid > li.gallery-item .project-cat {
    display: block;
    width: 100% !important;
    margin: 0;
    padding: 9px 9px 11px;
    border: 0;
    background: #fff;
    text-align: center;
  }
  .gallery-post-grid > li.gallery-item .project-details a,
  .gallery-post-grid > li.gallery-item .project-cat a {
    color: #314d62;
    font-weight: 500;
    font-size: 13px;
    line-height: 1.45;
    overflow-wrap: anywhere;
    text-decoration: none;
  }
  .gallery-post-grid > li.gallery-item .project-details a:hover,
  .gallery-post-grid > li.gallery-item .project-cat a:hover {
    color: #2173a9;
  }
}
