/* QC Global CSS — the entire Qatar Chamber "theme shell" as a client
   extension (no WAR theme, no build dependencies). Pages run the built-in
   Classic theme; Classic/Clay tokens are set by the QC Style Book; this file
   registers what a Style Book cannot: self-hosted fonts, the full --qc-*
   design-token vocabulary from the Figma file (J3e1thav8NIu6a3XhC6Wcl), and
   the shared RTL/i18n foundation utilities.

   Policy for ALL QC styling: logical properties only — margin-inline-start
   (not margin-left), padding-inline, inset-inline-end, text-align: start/end
   — so ar_SA mirrors from the same rules with no [dir=rtl] overrides. */

/* QC:fonts — Cairo (SIL OFL), the family specified by the Figma design for
   BOTH English and Arabic. Self-hosted variable font (weights 200–1000),
   split by script subset; never load fonts from external CDNs. */

@font-face {
	font-display: swap;
	font-family: "Cairo";
	font-style: normal;
	font-weight: 200 1000;
	src: url(./fonts/cairo-arabic.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-1EE03, U+1EE05-1EE1F, U+1EE21-1EE22, U+1EE24, U+1EE27, U+1EE29-1EE32, U+1EE34-1EE37, U+1EE39, U+1EE3B, U+1EE42, U+1EE47, U+1EE49, U+1EE4B, U+1EE4D-1EE4F, U+1EE51-1EE52, U+1EE54, U+1EE57, U+1EE59, U+1EE5B, U+1EE5D, U+1EE5F, U+1EE61-1EE62, U+1EE64, U+1EE67-1EE6A, U+1EE6C-1EE72, U+1EE74-1EE77, U+1EE79-1EE7C, U+1EE7E, U+1EE80-1EE89, U+1EE8B-1EE9B, U+1EEA1-1EEA3, U+1EEA5-1EEA9, U+1EEAB-1EEBB, U+1EEF0-1EEF1;
}

@font-face {
	font-display: swap;
	font-family: "Cairo";
	font-style: normal;
	font-weight: 200 1000;
	src: url(./fonts/cairo-latin-ext.woff2) format("woff2");
	unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
	font-display: swap;
	font-family: "Cairo";
	font-style: normal;
	font-weight: 200 1000;
	src: url(./fonts/cairo-latin.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;
}

/* Fraunces (SIL OFL) — display face for Figma fee-tile amounts only
   (Food Handlers "QAR 50"). Self-hosted, Latin glyphs, weight 500. */
@font-face {
	font-display: swap;
	font-family: "Fraunces";
	font-style: normal;
	font-weight: 500;
	src: url(./fonts/fraunces-500.ttf) format("truetype");
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+20AC;
}

/* QC:tokens — 1:1 with the Figma variable collection. Consumed by the QC
   Style Book (which chains Classic/Clay tokens to these), by QC fragments,
   and by the other QC client extensions. Values in rem at 16px root. */

:root {
	/* Primary (maroon) */
	--qc-primary-25: #fbf6f8;
	--qc-primary-50: #f4e7ea;
	--qc-primary-100: #e3c5cb;
	--qc-primary-200: #cd96a2;
	--qc-primary-300: #b76879;
	--qc-primary-400: #a13a50;
	--qc-primary-500: #911731;
	--qc-primary-600: #7a132a; /* derived hover tone (Figma jumps 500→800) */
	--qc-primary-800: #580f2a;

	/* Gold (secondary) */
	--qc-gold-50: #f6f0ec;
	--qc-gold-100: #e9dbd0;
	--qc-gold-200: #d7beaa;
	--qc-gold-300: #c5a185;
	--qc-gold-500: #a66f43;
	--qc-gold-600: #8f5f3a; /* derived hover tone (Figma jumps 500→950) */
	--qc-gold-950: #422c1b;

	/* Gray */
	--qc-white: #ffffff;
	--qc-gray-50: #f6f6f6;
	--qc-gray-100: #ededed;
	--qc-gray-200: #dededd;
	--qc-gray-300: #d0d0d0;
	--qc-gray-400: #a8a8a7;
	--qc-gray-500: #7c7b7b;
	--qc-gray-600: #6c6c6b;
	--qc-gray-700: #4a4a49;
	--qc-gray-800: #343432;
	--qc-gray-900: #1d1d1b;

	/* Alpha */
	--qc-alpha-white-10: #ffffff1a;
	--qc-alpha-white-20: #ffffff33;
	--qc-alpha-white-30: #ffffff4d;
	--qc-alpha-white-50: #ffffff80;
	--qc-alpha-white-60: #ffffff99;
	--qc-alpha-black-10: #1118271a;
	--qc-alpha-black-20: #11182733;
	--qc-alpha-black-40: #11182766;
	--qc-alpha-black-60: #11182799;
	--qc-alpha-black-70: #111827b2;
	--qc-alpha-primary-10: #9117311a;
	--qc-alpha-primary-30: #9117314d;

	/* Spacing */
	--qc-spacing-none: 0;
	--qc-spacing-xxs: 0.125rem;
	--qc-spacing-xs: 0.25rem;
	--qc-spacing-sm: 0.375rem;
	--qc-spacing-md: 0.5rem;
	--qc-spacing-lg: 0.75rem;
	--qc-spacing-xl: 1rem;
	--qc-spacing-2xl: 1.25rem;
	--qc-spacing-3xl: 1.5rem;
	--qc-spacing-4xl: 2rem;
	--qc-spacing-5xl: 2.5rem;
	--qc-spacing-6xl: 3rem;
	--qc-spacing-7xl: 4rem;
	--qc-spacing-8xl: 5rem;

	/* Radius */
	--qc-radius-none: 0;
	--qc-radius-xs: 0.25rem;
	--qc-radius-sm: 0.375rem;
	--qc-radius-md: 0.5rem;
	--qc-radius-lg: 0.625rem;
	--qc-radius-xl: 0.75rem;
	--qc-radius-2xl: 1rem;
	--qc-radius-3xl: 1.25rem;
	--qc-radius-4xl: 1.5rem;
	--qc-radius-full: 9999px;

	/* Type ramp (size / line-height) */
	--qc-text-xxs: 0.625rem;
	--qc-text-xxs-lh: 1rem;
	--qc-text-xs: 0.75rem;
	--qc-text-xs-lh: 1.125rem;
	--qc-text-sm: 0.875rem;
	--qc-text-sm-lh: 1.375rem;
	--qc-text-md: 1rem;
	--qc-text-md-lh: 1.5rem;
	--qc-text-lg: 1.125rem;
	--qc-text-lg-lh: 1.75rem;
	--qc-text-xl: 1.25rem;
	--qc-text-xl-lh: 1.875rem;
	--qc-display-xs: 1.5rem;
	--qc-display-xs-lh: 2rem;
	--qc-display-sm: 1.875rem;
	--qc-display-sm-lh: 2.375rem;
	--qc-display-md: 2.25rem;
	--qc-display-md-lh: 2.75rem;
	--qc-display-lg: 3rem;
	--qc-display-lg-lh: 3.75rem;

	/* Font families — Cairo covers Latin and Arabic; the two names are kept
	   so locale-specific overrides stay possible without touching consumers. */
	--qc-font-family-base: "Cairo", system-ui, -apple-system, "Segoe UI", sans-serif;
	--qc-font-family-arabic: "Cairo", "Segoe UI", Tahoma, sans-serif;

	/* Back-compat aliases (older QC fragments/extensions) */
	--qc-brand-primary: var(--qc-primary-500);
	--qc-brand-primary-dark: var(--qc-primary-600);
}

/* ============================================================
   Dark mode — token overrides sourced from the Figma "Dark"
   variable mode (same token names, dark values). Applied when the
   accessibility panel sets data-theme="dark" on <html> (persisted
   in the qcTheme session cookie, re-applied pre-render by
   qc-head-hooks.js so there is no flash). Fragments that consume
   the --qc-* tokens flip automatically; fragments with hardcoded
   colors carry their own [data-theme="dark"] fallbacks.

   The gray ramp is mirrored (white <-> gray-900), so a fragment
   using --qc-white as a surface and --qc-gray-900 as text inverts
   correctly. Primary/gold hues are largely preserved for brand
   consistency; only their tint/shade steps change.
   ============================================================ */
:root[data-theme="dark"] {
	color-scheme: dark;

	/* Primary */
	--qc-primary-25: #490c1b;
	--qc-primary-50: #f4e7ea;
	--qc-primary-100: #530b1b;
	--qc-primary-200: #cd96a2;
	--qc-primary-300: #b76879;
	--qc-primary-400: #a13a50;
	--qc-primary-500: #911731;
	--qc-primary-600: #a13a50; /* hover lifts brighter in dark */
	--qc-primary-800: #580f2a;

	/* Gold */
	--qc-gold-50: #422c1b;
	--qc-gold-100: #533822;
	--qc-gold-200: #644328;
	--qc-gold-300: #744e2f;
	--qc-gold-500: #a66f43;
	--qc-gold-600: #855936;
	--qc-gold-950: #422c1b;

	/* Neutrals — ramp mirrored: white becomes the dark surface,
	   gray-900 becomes the light text color. */
	--qc-white: #1d1d1b;

	/* Was #f6f6f6 — the ONLY pair in the ramp that was not mirrored, so it
	   stayed at its light value and every gray-50 surface (section-index
	   panels, section-header icon tiles) rendered near-white on the #1d1d1b
	   page. The mirror rule (gray-50 <-> gray-800) gives #343432, which is
	   also what Figma's dark frames render. Fixed 2026-08-11 with story
	   129406; safe to correct in place because all four consumers alias it to
	   a local --*-panel var that they already re-point under
	   [data-theme="dark"], so nothing was reading this value in dark mode. */
	--qc-gray-50: #343432;
	--qc-gray-100: #4a4a49;
	--qc-gray-200: #6c6c6b;
	--qc-gray-300: #7c7b7b;
	--qc-gray-400: #a8a8a7;
	--qc-gray-500: #d0d0d0;
	--qc-gray-600: #dededd;
	--qc-gray-700: #ededed;
	--qc-gray-800: #f6f6f6;
	--qc-gray-900: #ffffff;

	/* Alpha — black overlays rebased on the dark ink; white overlays
	   unchanged; primary overlay made near-opaque as in Figma. */
	--qc-alpha-black-10: #1d1d1b1a;
	--qc-alpha-black-20: #1d1d1b33;
	--qc-alpha-black-40: #1d1d1b66;
	--qc-alpha-black-60: #1d1d1b99;
	--qc-alpha-black-70: #1d1d1bb2;
	--qc-alpha-primary-10: #911731e5;
	--qc-alpha-primary-30: #9117314d;
}

/* Page baseline in dark mode: dark surface + light text, so any area
   not explicitly styled by a fragment still reads correctly. */
:root[data-theme="dark"] body {
	background-color: var(--qc-white);
	color: var(--qc-gray-900);
}

/* Liferay's own base CSS paints #wrapper white and sets the dark body ink on
   it, and #wrapper sits ABOVE body in the stack — so in dark mode it covers
   the rule above with a white page and re-darkens the inherited text.

   It went unnoticed until the Media Center (2026-09-22) because every earlier
   QC page's section fragments paint their own surface edge to edge and hide
   #wrapper entirely. The Media Center sections are deliberately transparent
   and let the page surface show through, which is what exposed it.

   Scoped to dark mode, so light mode keeps Liferay's white wrapper, and
   harmless on the pages that cover it anyway. */
:root[data-theme="dark"] #wrapper {
	background-color: var(--qc-white);
	color: var(--qc-gray-900);
}

[dir="rtl"] body,
html[lang^="ar"] body {
	font-family: var(--qc-font-family-arabic);
}

/* QC:foundation — shared RTL/i18n helpers (sprint task T09). */

/* Directional icons (chevrons, arrows) do not mirror by themselves — tag
   them with .qc-rtl-flip. */
[dir="rtl"] .qc-rtl-flip {
	transform: scaleX(-1);
}

.qc-text-start {
	text-align: start;
}

.qc-text-end {
	text-align: end;
}

/* Standard vertical rhythm for stacked home-page sections (block axis only,
   direction-neutral by construction). */
.qc-section {
	padding-block: var(--qc-spacing-6xl);
}

@media (min-width: 992px) {
	.qc-section {
		padding-block: var(--qc-spacing-8xl);
	}
}

img {
	user-select: none;
	pointer-events: none;
	-webkit-user-drag: none;
}

/* QC:broken-image — ADO bug 139214. A failed <img> must show its alt text
   WITHOUT the browser's broken-image glyph beside it. qc-img-fallback.js tags
   the element; the overlay below covers the glyph and renders attr(alt) in its
   place. A broken replaced element still paints generated content, which is
   what makes this work; a plain `display: none` would take the alt text with
   it, which is the opposite of what the bug asks for. */

img[data-qc-img-broken] {
	position: relative;
	min-block-size: 1.5em;
	min-inline-size: 1.5em;
	/* Kill the glyph's own box metrics so the overlay lines up. */
	overflow: hidden;
}

img[data-qc-img-broken]::after {
	align-items: center;
	background: var(--qc-color-surface-subtle, #f1f1f1);
	color: var(--qc-color-text-secondary, #6b6b6b);
	content: attr(alt);
	display: flex;
	font-family: inherit;
	font-size: 0.875rem;
	inset: 0;
	justify-content: center;
	line-height: 1.3;
	overflow: hidden;
	padding-inline: 0.5em;
	position: absolute;
	text-align: center;
}

/* Decorative image (alt="" by design, or no alt at all): there is no text to
   show, so the whole element goes — an empty grey box would be worse than
   nothing. */
img[data-qc-img-broken][alt=""],
img[data-qc-img-broken]:not([alt]) {
	display: none;
}

/* reCAPTCHA Enterprise badge — not in Figma designs; hidden site-wide.
   Google ToS allows hiding the badge when the reCAPTCHA branding is
   disclosed in the Privacy Policy / Terms of Service (already linked
   in the footer bottom bar). */
.grecaptcha-badge {
	visibility: hidden !important;
	/* Hidden is not enough: the fixed 256px badge is parked at right:-186px
	   and still extends the scrollable area ~10px at 390px (Dark, EN/AR). Collapse
	   it so it contributes no overflow, while keeping it in the DOM. */
	width: 0 !important;
	height: 0 !important;
	overflow: hidden !important;
	pointer-events: none !important;
	right: 0 !important;
	left: auto !important;
}

/* ADO 136467: Chrome paints its own pale-yellow/grey fill when a value comes
   from autofill, which overrode the designed field background on Contact Us
   and every other form. The colour cannot be unset, so it is covered with an
   inset shadow the width of the field, and the long transition keeps it from
   flashing back on focus. */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active,
textarea:-webkit-autofill,
select:-webkit-autofill {
	-webkit-box-shadow: 0 0 0 1000px var(--qc-white, #ffffff) inset;
	-webkit-text-fill-color: var(--qc-gray-900, #1d1d1b);
	caret-color: var(--qc-gray-900, #1d1d1b);
	transition: background-color 100000s ease-in-out 0s;
}

:root[data-theme="dark"] input:-webkit-autofill,
:root[data-theme="dark"] input:-webkit-autofill:hover,
:root[data-theme="dark"] input:-webkit-autofill:focus,
:root[data-theme="dark"] textarea:-webkit-autofill,
:root[data-theme="dark"] select:-webkit-autofill {
	-webkit-box-shadow: 0 0 0 1000px var(--qc-white, #1d1d1b) inset;
	-webkit-text-fill-color: var(--qc-gray-900, #ffffff);
	caret-color: var(--qc-gray-900, #ffffff);
}

/* ------------------------------------------------------------------ *
 * Hide Liferay's OOTB locale-mismatch prompt
 * ("This page is displayed in X / Display the page in X / Set X as
 *  your preferred language").
 *
 * Rendered by the portal theme's user_locale_options.jsp whenever a
 * logged-in user's account language differs from the page language.
 * Emitted as two top-level <div dir> blocks: one holds the close (x)
 * button #ignoreUserLocaleOptions, and both carry update_language
 * links tagged showUserLocaleOptionsMessage=false. We suppress it
 * site-wide. Guests never see it, so this is a no-op for visitors.
 * ------------------------------------------------------------------ */
div:has(> .d-block > #ignoreUserLocaleOptions),
div:has(> a[href*="/portal/update_language"][href*="showUserLocaleOptionsMessage=false"]) {
	display: none !important;
}

/* ADO 143511: on DXP 2026.q1 the same message is delivered as a Clay
 * toast (.alert.alert-info in #ToastAlertContainer, "Info:"/"معلومات:").
 * The rule above only hid the two <div dir> blocks INSIDE it, leaving
 * an empty "Info:" box with a dead close button bottom-right of every
 * page for a staff user whose account language differs from the page.
 * Hide the whole alert, not just its body. Other toasts (license,
 * save results) carry no update_language link and are unaffected. */
.alert:has(a[href*="/portal/update_language"][href*="showUserLocaleOptionsMessage=false"]),
.alert:has(#ignoreUserLocaleOptions) {
	display: none !important;
}

/* ---------------------------------------------------------------------------
   Shared empty / no-results state (ADO 152849) — the Global Search design:
   a bordered 12px card, a 72px tinted circle with a document + magnifier, a
   24/700 title and 16/24 text. Every listing page builds this DOM:
     <div class="qc-empty"><span class="qc-empty__icon">svg</span>
       <h3 class="qc-empty__title"></h3><p class="qc-empty__text"></p></div>
   The doubled .qc-empty outranks a fragment's older single-class empty styles. */
.qc-empty.qc-empty {
	align-items: center;
	background: #fff;
	border: 1px solid #ededed;
	border-radius: 12px;
	box-sizing: border-box;
	color: #343432;
	display: flex;
	flex-direction: column;
	gap: 0;
	justify-content: center;
	min-height: 320px;
	padding: 48px 24px;
	text-align: center;
}

.qc-empty.qc-empty[hidden] {
	display: none;
}

.qc-empty .qc-empty__icon {
	align-items: center;
	background: #fbeaee;
	border-radius: 50%;
	color: #911731;
	display: flex;
	height: 72px;
	justify-content: center;
	margin: 0 0 20px;
	width: 72px;
}

.qc-empty .qc-empty__title {
	color: #343432;
	font-size: 24px;
	font-weight: 700;
	line-height: 32px;
	margin: 0 0 12px;
}

.qc-empty .qc-empty__text {
	color: #343432;
	font-size: 16px;
	line-height: 24px;
	margin: 0;
	max-width: 420px;
}

:root[data-theme='dark'] .qc-empty.qc-empty {
	background: #1d1d1b;
	border-color: rgba(255, 255, 255, 0.14);
}

:root[data-theme='dark'] .qc-empty .qc-empty__icon {
	background: rgba(145, 23, 49, 0.35);
	color: #fff;
}

:root[data-theme='dark'] .qc-empty .qc-empty__title,
:root[data-theme='dark'] .qc-empty .qc-empty__text {
	color: #f0f0ef;
}

/* ADO 151187 - a long option in a customizable <select> list was cut at the
   list's edge ("Standards & Specificatio", the Arabic "الحيوانات والحيوانات
   الأليفة"). Options wrap inside the list on every page that opts into
   appearance: base-select; native popups ignore these rules. */
@supports (appearance: base-select) {
	select option {
		overflow-wrap: anywhere;
		white-space: normal;
	}
}
