/* ==========================================================================
   Work page: hero (tally marks, stats, crenellation), project filter and grid,
   achievements. Also holds the shared pieces: texture layers, crenellation band,
   project grid and card, used by project.css and blog.css.
   ========================================================================== */

/* ---------- Shared: texture layers and crenellation band ---------- */
.ramah-tex { position: absolute; inset: 0; inline-size: 100%; block-size: 100%; object-fit: cover; max-inline-size: none; pointer-events: none; }
.ramah-tex--grain { opacity: 0.18; }
.ramah-tex--multiply { opacity: 0.77; mix-blend-mode: multiply; }

.ramah-crenel { display: block; }
.ramah-crenel__teeth { display: block; block-size: 20px; background: repeating-linear-gradient(90deg, #b8b2a3 0 24.75px, #1d1d1f 24.75px 38.25px); }
.ramah-work-hero .ramah-crenel__wall { block-size: 16px; }
.ramah-crenel__wall { position: relative; display: block; block-size: 112px; overflow: hidden; background: #e0dad4; }
.ramah-crenel__star { position: absolute; inset-block-start: 0; inset-inline-end: 0; opacity: 0.6; }

/* ---------- Hero ---------- */
.ramah-work-hero {
	--ramah-tally-beige: #dedbd2;
	--ramah-tally-red: #c8383b;
	position: relative;
	overflow: hidden;
	isolation: isolate;
	background: #1d1d1f;
	color: var(--ramah-color-beige);
}
.ramah-work-hero__bg { position: absolute; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.ramah-work-hero__main { position: relative; padding-block: calc(var(--ramah-header-h) + 48px) 88px; }
.ramah-work-hero__pattern { position: absolute; inset-block-start: 0; left: 50%; translate: -50% 0; max-inline-size: none; opacity: 0.9; pointer-events: none; }
.ramah-work-hero__grid { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 48px; }
.ramah-work-hero__copy { grid-column: 1; grid-row: 1; justify-self: end; inline-size: min(576px, 100%); }
.ramah-work-hero__art { grid-column: 2; grid-row: 1; justify-self: start; }
.ramah-work-hero__title { font-size: var(--ramah-fs-display); line-height: 1.2; letter-spacing: -0.02em; color: var(--ramah-color-beige); }
.ramah-work-hero__accent { color: #c8383b; }
.ramah-work-hero__text { margin-block-start: 16px; color: #a3a096; font-size: 17px; line-height: 24px; }
.ramah-work-hero__stats { display: flex; flex-wrap: wrap; align-items: center; gap: 40px; margin-block-start: 48px; }
.ramah-work-hero__stat { position: relative; display: grid; gap: 8px; }
.ramah-work-hero__stat + .ramah-work-hero__stat::before {
	content: "";
	position: absolute;
	inset-block-start: 50%;
	inset-inline-start: -21px;
	block-size: 48px;
	inline-size: 1px;
	translate: 0 -50%;
	background: rgb(255 255 255 / 0.2);
}
.ramah-work-hero__value { font-size: clamp(1.75rem, 1.5rem + 1vw, 2.25rem); line-height: 1.1; color: #fff; }
.ramah-work-hero__label { color: #8e8b82; font-size: 14px; line-height: 20px; }
.ramah-work-hero__caption { margin-block-start: 40px; color: #8e8b82; font-size: 14px; line-height: 20px; text-align: start; }

/* Tally marks (drawn with bars and diagonals, LTR artwork) */
.ramah-tally { display: flex; flex-direction: column; gap: 36px; direction: ltr; inline-size: max-content; }
.ramah-tally__row { display: flex; align-items: center; gap: 36px; }
.ramah-tally__set { position: relative; display: flex; flex: none; align-items: center; justify-content: space-between; inline-size: 80px; block-size: 112px; }
.ramah-tally__set--3 { justify-content: flex-start; gap: 20px; padding-inline-start: 16px; }
.ramah-tally__bar { position: relative; display: block; flex: none; inline-size: 8px; block-size: 100%; border-radius: 9999px; }
.ramah-tally__bar--beige { background: var(--ramah-tally-beige); }
.ramah-tally__bar--red { background: var(--ramah-tally-red); }
.ramah-tally__diag {
	position: absolute;
	inset-block-start: 50%;
	inset-inline-start: 50%;
	z-index: 1;
	inline-size: 91px;
	block-size: 8px;
	border-radius: 9999px;
	translate: -50% -50%;
	rotate: -32deg;
	box-shadow: 0 1px 2px rgb(0 0 0 / 0.05);
}
.ramah-tally__diag--beige { background: var(--ramah-tally-beige); }
.ramah-tally__diag--red { background: var(--ramah-tally-red); }

@media (max-width: 1023px) {
	.ramah-work-hero__grid { grid-template-columns: minmax(0, 1fr); gap: 56px; }
	.ramah-work-hero__copy { grid-column: 1; grid-row: 1; justify-self: stretch; inline-size: 100%; }
	.ramah-work-hero__art { grid-column: 1; grid-row: 2; justify-self: start; }
}
@media (max-width: 639px) {
	.ramah-work-hero__stats { gap: 20px 28px; }
	.ramah-work-hero__stat + .ramah-work-hero__stat::before { display: none; }
}

/* ---------- Projects: heading, filter, grid ---------- */
.ramah-work-projects { position: relative; isolation: isolate; overflow: hidden; padding-block: 15px var(--ramah-section-y); background: #fff5eb; }
.ramah-work-projects__bg { position: absolute; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.ramah-work-projects__inner { display: grid; gap: 32px; justify-items: center; }
.ramah-work-projects__head { display: grid; justify-items: center; gap: 13px; text-align: center; }
.ramah-work-projects__eyebrow { display: flex; align-items: center; gap: 17px; color: #941c1e; font-size: 16px; font-weight: 600; line-height: 24px; }
.ramah-work-projects__ornament { inline-size: 114px; block-size: 7px; }
.ramah-work-projects__ornament--end { transform: scaleX(-1); }
.ramah-work-projects__title { color: #941c1e; font-size: clamp(2.25rem, 1.4rem + 2.6vw, 3.75rem); line-height: 1.5; letter-spacing: -0.025em; }
.ramah-work-projects__intro { color: #7a7571; font-size: 16px; line-height: 24px; }

.ramah-work-filter { position: relative; display: flex; justify-content: center; }
.ramah-work-filter__thumb { position: absolute; inset-block: 0; left: 0; inline-size: 0; border-radius: 9999px; background: #731217; box-shadow: 0 1px 1px rgb(0 0 0 / 0.05); opacity: 0; pointer-events: none; transition: left 0.5s var(--ramah-ease), width 0.5s var(--ramah-ease), opacity 0.3s ease; }
.ramah-work-filter__list { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; }
.ramah-work-filter__list li { display: flex; align-items: center; }
.ramah-work-filter__list li + li::before { content: "|"; margin-inline: 4px; color: #d6d3d1; font-size: 16px; font-weight: 600; }
.ramah-work-filter__btn {
	min-block-size: 44px; /* touch target */
	padding: 6px 14px;
	border: 0;
	border-radius: 9999px;
	background: transparent;
	color: #685f59;
	font-size: 16px;
	font-weight: 600;
	line-height: 24px;
	cursor: pointer;
	transition: background-color 0.2s ease, color 0.2s ease;
}
.ramah-work-filter__btn { position: relative; z-index: 1; }
.ramah-work-filter__btn:hover { color: #731217; }
.ramah-work-filter.is-js .ramah-work-filter__btn[aria-pressed="true"] { background: transparent; box-shadow: none; }
.ramah-work-filter.is-js .ramah-work-filter__btn[aria-pressed="true"]:hover { color: #fff; }
.ramah-work-filter__btn[aria-pressed="true"] { padding-inline: 28px; background: #731217; color: #fff; font-weight: 700; letter-spacing: 0.4px; box-shadow: 0 1px 1px rgb(0 0 0 / 0.05); }

.ramah-project-grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 28px;
	inline-size: 100%;
	max-inline-size: 1240px;
	margin-inline: auto;
}
.ramah-project-card {
	display: flex;
	flex-direction: column;
	overflow: hidden;
	border: 1px solid rgb(150 137 125 / 0.8);
	border-radius: 2px;
	background: #d5cbbf;
	box-shadow: 0 4px 14px -2px rgb(60 40 30 / 0.05);
}
.ramah-project-card[hidden] { display: none; }
.ramah-project-card__media { position: relative; z-index: 2; flex: none; block-size: 230px; overflow: hidden; background: #1c1917; }
.ramah-project-card__img { inline-size: 100%; block-size: 100%; object-fit: cover; }
.ramah-project-card__play {
	position: absolute;
	inset: 0;
	z-index: 1;
	display: grid;
	place-items: center;
	inline-size: 48px;
	block-size: 48px;
	margin: auto;
	border: 2px solid rgb(255 255 255 / 0.9);
	border-radius: 9999px;
	background: rgb(0 0 0 / 0.4);
	backdrop-filter: blur(2px);
}
/* Badge sits on the image's bottom edge; it lives outside .ramah-zoom (overflow hidden) so it is not clipped. */
.ramah-project-card { position: relative; }
.ramah-project-card__badge {
	position: absolute;
	inset-block-start: 220px; /* media height 230px, badge centred on its bottom edge */
	inset-block-end: auto;
	inset-inline-start: 24px;
	z-index: 3;
	padding: 2px 16px;
	border-radius: 9999px;
	background: linear-gradient(#7b1219, #5d0c12);
	color: #fff;
	font-size: 12px;
	font-weight: 600;
	line-height: 16px;
	box-shadow: 0 2px 2.5px rgb(90 13 19 / 0.35);
	white-space: nowrap;
}
.ramah-project-card__body { position: relative; z-index: 1; display: flex; flex: 1; flex-direction: column; gap: 9px; padding: 28px 24px 24px; }
.ramah-project-card__title { color: #1c1917; font-size: 20px; font-weight: 700; line-height: 28px; }
.ramah-project-card__title a { color: inherit; }
.ramah-project-card__text { color: #57534e; font-size: 14px; line-height: 22.75px; }
.ramah-project-card__link { display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; margin-block-start: auto; padding-block-start: 35px; color: #7a141b; font-size: 14px; font-weight: 700; line-height: 20px; }
.ramah-project-card__link:hover { text-decoration: underline; text-underline-offset: 3px; }
.ramah-project-card__arrow { inline-size: 16px; block-size: 16px; transition: translate 0.25s var(--ramah-ease); }
.ramah-project-card__link:hover .ramah-project-card__arrow { translate: -4px 0; }

@media (max-width: 1023px) {
	.ramah-project-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 639px) {
	.ramah-project-grid { grid-template-columns: minmax(0, 1fr); gap: 24px; }
	.ramah-work-filter__btn[aria-pressed="true"] { padding-inline: 20px; }
}

/* ---------- Achievements ---------- */
.ramah-achievements { position: relative; isolation: isolate; overflow: hidden; padding-block: 34px 136px; /* Figma 163:4988: 451px */ background: #1a1a1a; color: var(--ramah-color-beige); }
.ramah-achievements__bg { position: absolute; inset: 0; z-index: -2; overflow: hidden; }
.ramah-achievements__bg img { position: absolute; inset: 0; inline-size: 100%; block-size: 100%; object-fit: cover; max-inline-size: none; }
.ramah-achievements__strip { position: absolute; inset-block: 0; z-index: 0; inline-size: 84px; }
.ramah-achievements__strip--start { inset-inline-start: 0; }
.ramah-achievements__strip--end { inset-inline-end: 0; }
.ramah-achievements__inner { position: relative; z-index: 1; display: grid; gap: 81px; justify-items: center; }
.ramah-achievements__head { display: flex; justify-content: center; }
.ramah-achievements__title { display: flex; align-items: center; gap: 17px; color: #d8d3cf; font-size: clamp(2rem, 1.5rem + 1.6vw, 2.875rem); font-weight: 600; line-height: 1.4; }
.ramah-achievements__ornament { inline-size: 114px; block-size: 7px; }
.ramah-achievements__ornament:last-child { transform: scaleX(-1); }
.ramah-achievements__list { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); inline-size: 100%; max-inline-size: 1000px; }
.ramah-achievements__item { position: relative; display: grid; justify-items: center; gap: 12px; padding-inline: 16px; text-align: center; }
.ramah-achievements__item + .ramah-achievements__item::before {
	content: "";
	position: absolute;
	inset-block-start: 50%;
	inset-inline-start: 0;
	inline-size: 142px;
	block-size: 3px;
	translate: -50% -50%;
	rotate: 90deg;
	background: url("../../images/work/stat-separator.svg") center / 100% 100% no-repeat;
}
.ramah-achievements__value { color: #d8d3cf; font-size: clamp(2.25rem, 1.8rem + 1.6vw, 3.125rem); font-weight: 700; line-height: 1.1; }
.ramah-achievements__label { color: #fff; font-size: 18px; line-height: 1.5; }

@media (max-width: 767px) {
	.ramah-achievements__list { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 40px; }
	.ramah-achievements__item + .ramah-achievements__item::before { display: none; }
	.ramah-achievements__strip { inline-size: 40px; }
}

/* ---------- Motion: tally marks drawn on view (JS adds .is-armed, then .is-drawn) ---------- */
.ramah-tally__bar, .ramah-tally__diag { transition: transform 0.7s var(--ramah-ease); }
.ramah-tally__bar { transform-origin: 50% 100%; }
.ramah-tally.is-armed .ramah-tally__bar { transform: scaleY(0); }
.ramah-tally.is-armed .ramah-tally__diag { transform: scaleX(0); }
.ramah-tally.is-drawn .ramah-tally__bar { transform: none; }
.ramah-tally.is-drawn .ramah-tally__diag { transform: scaleX(1); transition-delay: 1.3s; }
.ramah-tally.is-drawn .ramah-tally__bar:nth-child(1) { transition-delay: 0.05s; }
.ramah-tally.is-drawn .ramah-tally__bar:nth-child(2) { transition-delay: 0.17s; }
.ramah-tally.is-drawn .ramah-tally__bar:nth-child(3) { transition-delay: 0.29s; }
.ramah-tally.is-drawn .ramah-tally__bar:nth-child(4) { transition-delay: 0.41s; }
.ramah-tally.is-drawn .ramah-tally__row + .ramah-tally__row .ramah-tally__bar { transition-delay: 0.6s; }

/* ---------- Motion: card badges slide in with the scroll, achievement icons pulse once ---------- */
@supports (animation-timeline: view()) {
	@media (prefers-reduced-motion: no-preference) {
		.ramah-project-card__badge { animation: ramah-badge-in 0.8s var(--ramah-ease) both; animation-timeline: view(); animation-range: entry 0% entry 60%; }
		.ramah-achievements__icon { animation: ramah-pulse-once 1.1s var(--ramah-ease) both; animation-timeline: view(); animation-range: entry 10% cover 40%; }
	}
}
@keyframes ramah-badge-in { from { opacity: 0; transform: translateX(28px); } to { opacity: 1; transform: none; } }
@keyframes ramah-pulse-once { 0% { opacity: 0; transform: scale(0.8); } 55% { opacity: 1; transform: scale(1.12); } 100% { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) {
	.ramah-tally.is-armed .ramah-tally__bar, .ramah-tally.is-armed .ramah-tally__diag { transform: none; }
}
