/* ================================================
   AMOTZ WIDGETS — shared base
   ================================================
   Rules every section relies on. Section-specific styling lives in its own file next to
   this one; nothing here should describe a single section.

   Depends on amotz-tokens.css for the variables.
   ================================================ */

/* ------------------------------------------------
   RTL — READ THIS BEFORE TOUCHING ANY LAYOUT RULE
   ------------------------------------------------
   The site's WordPress language is en_US, so <html> carries lang="en-US" and NO dir. That
   means core, Elementor and WooCommerce do not load their RTL stylesheets, and nothing
   above these widgets establishes right-to-left.

   So each widget declares `dir="rtl"` on its own <section> and the direction is inherited
   from there down. That is a deliberate decision, not a workaround for a missing setting:
   these sections are self-contained bands that must render correctly whatever the host page
   does, including inside the Elementor editor's LTR chrome.

   WHAT THIS BUYS, AND WHAT IT DOES NOT:
     ✓ text direction, punctuation and number/bidi ordering inside the section
     ✓ flex/grid row order — `flex-direction: row` fills right-to-left, matching the design
     ✓ every LOGICAL property below (margin-inline, padding-inline, inset-inline, text-align
       start/end) resolves mirrored, for free
     ✗ Elementor's own widget CSS, WooCommerce templates and core blocks — those still lay
       out LTR, because they sit outside our sections

   THE TRAP, and it is the one that bites hardest on this kind of design:
   Figma's canvas is LTR. A row that reads left-to-right in the design file lays out
   RIGHT-to-left once it is inside dir="rtl". So when you transcribe a row of cards, icons
   or columns from Figma, the FIRST child in the Figma tree is the RIGHTMOST on screen. Do
   not "fix" a mirrored row by reversing the markup — check the design's own reading order
   first, because in Hebrew the rightmost item usually IS the first one.

   Use LOGICAL properties (margin-inline-start, padding-inline-end, inset-inline-start) for
   anything that should mirror, and PHYSICAL ones (left/right, `to right`) only where the
   design's asymmetry is tied to the canvas rather than to the reading direction — the gold
   gradient in amotz-tokens.css is the standing example. */
.az-section {
	box-sizing: border-box;
	width: 100%;
	max-width: 100%;
	margin-inline: auto;
	font-family: var(--az-font-body);
	/* Belt to the dir="rtl" attribute's braces. The attribute is what browsers and
	   assistive tech read for bidi; this makes the same statement to the cascade so a
	   parent theme rule setting `direction: ltr` cannot silently win. */
	direction: rtl;
	text-align: start;
}

/* Latin runs inside Hebrew copy — a URL, "PhD", "Stanford", a price — must not be dragged
   out of place by the bidi algorithm. Wrapping them in .az-ltr isolates them so they read
   correctly without flipping the sentence around them. */
.az-section .az-ltr {
	direction: ltr;
	unicode-bidi: isolate;
}

.az-section *,
.az-section *::before,
.az-section *::after {
	box-sizing: inherit;
}

/* Hello Elementor sets no margin reset on headings inside widgets. Each section positions
   its own type, so zero them once here rather than in every section file. */
.az-section h1,
.az-section h2,
.az-section h3,
.az-section h4,
.az-section p {
	margin: 0;
}

/* ------------------------------------------------
   WHY EVERY IMAGE RULE IS PREFIXED WITH `.az-section`
   ------------------------------------------------
   DO NOT "TIDY" `.az-section .az-hero__author-avatar` BACK DOWN TO `.az-hero__author-avatar`.
   The prefix is load-bearing.

   Elementor's frontend stylesheet carries a blanket image reset:

       .elementor img { border:none; border-radius:0; box-shadow:none; height:auto; max-width:100% }

   That selector is specificity (0,1,1) — one class plus one element. Every rule of ours that
   targets an image by its own class is (0,1,0), so Elementor wins on specificity AND, because
   its sheet loads after ours, on document order too. The result is silent and looks like a
   design error rather than a cascade one:

     · `border-radius: 50%` on an avatar is discarded, and the circle renders SQUARE
     · `height: 100%` becomes `height: auto`, so an image inside a fixed-height box collapses
       to its own aspect ratio and leaves a gap under it

   Both of those shipped in the first build and were caught from screenshots, not from code.

   Adding `.az-section ` takes each rule to (0,2,0) or (0,2,1), which outranks Elementor's
   reset without a single `!important`. Any NEW rule that styles an <img> needs the same
   prefix — `object-fit` and `max-width` survive on their own, but `height`, `border-radius`,
   `border` and `box-shadow` do not.

   An image positioned `absolute` with `inset: 0` is immune to the height half of this, since
   top and bottom both being 0 resolves the height regardless — which is why some sections
   looked fine and others did not, and why the bug was easy to misread as isolated. */

/* ------------------------------------------------
   THE CONTENT COLUMN  —  --az-edge
   ------------------------------------------------
   The design is a 1440px frame with 60px gutters, i.e. a 1320px content column. Those two
   descriptions are the SAME THING at 1440 and completely different anywhere else, which is
   how the page came apart on a wide monitor:

     · sections that centred a `max-width: 1320px` column stayed in the middle
     · sections that just used `padding-inline: 60px` pushed their content to the SCREEN edge

   So the research headline flew to the far right of a 2560px display while its card stayed
   centred a few hundred pixels away — in the comp they share one right edge.

   `--az-edge` is the gutter that keeps both descriptions true at every width: 60px until the
   viewport exceeds 1440, then whatever is needed to centre a 1320 column. Use it as the
   horizontal padding on any band whose content is aligned to a GUTTER rather than centred in
   a max-width wrapper.

   `100%` resolves against the element the variable is USED on, so only apply it to elements
   that span the full band. */
.az-section {
	--az-edge: max(60px, calc((100% - 1320px) / 2));
}

/* ------------------------------------------------
   FOCUS RING FOR THE CAROUSEL BUTTONS
   ------------------------------------------------
   Every paging button carries `data-az-carousel`, so one rule covers the curriculum, research
   and bonus navs without repeating it per section.

   Without this the browser draws its OWN ring, which on some engines is a red/crimson outline
   — it looked like a design error on the white button and is not a colour that appears
   anywhere in this palette. Overriding it makes the focused state intentional and on-brand.

   `:focus-visible`, not `:focus` — a mouse click should not leave a ring behind, but keyboard
   users still need to see where they are. */
/* STRIP THE NATIVE BUTTON CHROME.
   These are <button> elements, so the browser brings its own appearance with them. The ring
   that showed as RED around the white paging button was on a `disabled` button — which cannot
   take focus, so it was never a focus ring. It is the user-agent's own disabled-button
   styling coming through, and `appearance: none` is what removes it.

   NO `border` DECLARATION HERE, deliberately. This selector is (0,2,0) — one class plus an
   attribute — while the bonus section's own buttons are only (0,1,0) (`.az-bonus__prev`). A
   border set here would outrank theirs no matter the load order and wipe out the tan outline
   the design gives the white button. Every section sets its own border already; `appearance`
   is the only thing that needs saying once. */
.az-section [data-az-carousel] {
	appearance: none;
	-webkit-appearance: none;
	background-clip: padding-box;
	-webkit-tap-highlight-color: transparent;
}

/* Two rules, and BOTH are needed.

   The first clears the browser's own ring in every focus state — including the one it paints
   after a MOUSE CLICK, which `:focus-visible` alone does not cover and which was showing as a
   red/crimson circle around the white button. Nothing in this plugin, the theme, Elementor or
   the generated page CSS contains red; it was entirely the user-agent default.

   The second puts an intentional, on-brand ring back for keyboard users. Clearing focus
   styling without restoring it would leave anyone navigating by keyboard unable to see where
   they are, so these two must stay together. */
.az-section [data-az-carousel]:focus {
	outline: none;
}

.az-section [data-az-carousel]:focus-visible {
	outline: 2px solid #DDA833;
	outline-offset: 3px;
}

/* Screen-reader-only, for labels the design shows visually but that need a text equivalent
   (e.g. an icon-only link). Same implementation WordPress core uses. */
.az-sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* ================================================
   RAIL — a card row that pages horizontally
   ================================================
   The home page draws several sections as a row of cards wider than the band: the five course
   cards, the lab's three rows, the testimonial quotes. The course page solved this with the
   `.az-carousel` block, but that block owns its own markup — track, items, nav row — and
   retrofitting it into those widgets would mean restructuring each one.

   A rail is the same behaviour applied to a row that already exists. Add `az-rail` to a flex row
   and it becomes a scroll-snapping track whose children are the slides; amotz-carousel.js then
   fits a pair of arrows to it, but only if it actually overflows.

   IT WORKS WITH NO JAVASCRIPT. This is a real overflow container, so touch, trackpad, shift-wheel
   and keyboard already page it, and the browser resolves RTL itself. The arrows are an affordance
   for mouse users, not the mechanism. */
.az-section .az-rail {
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scrollbar-width: none;
	-ms-overflow-style: none;
	/* Room for a focus ring on a card, which a scroll box would otherwise clip. */
	padding-block: 4px;
	/* A rail is not a place to wrap or to centre leftovers — every child is a slide. */
	flex-wrap: nowrap;
	justify-content: flex-start;
}

.az-section .az-rail::-webkit-scrollbar { display: none; }

/* Slides keep their designed width instead of being squeezed to fit, which is the whole point: a
   squeezed row never overflows and so never becomes pageable. */
.az-section .az-rail > * {
	flex: 0 0 auto;
	scroll-snap-align: start;
	min-width: 0;
}

.az-section .az-rail-nav {
	display: flex;
	flex-direction: row;
	align-items: center;
	justify-content: center;
	gap: 16px;
	width: 100%;
	margin-top: 24px;
}

/* Nothing to page: the row fits, so the arrows are removed rather than left dead. */
.az-section .az-rail-nav[hidden] { display: none; }

/* ------------------------------------------------
   HOVER / FOCUS ON THE PAGING BUTTONS
   ------------------------------------------------
   Hello Elementor ships this in its own stylesheet:

       [type="button"]:focus, [type="button"]:hover, button:focus, button:hover {
           background-color: #c36; color: #fff;
       }

   #c36 is a magenta-maroon that appears NOWHERE in this palette. It was repainting every paging
   button the moment a pointer touched it. Same root cause as the red ring noted above — the
   defaults that come free with a <button> — except this one is the theme's, not the browser's.

   The theme's selector is (0,1,1); these are (0,3,0), so they win without !important.

   RESTORING, NOT FLATTENING. The two buttons are deliberately different — `prev` is a white pill
   with a tan glyph, `next` is the gold gradient — so hover puts each back to its own resting
   colours rather than giving both one neutral state. The design has no hover treatment for these,
   so "unchanged on hover" is the correct behaviour, not a placeholder. */
.az-section [data-az-carousel]:hover,
.az-section [data-az-carousel]:focus,
.az-section [data-az-carousel]:active {
	background-color: #FFFFFF;
	color: #A28660;
}

.az-section [data-az-carousel="next"]:hover,
.az-section [data-az-carousel="next"]:focus,
.az-section [data-az-carousel="next"]:active {
	/* The gradient lives on background-IMAGE, so the colour underneath must go transparent or it
	   sits behind a gradient that has no alpha and is simply never seen — harmless here, but it
	   would confuse the next person reading the computed styles. */
	background-color: transparent;
	background-image: linear-gradient(to right, #CEAF83, #795D36);
	color: #FFFFFF;
}

/* A disabled button is not interactive, so it must not react to a pointer at all. */
.az-section [data-az-carousel]:disabled:hover,
.az-section [data-az-carousel]:disabled:focus {
	cursor: default;
}
