/*
Theme Name: Aljadawel 2026
Theme URI: https://www.aljadawel.sa/
Author: Dar Al Jadawel Publishing
Description: Editorial catalogue theme for Dar Al Jadawel Publishing & Distribution. University textbooks with digital activation codes, university B2B portals, and Saudi e-invoicing. Bidirectional from a single stylesheet; no CSS framework and no build step.
Version: 0.1.0
Requires at least: 6.4
Tested up to: 6.9
Requires PHP: 8.1
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: aljadawel-2026
Tags: rtl-language-support, translation-ready, e-commerce, custom-colors
WC requires at least: 8.0
WC tested up to: 10.9
*/

/**
 * Base layer only. Tokens live in assets/css/tokens.css; components in
 * assets/css/*.css. Everything is written with LOGICAL properties
 * (margin-inline, padding-block, inset-inline, text-align: start) so Arabic RTL
 * and English LTR both render correctly from this one file. There is no rtl.css
 * and no direction-flipping library - adding either would be a regression.
 */

/* ---- Reset ------------------------------------------------------------- */

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

body,
h1, h2, h3, h4, h5, h6,
p, figure, blockquote, dl, dd {
	margin: 0;
}

html {
	-webkit-text-size-adjust: 100%;
	text-size-adjust: 100%;
}

body {
	margin: 0;
	background-color: var(--jd-paper);
	color: var(--jd-ink);
	font-family: var(--jd-font-ui);
	font-size: var(--jd-fs-base);
	line-height: var(--jd-lh-body);
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

img,
picture,
svg,
video {
	display: block;
	max-inline-size: 100%;
	block-size: auto;
}

input,
button,
textarea,
select {
	font: inherit;
	color: inherit;
}

ul,
ol {
	margin: 0;
	padding: 0;
	list-style: none;
}

/* ---- Typography -------------------------------------------------------- */

h1, h2, h3, h4 {
	font-family: var(--jd-font-display);
	font-weight: 700;
	line-height: var(--jd-lh-title);
	color: var(--jd-navy);
}

h1 {
	font-size: var(--jd-fs-display);
}

/**
 * Latin runs inside Arabic text.
 *
 * Book titles, ISBNs, prices and activation codes stay Latin-script on an RTL page.
 * The prototype does this with 153 surgical dir="ltr" spans; these classes are the
 * reusable equivalent. `unicode-bidi: isolate` is what stops a Latin run from
 * reordering the Arabic around it.
 */
.jd-latin {
	font-family: var(--jd-font-latin);
	direction: ltr;
	unicode-bidi: isolate;
	text-align: start;
}

.jd-mono {
	font-family: var(--jd-font-mono);
	font-variant-numeric: tabular-nums;
	direction: ltr;
	unicode-bidi: isolate;
}

/* A price is one Latin run, so it is read left-to-right like .jd-mono above.
 *
 * wc_price() decides where the currency symbol goes from the store's own
 * woocommerce_currency_pos setting, and it expresses that decision as DOM order: symbol
 * before the number for "left", after it for "right". Inside an RTL block the bidi
 * algorithm then lays those two runs right-to-left and the rendered order comes out
 * reversed - the store is set to "right", yet catalogue cards and the invoice table drew
 * the riyal mark on the left of every figure, while the product page and the invoice
 * totals drew it on the right. Same markup, opposite results, decided by whichever
 * container happened to carry a direction.
 *
 * Isolating each amount as LTR makes the rendered order equal the DOM order everywhere,
 * which is to say it makes every price follow the WooCommerce setting - including if that
 * setting is ever changed to a left position, since then the symbol is emitted first and
 * still renders first. It sets no position of its own.
 *
 * `isolate` also keeps the price from re-ordering the Arabic text around it.
 */
.woocommerce-Price-amount {
	direction: ltr;
	unicode-bidi: isolate;
}

/* Bibliographic line: "Publisher · ISBN 978…" - 10.5px/.08em = the .84px tracking measured
 * on every biblio row of screen 01 (docs/design/01-home.md el.113-117). */
.jd-biblio {
	font-size: var(--jd-fs-3xs);
	letter-spacing: var(--jd-track-biblio);
	color: var(--jd-text-secondary);
}

/*
 * Section kickers and eyebrow labels. 400, not 600, and never uppercased: the prototype
 * sets text-transform: none on all four of screen 01's labels, and uppercasing is
 * meaningless for Arabic while it damages the Latin ones (docs/design/01-home.md el.105).
 */
.jd-label {
	font-size: var(--jd-fs-3xs);
	font-weight: 400;
	letter-spacing: var(--jd-track-label);
	text-transform: none;
	color: var(--jd-text-secondary);
}

/* ---- Layout ------------------------------------------------------------ */

.jd-container {
	inline-size: 100%;
	max-inline-size: var(--jd-container);
	margin-inline: auto;
	padding-inline: var(--jd-gutter);
}

.jd-container--wide {
	max-inline-size: var(--jd-container-wide);
}

/* Section separators are hairlines, never arbitrary whitespace. */
.jd-rule {
	border: 0;
	border-block-start: var(--jd-border);
	margin-block: var(--jd-space-16);
}

/* ---- Links & focus ----------------------------------------------------- */

a {
	color: var(--jd-navy);
	text-decoration: none;
	transition: color var(--jd-transition);
}

a:hover {
	color: var(--jd-navy-700);
	text-decoration: underline;
	text-underline-offset: 4px;
}

/**
 * Focus ring. :focus-visible only, so pointer users never see it but keyboard
 * users always do. Never remove this without a replacement - it is the primary
 * keyboard affordance on every interactive element in the theme.
 */
:focus-visible {
	outline: 2px solid var(--jd-navy);
	outline-offset: 2px;
	border-radius: var(--jd-radius-xs);
}

/* ---- Accessibility helpers -------------------------------------------- */

.screen-reader-text {
	position: absolute !important;
	inline-size: 1px;
	block-size: 1px;
	padding: 0;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

.skip-link:focus {
	position: fixed;
	inset-block-start: var(--jd-space-4);
	inset-inline-start: var(--jd-space-4);
	z-index: 999;
	padding: var(--jd-space-5) var(--jd-space-8);
	background-color: var(--jd-surface);
	border: var(--jd-border);
	border-radius: var(--jd-radius-btn);
	clip-path: none;
	inline-size: auto;
	block-size: auto;
}

/* Touch targets stay at or above 44px, per the QA gate. */
.jd-btn,
.jd-icon-btn {
	min-block-size: 44px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: var(--jd-space-4);
	border-radius: var(--jd-radius-btn);
	cursor: pointer;
	transition: background-color var(--jd-transition), border-color var(--jd-transition);
}

.jd-btn--primary {
	background-color: var(--jd-navy);
	color: var(--jd-on-navy);
	border: 1px solid var(--jd-navy);
	padding-inline: var(--jd-space-12);
	font-weight: 600;
}

.jd-btn--primary:hover {
	background-color: var(--jd-navy-700);
	border-color: var(--jd-navy-700);
	color: var(--jd-on-navy);
	text-decoration: none;
}

.jd-btn--hairline {
	background-color: transparent;
	color: var(--jd-navy);
	border: var(--jd-border);
	padding-inline: var(--jd-space-12);
}

.jd-btn--hairline:hover {
	border-color: var(--jd-hairline-strong);
	text-decoration: none;
}

/* ---- Tags ---------------------------------------------------------------
 *
 * One definition, here, because the tag is a shared atom and its two surface sheets do not
 * cover the same screens: catalog.css reaches 01/02/03/04 (enqueue.php:76 shop and product
 * taxonomies, :118 is_product(), :140 is_front_page()) and commerce.css reaches 09/20/22/404.
 * It lived in both, byte for byte, kept in sync by hand. style.css is enqueued unconditionally
 * as aljadawel2026-base (enqueue.php:68) and already houses .jd-btn for the same reason.
 *
 * padding-block is a 3px LITERAL, not --jd-space-1. The prototype hardcodes `padding:'3px 10px'`
 * (store.dc.html:2137 tagBase, :2419 stChip) and the scale has no 3px step - tokens.css's own
 * header forbids snapping a measured value to the nearest step. --jd-space-1 is 2px, and that
 * 2px rendered every tag on every screen 2px short of its measured box.
 * [el.66 wrapper 100×27 pad 3/10, radius 4 · el.47 74×27 · el.48 11px/1.7 500 ls .05em #1b5e43
 *  · el.67 print #18295e] */
.jd-tag {
	display: inline-flex;
	align-items: center;
	font-size: 11px;
	font-weight: 500;
	line-height: 1.7;
	letter-spacing: .05em;
	padding: 3px var(--jd-space-5);
	border-radius: var(--jd-radius-tag);
	border: 1px solid currentColor;
	white-space: nowrap;
}

/* Emerald is reserved for digital/instant identity and used nowhere else. The print tag is
 * navy, not secondary grey - it names a shipping method, not a caption (el.177/194/211). */
.jd-tag--digital { color: var(--jd-emerald); }
.jd-tag--print   { color: var(--jd-navy); }

/* ---- The theme's button must beat WooCommerce's ------------------------------
 *
 * Almost every WooCommerce button on this site already carries .jd-btn - the theme's own
 * templates put it there (myaccount/form-login.php, cart/proceed-to-checkout-button.php,
 * sms-global/*.php). It simply never won. WooCommerce ships
 *
 *   .woocommerce:where(body:not(.woocommerce-block-theme-has-button-styles)) button.button.alt
 *
 * and :where() contributes NO specificity, so that computes to 0,3,1 against
 * .jd-btn--primary's 0,1,0. The result was the checkout button rendering in #7f54b3
 * purple and the My Account login and register buttons in #e9e6ed grey, on pages whose
 * markup was already asking for navy.
 *
 * These are 0,4,0. Every WooCommerce button carries .button, so that class is the fourth
 * - and requiring it is what keeps this narrow: a .jd-btn outside WooCommerce (404 page,
 * universities) is untouched and still styled by the base rules above.
 *
 * This is deliberately NOT WooCommerce's own opt-out body class. That would strip the
 * default skin from every WooCommerce button site-wide, including ones no theme template
 * touches - the OTP screen's `إرسال` is plain `button alt` from sms-global-services - and
 * those would render bare rather than merely off-palette.
 */
.woocommerce .jd-btn.jd-btn--primary.button,
.woocommerce-page .jd-btn.jd-btn--primary.button {
	background-color: var(--jd-navy);
	border: 1px solid var(--jd-navy);
	border-radius: var(--jd-radius-btn);
	color: var(--jd-on-navy);
	font-weight: 600;
}

.woocommerce .jd-btn.jd-btn--primary.button:hover,
.woocommerce-page .jd-btn.jd-btn--primary.button:hover {
	background-color: var(--jd-navy-700);
	border-color: var(--jd-navy-700);
	color: var(--jd-on-navy);
}

.woocommerce .jd-btn.jd-btn--hairline.button,
.woocommerce-page .jd-btn.jd-btn--hairline.button {
	background-color: transparent;
	border: var(--jd-border);
	border-radius: var(--jd-radius-btn);
	color: var(--jd-navy);
	font-weight: 600;
}

.woocommerce .jd-btn.jd-btn--hairline.button:hover,
.woocommerce-page .jd-btn.jd-btn--hairline.button:hover {
	background-color: transparent;
	border-color: var(--jd-hairline-strong);
	color: var(--jd-navy);
}

/* Cards deepen their hairline on hover. They never lift and never gain a shadow. */
.jd-card {
	background-color: var(--jd-surface);
	border: var(--jd-border);
	border-radius: var(--jd-radius-card);
	transition: border-color var(--jd-transition);
}

.jd-card:hover {
	border-color: var(--jd-hairline-strong);
}
