/*
Theme Name: AEI Rebuild
Theme URI: https://aei-tergnier.org/
Author: AEI
Description: Rebuild du theme AEI a partir de contenu statique, avec templates WordPress maintenables.
Version: 1.0.0
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 7.4
Text Domain: aei-rebuild
*/

/* WordPress baseline fixes */
.screen-reader-text {
  border: 0;
  clip: rect(1px, 1px, 1px, 1px);
  clip-path: inset(50%);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute !important;
  width: 1px;
  word-wrap: normal !important;
}

.wp-caption,
.wp-caption-text,
.gallery-caption,
.bypostauthor {
  max-width: 100%;
}

.pagination,
.navigation.posts-navigation,
.navigation.post-navigation {
  margin: 30px 0;
}

.navigation.posts-navigation .nav-links,
.navigation.post-navigation .nav-links {
  display: flex;
  justify-content: space-between;
  gap: 20px;
}

/* =============================================
   Global resets - suppress WordPress default bullets
   ============================================= */
ul, ol {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Restore bullets only inside main content area (handled by legacy CSS) */
div.left ul,
div.left ol {
  list-style: none;
}

/* WordPress block editor lists - keep them clean */
.wp-block-list {
  list-style: none;
  padding-left: 0;
}

/* Nav menus - ensure no bullets anywhere */
nav ul,
nav ol,
.menu,
.sub-menu,
.blocs,
.breadcrumbs,
#menu-main-menu,
#blocs ul,
#news ul,
#jobs ul,
#photos ul,
#documents ul,
#partners ul,
footer ul,
.submenu,
.cycle {
  list-style: none !important;
  padding-left: 0 !important;
  margin: 0;
}

/* =============================================
   Header / Navbar overlay fixes
   ============================================= */

/*
 * How the original header works:
 *
 * 1. Initial state: header is transparent, positioned normally in flow
 *    (it sits ON TOP of the slideshow via negative margin on #slideshow).
 *
 * 2. On any scroll, JS adds body.scrolling → header becomes position:fixed
 *    and sticks to the top of the viewport.
 *
 * 3. When scrollTop > 0, JS adds header.shadow → dark blue background appears.
 *
 * 4. When scrolling DOWN past header height, JS adds body.scrolling-down
 *    → header slides up out of view (translateY(-190px)).
 *
 * 5. When scrolling UP, body.scrolling-down is removed → header slides back.
 *
 * The legacy CSS already handles all of this.  We just need to make sure:
 * - header has a high z-index so it overlays the slider
 * - body can scroll (legacy sets overflow-y:hidden until JS kicks in)
 * - the slideshow sits BEHIND the header
 */

/* Body overflow fix — the legacy CSS sets overflow-y:hidden on body which
   prevents scrolling until JS adds the 'scrolling' class.  Override so the
   page is scrollable even before JS fires. */
body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-y: auto !important;
}

#site-content {
  flex: 1 0 auto;
  width: 100%;
}

/* The header must sit above slider + blocs.  The legacy CSS already sets
   z-index:999999 on body.scrolling > header (position:fixed).
   For the initial non-scrolling state (before JS fires), we add
   position:relative so that z-index takes effect and the header
   renders above the slider (which has z-index:-1). */
body > header {
  position: relative;
  z-index: 999999;
}

/* Remove the bright seam under the sticky header */
body > header.shadow {
  box-shadow: none !important;
}

/* Ensure the h1 inside the logo link stays white (on transparent bg) */
#logo a.home-link > h1 {
  color: #fff;
}

/* Hero slides now use real <img> for responsive srcset/sizes. */
div.slideshow ul li {
  position: relative;
  overflow: hidden;
}

img.hero-slide-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

/* Prevent first-paint flash where all hero slides appear before Cycle2 init. */
div.slideshow ul.cycle {
  position: relative;
}

div.slideshow ul.cycle > li {
  position: absolute;
  inset: 0;
  display: none;
}

div.slideshow ul.cycle > li:first-child {
  display: block;
}

/* =============================================
   Slideshow positioning fix
   ============================================= */

/*
 * The slideshow must sit BEHIND the header.
 *
 * In the original site the <header> has float:left (from the legacy CSS
 * line 14: "header, footer ... { float:left; width:100%; clear:both }").
 * Because the header is floated, the following #slideshow is NOT pushed
 * down by it — it sits at the same vertical position (top of page).
 * Combined with #slideshow { margin-top:30px; z-index:-1 } from the
 * legacy CSS, the slider appears 30px from the top (just below the
 * liseret bar) and behind the transparent header.
 *
 * However, WordPress may inject elements before <header> (admin bar,
 * wp_body_open hooks) that could disrupt this.  The following rule
 * ensures the slideshow always pulls up behind the header even if
 * extra elements appear.
 *
 * We do NOT override margin-top or z-index here because the legacy CSS
 * already sets them correctly (#slideshow { margin-top:30px; z-index:-1 }).
 */

/* Keep hero stuck to the liseret on desktop (legacy CSS sets 30px). */
@media (min-width: 769px) {
  body.home #slideshow,
  body:not(.home) #slideshow {
    margin-top: 0 !important;
  }
}
/* If the admin bar is present, WP adds padding-top:32px to <html>.
   The legacy CSS doesn't account for this — the fixed header would
   be hidden behind the admin bar.
   Note: .admin-bar is on <body>, so the selector is body.admin-bar.scrolling */
body.admin-bar.scrolling > header {
  top: 32px;
}

@media screen and (max-width: 782px) {
  body.admin-bar.scrolling > header {
    top: 46px; /* WP admin bar is taller on mobile */
  }
}

/* =============================================
   Footer fixes
   ============================================= */

/* Ensure footer-bottom is not hidden behind anything */
footer {
  position: relative;
  z-index: 1;
  float: none !important;
  width: 100%;
  clear: none !important;
  flex-shrink: 0;
  margin-top: auto;
}

footer div.footer-bottom {
  clear: both;
}

.aei-hide-footer-bg::after {
  display: none !important;
}

footer div.footer-top div.footer-contact::after {
  z-index: 0 !important;
  opacity: 0.2 !important;
  pointer-events: none;
}

footer div.footer-top div.footer-contact > * {
  position: relative;
  z-index: 1;
}

/* Footer address lines */
footer div.footer-top div.address p {
  margin: 0;
  line-height: 23px;
}

/* Keep custom footer logos proportional (legacy CSS forces fixed width/height). */
footer div.footer-top div.footer-contact div.logo-footer img {
  width: auto !important;
  height: auto !important;
  max-width: 145px;
  max-height: 182px;
  object-fit: contain;
}

/* Footer bottom stays attached to footer-top (legacy layout) */
footer div.footer-bottom.footer-bottom-fixed {
  position: static !important;
  left: auto !important;
  right: auto !important;
  bottom: auto !important;
  width: 100% !important;
  float: left !important;
  clear: both !important;
}

/* =============================================
   WordPress blocks compatibility
   ============================================= */

/* Gutenberg alignment classes */
.alignfull {
  width: 100vw;
  max-width: 100vw;
  margin-left: calc(-50vw + 50%);
}

.alignwide {
  max-width: 1160px;
  margin-left: auto;
  margin-right: auto;
}

/* WP block spacer */
.wp-block-spacer {
  clear: both;
}

/* WP block image */
.wp-block-image {
  max-width: 100%;
  margin-bottom: 1em;
}

.wp-block-image img {
  max-width: 100%;
  height: auto;
}

/* WP block buttons */
.wp-block-button__link {
  transition: background 0.4s ease-in-out, color 0.4s ease-in-out;
}

/* WP block columns */
.wp-block-columns {
  display: flex;
  gap: 2em;
  margin-bottom: 1em;
}

.wp-block-column {
  flex: 1;
}

/* WP block separator */
.wp-block-separator {
  border: none;
  border-bottom: 2px solid #a6c736;
  max-width: 100px;
  margin: 2em auto;
}

/* WP block table */
.wp-block-table {
  width: 100%;
  margin: 1em 0;
  border-collapse: collapse;
}

.wp-block-table td,
.wp-block-table th {
  border: 1px solid #dadada;
  padding: 8px 12px;
}

.wp-block-table th {
  background: #212157;
  color: #fff;
  font-weight: 500;
}

/* WP block quote */
.wp-block-quote {
  border-left: 4px solid #a6c736;
  padding-left: 20px;
  margin: 1.5em 0;
  font-style: italic;
  color: #666;
}

/* Documents block: subtle fix for long filenames without changing card design */
#documents ul li {
  align-items: center;
  gap: 12px;
}

/* News/Jobs tiles: keep CTA fully visible on all slide content lengths */
#news ul li,
#jobs ul li {
  height: auto !important;
  min-height: 120px;
}

#news ul li a article,
#jobs ul li a article {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  min-height: 132px;
  padding-bottom: 44px;
}

#news ul li a article header h1,
#jobs ul li a article header h1 {
  line-height: 1.2 !important;
  min-height: 2.4em;
  margin: 10px 0 0 !important;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

#news ul li a article > span,
#jobs ul li a article > span {
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  margin: 0 !important;
  overflow: visible;
  height: 24px;
  line-height: 24px;
}

#documents ul li > span:first-child {
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#documents ul li a {
  flex: 0 0 auto;
}

#documents ul li a > span {
  display: inline-block;
  min-width: 110px;
  text-align: center;
}

/* Keep "Documents utiles" card from clipping the last row */
.home #documents {
  height: auto;
  min-height: 302px;
  padding-top: 42px;
  padding-bottom: 24px;
}

.home #documents div.title {
  margin-bottom: 28px;
}

/* Ensure decorative layers never block download button clicks */
#documents {
  position: relative;
  z-index: 2;
}

#documents::before,
#documents::after {
  pointer-events: none;
}

#documents ul li a {
  position: relative;
  z-index: 3;
  cursor: pointer;
}

/* Job offers: modern cards */
.aei-jobs-hub .left.long > h1 {
  margin-bottom: 26px;
}

.aei-jobs-grid {
  list-style: none;
  margin: 24px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.aei-job-card-wrap {
  padding-left: 0 !important;
}

.aei-job-card-wrap::before {
  display: none !important;
}

.aei-job-card {
  height: 100%;
  border-radius: 18px;
  background: linear-gradient(150deg, rgba(33, 33, 87, 0.96), rgba(33, 33, 87, 0.88));
  box-shadow: 0 16px 36px rgba(20, 22, 60, 0.22);
  overflow: hidden;
}

.aei-job-card-link {
  display: flex;
  flex-direction: column;
  min-height: 240px;
  height: 100%;
  padding: 20px 22px;
  color: #ffffff !important;
}

.aei-job-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.aei-job-pill {
  display: inline-block;
  background: rgba(166, 199, 54, 0.2);
  color: #d5f08a;
  border: 1px solid rgba(166, 199, 54, 0.45);
  border-radius: 999px;
  font-size: 12px;
  line-height: 1;
  padding: 7px 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.aei-job-flag {
  font-size: 12px;
  line-height: 1;
  padding: 7px 11px;
  border-radius: 999px;
  background: rgba(1, 149, 217, 0.18);
  border: 1px solid rgba(1, 149, 217, 0.45);
  color: #86d9ff;
}

.aei-job-card h2 {
  color: #fff !important;
  font-size: 29px !important;
  line-height: 1.15 !important;
  margin: 0 0 12px !important;
  text-transform: none !important;
  letter-spacing: 0 !important;
}

.aei-job-card p {
  color: rgba(255, 255, 255, 0.88) !important;
  margin: 0 0 14px;
  line-height: 1.4;
  font-size: 16px;
}

.aei-job-meta {
  margin-top: auto;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.aei-job-meta span {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 5px 9px;
  color: #fff;
  font-size: 12px;
}

.aei-job-cta {
  margin-top: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: flex-start;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  background: #ffffff;
  color: #0195d9 !important;
  font-weight: 600;
  font-size: 14px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.aei-job-card-link:hover .aei-job-cta,
.aei-job-cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.22);
}

.aei-jobs-spontaneous {
  margin-top: 26px;
  border-radius: 16px;
  border: 1px solid rgba(1, 149, 217, 0.3);
  background: rgba(1, 149, 217, 0.05);
  padding: 20px 22px;
}

.aei-jobs-spontaneous h2 {
  margin: 0 0 10px;
}

.aei-jobs-spontaneous p {
  margin: 0 0 14px;
}

.aei-job-cta-inline {
  margin-top: 0;
  min-height: 48px;
  padding: 0 22px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.01em;
  background: linear-gradient(135deg, #00a7f0 0%, #0195d9 100%);
  color: #fff !important;
  border: 2px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 12px 24px rgba(1, 149, 217, 0.35);
}

.aei-job-cta-inline:hover {
  background: linear-gradient(135deg, #15b8ff 0%, #00a7f0 100%);
  box-shadow: 0 16px 28px rgba(1, 149, 217, 0.45);
}

.aei-job-single-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.aei-job-single-meta span:not(.aei-job-pill) {
  background: rgba(33, 33, 87, 0.08);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 13px;
  color: #333;
}

.aei-job-back {
  display: inline-block;
  margin-bottom: 14px;
}

@media (max-width: 960px) {
  .aei-jobs-grid {
    grid-template-columns: 1fr;
  }

  .aei-job-card h2 {
    font-size: 25px !important;
  }
}

/* Modern forms */
.aei-form-card {
  margin-top: 22px;
  border-radius: 22px;
  padding: 26px;
  background:
    radial-gradient(circle at 0% 0%, rgba(255, 255, 255, 0.14), transparent 45%),
    linear-gradient(150deg, #212157 0%, #2e3270 52%, #3a3f85 100%);
  box-shadow: 0 24px 44px rgba(24, 28, 80, 0.26);
  color: #fff;
}

.aei-form-card h2 {
  margin: 0 0 8px !important;
  color: #fff !important;
  font-size: 34px !important;
  line-height: 1.1 !important;
  text-transform: none !important;
  letter-spacing: 0 !important;
}

.aei-form-card p {
  color: rgba(255, 255, 255, 0.9);
}

.aei-form-card .aei-form-card-head p {
  margin: 0 0 18px;
}

.aei-form {
  margin: 0;
}

.aei-form p {
  margin: 0 0 12px;
}

.aei-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 14px;
}

.aei-form label {
  display: inline-block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: #d7e4ff;
}

.aei-form input[type="text"],
.aei-form input[type="email"],
.aei-form textarea {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.26);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border-radius: 12px;
  padding: 11px 12px;
  font-size: 15px;
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.aei-form textarea {
  resize: vertical;
  min-height: 120px;
}

.aei-form input::placeholder,
.aei-form textarea::placeholder {
  color: rgba(255, 255, 255, 0.62);
}

.aei-form input:focus,
.aei-form textarea:focus {
  border-color: rgba(1, 149, 217, 0.95);
  background: rgba(255, 255, 255, 0.14);
  outline: none;
  box-shadow: 0 0 0 3px rgba(1, 149, 217, 0.25);
}

.aei-form-submit {
  margin-top: 4px;
  border: 0;
  border-radius: 999px;
  background: #fff;
  color: #0195d9;
  font-weight: 700;
  font-size: 15px;
  padding: 11px 18px;
  min-height: 44px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.aei-form-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 16px rgba(0, 0, 0, 0.22);
}

.aei-form-notice {
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 14px;
  font-size: 14px;
}

.aei-form-notice-ok {
  background: rgba(166, 199, 54, 0.22);
  border: 1px solid rgba(166, 199, 54, 0.55);
  color: #ecffaf;
}

.aei-form-notice-error {
  background: rgba(255, 90, 95, 0.2);
  border: 1px solid rgba(255, 90, 95, 0.56);
  color: #ffd4d5;
}

.aei-form-hp {
  position: absolute !important;
  left: -9999px !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

@media (max-width: 900px) {
  .aei-form-grid {
    grid-template-columns: 1fr;
  }

  .aei-form-card {
    padding: 20px;
    border-radius: 16px;
  }

  .aei-form-card h2 {
    font-size: 28px !important;
  }
}

/* Modern gallery */
.aei-home-gallery {
  margin: 34px auto 0;
  width: min(1240px, calc(100% - 40px));
  display: flex;
  align-items: center;
  gap: 12px;
}

.aei-home-gallery-viewport {
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  scroll-behavior: smooth;
  flex: 1 1 auto;
}

.aei-home-gallery-track {
  display: flex;
  gap: 12px;
  padding: 4px 2px 10px;
  width: max-content;
}

.aei-home-gallery-item {
  width: clamp(260px, 31vw, 420px);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 14px 30px rgba(20, 22, 60, 0.2);
}

.aei-home-gallery-item a {
  position: relative;
  display: block;
  height: 100%;
}

.aei-home-gallery-item img {
  display: block;
  width: 100%;
  height: clamp(190px, 21vw, 280px);
  object-fit: cover;
}

.aei-gallery-image {
  position: static !important;
  top: auto !important;
  left: auto !important;
  margin: 0 !important;
  opacity: 1 !important;
  filter: none !important;
}

.aei-home-gallery-overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(to top, rgba(10, 13, 40, 0.85), rgba(10, 13, 40, 0));
  color: #fff;
  font-size: 14px;
  line-height: 1.3;
  padding: 30px 14px 12px;
}

.aei-gallery-nav {
  border: none;
  width: 46px;
  height: 46px;
  border-radius: 999px;
  background: #212157;
  color: #fff;
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(15, 18, 50, 0.25);
}

.aei-gallery-nav:hover {
  background: #0195d9;
}

.aei-gallery-intro {
  text-align: center;
  margin: 8px 0 24px;
}

.aei-gallery-grid-page {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.aei-gallery-card {
  margin: 0;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 12px 24px rgba(16, 18, 54, 0.16);
}

.aei-gallery-card a {
  display: block;
  position: relative;
}

.aei-gallery-card img {
  width: 100%;
  height: 260px;
  object-fit: cover;
  display: block;
}

.aei-gallery-card figcaption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 16px 12px 10px;
  color: #fff;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.76), rgba(0, 0, 0, 0));
  font-size: 14px;
}

@media (max-width: 1000px) {
  .aei-gallery-grid-page {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .aei-home-gallery {
    width: calc(100% - 20px);
    gap: 8px;
  }

  .aei-gallery-nav {
    width: 40px;
    height: 40px;
    font-size: 26px;
  }
}

@media (max-width: 680px) {
  .aei-gallery-grid-page {
    grid-template-columns: 1fr;
  }

  .aei-home-gallery-item {
    width: min(82vw, 360px);
  }
}

/* Documents page */
#documents-page .aei-documents-list {
  list-style: none;
  margin: 20px 0 50px;
  padding: 0;
  display: grid;
  gap: 10px;
}

#documents-page .aei-document-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(33, 33, 87, 0.06);
}

#documents-page .aei-document-title {
  font-weight: 500;
  word-break: break-word;
}

#documents-page .aei-document-download {
  flex-shrink: 0;
}


/* Customizer preview: force show title/slogan even with custom logo.
   We only force opacity/visibility so jQuery .toggle() can still control display. */
body.customize-preview.wp-custom-logo header #logo a.home-link .home-link__brand {
  display: block !important;
  opacity: 1 !important;
  visibility: visible !important;
}
body.customize-preview.wp-custom-logo header #logo a.home-link .home-link__title,
body.customize-preview.wp-custom-logo header #logo a.home-link .home-link__tagline,
body.customize-preview.wp-custom-logo header #logo a.home-link .site-title-text,
body.customize-preview.wp-custom-logo header #logo a.home-link .site-tagline-text {
  opacity: 1 !important;
  visibility: visible !important;
}


/* AEI Header Brand Fix */
#logo a.home-link {
  overflow: visible;
}
#logo a.home-link .home-link__brand {
  position: absolute;
  z-index: 6;
  display: block;
  color: #fff;
  text-align: left;
}
#logo a.home-link .home-link__title,
#logo a.home-link .home-link__tagline,
#logo a.home-link .site-title-text,
#logo a.home-link .site-tagline-text {
  display: block;
  color: #fff;
  opacity: 1;
  visibility: visible;
}

.home .top-content .left .home-presentation-cta {
  display: inline-block;
  margin-top: 18px;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--aei-links, #0195d9);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
}

/* Ensure establishment photos keep a consistent card ratio */
div.left div.establishments div.estab .estab-image > div#img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

/* Liseret icons follow the configurable liseret text color */
div.liseret strong:first-child:before,
div.liseret strong.phone:before {
  background: none !important;
  background-color: var(--aei-liseret-text, #fff) !important;
  opacity: 0.9;
}

div.liseret strong:first-child:before {
  -webkit-mask: url('assets/css/images/pin.svg') no-repeat center / contain;
  mask: url('assets/css/images/pin.svg') no-repeat center / contain;
}

div.liseret strong.phone:before {
  -webkit-mask: url('assets/css/images/phone.svg') no-repeat center / contain;
  mask: url('assets/css/images/phone.svg') no-repeat center / contain;
}

/* Keep legacy page galleries rendered in columns like original site */
div.left div.gallery {
  margin: 2em 0;
}

div.left div.gallery::after {
  content: "";
  display: block;
  clear: both;
}

div.left div.gallery .gallery-item {
  float: left;
  margin: 0 0 14px;
  text-align: center;
  width: 100%;
  padding: 0 8px;
  box-sizing: border-box;
}

div.left div.gallery.gallery-columns-2 .gallery-item,
div.left div.gallery.columns_2 .gallery-item {
  width: 50%;
}

div.left div.gallery.gallery-columns-3 .gallery-item,
div.left div.gallery.columns_3 .gallery-item {
  width: 33.3333%;
}

div.left div.gallery.gallery-columns-4 .gallery-item,
div.left div.gallery.columns_4 .gallery-item {
  width: 25%;
}

div.left div.gallery br.clear {
  clear: both;
}
