/*
Theme Name: TT5 Child (Dolibarr Services)
Theme URI: https://my-dolibarr.eu
Description: Child theme of Twenty Twenty-Five. Holds the templates for the
             "modul" and "referenz" post types plus the site-specific styling
             carried over from the previous Divi design.
Author: GL
Template: twentytwentyfive
Version: 1.1.0
*/

/* Demo screencasts are embedded as <video> in custom HTML blocks. */
.modul-demo video,
.wp-block-html video {
	width: 100%;
	height: auto;
	display: block;
	border-radius: 6px;
}

/* Compact meta line for module compatibility / reference industry. */
.entry-meta-line {
	font-size: 0.9rem;
	opacity: 0.75;
}

/* ------------------------------------------------------------------
   Flip cards

   Replaces the two Divi flip-card plugins that were active before the
   relaunch. Colours are the ones from the old design: #2ea3f2 front,
   #3e6580 back.
   ------------------------------------------------------------------ */

.flip-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(230px, 100%), 1fr));
	gap: 1.25rem;
	margin: 1.5rem 0;
}

.flip-card {
	perspective: 1200px;
	height: 215px;
}

.flip-card__inner {
	position: relative;
	width: 100%;
	height: 100%;
	transition: transform 0.6s;
	transform-style: preserve-3d;
}

/* focus-within keeps the back reachable by keyboard, not just by mouse. */
.flip-card:hover .flip-card__inner,
.flip-card:focus-within .flip-card__inner {
	transform: rotateY(180deg);
}

.flip-card__front,
.flip-card__back {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	justify-content: center;
	padding: 1.5rem;
	border-radius: 8px;
	backface-visibility: hidden;
	-webkit-backface-visibility: hidden;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.flip-card__front {
	background: #2ea3f2;
	color: #fff;
	align-items: center;
	text-align: center;
}

.flip-card__front h3 {
	color: #fff;
	margin: 0;
	font-size: 1.4rem;
}

.flip-card__back {
	background: #3e6580;
	color: #fff;
	transform: rotateY(180deg);
	font-size: 0.95rem;
	line-height: 1.45;
	overflow-y: auto;
}

.flip-card__back p { margin: 0 0 0.75rem; }
.flip-card__back a { color: #fff; text-decoration: underline; font-weight: 600; }

/* Touch devices have no hover state. Rather than trapping the text behind a
   flip nobody can trigger, both sides are stacked. */
@media (hover: none) {
	.flip-card { perspective: none; height: auto; }
	.flip-card__inner { transform: none !important; }
	.flip-card__front,
	.flip-card__back {
		position: static;
		transform: none;
		backface-visibility: visible;
	}
	.flip-card__front { border-radius: 8px 8px 0 0; padding-block: 1rem; }
	.flip-card__back  { border-radius: 0 0 8px 8px; }
}

@media (prefers-reduced-motion: reduce) {
	.flip-card__inner { transition: none; }
}

/* Hero banner (GLC / Dolibarr lettering from the previous design). */
.site-hero .wp-block-image img,
.site-hero img {
	/* Higher specificity than the generic safety net further down, which would
	   otherwise reset this back to max-width: 100%. */
	max-width: min(340px, 70%);
	height: auto;
	margin-inline: auto;
	display: block;
}

.partner-badge img {
	max-width: 230px;
	height: auto;
}

/* TT5's default content column is narrow; screencasts need room to stay legible. */
.wp-block-html video { max-width: 100%; }

.alignwide .wp-block-html video,
.wp-block-group.alignwide video {
	width: 100%;
}

/* Icons are inline SVG (no icon font, no external request), drawn in the same
   outline style at 24x24 and coloured via currentColor. */
.flip-card__front svg {
	width: 44px;
	height: 44px;
	margin-bottom: 0.75rem;
	stroke: currentColor;
	fill: none;
	stroke-width: 1.6;
	stroke-linecap: round;
	stroke-linejoin: round;
}

/* Section with a soft tint, used sparingly to break up long pages. */
.section-soft {
	background: var(--wp--preset--color--soft, #eef4f8);
	padding: 2rem 1.5rem;
	border-radius: 10px;
}

/* Feature lists get a check mark instead of a plain bullet. */
.list-check { list-style: none; padding-left: 0; }
.list-check li {
	position: relative;
	padding-left: 1.75rem;
	margin-bottom: 0.4rem;
}
.list-check li::before {
	content: "";
	position: absolute;
	left: 0;
	top: 0.45em;
	width: 0.7rem;
	height: 0.38rem;
	border-left: 2px solid var(--wp--preset--color--accent, #2ea3f2);
	border-bottom: 2px solid var(--wp--preset--color--accent, #2ea3f2);
	transform: rotate(-45deg);
}

/* Small coloured lead-in bar above section headings. */
.wp-block-heading.has-rule::before {
	content: "";
	display: block;
	width: 46px;
	height: 3px;
	background: var(--wp--preset--color--accent, #2ea3f2);
	margin-bottom: 0.6rem;
	border-radius: 2px;
}

/* Safety net: no image or embedded media may push the page wider than the
   viewport. Checked on a 390px viewport after the relaunch. */
.wp-block-image img,
.wp-block-html video,
figure img {
	max-width: 100%;
	height: auto;
}

/* ------------------------------------------------------------------
   Vertical rhythm

   Sections were sitting right on top of each other. The coloured rule above
   each H2 now carries the separation on its own - the grey <hr> that used to
   sit next to it was redundant and has been removed from the content.
   ------------------------------------------------------------------ */

.wp-block-heading.has-rule {
	margin-top: 3.5rem;
	margin-bottom: 1rem;
}

.entry-content > .wp-block-heading:first-child,
.wp-site-blocks .wp-block-heading.has-rule:first-child {
	margin-top: 1.5rem;
}

.flip-grid { margin: 2rem 0 3.5rem; }

.section-soft {
	margin: 3rem 0;
	padding: 2.5rem 2rem;
}

.site-hero { margin-bottom: 1.5rem; }

/* Give buttons and lists a little air as well. */
.wp-block-buttons { margin-top: 1.5rem; }
.list-check li { margin-bottom: 0.55rem; }

/* ------------------------------------------------------------------
   Flip cards inside a query loop (module archive)

   post-template renders a <ul> with one <li> per post, so the grid has to
   live on that list and the cards need to fill their list item.
   ------------------------------------------------------------------ */

ul.wp-block-post-template.flip-grid {
	list-style: none;
	padding-left: 0;
}

.flip-grid > li {
	margin: 0;
}

.flip-grid > li > .flip-card {
	height: 100%;
	min-height: 215px;
}

/* Query-loop cards carry more text than the ones on the front page. */
.flip-card__back .wp-block-post-excerpt__excerpt { margin: 0 0 0.6rem; }
.flip-card__back .wp-block-post-excerpt__more-link,
.flip-card__back .wp-block-read-more {
	color: #fff;
	text-decoration: underline;
	font-weight: 600;
	display: inline-block;
	margin-top: 0.3rem;
}
.flip-card__back .card-meta {
	font-size: 0.82rem;
	opacity: 0.85;
	margin: 0 0 0.4rem;
}
.flip-card__front .wp-block-post-title {
	color: #fff;
	margin: 0;
	font-size: 1.35rem;
	text-align: center;
}
.flip-card__front .wp-block-post-title a { color: #fff; text-decoration: none; }

/* In the archive the cards would stretch to a third of the page each while
   only three modules exist. Cap their width so the grid still looks right at
   three and fills up naturally as more modules are added. */
.wp-block-query .flip-grid {
	grid-template-columns: repeat(auto-fit, minmax(240px, 360px));
	justify-content: start;
}
