/* Restaurant Elementor Widgets — base: tokens with safe fallbacks, accessibility utilities, site shell, reveals. */

/*
 * Design tokens. Declared on body because Elementor writes its Site Settings globals (--e-global-*) on the body's kit
 * class: colours and fonts chosen in Elementor → Site Settings flow into every restaurant widget. The fallbacks are the
 * Mediterranean palette (warm ivory, olive, sage, terracotta, warm ink) and apply when no kit is active.
 */
body {
	--mg-bg: var(--e-global-color-mglime, #FBF7EF);
	--mg-bg-soft: var(--e-global-color-mgsand, #F4EDDF);
	--mg-surface: var(--e-global-color-mgwhite, #FFFFFF);
	--mg-surface-elevated: #FFFFFF;
	--mg-primary: var(--e-global-color-primary, #3F5A2A);
	--mg-primary-hover: var(--e-global-color-mgindigo, #2F4520);
	--mg-secondary: var(--e-global-color-secondary, #8A9A6E);
	--mg-secondary-soft: var(--e-global-color-mgsage, #E4E9D8);
	--mg-accent: var(--e-global-color-accent, #B4502A);
	--mg-accent-hover: var(--e-global-color-mgsafdeep, #96401F);
	--mg-gold: var(--e-global-color-mgolive, #D9A441);
	--mg-text: var(--e-global-color-text, #2A2620);
	--mg-text-muted: var(--e-global-color-mgmuted, #6B6255);
	--mg-text-on-dark: var(--e-global-color-mgmist, #EDE6D6);
	--mg-ink: var(--e-global-color-mgink, #1F1C17);
	--mg-border: var(--e-global-color-mgline, #E6DCCB);
	--mg-border-strong: #CFC2AC;
	--mg-success: var(--e-global-color-mgsuccess, #2F7D4F);
	--mg-warning: var(--e-global-color-mgwarning, #9A6114);
	--mg-danger: var(--e-global-color-mgpom, #B3261E);
	--mg-focus: var(--e-global-color-primary, #3F5A2A);
	--mg-container: 1240px;
	--mg-gutter: clamp(16px, 4vw, 32px);
	--mg-radius-sm: 8px;
	--mg-radius-md: 14px;
	--mg-radius-lg: 24px;
	--mg-radius-pill: 999px;
	--mg-shadow-sm: 0 1px 2px rgba(42, 38, 32, .06), 0 2px 8px rgba(42, 38, 32, .05);
	--mg-shadow-md: 0 10px 30px rgba(42, 38, 32, .12), 0 2px 6px rgba(42, 38, 32, .06);
	--mg-shadow-lg: 0 24px 60px rgba(31, 28, 23, .22);
	--mg-header-height: 76px;
	--mg-transition-fast: 160ms cubic-bezier(.2, .7, .2, 1);
	--mg-transition-normal: 240ms cubic-bezier(.2, .7, .2, 1);
	--mg-font-display: var(--e-global-typography-primary-font-family, "Fraunces"), Georgia, "Times New Roman", serif;
	--mg-font-ui: var(--e-global-typography-text-font-family, "Inter"), system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	--mg-step--1: clamp(.8125rem, .79rem + .1vw, .875rem);
	--mg-step-0: clamp(.9375rem, .91rem + .15vw, 1.0625rem);
	--mg-step-1: clamp(1.125rem, 1.05rem + .35vw, 1.3125rem);
	--mg-step-2: clamp(1.375rem, 1.2rem + .8vw, 1.875rem);
	--mg-step-3: clamp(1.75rem, 1.4rem + 1.6vw, 2.75rem);
	--mg-step-4: clamp(2.25rem, 1.6rem + 3vw, 4rem);

	/* Older widget variables, kept so saved Elementor styles keep working; they now follow the tokens. */
	--rew-ink: var(--mg-primary);
	--rew-accent: var(--mg-accent);
	--rew-text: var(--mg-text);
	--rew-line-accent: var(--mg-secondary);
	--rew-surface: var(--mg-surface);
	--rew-muted: var(--mg-text-muted);
	--rew-focus: var(--mg-focus);
	--rew-ease: cubic-bezier(.2, .7, .2, 1);
	--rew-ease-out: cubic-bezier(.16, 1, .3, 1);
}

@media (max-width: 1024px) {
	body {
		--mg-header-height: 68px;
	}
}

/*
 * Blocksy styles WooCommerce screens (cart, checkout, account) through its own variables, declared on :root with the
 * theme's default blue palette and system font. They are re-pointed at the restaurant tokens here, on body, where the
 * tokens exist; the theme's derived variables are computed on :root, so they are set directly as well. Other themes
 * ignore these variables.
 */
body {
	--theme-palette-color-1: var(--mg-primary);
	--theme-palette-color-2: var(--mg-primary-hover);
	--theme-text-color: var(--mg-text);
	--theme-headings-color: var(--mg-text);
	--theme-border-color: var(--mg-border);
	--theme-link-initial-color: var(--mg-primary-hover);
	--theme-link-hover-color: var(--mg-accent-hover);
	--theme-selection-background-color: var(--mg-primary);
	--theme-font-family: var(--mg-font-ui);
	--theme-form-field-border-initial-color: var(--mg-border-strong);
	--theme-form-field-border-focus-color: var(--mg-primary);
	--theme-form-selection-field-initial-color: var(--mg-border-strong);
	--theme-form-selection-field-active-color: var(--mg-primary);
	--theme-button-background-initial-color: var(--mg-primary);
	--theme-button-background-hover-color: var(--mg-primary-hover);
	--theme-button-text-initial-color: #FFFFFF;
	--theme-button-text-hover-color: #FFFFFF;
	--theme-button-border-radius: var(--mg-radius-pill);
	--theme-button-min-height: 48px;
	--theme-button-font-weight: 600;
	--theme-button-font-size: 16px;
}

:root {
	--rew-header-h: 0px;
}

.rew-sr,
.rew-form__hp {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0;
}

body a.rew-skip-link {
	position: absolute;
	inset-inline-start: 12px;
	top: -100px;
	z-index: 100000;
	padding: 12px 18px;
	border-radius: 10px;
	background: var(--rew-ink);
	color: #fff;
	font-weight: 600;
	text-decoration: none;
}

body a.rew-skip-link:focus {
	top: 12px;
	outline: 3px solid var(--rew-accent);
	outline-offset: 2px;
}

/* Shell anchors and wrappers add no layout of their own. */
.rew-shell__anchor {
	display: block;
	height: 0;
	outline: none;
	scroll-margin-top: var(--rew-header-h);
}

.rew-shell__header,
.rew-shell__footer,
.rew-shell__main {
	display: block;
}

.rew-shell__main:focus {
	outline: none;
}

/* Section anchors land below the sticky header. */
.rew-shell [id] {
	scroll-margin-top: calc(var(--rew-header-h, 0px) + 16px);
}

/* Visible keyboard focus everywhere the restaurant widgets render. */
.rew-shell a:focus-visible,
.rew-shell button:focus-visible,
.rew-shell input:focus-visible,
.rew-shell select:focus-visible,
.rew-shell textarea:focus-visible,
.rew-shell summary:focus-visible,
.rew-shell [tabindex]:not([tabindex="-1"]):focus-visible {
	outline: 3px solid var(--rew-focus);
	outline-offset: 3px;
}

/* Fallback header/footer when a template is missing. */
.rew-fallback {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 12px 24px;
	max-width: 1240px;
	margin-inline: auto;
	padding: 16px;
	color: var(--rew-ink);
}

.rew-fallback--header {
	justify-content: space-between;
}

body a.rew-fallback__brand {
	font-weight: 700;
	font-size: 1.25rem;
	color: inherit;
	text-decoration: none;
}

.rew-fallback__menu {
	display: flex;
	flex-wrap: wrap;
	gap: 4px 18px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.rew-fallback__menu a {
	display: inline-block;
	padding: 10px 2px;
	color: inherit;
}

body a.rew-fallback__cta {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
	padding: 0 20px;
	border-radius: 999px;
	background: var(--rew-accent);
	color: #141833;
	font-weight: 600;
	text-decoration: none;
}

.rew-fallback--footer {
	display: block;
	padding-block: 40px;
}

.rew-fallback--footer p {
	margin: 0 0 8px;
}

.rew-editor-notice {
	padding: 14px 16px;
	border: 1px dashed #85889a;
	border-radius: 10px;
	background: #fff8e8;
	color: #33364a;
	font-size: 14px;
}

.rew-hours-line {
	display: block;
}

.rew-hours-line span {
	font-weight: 600;
}

/* Scroll reveals: add the CSS class rew-reveal (fade & rise), rew-reveal--mask (image wipe) or rew-reveal--fade to any
   Elementor element. Content is hidden only when JavaScript is running, so it can never stay invisible. */
.rew-reveal.rew-reveal-ready:not(.is-revealed) {
	opacity: 0;
	transform: translate3d(0, 24px, 0);
}

.rew-reveal-ready.rew-reveal--fade:not(.is-revealed) {
	transform: none;
}

.rew-reveal-ready.rew-reveal--mask:not(.is-revealed) {
	opacity: 1;
	transform: none;
	clip-path: inset(0 0 100% 0 round 24px);
}

.rew-reveal {
	transition: opacity .7s var(--rew-ease), transform .7s var(--rew-ease), clip-path 1s var(--rew-ease-out);
	transition-delay: var(--rew-reveal-delay, 0ms);
}

/* Revealed masks extend past the box so shadows and overflowing ornaments are not clipped. */
.rew-reveal--mask {
	clip-path: inset(-60px -60px -60px -60px round 0);
}

/* Stagger: put rew-stagger on a container; its direct children reveal one after another. */
.rew-stagger > .rew-reveal-ready:not(.is-revealed) {
	opacity: 0;
	transform: translate3d(0, 20px, 0);
}

.rew-stagger > * {
	transition: opacity .6s var(--rew-ease), transform .6s var(--rew-ease);
	transition-delay: var(--rew-reveal-delay, 0ms);
}

/* Catalog mode: the ordering panel becomes one clear way to the external ordering page (rew-ordering.css is not
   loaded in this mode, so the panel carries its own card styling). */
.rew-catalog-order {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	justify-content: center;
	gap: 12px;
	padding: clamp(18px, 3vw, 28px);
	border: 1px solid var(--mg-border);
	border-radius: var(--mg-radius-lg);
	background: var(--mg-surface);
	box-shadow: var(--mg-shadow-sm);
	color: var(--mg-text);
	font-family: var(--mg-font-ui);
}

.rew-catalog-order__title {
	margin: 0;
	font-family: var(--mg-font-display);
	font-size: var(--mg-step-2);
	font-weight: 500;
	line-height: 1.2;
	color: var(--mg-text);
}

.rew-catalog-order__text {
	margin: 0;
	font-size: var(--mg-step-0);
	line-height: 1.6;
	color: var(--mg-text-muted);
}

body a.rew-catalog-order__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-height: 48px;
	margin-top: 4px;
	padding: 12px 24px;
	border-radius: var(--mg-radius-pill);
	background: var(--mg-primary);
	color: #FFFFFF;
	font-size: 16px;
	font-weight: 600;
	line-height: 1.3;
	text-decoration: none;
	transition: background-color var(--mg-transition-fast);
}

body a.rew-catalog-order__btn:hover,
body a.rew-catalog-order__btn:focus-visible {
	background: var(--mg-primary-hover);
	color: #FFFFFF;
}

body a.rew-catalog-order__btn:focus-visible {
	outline: 3px solid var(--mg-focus);
	outline-offset: 3px;
}

.rew-catalog-order__btn svg {
	width: 18px;
	height: 18px;
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
}

/* Arrow nudge for Elementor buttons with the CSS class rew-btn-arrow. */
.rew-btn-arrow .elementor-button-text::after,
.rew-btn-arrow .elementor-button-content-wrapper::after {
	content: "";
	display: inline-block;
	width: .9em;
	height: .9em;
	margin-inline-start: .55em;
	vertical-align: -.1em;
	background: currentColor;
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M3 10h12M10 4l6 6-6 6' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M3 10h12M10 4l6 6-6 6' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
	transition: transform .25s var(--rew-ease);
}

.rew-btn-arrow .elementor-button-content-wrapper::after {
	display: none;
}

.rew-btn-arrow .elementor-button:hover .elementor-button-text::after,
.rew-btn-arrow .elementor-button:focus-visible .elementor-button-text::after {
	transform: translateX(4px);
}

/* ---------------------------------------------------------------- shared UI primitives
   Selectors carry body + element so theme and Elementor kit button/link styles (0-1-1) never leak in, while staying below
   Elementor widget control selectors ({{WRAPPER}} .x, 0-2-0+) so owners can still restyle them. */

body a.rew-btn,
body button.rew-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: .5em;
	min-height: 44px;
	margin: 0;
	padding: 0 20px;
	border: 1.5px solid transparent;
	border-radius: var(--mg-radius-pill);
	background: var(--mg-primary);
	color: #FFF;
	font: 600 var(--mg-step-0) / 1.1 var(--mg-font-ui);
	letter-spacing: 0;
	text-decoration: none;
	text-transform: none;
	white-space: nowrap;
	cursor: pointer;
	box-shadow: none;
	transition: background-color var(--mg-transition-fast), color var(--mg-transition-fast), border-color var(--mg-transition-fast), box-shadow var(--mg-transition-fast), transform var(--mg-transition-fast);
}

body a.rew-btn:hover,
body button.rew-btn:hover,
body a.rew-btn:focus-visible,
body button.rew-btn:focus-visible,
body a.rew-btn:focus,
body button.rew-btn:focus {
	background: var(--mg-primary-hover);
	color: #FFF;
	text-decoration: none;
}

body a.rew-btn:active,
body button.rew-btn:active {
	transform: translateY(1px);
}

body a.rew-btn.rew-btn--accent,
body button.rew-btn.rew-btn--accent {
	background: var(--mg-accent);
	color: #FFF;
}

body a.rew-btn.rew-btn--accent:hover,
body button.rew-btn.rew-btn--accent:hover,
body a.rew-btn.rew-btn--accent:focus-visible,
body button.rew-btn.rew-btn--accent:focus-visible,
body a.rew-btn.rew-btn--accent:focus,
body button.rew-btn.rew-btn--accent:focus {
	background: var(--mg-accent-hover);
}

body a.rew-btn.rew-btn--ghost,
body button.rew-btn.rew-btn--ghost {
	background: transparent;
	border-color: var(--mg-border-strong);
	color: var(--mg-primary);
}

body a.rew-btn.rew-btn--ghost:hover,
body button.rew-btn.rew-btn--ghost:hover,
body a.rew-btn.rew-btn--ghost:focus-visible,
body button.rew-btn.rew-btn--ghost:focus-visible,
body a.rew-btn.rew-btn--ghost:focus,
body button.rew-btn.rew-btn--ghost:focus {
	background: var(--mg-secondary-soft);
	border-color: var(--mg-primary);
	color: var(--mg-primary-hover);
}

body a.rew-btn.rew-btn--light,
body button.rew-btn.rew-btn--light {
	background: var(--mg-surface);
	color: var(--mg-primary);
}

body a.rew-btn.rew-btn--light:hover,
body button.rew-btn.rew-btn--light:hover,
body a.rew-btn.rew-btn--light:focus-visible,
body button.rew-btn.rew-btn--light:focus-visible,
body a.rew-btn.rew-btn--light:focus,
body button.rew-btn.rew-btn--light:focus {
	background: var(--mg-bg-soft);
	color: var(--mg-primary-hover);
}

body a.rew-btn.rew-btn--block,
body button.rew-btn.rew-btn--block {
	display: flex;
	width: 100%;
}

body a.rew-btn.rew-btn--sm,
body button.rew-btn.rew-btn--sm {
	min-height: 36px;
	padding: 0 14px;
	font-size: var(--mg-step--1);
}

body a.rew-btn[disabled],
body button.rew-btn[disabled],
body a.rew-btn[aria-disabled="true"],
body button.rew-btn[aria-disabled="true"] {
	opacity: .55;
	cursor: not-allowed;
	transform: none;
}

body button.rew-icon-btn {
	position: relative;
	display: inline-grid;
	place-items: center;
	flex: 0 0 auto;
	width: 44px;
	height: 44px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: var(--mg-radius-pill);
	background: transparent;
	color: var(--mg-text);
	line-height: 1;
	cursor: pointer;
	box-shadow: none;
	transition: background-color var(--mg-transition-fast), color var(--mg-transition-fast);
}

body button.rew-icon-btn:hover,
body button.rew-icon-btn:focus-visible,
body button.rew-icon-btn[aria-expanded="true"],
body button.rew-icon-btn:focus {
	background: var(--mg-bg-soft);
	color: var(--mg-primary);
}

body button.rew-icon-btn svg {
	width: 22px;
	height: 22px;
	pointer-events: none;
}

/* Pickup / Delivery segmented control: native radios inside a fieldset, so arrow keys and screen readers work as-is. */
.rew-seg {
	display: inline-grid;
	grid-auto-columns: 1fr;
	grid-auto-flow: column;
	min-width: 0;
	margin: 0;
	padding: 4px;
	border: 1px solid var(--mg-border);
	border-radius: var(--mg-radius-pill);
	background: var(--mg-bg-soft);
}

.rew-seg legend {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

.rew-seg__opt {
	position: relative;
	display: block;
	margin: 0;
	font-family: var(--mg-font-ui); /* themes style bare labels (Blocksy: its system font stack) */
	cursor: pointer;
}

.rew-seg__opt input {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	margin: 0;
	opacity: 0;
	cursor: inherit;
}

.rew-seg__opt span {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-height: 40px;
	padding: 0 16px;
	border-radius: var(--mg-radius-pill);
	color: var(--mg-text-muted);
	font: 600 var(--mg-step--1) / 1 var(--mg-font-ui);
	white-space: nowrap;
	transition: background-color var(--mg-transition-fast), color var(--mg-transition-fast), box-shadow var(--mg-transition-fast);
}

.rew-seg__opt svg {
	width: 18px;
	height: 18px;
	flex: 0 0 auto;
}

.rew-seg__opt input:checked + span {
	background: var(--mg-surface);
	color: var(--mg-primary);
	box-shadow: var(--mg-shadow-sm);
}

.rew-seg__opt input:focus-visible + span {
	outline: 3px solid var(--mg-focus);
	outline-offset: 2px;
}

.rew-seg__opt input:disabled + span {
	color: var(--mg-text-muted);
	opacity: .55;
	text-decoration: line-through;
	text-decoration-thickness: 1px;
}

.rew-seg__opt:has(input:disabled) {
	cursor: not-allowed;
}

.rew-seg-note {
	margin: 6px 0 0;
	color: var(--mg-text-muted);
	font: 400 var(--mg-step--1) / 1.4 var(--mg-font-ui);
}

.rew-badge {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	min-height: 22px;
	padding: 0 8px;
	border-radius: var(--mg-radius-pill);
	background: var(--mg-secondary-soft);
	color: var(--mg-primary-hover);
	font: 600 12px / 1 var(--mg-font-ui);
	letter-spacing: .01em;
	white-space: nowrap;
}

.rew-badge--accent {
	background: #F8E3D8;
	color: var(--mg-accent-hover);
}

.rew-badge--muted {
	background: var(--mg-bg-soft);
	color: var(--mg-text-muted);
}

.rew-spinner {
	display: inline-block;
	width: 18px;
	height: 18px;
	border: 2px solid currentColor;
	border-inline-end-color: transparent;
	border-radius: 50%;
	animation: rew-spin .7s linear infinite;
	vertical-align: middle;
}

@keyframes rew-spin {
	to {
		transform: rotate(360deg);
	}
}

/* Scroll lock while a drawer or dialog is open; the scrollbar gutter is kept so the page does not jump sideways. */
html.rew-scroll-lock,
html.rew-scroll-lock body {
	overflow: hidden;
}

html.rew-scroll-lock {
	scrollbar-gutter: stable;
}

@media (prefers-reduced-motion: reduce) {
	.rew-reveal.rew-reveal-ready:not(.is-revealed),
	.rew-stagger > .rew-reveal-ready:not(.is-revealed) {
		opacity: 1;
		transform: none;
		clip-path: none;
	}

	.rew-reveal,
.rew-stagger > *,
.rew-btn-arrow .elementor-button-text::after,
body a.rew-btn,
body button.rew-btn,
body button.rew-icon-btn,
.rew-seg__opt span {
		transition: none;
	}

	.rew-spinner {
		animation-duration: 2.4s;
	}

	/* Themes such as Blocksy set html { scroll-behavior: smooth }; anchor jumps should not animate here. */
	:root {
		scroll-behavior: auto;
	}
}
