/* BookVisit Extras — [bookvisit_extras] bildrutor (Marienlyst-stil). */

.bvex-section {
	--bvex-bg: #f6f1e9;
	--bvex-ink: #fff;
	--bvex-gap: clamp(16px, 1.9vw, 36px);
	--bvex-font: "ivymode", "Cormorant Garamond", "Didot", Georgia, serif;

	background: var(--bvex-bg);
	padding: clamp(24px, 2.4vw, 44px) 0;
}

/* Elementor: i en flexkolumn med flex-wrap:wrap (Marienlysts mobil-layout)
   mäts widgeten efter innehållets max-content-bredd. Rutornas innehåll är
   absolut positionerat, så den bredden — och därmed höjden — blev 0: widgeten
   blev 96px hög och nästa sektion lade sig över rutorna. Sträck widgeten. */
.elementor-widget:has(> .elementor-widget-container .bvex-section),
.elementor-widget:has(> .bvex-section) {
	align-self: stretch !important;
	width: 100% !important;
	max-width: 100%;
}

.bvex-section {
	width: 100%;
}

.bvex-section-title {
	margin: 0 0 clamp(20px, 2vw, 36px);
	font-family: var(--bvex-font);
	font-weight: 300;
	text-align: center;
	text-transform: uppercase;
}

.bvex-grid {
	display: grid;
	grid-template-columns: repeat(var(--bvex-cols, 4), minmax(0, 1fr));
	gap: var(--bvex-gap);
}

/* Höjden kommer från aspect-ratio. INTE padding-bottom-%-tricket: i en
   Elementor-flexkolumn (mobil) räknas %-padding som 0 när containerns höjd
   mäts, så sektionen blev 96px hög och nästa sektion lade sig över rutorna.
   overflow:hidden + min-height:0 gör att aspect-ratio inte växer med
   innehållet (t.ex. <p>/<br> som wpautop stoppar in). */
.bvex-section .bvex-tile {
	position: relative;
	display: block;
	box-sizing: border-box;
	width: 100%;
	height: auto !important;
	min-height: 0 !important;
	max-height: none;
	margin: 0;
	padding: 0 !important;
	aspect-ratio: 450 / 557;
	overflow: hidden;
	background: #2b2723;
	color: var(--bvex-ink);
	text-decoration: none;
	isolation: isolate;
}

.bvex-tile:hover,
.bvex-tile:focus {
	color: var(--bvex-ink);
	text-decoration: none;
}

.bvex-tile:focus-visible {
	outline: 2px solid #114542;
	outline-offset: 3px;
}

/* !important: tema-regler som `.elementor img { height:auto; max-width:100% }`
   har högre specificitet och gör annars att bilden inte fyller rutan. */
.bvex-section .bvex-tile .bvex-img {
	position: absolute !important;
	top: 0 !important;
	left: 0 !important;
	width: 100% !important;
	height: 100% !important;
	max-width: none !important;
	max-height: none !important;
	margin: 0 !important;
	padding: 0 !important;
	border: 0 !important;
	border-radius: 0 !important;
	box-shadow: none !important;
	object-fit: cover !important;
	object-position: center;
	transition: transform .8s cubic-bezier(.2, .7, .2, 1);
}

/* Det wpautop eventuellt stoppat in mellan taggarna ska inte synas. */
.bvex-tile > p,
.bvex-tile > br,
.bvex-grid > p,
.bvex-grid > br { display: none !important; }

.bvex-shade {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, .16);
	transition: background-color .4s ease;
}

.bvex-tile:hover .bvex-img  { transform: scale(1.04); }
.bvex-tile:hover .bvex-shade { background: rgba(0, 0, 0, .28); }

/* Titeln hänger från mitten (ett- och tvåradiga titlar börjar på samma höjd),
   "Book nu" sitter fast ovanför nederkanten — som i förlagan. Är titeln för
   lång krymper distansen ovanför (::before), så titeln flyttar upp i stället
   för att krocka med "Book nu". 59.75% = 49% av rutan / bodyns 82%. */
.bvex-body {
	position: absolute;
	inset: 0 7% 18%;
	z-index: 1;
	display: flex;
	flex-direction: column;
	align-items: center;
}

.bvex-body::before {
	content: "";
	flex: 0 1 59.75%;
	min-height: 0;
}

/* Titel/CTA: temat (Elementor/Avada) har h3- och a-regler med högre specificitet
   som krympte texten. Typografin låses därför med !important, och storlekarna
   styrs via variabler som brytpunkterna nedan ändrar. */
.bvex-section {
	--bvex-title-size: clamp(24px, 2.15vw, 42px);
	--bvex-cta-size: clamp(18px, 1.55vw, 30px);
}

.bvex-section .bvex-tile .bvex-title,
.bvex-section .bvex-tile .bvex-cta {
	flex: none;
	max-width: 100%;
	margin: 0 !important;
	color: var(--bvex-ink) !important;
	font-family: var(--bvex-font) !important;
	font-style: normal !important;
	font-weight: 300 !important;
	text-align: center !important;
	text-shadow: 0 1px 14px rgba(0, 0, 0, .35);
}

.bvex-section .bvex-tile .bvex-title {
	padding: 0 !important;
	font-size: var(--bvex-title-size) !important;
	line-height: 1.32 !important;
	letter-spacing: -.005em !important;
	text-transform: uppercase !important;
	overflow-wrap: anywhere;
}

.bvex-section .bvex-tile .bvex-cta {
	margin-top: auto !important;
	padding: clamp(12px, 1.2vw, 22px) 0 0 !important;
	font-size: var(--bvex-cta-size) !important;
	line-height: 1 !important;
	letter-spacing: normal !important;
	text-transform: none !important;
}

.bvex-tile:hover .bvex-cta {
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: .2em;
}

@media (max-width: 1024px) {
	.bvex-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.bvex-grid[style*="--bvex-cols:1"] { grid-template-columns: minmax(0, 1fr); }
	.bvex-section {
		--bvex-title-size: clamp(22px, 3.6vw, 36px);
		--bvex-cta-size: clamp(17px, 2.6vw, 26px);
	}
}

@media (max-width: 600px) {
	.bvex-section { padding-left: 16px; padding-right: 16px; }
	.bvex-grid    { grid-template-columns: minmax(0, 1fr); }
	.bvex-section .bvex-tile { aspect-ratio: 1 / 1.1; }
	.bvex-section {
		--bvex-title-size: 28px;
		--bvex-cta-size: 21px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.bvex-img, .bvex-shade { transition: none; }
	.bvex-tile:hover .bvex-img { transform: none; }
}
