/* ==========================================================================
   Alkhaleej theme — component styles
   Colours, fonts and spacing come from theme.json (CSS variables).
   Logical properties (inline-start/end) keep Arabic RTL and English LTR in
   one stylesheet.
   ========================================================================== */

:root {
	--alk-radius: var(--wp--custom--radius--sm, 3px);
	--alk-radius-md: var(--wp--custom--radius--md, 6px);
	--alk-border: 1px solid var(--wp--preset--color--border);
	--alk-shadow: var(--wp--custom--shadow--card);
	--alk-admin-bar: var(--wp-admin--admin-bar--height, 0px);
}

html { scroll-behavior: smooth; }
body { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
/* Guard: old page content sometimes contains pasted <style> rules for body
   (e.g. a light background, Arial, 40px padding). They must never restyle the
   whole page, so the page frame always comes from this theme. */
html body {
	margin: 0 !important; padding: 0 !important;
	background: var(--wp--preset--color--base) !important;
	color: var(--wp--preset--color--contrast) !important;
	font-family: var(--wp--preset--font-family--body) !important;
}
img { height: auto; }
:where(.wp-block-image img, .wp-block-post-featured-image img) { border-radius: var(--alk-radius-md); }
:focus-visible { outline: 2px solid var(--wp--preset--color--accent); outline-offset: 2px; }
::selection { background: var(--wp--preset--color--primary); color: #fff; }

/* ---------- Header ------------------------------------------------------- */

/* Let the two header bars join the page flow so the menu bar can stick. */
.wp-site-blocks > header.wp-block-template-part { display: contents; }

.alk-topbar {
	background: var(--wp--preset--color--base);
	padding-block: 0.875rem;
	border-block-end: var(--alk-border);
}
.alk-topbar .wp-block-site-logo img { display: block; }

.alk-navbar {
	position: sticky;
	top: var(--alk-admin-bar);
	z-index: 50;
	background: color-mix(in srgb, var(--wp--preset--color--surface) 92%, transparent);
	backdrop-filter: saturate(140%) blur(8px);
	border-block-end: 1px solid var(--wp--preset--color--border);
	box-shadow: 0 6px 18px rgba(0, 0, 0, .25);
}
.wp-site-blocks > .alk-navbar,
.wp-site-blocks > .alk-topbar { margin-block-start: 0; }
.alk-navbar__inner { min-height: 56px; gap: 1rem; }

/* ---------- Main menu ---------------------------------------------------- */

.alk-menu { position: relative; flex: 1 1 auto; min-width: 0; }
.alk-menu__list,
.alk-menu__list ul { list-style: none; margin: 0; padding: 0; }
.alk-menu__list { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem; }
.alk-menu__list > li { position: relative; }
.alk-menu__list a {
	display: block;
	padding: 0.9rem 0.75rem;
	color: var(--wp--preset--color--contrast);
	text-decoration: none;
	font-weight: 600;
	font-size: 0.95rem;
	white-space: nowrap;
	border-block-end: 2px solid transparent;
}
.alk-menu__list a:hover,
.alk-menu__list .current-menu-item > a,
.alk-menu__list .current-menu-ancestor > a {
	color: var(--wp--preset--color--accent);
	border-block-end-color: var(--wp--preset--color--accent);
}
.alk-menu__list .menu-item-has-children > a::after {
	content: "";
	display: inline-block;
	width: .4em; height: .4em;
	margin-inline-start: .45em;
	border: solid currentColor;
	border-width: 0 1.5px 1.5px 0;
	transform: translateY(-.2em) rotate(45deg);
	opacity: .7;
}

/* Dropdowns (desktop) */
.alk-menu__list .sub-menu {
	position: absolute;
	inset-inline-start: 0;
	top: 100%;
	min-width: 230px;
	padding: 0.4rem;
	background: var(--wp--preset--color--surface-2);
	border: var(--alk-border);
	border-radius: var(--alk-radius);
	box-shadow: var(--alk-shadow);
	opacity: 0;
	visibility: hidden;
	transform: translateY(6px);
	transition: opacity .15s, transform .15s, visibility .15s;
	z-index: 60;
}
.alk-menu__list li:hover > .sub-menu,
.alk-menu__list li:focus-within > .sub-menu { opacity: 1; visibility: visible; transform: none; }
.alk-menu__list .sub-menu a { padding: 0.55rem 0.75rem; border: 0; border-radius: var(--alk-radius); }
.alk-menu__list .sub-menu a:hover { background: var(--wp--preset--color--surface); }

/* Mobile toggle (CSS only, no JavaScript) */
.alk-menu__toggle { position: absolute; opacity: 0; pointer-events: none; }
.alk-menu__burger { display: none; }
.alk-menu__sub, .alk-menu__subbtn { display: none; }

@media (max-width: 960px) {
	.alk-menu__burger {
		display: inline-flex;
		align-items: center;
		gap: .5rem;
		padding: .6rem .2rem;
		cursor: pointer;
		font-weight: 600;
		color: var(--wp--preset--color--contrast);
	}
	.alk-menu__burger-icon,
	.alk-menu__burger-icon::before,
	.alk-menu__burger-icon::after {
		display: block; width: 22px; height: 2px;
		background: currentColor; border-radius: 2px; position: relative;
	}
	.alk-menu__burger-icon::before,
	.alk-menu__burger-icon::after { content: ""; position: absolute; inset-inline-start: 0; }
	.alk-menu__burger-icon::before { top: -7px; }
	.alk-menu__burger-icon::after { top: 7px; }

	/* The bar's backdrop-filter makes it the box for fixed children, so the panel hangs from the bar instead. */
	.alk-menu--toggle { position: static; }
	.alk-menu--toggle .alk-menu__panel {
		display: none;
		position: absolute;
		inset-inline: 0;
		top: 100%;
		max-height: calc(100vh - 57px - 62px - var(--alk-admin-bar));
		max-height: calc(100dvh - 57px - 62px - var(--alk-admin-bar));
		overflow-y: auto;
		overscroll-behavior: contain;
		background: var(--wp--preset--color--base);
		border-block-end: 1px solid var(--wp--preset--color--border);
		box-shadow: 0 18px 30px rgba(0, 0, 0, .5);
		padding: .5rem clamp(1rem, 4vw, 1.5rem) 1.25rem;
		z-index: 70;
	}
	.alk-menu__toggle:checked ~ .alk-menu__panel { display: block; }
	.alk-menu__toggle:focus-visible + .alk-menu__burger { outline: 2px solid var(--wp--preset--color--accent); }

	.alk-menu--toggle .alk-menu__list { flex-direction: column; align-items: stretch; gap: 0; }
	.alk-menu--toggle .alk-menu__list a { padding: .85rem .25rem; border-block-end: var(--alk-border); white-space: normal; }
	.alk-menu--toggle .alk-menu__list .sub-menu {
		position: static; opacity: 1; visibility: visible; transform: none;
		background: none; border: 0; box-shadow: none; padding: 0 0 0 0;
		padding-inline-start: 1rem;
	}
	.alk-menu--toggle .menu-item-has-children > a::after { display: none; }
	/* Reviews open and close with the arrow, so the country pages stay in view. */
	.alk-menu--toggle .menu-item-has-children { display: grid; grid-template-columns: 1fr auto; align-items: stretch; }
	.alk-menu--toggle .menu-item-has-children > .sub-menu { grid-column: 1 / -1; display: none; }
	.alk-menu--toggle .alk-menu__sub:checked ~ .sub-menu { display: block; }
	.alk-menu--toggle .alk-menu__sub { display: block; position: absolute; opacity: 0; pointer-events: none; }
	.alk-menu--toggle .alk-menu__subbtn { display: grid; place-items: center; width: 52px; cursor: pointer; border-block-end: var(--alk-border); }
	.alk-menu__subbtn::before { content: ""; width: .55em; height: .55em; border: solid currentColor; border-width: 0 2px 2px 0; transform: translateY(-.15em) rotate(45deg); transition: transform .15s; }
	.alk-menu__sub:checked + .alk-menu__subbtn::before { transform: translateY(.15em) rotate(225deg); }
	.alk-menu__sub:focus-visible + .alk-menu__subbtn { outline: 2px solid var(--wp--preset--color--accent); }
}

/* ---------- Top casinos button & language switcher ------------------------ */

.alk-cta-btn,
.wp-block-button__link { border-radius: var(--alk-radius); }
.alk-cta-btn {
	display: inline-flex;
	align-items: center;
	gap: .45rem;
	flex-shrink: 0;
	padding: .55rem 1rem;
	background: var(--wp--preset--gradient--gold);
	color: var(--wp--preset--color--base) !important;
	font-weight: 700;
	font-size: .9rem;
	text-decoration: none;
	white-space: nowrap;
	box-shadow: 0 4px 14px rgba(242, 185, 81, .25);
	transition: transform .15s, box-shadow .15s;
}
.alk-cta-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(242, 185, 81, .35); }
.alk-cta-btn svg { width: 1em; height: 1em; }

.alk-lang { display: flex; gap: .35rem; margin: 0; padding: 0; list-style: none; }
.alk-lang a {
	display: inline-flex;
	align-items: center;
	gap: .45rem;
	padding: .35rem .6rem;
	border: var(--alk-border);
	border-radius: var(--alk-radius);
	color: var(--wp--preset--color--muted);
	font-size: .85rem;
	font-weight: 600;
	text-decoration: none;
}
.alk-lang a:hover { color: var(--wp--preset--color--contrast); border-color: var(--wp--preset--color--primary-light); }
.alk-lang .is-current a { color: var(--wp--preset--color--contrast); background: var(--wp--preset--color--surface-2); border-color: var(--wp--preset--color--primary); }
.alk-lang__flag { width: 22px; height: 15px; border-radius: 2px; display: block; box-shadow: 0 0 0 1px rgba(255,255,255,.15); }

/* ---------- Page structure ----------------------------------------------- */

.alk-main { padding-block: var(--wp--preset--spacing--40) var(--wp--preset--spacing--60); }
.alk-page-title { margin-block-start: .5rem; }

.alk-breadcrumbs { font-size: var(--wp--preset--font-size--small); color: var(--wp--preset--color--muted); }
.alk-breadcrumbs a { color: var(--wp--preset--color--muted); text-decoration: none; }
.alk-breadcrumbs a:hover { color: var(--wp--preset--color--accent); }
.alk-breadcrumbs .separator { margin-inline: .4em; opacity: .6; }

.alk-post-meta {
	display: flex;
	flex-wrap: wrap;
	gap: .35rem 1.25rem;
	font-size: var(--wp--preset--font-size--small);
	color: var(--wp--preset--color--muted);
}
.alk-post-meta a { color: var(--wp--preset--color--contrast); text-decoration: none; font-weight: 600; }
.alk-post-meta__item { display: inline-flex; align-items: center; gap: .4rem; }
.alk-post-meta svg { width: 1.05em; height: 1.05em; stroke: var(--wp--preset--color--accent); }

.alk-muted { color: var(--wp--preset--color--muted); }

/* Author box */
.alk-author-box.wp-block-post-author {
	margin-block-start: var(--wp--preset--spacing--50);
	padding: 1.25rem;
	gap: 1rem;
	background: var(--wp--preset--color--surface);
	border: var(--alk-border);
	border-inline-start: 3px solid var(--wp--preset--color--accent);
	border-radius: var(--alk-radius);
}
.alk-author-box .wp-block-post-author__avatar img { border-radius: 50%; }
.alk-author-box .wp-block-post-author__name { font-weight: 700; color: #fff; font-size: 1.05rem; }
.alk-author-box .wp-block-post-author__bio { color: var(--wp--preset--color--muted); font-size: .95rem; margin-block-start: .25rem; }

/* Cards (archives, related items) */
.alk-card {
	height: 100%;
	background: var(--wp--preset--color--surface);
	border: var(--alk-border);
	border-radius: var(--alk-radius-md);
	overflow: hidden;
	transition: border-color .15s, transform .15s;
}
.alk-card:hover { border-color: var(--wp--preset--color--primary-light); transform: translateY(-2px); }
.alk-card .wp-block-post-featured-image { margin: 0; }
.alk-card .wp-block-post-featured-image img { border-radius: 0; }
.alk-card__body { padding: 1rem 1.15rem 1.25rem; }
.alk-card__body > * + * { margin-block-start: .5rem; }
.alk-card .wp-block-post-title a { text-decoration: none; }
.alk-card .wp-block-post-excerpt { color: var(--wp--preset--color--muted); font-size: .95rem; }

/* ---------- Core blocks in content --------------------------------------- */

.wp-block-table table { border-collapse: collapse; width: 100%; }
.wp-block-table th,
.wp-block-table td { padding: .75rem 1rem; border: var(--alk-border); }
.wp-block-table thead th,
.wp-block-table tr:first-child th { background: var(--wp--preset--color--primary); color: #fff; font-weight: 700; }
.wp-block-table tbody tr:nth-child(even) { background: var(--wp--preset--color--surface); }
.wp-block-table { overflow-x: auto; border-radius: var(--alk-radius); }

.wp-block-button.is-style-outline .wp-block-button__link {
	background: transparent;
	border: 1.5px solid var(--wp--preset--color--accent);
	color: var(--wp--preset--color--accent);
}

.wp-block-details {
	background: var(--wp--preset--color--surface);
	border: var(--alk-border);
	border-radius: var(--alk-radius);
	padding: .9rem 1.1rem;
}
.wp-block-details summary { font-weight: 700; cursor: pointer; }

/* list markers: see the glowing bullets in Alkhaleej Core components.css */

/* ---------- Rank Math blocks: match the theme ---------------------------- */

/* FAQ */
.wp-block-rank-math-faq-block .rank-math-list-item,
.rank-math-block .rank-math-list-item {
	margin-block-end: .75rem;
	padding: 1rem 1.25rem;
	background: var(--wp--preset--color--surface);
	border: var(--alk-border);
	border-inline-start: 3px solid var(--wp--preset--color--primary-light);
	border-radius: var(--alk-radius);
}
.rank-math-block .rank-math-question {
	margin: 0 0 .4rem;
	font-size: var(--wp--preset--font-size--large);
	color: #fff;
}
.rank-math-block .rank-math-answer { color: var(--wp--preset--color--contrast); }
.rank-math-block .rank-math-answer > :last-child { margin-block-end: 0; }

/* HowTo */
.wp-block-rank-math-howto-block .rank-math-howto-description { color: var(--wp--preset--color--muted); }
.rank-math-howto-duration,
.rank-math-howto-total-time {
	display: inline-block;
	padding: .3rem .7rem;
	background: var(--wp--preset--color--surface-2);
	border-radius: var(--alk-radius);
	font-size: var(--wp--preset--font-size--small);
	color: var(--wp--preset--color--accent);
}
.rank-math-steps { list-style: none; margin: 1rem 0 0; padding: 0; counter-reset: alk-step; }
.rank-math-steps .rank-math-step {
	position: relative;
	margin-block-end: .9rem;
	padding: 1rem 1.25rem;
	padding-inline-start: 4rem;
	background: var(--wp--preset--color--surface);
	border: var(--alk-border);
	border-radius: var(--alk-radius);
	counter-increment: alk-step;
}
.rank-math-steps .rank-math-step::before {
	content: counter(alk-step);
	position: absolute;
	inset-inline-start: 1rem;
	top: 1rem;
	width: 2.1rem; height: 2.1rem;
	display: grid; place-items: center;
	background: var(--wp--preset--gradient--gold);
	color: var(--wp--preset--color--base);
	font-weight: 700;
	border-radius: var(--alk-radius);
}
.rank-math-step .rank-math-step-title { margin: 0 0 .35rem; font-size: var(--wp--preset--font-size--large); color: #fff; }
.rank-math-step .rank-math-step-content > :last-child { margin-block-end: 0; }

/* ---------- Footer -------------------------------------------------------- */

.alk-footer {
	margin-block-start: 0;
	padding-block: var(--wp--preset--spacing--50) var(--wp--preset--spacing--30);
	background: var(--wp--preset--color--surface);
	border-block-start: 3px solid var(--wp--preset--color--primary);
	color: var(--wp--preset--color--muted);
	font-size: .95rem;
}
.wp-site-blocks > footer.wp-block-template-part { margin-block-start: 0; }
.alk-footer__cols { gap: var(--wp--preset--spacing--40); }
.alk-footer__title { font-size: 1rem; color: #fff; margin-block-end: .75rem; }
.alk-footer__flags { font-size: 1.6rem; letter-spacing: .15em; line-height: 1.4; }
.alk-footer__adult { display: flex; align-items: center; gap: .5rem; }
.alk-footer__help { display: flex; flex-wrap: wrap; gap: .5rem; }
.alk-footer__help a { padding: .25rem .75rem; border: var(--alk-border); border-radius: 999px; text-decoration: none; }
.alk-sisters { display: flex; flex-wrap: wrap; gap: .75rem; }
.alk-sisters a { display: inline-grid; place-items: center; height: 92px; padding: 6px 10px; background: #fff; border-radius: 12px; }
.alk-sisters img { display: block; max-width: 100%; height: auto; max-height: 80px; }

.alk-footer__bottom {
	margin-block-start: var(--wp--preset--spacing--40);
	padding-block-start: var(--wp--preset--spacing--30);
	border-block-start: var(--alk-border);
	gap: .75rem 1.5rem;
	font-size: var(--wp--preset--font-size--small);
}
.alk-footer__bottom .alk-menu { flex: 0 1 auto; }
.alk-footer__bottom .alk-menu__list a {
	padding: .25rem .5rem;
	font-weight: 400;
	font-size: inherit;
	color: var(--wp--preset--color--muted);
	border: 0;
}
.alk-footer__bottom .alk-menu__list a:hover { color: var(--wp--preset--color--accent); }
.alk-footer__legal { margin: 0; }
.alk-18 {
	display: inline-grid;
	place-items: center;
	width: 2rem; height: 2rem;
	margin-inline-end: .5rem;
	border: 2px solid var(--wp--preset--color--danger);
	border-radius: 50%;
	color: #fff;
	font-weight: 700;
	font-size: .7rem;
	vertical-align: middle;
}

/* ---------- 404 ------------------------------------------------------------ */
.alk-404 .alk-page-title { font-size: clamp(4rem, 15vw, 8rem); color: var(--wp--preset--color--accent); }

/* ---------- Small screens -------------------------------------------------- */
@media (max-width: 600px) {
	.alk-topbar .wp-block-site-logo img { width: 150px !important; }
	.alk-lang__name { display: none; }
	.alk-cta-btn { padding: .5rem .75rem; font-size: .85rem; }
}

/* ---------- Casino review template: content + desktop sidebar ----------
   The page content's blocks join this grid directly, so a review header that
   is the first block spans the full width and the sidebar starts below it. */
.alk-review-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; column-gap: 2rem; align-items: start; }
.alk-review-layout > .wp-block-post-content { display: contents; }
.alk-review-layout > .wp-block-post-content > * { grid-column: 1; min-width: 0; max-width: none; margin-inline: 0; }
.alk-review-layout > .wp-block-post-content > .wp-block-alkhaleej-review-header:first-child { grid-column: 1 / -1; margin-bottom: 1.5rem; }
.alk-review-layout > .alk-review-aside { grid-column: 2; grid-row: 2 / span 999; height: 100%; margin: 0; }
.alk-review-layout:not(:has(> .wp-block-post-content > .wp-block-alkhaleej-review-header:first-child)) > .alk-review-aside { grid-row: 1 / span 999; }
@media (max-width: 1023px) {
	.alk-review-layout { grid-template-columns: minmax(0, 1fr); }
	.alk-review-layout > .alk-review-aside { display: none; }
}
.alk-after-content { margin-top: 2.5rem; }
/* Sidebar: card + top casinos scroll away; the page contents stay pinned. */
.alk-review-aside > .wp-block-alkhaleej-review-sidebar { height: 100%; max-width: none; }
.alk-review-aside .alk-side { position: static; height: 100%; }
.alk-review-aside .alk-side > nav { position: sticky; top: calc(var(--wp-admin--admin-bar--height, 0px) + 96px); max-height: calc(100vh - 120px); overflow: auto; }

/* Images in page content (incl. Rank Math How-to / FAQ) never overflow. */
:where(.wp-block-post-content) img { max-width: 100%; height: auto; }
/* Review pages: the article column is narrower (sidebar), so cards go two per row. */
@media (min-width: 1024px) {
	.alk-review-layout .is-style-alk-cards { flex-wrap: wrap !important; }
	.alk-review-layout .is-style-alk-cards > .wp-block-column { flex: 1 1 calc(50% - 1rem) !important; max-width: calc(50% - .5rem); }
}

/* Tables on phones: columns keep a readable width; a wide table scrolls
   sideways inside its own box instead of breaking words. */
@media (max-width: 700px) {
	.wp-block-table, .wp-block-table.aligncenter { display: block !important; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
	.wp-block-table table { min-width: 100%; table-layout: auto !important; }
	.wp-block-table td, .wp-block-table th { min-width: 6.5rem; word-break: normal !important; overflow-wrap: normal !important; hyphens: none; }
	.wp-block-table.is-style-alk-spec td, .wp-block-table.is-style-alk-spec th { min-width: 0; }
}
