/**
 * ROYA - Reusable components
 *
 * Patterns that recur across pages: the pill button and the section heading
 * with its ghost watermark. Section-specific layout stays in the page sheets.
 */

/* ==========================================================================
   Pill button
   Figma: sage pill, 2px light-brown stroke, soft shadow, cream text with a
   50px circular arrow icon at the inline end (e.g. node 1:135).
   ========================================================================== */

.roya-button {
	display: inline-flex;
	align-items: center;
	gap: var(--roya-space-2);
	min-height: var(--roya-button-height);
	padding-block: var(--roya-space-1);
	padding-inline: var(--roya-space-3) var(--roya-space-4);
	background-color: var(--roya-accent);
	border: var(--roya-border-width) solid var(--roya-border);
	border-radius: var(--roya-radius-pill);
	box-shadow: var(--roya-shadow-soft);
	color: var(--roya-on-accent);
	font-size: var(--roya-text-button);
	font-weight: var(--roya-weight-regular);
	line-height: 1;
	transition: background-color var(--roya-transition), box-shadow var(--roya-transition);
}

.roya-button:hover {
	background-color: var(--roya-graphite);
	box-shadow: var(--roya-shadow-card);
	color: var(--roya-on-accent);
}

/* The icon is a mask filled with currentColor, so it always matches the
   button's text color - including on hover, where a fixed-color file would
   vanish against the swapped background. */
.roya-button__icon {
	width: var(--roya-icon-size);
	height: var(--roya-icon-size);
	flex-shrink: 0;
	background-color: currentColor;
	mask: url("../img/icon-arrow.svg") center / contain no-repeat;
	-webkit-mask: url("../img/icon-arrow.svg") center / contain no-repeat;
}

/* Light variant: cream body, sage text (e.g. the about panel button). */
.roya-button--light {
	background-color: var(--roya-cream);
	color: var(--roya-accent);
}

.roya-button--light:hover {
	background-color: var(--roya-accent);
	color: var(--roya-cream);
}


/* ==========================================================================
   Section heading
   Every home section opens with a huge Brown Sugar watermark in English
   behind a Hebrew title. The watermark is decorative (aria-hidden) and often
   wider than the viewport - the head clips it.
   ========================================================================== */

.roya-section-head {
	/* Both layers share one grid cell: the watermark sets the height, the
	   visible title anchors to its bottom edge (client note 2026-08-31).
	   The column is pinned to the container width - without this the
	   max-content marquee track stretches the implicit column to its own
	   width and the centered title lands off-screen. */
	display: grid;
	grid-template-columns: 100%;
	justify-items: center;
	overflow: hidden;
	text-align: center;
}

/* The watermark drifts right-to-left forever. The track holds two identical
   copies of the text and translates by exactly one copy (-50%), so the loop
   point is invisible. transform is compositor-only - no layout, no paint,
   no JS - which is the cheapest possible way to run an infinite marquee. */
.roya-section-head__ghost {
	grid-area: 1 / 1;
	/* Physically left-anchored (not logical - this is an RTL document): the
	   track overhangs to the right, so drifting left never exposes a gap.
	   Four copies keep half the track wider than any viewport, including the
	   mobile sizes where the clamped font makes one copy narrow. */
	justify-self: left;
	display: flex;
	width: max-content;
	color: var(--roya-watermark);
	font-family: var(--roya-font-display);
	font-size: var(--roya-text-watermark);
	font-weight: var(--roya-weight-regular);
	line-height: 1;
	white-space: nowrap;
	pointer-events: none;
	user-select: none;
	animation: roya-ghost-drift 60s linear infinite;
}

/* Each half must be identical for the -50% loop to be seamless, so the gap
   is carried inside the copies as padding rather than by the flex gap. */
.roya-section-head__ghost > span {
	padding-inline-end: 0.5em;
}

@keyframes roya-ghost-drift {
	from {
		transform: translateX(0);
	}

	to {
		transform: translateX(-50%);
	}
}

.roya-section-head__title {
	grid-area: 1 / 1;
	align-self: end;
	font-size: var(--roya-text-page-title);
}


/* ==========================================================================
   Lightbox
   A full-screen overlay whose images are one horizontal scroll-snap strip,
   so moving between them is the browser's own scrolling - swipe on touch,
   drag/arrows/keys elsewhere. The design defines none of this; it is ours.
   ========================================================================== */

.roya-lightbox {
	position: fixed;
	inset: 0;
	z-index: 90;
	display: flex;
	align-items: center;
	justify-content: center;
}

/* [hidden] must beat the display:flex above. */
.roya-lightbox[hidden] {
	display: none;
}

.roya-lightbox__backdrop {
	position: absolute;
	inset: 0;
	background-color: var(--roya-scrim);
	backdrop-filter: blur(var(--roya-blur-panel));
	-webkit-backdrop-filter: blur(var(--roya-blur-panel));
}

/* ul.- prefix: must outrank the ul[class] margin reset in base.css. */
ul.roya-lightbox__strip {
	position: relative;
	display: flex;
	width: 100%;
	height: 100%;
	overflow-x: auto;
	overscroll-behavior: contain; /* the page behind must not scroll with it */
	scroll-snap-type: x mandatory;
	scrollbar-width: none;
}

.roya-lightbox__strip::-webkit-scrollbar {
	display: none;
}

.roya-lightbox__item {
	flex: 0 0 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: clamp(var(--roya-space-4), 6vw, var(--roya-space-7));
	scroll-snap-align: center;
	scroll-snap-stop: always; /* one image per swipe, never a blur past three */
}

.roya-lightbox__image {
	max-width: 100%;
	max-height: 100%;
	width: auto;
	height: auto;
	object-fit: contain;
	box-shadow: var(--roya-shadow-card);
}

/* Controls -------------------------------------------------------------- */

/* Sized off the touch-target floor (44px), not --roya-icon-size: these are
   the only controls on the overlay and a thumb has to find them. */
.roya-lightbox__close,
.roya-lightbox__nav {
	position: absolute;
	width: clamp(2.75rem, 5vw, 3.75rem);
	height: clamp(2.75rem, 5vw, 3.75rem);
	padding: 0;
	background-color: transparent;
	border: 0;
	border-radius: 50%;
	color: var(--roya-cream);
	cursor: pointer;
	transition: transform var(--roya-transition), opacity var(--roya-transition);
}

.roya-lightbox__close::before,
.roya-lightbox__nav::before {
	content: "";
	display: block;
	width: 100%;
	height: 100%;
	background-color: currentColor;
	mask: url("../img/icon-arrow.svg") center / contain no-repeat;
	-webkit-mask: url("../img/icon-arrow.svg") center / contain no-repeat;
}

.roya-lightbox__close {
	inset-block-start: clamp(var(--roya-space-2), 3vw, var(--roya-space-4));
	inset-inline-end: clamp(var(--roya-space-2), 3vw, var(--roya-space-4));
}

/* No close glyph was ever downloaded; the arrow rotated 45 degrees twice is
   not a cross, so the close button gets a drawn one instead of a mask. */
.roya-lightbox__close::before {
	mask: none;
	-webkit-mask: none;
	background-color: transparent;
	background-image:
		linear-gradient(currentColor, currentColor),
		linear-gradient(currentColor, currentColor);
	background-size: 100% 1px, 1px 100%;
	background-position: center;
	background-repeat: no-repeat;
	transform: rotate(45deg);
}

/* PHYSICAL sides: the arrow glyph points left, so "next" is the left-hand
   control in this RTL document and mirroring would point them both wrong. */
.roya-lightbox__nav--next {
	left: clamp(var(--roya-space-1), 2vw, var(--roya-space-4));
}

.roya-lightbox__nav--prev {
	right: clamp(var(--roya-space-1), 2vw, var(--roya-space-4));
}

.roya-lightbox__nav--prev::before {
	transform: scaleX(-1);
}

.roya-lightbox__close:hover,
.roya-lightbox__nav:hover {
	opacity: 0.7;
}

.roya-lightbox__nav--next:hover {
	transform: translateX(-4px);
}

.roya-lightbox__nav--prev:hover {
	transform: translateX(4px);
}

/* The page behind must not scroll while the overlay is up. */
.roya-lightbox-open {
	overflow: hidden;
}



/* ==========================================================================
   Inner-page head
   The device every inner page opens with. Measured on the projects archive
   (18:468-471, 18:625) and identical on the contact page (18:912-915,
   18:953) - every y matches, so it is one component and not two.

   From the header's bottom edge at y128: a half-width rule on the RIGHT at
   +45, the Brown Sugar word at +90 (box 137), the Hebrew title straight after
   it at +227 (box 173), the circle-arrow at +421, and a half-width rule on
   the LEFT closing the block at +558. Both words are ירוק מרווה at 150.

   The rules are physical right and left, as in the About statement: the design
   draws them on those sides and the page is RTL throughout.
   ========================================================================== */

.roya-page-head {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	/* 90 to the English word, 40 under the cue. */
	padding-block: clamp(2.5rem, 6.25vw, 5.625rem) clamp(1.5rem, 2.778vw, 2.5rem);
	text-align: center;
}

.roya-page-head::before,
.roya-page-head::after {
	content: "";
	position: absolute;
	width: 50%;
	height: var(--roya-rule-width);
	background-color: var(--roya-rule);
}

.roya-page-head::before {
	top: clamp(1.25rem, 3.125vw, 2.8125rem); /* +45 */
	right: 0;
}

.roya-page-head::after {
	bottom: 0;
	left: 0;
}

.roya-page-head__ghost,
.roya-page-head__title {
	margin: 0;
	color: var(--roya-accent);
	font-size: clamp(2.75rem, 10.417vw, 9.375rem); /* 150px */
	font-weight: var(--roya-weight-light);
}

/* Figma boxes the English at 137 and the Hebrew at 173 around the same 150px
   type, and sets them back to back - so the two line-heights are the lockup. */
.roya-page-head__ghost {
	font-family: var(--roya-font-display);
	font-weight: var(--roya-weight-regular);
	line-height: 0.913; /* 137 / 150 */
}

.roya-page-head__title {
	line-height: 1.153; /* 173 / 150 */
}

.roya-page-head__cue {
	display: block;
	margin-block-start: clamp(0.75rem, 1.458vw, 1.3125rem); /* 21px */
	line-height: 0;
}

.roya-page-head__cue img {
	width: clamp(2.75rem, 6.944vw, 6.25rem); /* 100px */
	height: auto;
}

@media (max-width: 900px) {
	/* The two rules frame a composition that only exists at width; stacked they
	   read as stray lines. The title carries the page on its own. */
	.roya-page-head::before,
	.roya-page-head::after {
		display: none;
	}
}


/* ==========================================================================
   Related-strip card
   Figma 144:29 (single article) and 144:18 (single project) - one card, two
   frame colours. 419x432, cream body in an 8px frame on radius 32, the
   photograph filling the top on a 28 radius, the title at 30 centred below.
   Global because it renders on two page-scoped sheets' pages
   (handover item 5); the strips' grids stay in their own sheets.
   ========================================================================== */

.roya-related-card {
	display: flex;
}

.roya-related-card__link {
	display: flex;
	flex: 1;
	flex-direction: column;
	gap: clamp(0.5rem, 2.222vw, 2rem); /* 32 between photograph and title */
	aspect-ratio: 419 / 432;
	/*
	 * No padding above the photograph. Both frames (144:18 and 144:29) carry
	 * `pt-7`, which reads on screen as a stray cream sliver between the
	 * photograph and its own frame - the client raised it 2026-09-09 and it is
	 * almost certainly a nudge left in the file rather than a decision: the
	 * card has NO inline padding, so the photograph bleeds to the left and
	 * right border but not the top. It bleeds to all three now (D-40).
	 */
	padding-block: 0 clamp(0.75rem, 2.222vw, 2rem);
	overflow: hidden;
	background-color: var(--roya-cream);
	/* The article screen outlines this card in the body ink - the one place
	   the design does - and the project screen in sage; both are verified in
	   docs/wip/. Ink is the default, sage the modifier. */
	border: clamp(3px, 0.556vw, 8px) solid var(--roya-ink);
	border-radius: clamp(1rem, 2.222vw, 2rem); /* 32 */
	box-shadow: var(--roya-shadow-box);
	color: inherit;
	text-decoration: none;
	transition: box-shadow var(--roya-transition), transform var(--roya-transition);
}

.roya-related-card--sage .roya-related-card__link {
	border-color: var(--roya-accent);
}

.roya-related-card__link:hover {
	box-shadow: var(--roya-shadow-card);
	transform: translateY(-4px);
}

/* flex:1 + min-height:0 is what gives object-fit a definite box to crop into -
   the photograph takes whatever the title leaves, however many lines it runs. */
.roya-related-card__photo {
	display: block;
	flex: 1 1 0;
	min-height: 0;
	width: 100%;
	object-fit: cover;
	/*
	 * No radius of its own. The design gives the photograph 28 while the card's
	 * INNER curve is 24 (32 of border-radius less the 8 of border), so a 28
	 * corner curves away from the frame and leaves a cream crescent at each top
	 * corner - the same defect as the `pt-7` above, in the corners instead of
	 * along the edge. The card already clips to its own inner curve through
	 * `overflow: hidden`, so leaving this at 0 makes the photograph nest exactly
	 * inside the frame at every size, with no second value to keep in step.
	 */
	/* The design draws 0 4px 8px at 16%; the token is 0 4px 4px at 20%, which
	   is the same shadow to the eye and keeps the value in tokens.css. */
	box-shadow: var(--roya-shadow-soft);
}

.roya-related-card__photo--empty {
	background-color: var(--roya-media-placeholder);
}

.roya-related-card__title {
	flex: 0 0 auto;
	/* The card has no inline padding of its own - the photograph runs edge to
	   edge - so a long title's breathing room lives here. */
	padding-inline: clamp(0.5rem, 1.5vw, 1.25rem);
	color: var(--roya-text);
	font-size: clamp(1rem, 2.083vw, 1.875rem); /* 30 */
	font-weight: var(--roya-weight-light);
	line-height: var(--roya-leading-normal);   /* 1.4 - the design's 30 on 42 */
	text-align: center;
}


/* ==========================================================================
   Prose
   Editor-written HTML, styled entirely through element selectors under
   .roya-prose - nothing may depend on hand-authored markup or classes.
   Measured on the single article (18:1102): 45px type, line-height 1.222
   (the design's 55px advance), paragraphs broken by one blank line. Global
   (moved out of single-article.css) so generic pages - the accessibility
   statement first - render editor content the same way.
   ========================================================================== */
.roya-prose {
	color: var(--roya-text);
	font-size: var(--roya-text-body); /* 45 */
	font-weight: var(--roya-weight-light);
	line-height: 1.222;
	/* Flush right, ragged left - the document is RTL, so this is `start`
	   rather than `right`, and it stays correct if a block is ever set ltr. */
	text-align: start;
}

.roya-prose > :first-child {
	margin-block-start: 0;
}

.roya-prose > :last-child {
	margin-block-end: 0;
}

.roya-prose p {
	margin-block: 0 1.222em;
}

/*
 * The design does not enlarge H2 - it swaps Fb Mega Light for Regular at the
 * same 45 and puts one blank line above it and nothing below (18:1102).
 */
.roya-prose h2 {
	margin-block: 1.222em 0;
	color: var(--roya-text);
	font-size: 1em;
	font-weight: var(--roya-weight-regular);
	line-height: inherit;
}

/*
 * OURS, not the design's: no H3 is drawn anywhere on this screen, but the
 * seeded content has them (the FAQ block at the foot of article 1), so they
 * need a treatment. One step down the design system's own scale from the H2 -
 * 40 against 45 - keeping the Regular cut that marks a heading in this body.
 */
.roya-prose h3,
.roya-prose h4,
.roya-prose h5,
.roya-prose h6 {
	margin-block: 0.9em 0;
	color: var(--roya-text);
	font-size: var(--roya-text-button); /* 40 */
	font-weight: var(--roya-weight-regular);
	line-height: 1.222;
}

/* padding-inline-start puts the markers on the reading edge - the right, in
   this document - without a mirrored rule. */
.roya-prose ul,
.roya-prose ol {
	margin-block: 0 1.222em;
	padding-inline-start: 1.2em;
}

.roya-prose li {
	margin-block-end: 0.35em;
}

.roya-prose li:last-child {
	margin-block-end: 0;
}

/* Not drawn in the design. Kept to the vocabulary that is: the section rule's
   colour and width, on the reading edge. */
.roya-prose blockquote {
	margin-block: 0 1.222em;
	padding-inline-start: 0.75em;
	border-inline-start: var(--roya-rule-width) solid var(--roya-brown);
	color: var(--roya-heading);
}

.roya-prose figure {
	margin-block: 1.222em;
}

/* The hero's radius and shadow, so an in-body photograph reads as the same
   object as the one at the top of the page. */
.roya-prose img {
	margin-inline: auto;
	border-radius: clamp(0.875rem, 2.083vw, 1.875rem);
	box-shadow: var(--roya-shadow-card);
}

.roya-prose figcaption {
	margin-block-start: 0.5em;
	font-size: var(--roya-text-nav);
	text-align: center;
}

.roya-prose a {
	color: var(--roya-accent);
	text-decoration: underline;
	text-underline-offset: 0.15em;
}

.roya-prose a:hover {
	color: var(--roya-heading);
}

/* A table is the one editor block that can push the document wider than the
   viewport, so it scrolls inside its own box rather than the page. */
.roya-prose table {
	display: block;
	width: 100%;
	margin-block: 0 1.222em;
	overflow-x: auto;
	border-collapse: collapse;
	font-size: var(--roya-text-nav);
}

.roya-prose th,
.roya-prose td {
	padding: 0.5em 0.75em;
	border-block-end: 1px solid var(--roya-border);
	text-align: start;
}


/* ==========================================================================
   Utility pages (404, search, generic page body)
   No design exists for any of these screens - everything here is ours,
   assembled from the tokens and the page-head device.
   ========================================================================== */

.roya-page-body {
	--roya-container: 1296px; /* the article body's measure */

	padding-block-end: var(--roya-section-gap);
}

.roya-utility {
	padding-block-end: var(--roya-section-gap);
	text-align: center;
}

.roya-utility__text {
	margin: 0 auto;
	max-width: 28em;
	color: var(--roya-text);
	font-size: var(--roya-text-body);
	font-weight: var(--roya-weight-light);
	line-height: var(--roya-leading-normal);
}

.roya-utility__button {
	margin-block-start: clamp(var(--roya-space-4), 4.4vw, var(--roya-space-6));
}

ul.roya-search-results {
	padding: 0;
	list-style: none;
	text-align: start;
}

.roya-search-result {
	padding-block: clamp(var(--roya-space-3), 3.3vw, var(--roya-space-5));
	border-block-end: 1px solid var(--roya-border);
}

.roya-search-result:last-child {
	border-block-end: 0;
}

.roya-search-result__title {
	color: var(--roya-heading);
	font-size: var(--roya-text-subtitle);
	font-weight: var(--roya-weight-regular);
	text-decoration: none;
}

.roya-search-result__title:hover {
	color: var(--roya-accent);
}

.roya-search-result__excerpt {
	margin-block: 0.5em 0;
	color: var(--roya-text);
	font-size: var(--roya-text-nav);
	font-weight: var(--roya-weight-light);
	line-height: var(--roya-leading-relaxed);
}

/* WP pagination, kept to the house vocabulary. */
.roya-utility .navigation.pagination {
	margin-block-start: var(--roya-space-5);
}

.roya-utility .nav-links {
	display: flex;
	justify-content: center;
	gap: var(--roya-space-2);
	font-size: var(--roya-text-nav);
}

.roya-utility .page-numbers {
	color: var(--roya-text);
	text-decoration: none;
}

.roya-utility .page-numbers.current {
	color: var(--roya-accent);
	font-weight: var(--roya-weight-regular);
}

.roya-utility a.page-numbers:hover {
	color: var(--roya-accent);
}