/*
Theme Name:   Astra Child
Theme URI:    https://wpastra.com/
Description:  Child theme for Astra. Put all custom styles and template overrides here so they survive parent theme updates.
Author:       Mohamed Dawaina
Version:      1.1.0
Template:     astra
License:      GNU General Public License v2 or later
License URI:  http://www.gnu.org/licenses/gpl-2.0.html
Text Domain:  astra-child
Tags:         custom-menu, e-commerce, full-width-template
*/

/* ==========================================================================
   O&Y brand tokens
   Sampled directly from logo-modern.png: the ring reads #114E61 and the
   Y-propeller reads #C99A2E. Every other value is derived from those two and
   checked to at least 4.5:1 against the ground it sits on.
   Astra's own palette carries the same values, so the Customizer stays the
   source of truth for anything it controls; these tokens cover the component
   details Astra has no control for.
   ========================================================================== */
:root {
	--oy-teal: #114e61;
	--oy-teal-dark: #0c3a49;
	--oy-ink: #0a2a35;
	--oy-gold: #c99a2e;
	--oy-gold-light: #e3b94a;
	--oy-gold-deep: #7a5c15;
	--oy-heading: #0e2e3a;
	--oy-body: #33454c;
	--oy-surface: #f4f7f9;
	--oy-border: #dbe4e8;
	--oy-white: #fff;
	--oy-footer-text: #c4d3d9;
	--oy-radius: 4px;
	--oy-transition: 0.2s ease;
}

/* --- Header ------------------------------------------------------------ */
/* The logo is a transparent PNG, so the bar is white and the mark supplies
   the colour. Icons are inline SVG and follow fill, not color. */
.ast-primary-header-bar .ast-builder-menu .menu-item > .menu-link {
	color: var(--oy-heading);
	transition: color var(--oy-transition);
}

/* Hover takes the logo's gold. Gold is 2.58:1 on the white header, so the
   underline carries the affordance rather than colour alone. */
.ast-primary-header-bar .ast-builder-menu .menu-item > .menu-link {
	position: relative;
}

.ast-primary-header-bar .ast-builder-menu .menu-item > .menu-link:hover,
.ast-primary-header-bar .ast-builder-menu .menu-item > .menu-link:focus-visible {
	color: var(--oy-gold);
}

.ast-primary-header-bar .ast-builder-menu .menu-item > .menu-link::after {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0.45em;
	height: 2px;
	background-color: var(--oy-gold);
	transform: scaleX(0);
	transition: transform var(--oy-transition);
}

.ast-primary-header-bar .ast-builder-menu .menu-item > .menu-link:hover::after,
.ast-primary-header-bar .ast-builder-menu .menu-item > .menu-link:focus-visible::after {
	transform: scaleX(1);
}

/* Current item: teal text at 9.19:1, heavier weight, and a persistent gold
   rule. Three cues so the active page reads without relying on colour. */
.ast-primary-header-bar .ast-builder-menu .menu-item.current-menu-item > .menu-link,
.ast-primary-header-bar .ast-builder-menu .menu-item.current-menu-ancestor > .menu-link,
.ast-primary-header-bar .ast-builder-menu .menu-item.current-menu-parent > .menu-link,
.ast-primary-header-bar .ast-builder-menu .menu-item.current_page_item > .menu-link {
	color: var(--oy-teal);
	font-weight: 700;
}

.ast-primary-header-bar .ast-builder-menu .menu-item.current-menu-item > .menu-link::after,
.ast-primary-header-bar .ast-builder-menu .menu-item.current-menu-ancestor > .menu-link::after,
.ast-primary-header-bar .ast-builder-menu .menu-item.current-menu-parent > .menu-link::after,
.ast-primary-header-bar .ast-builder-menu .menu-item.current_page_item > .menu-link::after {
	transform: scaleX(1);
	height: 3px;
}

/* Mobile menu panel: same states, no underline animation in a stacked list. */
.ast-mobile-popup-drawer .menu-item > .menu-link:hover,
.ast-mobile-popup-drawer .menu-item > .menu-link:focus-visible {
	color: var(--oy-gold);
}

.ast-mobile-popup-drawer .menu-item.current-menu-item > .menu-link {
	color: var(--oy-teal);
	font-weight: 700;
	border-inline-start: 3px solid var(--oy-gold);
	padding-inline-start: 0.75em;
}

.ast-primary-header-bar .ast-icon svg,
.ast-primary-header-bar .ast-button-wrap .menu-toggle .ast-mobile-svg {
	fill: var(--oy-heading);
	transition: fill var(--oy-transition);
}

.ast-primary-header-bar .ast-icon svg:hover {
	fill: var(--oy-teal);
}

/* Cart count sits on the gold accent for a spot of brand colour. */
.ast-site-header-cart .ast-cart-menu-wrap .count,
.ast-site-header-cart .ast-cart-menu-wrap .ast-count-icon,
.ast-cart-menu-wrap .ast-count-icon {
	background-color: var(--oy-gold);
	color: var(--oy-ink);
	font-weight: 700;
}

/* --- Buttons ----------------------------------------------------------- */
/* One button language across WooCommerce, Gutenberg/Spectra and Astra so the
   catalog and single-product pages stop disagreeing. */
.ast-button,
.button,
button,
input[type="submit"],
.wp-block-button__link,
.woocommerce a.button,
.woocommerce button.button,
.woocommerce input.button,
.woocommerce a.button.alt,
.woocommerce button.button.alt,
.woocommerce #respond input#submit {
	background-color: var(--oy-teal);
	border: 2px solid var(--oy-teal);
	color: var(--oy-white);
	border-radius: var(--oy-radius);
	font-weight: 600;
	transition: background-color var(--oy-transition), border-color var(--oy-transition), color var(--oy-transition);
}

.ast-button:hover,
.button:hover,
button:hover,
input[type="submit"]:hover,
.wp-block-button__link:hover,
.woocommerce a.button:hover,
.woocommerce button.button:hover,
.woocommerce input.button:hover,
.woocommerce a.button.alt:hover,
.woocommerce button.button.alt:hover,
.woocommerce #respond input#submit:hover,
.ast-button:focus-visible,
.button:focus-visible,
.woocommerce a.button:focus-visible {
	background-color: var(--oy-teal-dark);
	border-color: var(--oy-teal-dark);
	color: var(--oy-white);
}

/* Secondary / outline variant. */
.wp-block-button.is-style-outline .wp-block-button__link,
.woocommerce a.button.wc-backward,
.ast-outline-button {
	background-color: transparent;
	border: 2px solid var(--oy-teal);
	color: var(--oy-teal);
}

.wp-block-button.is-style-outline .wp-block-button__link:hover,
.woocommerce a.button.wc-backward:hover,
.ast-outline-button:hover {
	background-color: var(--oy-teal);
	color: var(--oy-white);
}

/* Checkout's primary action carries the gold accent to mark it as the goal. */
.woocommerce #payment #place_order,
.woocommerce-checkout .wc-block-components-checkout-place-order-button {
	background-color: var(--oy-gold);
	border-color: var(--oy-gold);
	color: var(--oy-ink);
}

.woocommerce #payment #place_order:hover,
.woocommerce-checkout .wc-block-components-checkout-place-order-button:hover {
	background-color: var(--oy-gold-light);
	border-color: var(--oy-gold-light);
	color: var(--oy-ink);
}

/* --- Links and headings ------------------------------------------------ */
.entry-content a:not(.button):not(.wp-block-button__link):not(.ast-button) {
	color: var(--oy-teal);
	text-decoration-color: rgba(17, 78, 97, 0.4);
	text-underline-offset: 2px;
}

.entry-content a:not(.button):not(.wp-block-button__link):not(.ast-button):hover {
	color: var(--oy-teal-dark);
	text-decoration-color: currentColor;
}

h1, h2, h3, h4, h5, h6,
.entry-title,
.woocommerce div.product .product_title {
	color: var(--oy-heading);
}

/* --- WooCommerce accents ----------------------------------------------- */
.woocommerce span.onsale,
.woocommerce ul.products li.product .onsale {
	background-color: var(--oy-gold);
	color: var(--oy-ink);
	font-weight: 700;
}

.woocommerce div.product p.price,
.woocommerce div.product span.price,
.woocommerce ul.products li.product .price {
	color: var(--oy-teal);
	font-weight: 700;
}

.woocommerce .star-rating span::before,
.woocommerce p.stars a::before {
	color: var(--oy-gold);
}

.woocommerce-message,
.woocommerce-info {
	border-top-color: var(--oy-teal);
}

.woocommerce-message::before,
.woocommerce-info::before {
	color: var(--oy-teal);
}

.woocommerce-error {
	border-top-color: var(--oy-gold-deep);
}

/* Form focus states need a visible brand-coloured ring for keyboard users. */
.woocommerce form .form-row input.input-text,
.woocommerce form .form-row textarea,
.woocommerce form .form-row select,
input[type="text"], input[type="email"], input[type="tel"],
input[type="password"], input[type="search"], input[type="number"],
textarea, select {
	border: 1px solid var(--oy-border);
	border-radius: var(--oy-radius);
}

.woocommerce form .form-row input.input-text:focus,
.woocommerce form .form-row textarea:focus,
.woocommerce form .form-row select:focus,
input:focus, textarea:focus, select:focus {
	border-color: var(--oy-teal);
	outline: 2px solid rgba(17, 78, 97, 0.25);
	outline-offset: 1px;
}

/* Coupon field and its button share a height so they line up. */
.woocommerce .cart .coupon input.input-text,
.woocommerce .cart .coupon .button,
#ast-apply-coupon {
	height: 44px;
	line-height: 1;
	vertical-align: middle;
	box-sizing: border-box;
}

/* --- Footer ------------------------------------------------------------ */
/* Deep brand ink; every foreground below is checked against it. */
.site-footer .ast-builder-grid-row-container,
.site-footer .site-primary-footer-wrap,
.site-footer .site-below-footer-wrap,
.site-footer .site-above-footer-wrap {
	color: var(--oy-footer-text);
}

.site-footer h1, .site-footer h2, .site-footer h3,
.site-footer h4, .site-footer h5, .site-footer h6,
.site-footer .widget-title {
	color: var(--oy-white);
}

.site-footer a {
	color: var(--oy-footer-text);
	transition: color var(--oy-transition);
}

.site-footer a:hover,
.site-footer a:focus-visible {
	color: var(--oy-gold-light);
}

.site-footer .ast-builder-social-element svg {
	fill: var(--oy-footer-text);
	transition: fill var(--oy-transition);
}

.site-footer .ast-builder-social-element:hover svg {
	fill: var(--oy-gold-light);
}

/* --- Accessibility ----------------------------------------------------- */
a:focus-visible,
button:focus-visible,
.button:focus-visible {
	outline: 2px solid var(--oy-gold);
	outline-offset: 2px;
}

/* ==========================================================================
   Mobile overflow guards
   WooCommerce account/cart tables are fixed multi-column layouts and the
   product gallery is width-driven, so both can push the viewport sideways on
   narrow screens. Confine the scroll to the element.
   ========================================================================== */
@media (max-width: 768px) {
	.woocommerce-account .woocommerce-orders-table,
	.woocommerce-account .woocommerce-MyAccount-content table,
	.woocommerce-cart-form__contents,
	.shop_table {
		display: block;
		width: 100%;
		overflow-x: auto;
		-webkit-overflow-scrolling: touch;
	}

	.woocommerce div.product div.images,
	.woocommerce div.product div.images .woocommerce-product-gallery__wrapper,
	.woocommerce-product-gallery {
		max-width: 100%;
		overflow-x: hidden;
	}

	.woocommerce div.product div.images img {
		max-width: 100%;
		height: auto;
	}
}

/* Nothing should be able to scroll the page body sideways. */
body {
	overflow-x: hidden;
}

/* ==========================================================================
   Saudi Riyal symbol (U+20C1)
   Encoded in Unicode 17.0 (Sept 2025). Lato has no glyph for it, so it is
   served from a single-glyph webfont scoped with `unicode-range` — the browser
   uses this face ONLY for U+20C1 and every other character still renders in
   Lato. That scoping is what keeps the rest of the typography untouched.
   Font: Saudi-Riyal-Font by Emran Alhaddad, SIL Open Font License 1.1.
   https://github.com/emran-alhaddad/Saudi-Riyal-Font
   ========================================================================== */
@font-face {
	font-family: "SaudiRiyal";
	src: url("assets/fonts/saudi_riyal.woff2") format("woff2"),
	     url("assets/fonts/saudi_riyal.woff") format("woff");
	font-weight: 400;
	font-style: normal;
	font-display: swap;
	unicode-range: U+20C1;
}

/* Mirrors Astra's own body selector list so the face is in scope wherever a
   price can appear. Harmless elsewhere: unicode-range limits it to one char. */
body,
button,
input,
select,
textarea,
.wp-block-button__link,
.woocommerce-Price-amount,
.woocommerce-Price-currencySymbol {
	font-family: "SaudiRiyal", "Lato", sans-serif;
}

/* Sized up per request. `line-height: 1` keeps the taller glyph from stretching
   the line box, and the inline-block stops it affecting the number's baseline. */
.woocommerce-Price-currencySymbol {
	font-size: 1.5em;
	line-height: 1;
	display: inline-block;
	vertical-align: baseline;
}

/* --- Header separation + hero CTA ---------------------------------------- */
/* Header is opaque white (Customizer); this just divides it from the hero. */
.ast-primary-header-bar,
.ast-sticky-active .ast-primary-header-bar {
	border-bottom: 1px solid var(--oy-border);
	box-shadow: 0 1px 3px rgba(10, 42, 53, .06);
}

/* Spectra sets these buttons with inline custom properties, so the override
   has to beat its class rule on specificity rather than redefine the var. */
.home .wp-block-spectra-button[aria-label="Shop Now"],
.home .wp-block-spectra-button[aria-label="Shop Now"] .spectra-button__link {
	background-color: var(--oy-teal);
	border-color: var(--oy-teal);
	color: var(--oy-white);
}

.home .wp-block-spectra-button[aria-label="Shop Now"]:hover,
.home .wp-block-spectra-button[aria-label="Shop Now"]:focus-visible,
.home .wp-block-spectra-button[aria-label="Shop Now"]:hover .spectra-button__link {
	background-color: var(--oy-teal-dark);
	border-color: var(--oy-teal-dark);
	color: var(--oy-white);
}

/* ==========================================================================
   Footer
   Ground is the brand ink (Customizer); this sets the typographic rhythm and
   the states Astra has no control for. All colours come from the tokens above.
   ========================================================================== */
.site-footer .footer-widget-area h4,
.site-footer .widget-title {
	font-size: 0.95rem;
	font-weight: 600;
	letter-spacing: .04em;
	text-transform: uppercase;
	color: var(--oy-white);
	margin: 0 0 1rem;
	padding-bottom: .6rem;
	border-bottom: 1px solid rgba(255, 255, 255, .12);
}

.site-footer .footer-widget-area p {
	font-size: .92rem;
	line-height: 1.75;
}

/* Links sit quiet until hovered, then take the logo's gold. */
.site-footer a {
	text-decoration: none;
	transition: color var(--oy-transition);
}

.site-footer a:hover,
.site-footer a:focus-visible {
	color: var(--oy-gold-light);
}

/* The mark is teal-on-transparent; lift it slightly off the dark ground. */
.site-footer .wp-block-image img {
	max-width: 150px;
	height: auto;
}

/* Social row: outlined chips rather than bare glyphs. */
.site-footer .ast-builder-social-element {
	border: 1px solid rgba(255, 255, 255, .18);
	border-radius: 50%;
	width: 36px;
	height: 36px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	transition: border-color var(--oy-transition), background-color var(--oy-transition);
}

.site-footer .ast-builder-social-element:hover {
	border-color: var(--oy-gold-light);
	background-color: rgba(227, 185, 74, .12);
}

.site-footer .ast-builder-social-element svg {
	fill: var(--oy-footer-text);
}

.site-footer .ast-builder-social-element:hover svg {
	fill: var(--oy-gold-light);
}

/* Separate the copyright strip from the columns above it. */
.site-footer .site-below-footer-wrap {
	border-top: 1px solid rgba(255, 255, 255, .12);
}

.site-footer .ast-footer-copyright p {
	font-size: .85rem;
	opacity: .85;
}

@media (max-width: 768px) {
	.site-footer .footer-widget-area {
		text-align: center;
		margin-bottom: 1.75rem;
	}
	.site-footer .footer-widget-area h4 {
		border-bottom: none;
		padding-bottom: .2rem;
	}
	.site-footer .wp-block-image { display: flex; justify-content: center; }
}

/* Astra emits a per-widget-area rule that hard-codes --ast-global-color-3
   (#33454c, the light-background body colour) onto the footer columns. That is
   1.50:1 on the footer ink and effectively invisible. The Customizer's
   footer-widget-N-content-color does not reliably override it, so it is pinned
   here. Attribute selector matches Astra's own specificity; the extra class
   wins the cascade. */
.site-footer .footer-widget-area[data-section].footer-widget-area-inner,
.site-footer .footer-widget-area[data-section] .footer-widget-area-inner {
	color: var(--oy-footer-text);
}

.site-footer .footer-widget-area[data-section] .footer-widget-area-inner a,
.site-footer .footer-widget-area[data-section].footer-widget-area-inner a {
	color: var(--oy-footer-text);
}

.site-footer .footer-widget-area[data-section] .footer-widget-area-inner a:hover,
.site-footer .footer-widget-area[data-section].footer-widget-area-inner a:hover,
.site-footer .footer-widget-area[data-section] .footer-widget-area-inner a:focus-visible {
	color: var(--oy-gold-light);
}

/* --- Footer RTL alignment ------------------------------------------------
   Astra writes `text-align: left` onto every footer widget area regardless of
   direction, so the Arabic footer reads left-aligned against an RTL layout.
   Flip it for RTL only, above the mobile breakpoint where the columns are
   deliberately centred. */
@media (min-width: 769px) {
	html[dir="rtl"] .site-footer .footer-widget-area[data-section],
	html[dir="rtl"] .site-footer .footer-widget-area[data-section] .footer-widget-area-inner,
	body.rtl .site-footer .footer-widget-area[data-section],
	body.rtl .site-footer .footer-widget-area[data-section] .footer-widget-area-inner {
		text-align: right;
	}

	/* The logo is a block-level figure, so text-align does not move it.
	   Logical margins push it to the inline-start edge, which resolves to the
	   right in RTL and the left in LTR without a direction-specific rule. */
	.site-footer .wp-block-image {
		width: fit-content;
		margin-inline-start: 0;
		margin-inline-end: auto;
	}

	/* Keep the heading rule running the full column width in both directions. */
	html[dir="rtl"] .site-footer .footer-widget-area h4,
	body.rtl .site-footer .footer-widget-area h4 {
		text-align: right;
	}

	/* Copyright and social row follow the same direction. */
	html[dir="rtl"] .site-footer .ast-footer-copyright,
	body.rtl .site-footer .ast-footer-copyright {
		text-align: right;
	}
}

/* ==========================================================================
   Product grid cards (New Arrivals / Best Sellers)
   WooCommerce block grid. The block's own CSS already makes each card a flex
   column and spaces the cards with transparent borders, so don't set a border
   or a container gap here — either one kills the gutters.
   ========================================================================== */
.wc-block-grid__product-link {
	text-decoration: none;
}

.wc-block-grid__product-image {
	margin: 0 0 0.85rem;
}

/* Clamped to two lines so the price and button line up across a row even when
   one name is longer than the others. */
.wc-block-grid__product-title {
	font-size: 1.05rem;
	font-weight: 600;
	line-height: 1.4;
	color: var(--oy-heading);
	margin: 0 0 0.5rem;
	min-height: 2.8em;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	transition: color var(--oy-transition);
}

.wc-block-grid__product-link:hover .wc-block-grid__product-title,
.wc-block-grid__product-link:focus-visible .wc-block-grid__product-title {
	color: var(--oy-teal);
}

.wc-block-grid__product-price {
	font-size: 1rem;
	font-weight: 700;
	color: var(--oy-teal);
	margin-bottom: 0.9rem;
}

/* A struck original beside a sale price has to recede. */
.wc-block-grid__product-price del {
	color: var(--oy-body);
	font-weight: 400;
	opacity: 0.7;
	margin-inline-end: 0.4rem;
}

.wc-block-grid__product-price ins {
	text-decoration: none;
	color: var(--oy-teal);
}

/* Pin the action to the card's base so buttons share one baseline. */
.wc-block-grid__product .wc-block-grid__product-add-to-cart {
	margin-top: auto;
}

.wc-block-grid__product .wc-block-grid__product-add-to-cart .wp-block-button__link {
	display: block;
	width: 100%;
	background-color: var(--oy-gold);
	border: 2px solid var(--oy-gold);
	color: var(--oy-ink);
	font-weight: 700;
	font-size: 0.82rem;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	padding: 0.7rem 1rem;
	border-radius: var(--oy-radius);
	transition: background-color var(--oy-transition), border-color var(--oy-transition);
}

.wc-block-grid__product .wc-block-grid__product-add-to-cart .wp-block-button__link:hover,
.wc-block-grid__product .wc-block-grid__product-add-to-cart .wp-block-button__link:focus-visible {
	background-color: var(--oy-gold-light);
	border-color: var(--oy-gold-light);
	color: var(--oy-ink);
}

/* Gold is the button's colour now, so the sale flash moves to teal. */
.wc-block-grid__product-onsale {
	background-color: var(--oy-teal);
	color: var(--oy-white);
	border: 0;
	font-weight: 700;
	font-size: 0.72rem;
	letter-spacing: 0.04em;
	padding: 0.3em 0.7em;
	border-radius: 2px;
	min-width: 0;
	line-height: 1.4;
}

@media (max-width: 544px) {
	.wc-block-grid__product-title {
		font-size: 1rem;
		min-height: 0;
	}
}
