/* Responsive fixes on top of the legacy WordPress "sugar" theme (Bootstrap 3).
   Targets: phones (incl. folded foldables ~280px), unfolded foldables, tablets, desktops. */

/* Media never wider than its container */
img,
video,
iframe,
embed,
object {
	max-width: 100%;
}
img {
	height: auto;
}
/* Images used as fixed-size sprites/icons keep their natural ratio rules from the theme */
.rev_slider img,
.fotorama img,
.fotorama__stage img {
	max-width: none;
}

/* Long words / URLs / e-mails must wrap instead of pushing the page wider */
a,
p,
li,
h1,
h2,
h3,
h4,
h5,
h6,
td,
th {
	overflow-wrap: break-word;
}

/* Form controls never exceed their column */
input,
select,
textarea,
button {
	max-width: 100%;
}
input[type='file'] {
	width: 100%;
}

/* The sticky plugin writes a pixel width on the header; when the header is not stuck it must follow
   the page width again (rotating a tablet, fold/unfold, split-screen) */
#header:not(.sticky) {
	/* 100% (not auto): when the plugin un-sticks it uses position:absolute, where auto would shrink-wrap */
	width: 100% !important;
}

/* Menu anchors on the home page: stop below the fixed header so the section title stays visible.
   170px matches the offset used by the old site. */
#widgets_services-2,
#widgets_testimonial-2,
#widgets_competences-3,
#widgets_portfolio-2,
#widgets_teams-2 {
	scroll-margin-top: 170px;
}
@media (max-width: 991.98px) {
	#widgets_services-2,
	#widgets_testimonial-2,
	#widgets_competences-3,
	#widgets_portfolio-2,
	#widgets_teams-2 {
		scroll-margin-top: 110px;
	}
}

/* Footer bar: copyright and slogan were nearly invisible (#636363 on #3c3c3c, contrast ~1.7:1) */
#fullfooter .copyright,
#fullfooter .site-description a {
	color: #a1a1a1;
}

/* Tablets and phones: keep the fixed "back to top" arrow from covering the footer logo */
@media (max-width: 991.98px) {
	#fullfooter {
		padding-bottom: 64px;
	}
	#fullfooter #footerlogo,
	#fullfooter #copyright {
		float: none;
		width: 100%;
	}
	/* the vertical-center plugin adds big top margins meant for side-by-side columns */
	#fullfooter .vertical-target {
		margin-top: 0 !important;
		margin-bottom: 0 !important;
	}
	#fullfooter {
		padding-top: 20px;
	}
	#fullfooter #footerlogo {
		margin-top: 16px !important;
	}
	#fullfooter #footerlogo .pull-right {
		float: none !important;
		text-align: left;
	}
}

/* Tablet portrait (Bootstrap fixed 750px .container was offset and overflowed by a few px) */
@media (min-width: 768px) and (max-width: 991.98px) {
	.container {
		width: auto;
		max-width: 750px;
	}
}

/* Phones and folded foldables */
@media (max-width: 767.98px) {
	.container {
		width: auto;
		max-width: 100%;
	}
	/* The sticky-header plugin stores a stale fixed height before layout settles */
	.wrapper-sticky {
		min-height: 0;
	}
	table {
		display: block;
		max-width: 100%;
		overflow-x: auto;
	}
	/* Buttons: allow wrapping on very narrow screens */
	.btn {
		white-space: normal;
		max-width: 100%;
	}
}


/* Very narrow screens (Galaxy Fold cover display ~280px) */
@media (max-width: 359.98px) {
	h1,
	h2 {
		font-size: 1.35em;
	}
}

/* Project pages: show the screenshot at its natural size, centered, never upscaled or overflowing
   (the Fotorama gallery stretched a single 800x569 image to a 1140x855 stage) */
.project-image {
	text-align: center;
	margin: 20px 0 30px;
}
.project-image img {
	display: inline-block;
	max-width: 100%;
	height: auto;
}

/* Menu: the current section / page must be clearly marked (the theme's .active was #fcfcfc on white) */
#navigation .nav-pills > li.active > a,
#navigation .nav-pills > li.active > a:focus,
#navigation .nav-pills > li.active > a:hover,
#navigation .nav-pills > li.active:hover > a {
	color: #fff;
	background: #1d9fd3;
}
.slicknav_nav li.active > a {
	background: #1d9fd3;
	color: #fff;
}
/* Hover/focus must not look like the "current section" state: after clicking a link the mouse stays on it
   (the header is fixed), so a solid blue hover made the clicked item look stuck as active. */
#navigation .nav-pills > li:not(.active) > a:hover,
#navigation .nav-pills > li:not(.active) > a:focus {
	color: #1d9fd3;
	background: transparent;
}

/* Short pages on tall screens (e.g. iPad Pro portrait): the footer ended mid-screen and the grey theme background showed
   underneath. Make the page at least as tall as the window, let the content area absorb the extra height, so the footer
   sits at the bottom; the dark background is only a fallback for overscroll. */
html {
	background: #333333;
}
body {
	min-height: 100vh;
	display: flex;
	flex-direction: column;
}
#page {
	flex: 1 0 auto;
	display: flex;
	flex-direction: column;
	width: 100%;
}
#page > #maincontent {
	flex: 1 0 auto;
}

/* Small desktops / iPad Pro portrait (992-1199px): the 7 menu entries wrapped onto a second row; keep them on one line */
@media (min-width: 992px) and (max-width: 1199.98px) {
	#navigation ul.nav > li > a {
		padding: 0 9px;
		font-size: 13px;
	}
}

/* "Nos derniers projets" cards on tablets and phones: no scrolling box inside the page (nested scroll is awkward on touch),
   and on phones one full-width card per row instead of two cramped ones that cut the titles in the middle of a word */
@media (max-width: 991.98px) {
	#portfolio_ul.portfolio.small,
	#portfolio_ul.portfolio.big {
		max-height: none !important;
		overflow: visible !important;
	}
	#portfolio_scroll {
		display: none !important;
	}
}
@media (max-width: 575.98px) {
	#portfolio_ul.portfolio {
		display: block;
	}
	#portfolio_ul.portfolio > .isotope-item {
		width: 100% !important;
		height: auto !important;
		min-height: 0 !important;
		float: none;
		margin: 0 0 20px;
	}
	#portfolio_ul .portfolio-info.row {
		margin: 0;
		padding: 12px 15px;
	}
	#portfolio_ul .post-title,
	#portfolio_ul .post-title a {
		word-break: normal;
		overflow-wrap: break-word;
		hyphens: auto;
	}
	#portfolio_ul .view-header {
		font-size: 16px !important;
	}
	#portfolio_ul .btn.info {
		font-size: 13px !important;
	}
}

/* Cards: the screenshot fills the card width at every screen size (the thumbnails are at most 400px wide,
   which left grey bands beside them on wider cards). The tall phone screenshots (168/174px) are excluded:
   stretched they would be about twice as high as the other cards. */
#portfolio_ul .view img:not([width='168']):not([width='174']) {
	width: 100%;
	height: auto;
}

/* Touch screens have no hover: the blue overlay with arrow / title / "En savoir plus" must never show there.
   The thumbnail itself stays tappable (the overlay link becomes an invisible layer over the image). */
@media (hover: none), (pointer: coarse) {
	#portfolio_ul .view .mask,
	#portfolio_ul .view .view-header,
	#portfolio_ul .view .view-content,
	#portfolio_ul .view a.info {
		display: none !important;
	}
	#portfolio_ul .view .content > a:first-child {
		display: block;
		position: absolute;
		top: 0;
		right: 0;
		bottom: 0;
		left: 0;
		z-index: 2;
	}
	/* no zoom-on-hover either: a tap would leave the image stuck zoomed */
	#portfolio_ul .view-first:hover img {
		transform: none;
	}
}

/* Phones and tablets - page title band: the title only had half the width (the right half is empty) and long titles
   such as "Consultant, chefs de projets, developpeurs" wrapped to 3+ lines in a fixed-height band (clipped on phones).
   Use the full width, a smaller title (36px on desktop -> 26px tablets -> 22px phones) and real vertical padding. */
@media (max-width: 1199.98px) {
	#headline {
		height: auto !important;
		min-height: 140px;
	}
	#headline .headline-left {
		float: none;
		width: 100%;
	}
	#headline .headline-right {
		display: none;
	}
	#headline .area {
		padding-top: 28px;
		padding-bottom: 28px;
	}
	#headline .vertical-target {
		margin-top: 0 !important;
		margin-bottom: 0 !important;
	}
	#headline .headline-title {
		font-size: 26px;
		line-height: 1.2;
		margin-top: 0;
		margin-bottom: 6px;
		overflow-wrap: break-word;
	}
}
/* Phones: the band was still fixed at 140px there, so long titles were both too big and clipped */
@media (max-width: 575.98px) {
	#headline {
		min-height: 0;
	}
	#headline .area {
		padding-top: 20px;
		padding-bottom: 20px;
	}
	#headline .headline-title {
		font-size: 22px;
	}
}

/* Services arrow icons: the link keeps focus after a click, and Bootstrap's
   a:focus/a:hover underline then shows up as a stray line under the arrow glyph */
a:has(> .service-icon),
a:has(> .service-icon):hover,
a:has(> .service-icon):focus,
.service-icon {
	text-decoration: none;
}
/* Hide the focus ring after a mouse click, but keep it for keyboard navigation */
a:has(> .service-icon):focus:not(:focus-visible) {
	outline: none;
}

/* Mobile menu (shown up to 768px by slicknav): it stays open inside the sticky header, so keep it within
   the screen and let it scroll on its own when it is taller (short phones, landscape) */
@media (max-width: 768px) {
	#header .slicknav_nav {
		max-height: calc(100vh - 100px);
		max-height: calc(100dvh - 100px);
		overflow-y: auto;
		overscroll-behavior: contain;
	}
}

/* Phones / small tablets: below 721px the home slider is hidden by its own "hideSliderAtLimit" setting,
   so drop its empty block too */
@media (max-width: 720.98px) {
	#slider {
		display: none;
	}
}

/* Phones: the home sections were spaced for desktop (about 200px between two sections: item + row
   margins, 50px area paddings, 40-50px before each list). Tighten it to about 60px. */
@media (max-width: 767.98px) {
	#content-top .area {
		padding-top: 25px;
		padding-bottom: 25px;
	}
	#content-top .row {
		margin-top: 0;
		margin-bottom: 0;
	}
	#content-top .widgettitle {
		margin: 0 0 15px;
	}
	#content-top .post-description {
		margin-bottom: 15px;
	}
	/* space between the intro text and the list of each section */
	#content-top .post-grid,
	.post-services .post-grid,
	.widget_widgets_teams .post-grid,
	.widget_widgets_testimonial .testimonials {
		margin-top: 20px;
	}
	/* no extra space after the last item of a section */
	.widget_widgets_services > ul > li:last-child {
		padding-bottom: 0 !important;
	}
	#content-top ul.portfolio > li:last-child,
	.widget_widgets_testimonial .testimonial-items:last-child,
	#content-top .post-grid > li:last-child {
		margin-bottom: 0;
	}
	/* team cards: smaller gap around the round photos, and the (always empty) social-links list takes no space */
	.teams .post-round-thumbnail {
		margin: 15px auto;
	}
	.teams .post-social {
		margin: 0;
	}
	/* "Retrouvez ici notre plaquette" band above the footer */
	#content-bottom {
		padding: 20px 0;
	}
	#content-bottom .widget {
		margin-bottom: 0;
	}
	#content-bottom h2 {
		margin: 0;
	}
}

/* Project filters (home + category pages): the buttons were inline-blocks with only side padding,
   so wrapped rows touched each other. A wrapping flex row with a gap spaces them in both directions. */
ul.portfolio-source {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 10px;
}
ul.portfolio-source::before,
ul.portfolio-source::after {
	/* the clearfix pseudo-elements would become empty flex items and add gaps */
	display: none;
}
ul.portfolio-source > li {
	padding: 0;
	margin: 0;
}

/* Footer on tablets (2 columns): the 4 floated columns snagged on each other (a tall first column pushed
   "Implantations" far down) and every widget added 35px below itself. A 2-column grid keeps the rows
   aligned, with tighter gaps. */
@media (min-width: 576px) and (max-width: 991.98px) {
	#footer {
		padding-top: 30px;
		padding-bottom: 25px;
	}
	#footer > .container > .row {
		display: grid;
		grid-template-columns: 1fr 1fr;
		row-gap: 25px;
	}
	/* Bootstrap clearfix pseudo-elements would become empty grid cells */
	#footer > .container > .row::before,
	#footer > .container > .row::after {
		display: none;
	}
	#footer .region {
		float: none;
		width: auto;
	}
	#footer .widget {
		margin-bottom: 0;
	}
	#footer .widgettitle {
		margin-bottom: 12px;
	}
	#footer .widget p:last-child {
		margin-bottom: 0;
	}
}
