/* ==========================================================================
   Book Purchase Places for Elementor
   Concept: a book's contents page. Each store is a line, the name joined to
   its location by a dotted leader. A classical double rule opens each section.
   Logical properties throughout, so RTL and LTR share one stylesheet.
   ========================================================================== */

/* Bundled Amiri (SIL Open Font License, see assets/fonts/OFL-Amiri.txt) */
@font-face {
	font-family: "BPW Amiri";
	font-style: normal;
	font-weight: 400;
	font-display: swap;
	src: url("../fonts/amiri-latin-400-normal.woff2") format("woff2");
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
	font-family: "BPW Amiri";
	font-style: normal;
	font-weight: 700;
	font-display: swap;
	src: url("../fonts/amiri-latin-700-normal.woff2") format("woff2");
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
	font-family: "BPW Amiri";
	font-style: normal;
	font-weight: 400;
	font-display: swap;
	src: url("../fonts/amiri-arabic-400-normal.woff2") format("woff2");
	unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC, U+102E0-102FB, U+10E60-10E7E, U+10EC2-10EC4, U+10EFC-10EFF, U+1EE00-1EEFF;
}
@font-face {
	font-family: "BPW Amiri";
	font-style: normal;
	font-weight: 700;
	font-display: swap;
	src: url("../fonts/amiri-arabic-700-normal.woff2") format("woff2");
	unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC, U+102E0-102FB, U+10E60-10E7E, U+10EC2-10EC4, U+10EFC-10EFF, U+1EE00-1EEFF;
}

/* --- Tokens (Elementor style controls override these) -------------------- */
.bpw-places {
	--bpw-ink: #1d2330;
	--bpw-muted: #5e6672;
	--bpw-rule: #d2d4d1;
	--bpw-accent: #7a2433;
	--bpw-plate: #f1f0ec;
	--bpw-surface: transparent;
	--bpw-logo-w: 112px;
	--bpw-logo-h: 64px;
	--bpw-logo-pad: 10px;
	--bpw-radius: 2px;
	--bpw-gap: 56px;
	--bpw-row-pad: 18px;
	--bpw-columns: 3;
	--bpw-dir: 1; /* flips the hover nudge in RTL */
	--bpw-font-display: "Noto Naskh Arabic", "Traditional Arabic", Georgia, "Times New Roman", serif;

	position: relative;
	display: grid;
	gap: var(--bpw-gap);
	container-type: inline-size;
	color: var(--bpw-ink);
	font-size: 1rem;
	line-height: 1.8;
	text-align: start;
}

.bpw-places--rtl { --bpw-dir: -1; }

.bpw-places--amiri {
	--bpw-font-display: "BPW Amiri", "Noto Naskh Arabic", "Traditional Arabic", Georgia, "Times New Roman", serif;
}

.bpw-places *,
.bpw-places *::before,
.bpw-places *::after {
	box-sizing: border-box;
}

/* --- Category -------------------------------------------------------------- */
.bpw-group {
	position: relative;
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	row-gap: 8px;
	padding-block-start: 28px;
}

/* Classical double rule */
.bpw-group::before {
	content: "";
	position: absolute;
	inset-block-start: 0;
	inset-inline: 0;
	block-size: 4px;
	background:
		linear-gradient(var(--bpw-ink), var(--bpw-ink)) 0 0 / 100% 1px no-repeat,
		linear-gradient(var(--bpw-ink), var(--bpw-ink)) 0 100% / 100% 1px no-repeat;
	transform-origin: 0 50%;
}

.bpw-places--rtl .bpw-group::before { transform-origin: 100% 50%; }

.bpw-places .bpw-group__head {
	padding-block-start: var(--bpw-row-pad);
}

.bpw-places .bpw-group__title {
	margin: 0;
	padding: 0;
	color: var(--bpw-ink);
	font-family: var(--bpw-font-display);
	font-size: clamp(1.5rem, 1.25rem + 0.9vw, 2rem);
	font-weight: 700;
	line-height: 1.5;
	text-wrap: balance;
}

/* Heading beside the list when the widget is wide enough */
@container (min-width: 640px) {
	.bpw-places--list .bpw-group {
		grid-template-columns: minmax(180px, 0.32fr) minmax(0, 1fr);
		column-gap: 48px;
	}
	.bpw-places--list .bpw-group:not(:has(.bpw-group__head)) {
		grid-template-columns: minmax(0, 1fr);
	}
}

/* --- List ------------------------------------------------------------------ */
.bpw-places .bpw-list {
	margin: 0;
	padding: 0;
	list-style: none;
}

.bpw-places .bpw-item {
	margin: 0;
	padding: 0;
	list-style: none;
}

.bpw-places--list .bpw-item + .bpw-item {
	border-block-start: 1px solid var(--bpw-rule);
}

/* --- Store line / card ----------------------------------------------------- */
.bpw-places .bpw-card {
	position: relative;
	display: grid;
	grid-template-columns: auto minmax(0, 1fr);
	align-items: center;
	column-gap: 20px;
	min-block-size: 44px;
	padding-block: var(--bpw-row-pad);
	color: inherit;
	text-decoration: none;
	box-shadow: none;
	border: 0;
}

.bpw-places .bpw-card--go {
	grid-template-columns: auto minmax(0, 1fr) auto;
}

.bpw-places a.bpw-card:hover,
.bpw-places a.bpw-card:active,
.bpw-places a.bpw-card:visited {
	color: inherit;
	text-decoration: none;
}

.bpw-places a.bpw-card:focus-visible {
	outline: 2px solid var(--bpw-accent);
	outline-offset: 4px;
	border-radius: var(--bpw-radius);
}

/* Logo plate */
.bpw-places .bpw-logo {
	display: flex;
	align-items: center;
	justify-content: center;
	flex: none;
	width: var(--bpw-logo-w);
	height: var(--bpw-logo-h);
	padding: var(--bpw-logo-pad);
	overflow: hidden;
	background: var(--bpw-plate);
	border-radius: var(--bpw-radius);
}

/* Fill the plate and let object-fit keep the original aspect ratio.
   This also sizes SVGs that carry no width/height of their own. */
.bpw-places .bpw-logo img,
.bpw-places .bpw-logo .bpw-logo__img {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	box-shadow: none;
	object-fit: contain;
	transition: filter 0.25s ease, opacity 0.25s ease;
}

.bpw-places--mono .bpw-logo img {
	filter: grayscale(1);
	opacity: 0.8;
}

.bpw-places .bpw-logo__mark {
	color: var(--bpw-muted);
	font-family: var(--bpw-font-display);
	font-size: 1.875rem;
	font-weight: 700;
	line-height: 1;
}

/* Name · leader · location */
.bpw-places .bpw-body {
	display: flex;
	align-items: baseline;
	gap: 12px;
	min-inline-size: 0;
}

.bpw-places .bpw-name {
	color: var(--bpw-ink);
	font-family: var(--bpw-font-display);
	font-size: 1.375rem;
	font-weight: 700;
	line-height: 1.5;
	transition: color 0.2s ease;
}

/* Sits on the text baseline, so the dots read as a contents-page leader. */
.bpw-places .bpw-leader {
	flex: 1 1 24px;
	min-inline-size: 24px;
	border-block-end: 2px dotted var(--bpw-muted);
	opacity: 0.45;
}

.bpw-places .bpw-place {
	color: var(--bpw-muted);
	font-size: 0.9375rem;
	line-height: 1.6;
}

/* Arrow */
.bpw-places .bpw-go {
	display: inline-flex;
	color: var(--bpw-muted);
	transition: transform 0.25s ease, color 0.2s ease;
}

.bpw-places .bpw-go svg {
	display: block;
	width: 20px;
	height: 20px;
}

.bpw-places--rtl .bpw-go svg { transform: scaleX(-1); }

/* Hover and keyboard focus: the only hover effect, answering the reader's action */
@media (hover: hover) {
	.bpw-places a.bpw-card:hover .bpw-name { color: var(--bpw-accent); }
	.bpw-places a.bpw-card:hover .bpw-go {
		color: var(--bpw-accent);
		transform: translateX(calc(var(--bpw-dir) * 4px));
	}
	.bpw-places--mono a.bpw-card:hover .bpw-logo img {
		filter: none;
		opacity: 1;
	}
}

.bpw-places a.bpw-card:focus-visible .bpw-name { color: var(--bpw-accent); }
.bpw-places a.bpw-card:focus-visible .bpw-go { color: var(--bpw-accent); }
.bpw-places--mono a.bpw-card:focus-visible .bpw-logo img {
	filter: none;
	opacity: 1;
}

/* Narrow container: stack location under the name, drop the leader */
@container (max-width: 480px) {
	.bpw-places .bpw-body {
		display: block;
	}
	.bpw-places .bpw-leader {
		display: none;
	}
	.bpw-places .bpw-place {
		display: block;
	}
	.bpw-places--list .bpw-card {
		column-gap: 14px;
	}
}

/* --- Cards layout ---------------------------------------------------------- */
.bpw-places--cards .bpw-group {
	grid-template-columns: minmax(0, 1fr);
	row-gap: 24px;
}

/* Fallback column counts; Elementor's Columns control overrides these. */
@media (max-width: 1024px) {
	.bpw-places { --bpw-columns: 2; }
}
@media (max-width: 767px) {
	.bpw-places { --bpw-columns: 1; }
}

.bpw-places--cards .bpw-list {
	display: grid;
	grid-template-columns: repeat(var(--bpw-columns), minmax(0, 1fr));
	gap: 20px;
}

.bpw-places--cards .bpw-item,
.bpw-places--cards .bpw-item + .bpw-item {
	border: 0;
}

.bpw-places--cards .bpw-card,
.bpw-places--cards .bpw-card--go {
	grid-template-columns: minmax(0, 1fr) auto;
	grid-template-areas:
		"logo go"
		"body body";
	align-content: start;
	align-items: start;
	row-gap: 18px;
	height: 100%;
	padding: 22px;
	background: var(--bpw-surface);
	border: 1px solid var(--bpw-rule);
	border-radius: var(--bpw-radius);
	transition: border-color 0.2s ease;
}

.bpw-places--cards .bpw-logo { grid-area: logo; justify-self: start; }
.bpw-places--cards .bpw-body { grid-area: body; display: block; }
.bpw-places--cards .bpw-go { grid-area: go; }
.bpw-places--cards .bpw-leader { display: none; }
.bpw-places--cards .bpw-place { display: block; }

@media (hover: hover) {
	.bpw-places--cards a.bpw-card:hover { border-color: var(--bpw-accent); }
}

/* --- Reveal: the section rule draws in once (class added by JS only) ------- */
.bpw-places.bpw-js .bpw-group::before {
	transform: scaleX(0);
	transition: transform 0.9s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.bpw-places.bpw-js .bpw-group.is-visible::before {
	transform: scaleX(1);
}

/* --- Utilities ------------------------------------------------------------- */
.bpw-places .bpw-sr {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

/* Editor-only hint when both categories are empty */
.bpw-empty {
	padding: 20px;
	color: #5e6672;
	font-size: 14px;
	text-align: center;
	border: 1px dashed #b8bcc2;
	border-radius: 2px;
}

@media (prefers-reduced-motion: reduce) {
	.bpw-places *,
	.bpw-places *::before,
	.bpw-places *::after {
		transition: none !important;
	}
}
