/* =========================================================================
   Osama Shawky — motion & visual layer
   Loaded after site.css. Additive only: nothing here changes layout metrics,
   content, palette or typography.
   - Static depth (grids, glows, portrait bloom) is always on.
   - Everything that moves lives inside @media (prefers-reduced-motion: no-preference).
   ========================================================================= */

:root {
	--os-ease: cubic-bezier(.22, .68, .24, 1);
	--os-ease-out: cubic-bezier(.16, .84, .28, 1);
}

/* -------------------------------------------------------------------------
 * Scroll progress (element is injected by site.js)
 * ---------------------------------------------------------------------- */
.os-progress {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 3px;
	z-index: 9999;
	pointer-events: none;
	transform: scaleX(var(--os-progress, 0));
	transform-origin: 0 50%;
	background: linear-gradient(90deg, var(--purple), var(--soft));
	box-shadow: 0 0 14px #ff2800b3;
}

/* -------------------------------------------------------------------------
 * Ambient depth — hero grid + red bloom
 * ---------------------------------------------------------------------- */
.hero {
	isolation: isolate;
}

.hero:before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -1;
	pointer-events: none;
	background-image:
		linear-gradient(90deg, #0b0b0b0a 1px, transparent 1px),
		linear-gradient(#0b0b0b0a 1px, transparent 1px);
	background-size: 76px 76px;
	-webkit-mask-image: radial-gradient(115% 85% at 72% 6%, #000 8%, transparent 72%);
	mask-image: radial-gradient(115% 85% at 72% 6%, #000 8%, transparent 72%);
}

.hero:after {
	content: "";
	position: absolute;
	top: -34%;
	right: -16%;
	width: 780px;
	height: 780px;
	z-index: -1;
	pointer-events: none;
	border-radius: 50%;
	background: radial-gradient(circle, #ff280017, #ff280008 42%, transparent 66%);
}

/* -------------------------------------------------------------------------
 * Ambient depth — dark bands
 * ---------------------------------------------------------------------- */
.section-ink,
.chapter-band {
	isolation: isolate;
}

.section-ink.section,
.section-ink.e-con {
	position: relative;
	overflow: hidden;
	overflow: clip;
}

.section-ink:before,
.chapter-band:before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -1;
	pointer-events: none;
	background-image:
		linear-gradient(90deg, #ffffff08 1px, transparent 1px),
		linear-gradient(#ffffff08 1px, transparent 1px);
	background-size: 84px 84px;
	-webkit-mask-image: radial-gradient(90% 80% at 18% 0%, #000 0%, transparent 70%);
	mask-image: radial-gradient(90% 80% at 18% 0%, #000 0%, transparent 70%);
}

.section-ink:after {
	content: "";
	position: absolute;
	z-index: -1;
	left: -14%;
	bottom: -52%;
	width: 700px;
	height: 700px;
	pointer-events: none;
	border-radius: 50%;
	background: radial-gradient(circle, #ff280014, transparent 62%);
}

/* -------------------------------------------------------------------------
 * Portrait bloom + node accents
 * ---------------------------------------------------------------------- */
.atlas:before {
	content: "";
	position: absolute;
	inset: 8% 8% 6%;
	z-index: 0;
	pointer-events: none;
	background: radial-gradient(58% 58% at 58% 22%, #ff280026, transparent 70%);
	filter: blur(2px);
}

.atlas-photo {
	z-index: 1;
}

.atlas-photo-label {
	z-index: 2;
}

.atlas-node {
	border-top: 2px solid #ff2800;
	transition: box-shadow .3s ease, border-color .3s ease;
}

.atlas-node:hover {
	box-shadow: 0 16px 40px #ff28001f;
	border-color: #ff2800;
}

/* -------------------------------------------------------------------------
 * Hover lift for content cards
 * ---------------------------------------------------------------------- */
.service,
.article-card,
.milestone-card,
.planning-item,
.education,
.quote,
.case-fact {
	transition: transform .32s var(--os-ease), box-shadow .32s var(--os-ease), border-color .32s ease;
}

.service:hover,
.article-card:hover,
.milestone-card:hover,
.planning-item:hover,
.education:hover,
.quote:hover,
.case-fact:hover {
	transform: translateY(-5px);
	border-color: #ff280038;
	box-shadow: 0 22px 48px #0b0b0b12;
}

/* -------------------------------------------------------------------------
 * Navigation underline + logo tilt
 * ---------------------------------------------------------------------- */
.nav-links a {
	position: relative;
}

.nav-links a:after {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	bottom: -3px;
	height: 2px;
	border-radius: 2px;
	background: var(--purple);
	transform: scaleX(0);
	transform-origin: left center;
	transition: transform .3s var(--os-ease);
}

.nav-links a:hover:after,
.nav-links a[aria-current="page"]:after {
	transform: scaleX(1);
}

.logo-mark {
	transition: transform .45s var(--os-ease);
}

.logo:hover .logo-mark {
	transform: rotate(-10deg) scale(1.06);
}

.footer-col a {
	transition: color .2s ease, padding-left .2s ease;
}

.footer-col a:hover {
	color: var(--purple);
	padding-left: 5px;
}

@media (max-width: 900px) {
	.nav-links a:after {
		display: none;
	}
}

/* -------------------------------------------------------------------------
 * Ticker → marquee (markup is upgraded by site.js)
 * ---------------------------------------------------------------------- */
.ticker {
	overflow: hidden;
}

.os-marquee > .wrap.ticker-inner {
	display: flex;
	flex-wrap: nowrap;
	justify-content: flex-start;
	align-items: center;
	gap: 0;
	width: max-content;
	max-width: none;
	margin: 0;
	padding: 0;
}

.os-marquee-group {
	display: flex;
	flex: 0 0 auto;
	align-items: center;
	gap: clamp(30px, 4vw, 60px);
	padding-right: clamp(30px, 4vw, 60px);
}

.os-marquee .ticker-item {
	flex: 0 0 auto;
	white-space: nowrap;
}

.os-marquee .ticker-item span {
	max-width: none;
}

@media (max-width: 720px) {
	.os-marquee > .wrap.ticker-inner {
		display: grid;
		grid-template-columns: repeat(2, 1fr);
		gap: 18px;
		width: min(var(--max), calc(100% - 38px));
		margin: 0 auto;
	}

	.os-marquee .ticker-item {
		white-space: normal;
	}

	.os-marquee-group {
		display: contents;
	}

	.os-marquee-group[aria-hidden="true"] {
		display: none;
	}

	.os-marquee .ticker-item span {
		max-width: 100px;
	}
}

@media (max-width: 420px) {
	.os-marquee > .wrap.ticker-inner {
		width: calc(100% - 30px);
	}
}

/* -------------------------------------------------------------------------
 * Motion layer
 * ---------------------------------------------------------------------- */
@media (prefers-reduced-motion: no-preference) {

	/* Scroll-in reveals: lift, blur, short stagger set from site.js. */
	.js .reveal {
		opacity: 0;
		transform: translateY(26px) scale(.992);
		filter: blur(6px);
		transition:
			opacity .8s var(--os-ease),
			transform .8s var(--os-ease),
			filter .6s var(--os-ease);
		transition-delay: var(--os-delay, 0ms);
	}

	.js .reveal.in {
		opacity: 1;
		transform: none;
		filter: none;
	}

	/* Hero is above the fold: animate its parts, not the whole column. */
	.js .hero .hero-grid > .reveal {
		opacity: 1;
		transform: none;
		filter: none;
		transition: none;
	}

	.hero .eyebrow,
	.hero h1 .line,
	.hero .hero-lead,
	.hero .hero-actions,
	.hero .hero-meta {
		animation: os-rise .85s var(--os-ease-out) both;
	}

	.hero .eyebrow {
		animation-delay: .06s;
	}

	.hero h1 .line:nth-of-type(1) {
		animation-delay: .14s;
	}

	.hero h1 .line:nth-of-type(2) {
		animation-delay: .23s;
	}

	.hero h1 .line:nth-of-type(3) {
		animation-delay: .32s;
	}

	.hero h1 .line:nth-of-type(4) {
		animation-delay: .41s;
	}

	.hero .hero-lead {
		animation-delay: .5s;
	}

	.hero .hero-actions {
		animation-delay: .58s;
	}

	.hero .hero-meta {
		animation-delay: .66s;
	}

	.hero .atlas {
		animation: os-atlas-in 1.05s var(--os-ease-out) .18s both;
	}

	/* Ambient glows breathe very slowly. */
	.hero:after {
		animation: os-drift 18s ease-in-out infinite;
	}

	.section-ink:after {
		animation: os-drift 24s ease-in-out infinite reverse;
	}

	/* Floating atlas nodes. */
	.atlas-node {
		animation: os-float 7.5s ease-in-out infinite;
	}

	.atlas-node.node-a {
		animation-delay: .2s;
	}

	.atlas-node.node-b {
		animation-delay: 1.3s;
	}

	.atlas-node.node-c {
		animation-delay: 2.1s;
	}

	.atlas-node.node-d {
		animation-delay: 2.9s;
	}

	.atlas-node:hover {
		animation-play-state: paused;
	}

	/* Portrait tilt (pointer driven, fine pointers only). */
	@media (pointer: fine) {
		.atlas-photo {
			transform-origin: 50% 42%;
			transition: transform .28s ease-out, box-shadow .4s ease;
			will-change: transform;
		}
	}

	/* Ticker marquee. Duration is set in site.js from the track width. */
	.os-marquee > .wrap.ticker-inner {
		animation: os-marquee-scroll var(--os-marquee-duration, 32s) linear infinite;
	}

	.os-marquee:hover > .wrap.ticker-inner {
		animation-play-state: paused;
	}

	/* Meters fill when they enter the viewport. */
	.js .skill-meter > i em,
	.js .planning-item > i em {
		transform: scaleX(0);
		transform-origin: left center;
		transition: transform 1.15s var(--os-ease-out);
	}

	.js .skill-meter.os-meter-on > i em,
	.js .planning-item.os-meter-on > i em {
		transform: none;
	}

	.skill-meter:nth-child(2) > i em {
		transition-delay: .12s;
	}

	.skill-meter:nth-child(3) > i em {
		transition-delay: .24s;
	}

	.skill-meter:nth-child(4) > i em {
		transition-delay: .36s;
	}

	.skill-meter:nth-child(5) > i em {
		transition-delay: .48s;
	}

	/* Button shine sweep. */
	.btn {
		position: relative;
		overflow: hidden;
	}

	.btn:before {
		content: "";
		position: absolute;
		top: -20%;
		left: 0;
		width: 55%;
		height: 140%;
		pointer-events: none;
		background: linear-gradient(100deg, transparent, #ffffff59, transparent);
		transform: translateX(-190%) skewX(-18deg);
		transition: transform .7s var(--os-ease-out);
	}

	.btn:hover:before {
		transform: translateX(360%) skewX(-18deg);
	}

	.btn.outline:before {
		background: linear-gradient(100deg, transparent, #ff280021, transparent);
	}

	/* Skeletons / avatar rings get a slow glow pulse. */
	.atlas-core,
	.contact-cta:after {
		animation: os-breathe 9s ease-in-out infinite;
	}
}

@media (prefers-reduced-motion: no-preference) and (max-width: 720px) {
	.js .reveal {
		filter: none;
	}

	/* The strip falls back to a static two-column grid on small screens. */
	.os-marquee > .wrap.ticker-inner {
		animation: none;
	}

	.hero h1 .line,
	.hero .eyebrow,
	.hero .hero-lead,
	.hero .hero-actions,
	.hero .hero-meta {
		animation-duration: .6s;
	}

	.atlas-node {
		animation: none;
	}
}

/* -------------------------------------------------------------------------
 * Keyframes
 * ---------------------------------------------------------------------- */
@keyframes os-rise {
	from {
		opacity: 0;
		transform: translateY(22px);
	}

	to {
		opacity: 1;
		transform: none;
	}
}

@keyframes os-atlas-in {
	from {
		opacity: 0;
		transform: translateY(30px) scale(.965);
	}

	to {
		opacity: 1;
		transform: none;
	}
}

@keyframes os-float {
	0%,
	100% {
		transform: translate3d(0, 0, 0);
	}

	50% {
		transform: translate3d(0, -10px, 0);
	}
}

@keyframes os-marquee-scroll {
	from {
		transform: translateX(0);
	}

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

@keyframes os-drift {
	0%,
	100% {
		transform: translate3d(0, 0, 0) scale(1);
	}

	50% {
		transform: translate3d(-3%, 4%, 0) scale(1.07);
	}
}

@keyframes os-breathe {
	0%,
	100% {
		opacity: .85;
	}

	50% {
		opacity: 1;
	}
}

/* -------------------------------------------------------------------------
 * Reduced motion: keep the static depth, drop the rest.
 * ---------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
	.os-progress {
		display: none;
	}

	.os-marquee-group[aria-hidden="true"] {
		display: none;
	}

	.skill-meter > i em,
	.planning-item > i em {
		transform: none;
	}

	.atlas-node {
		animation: none;
	}
}
