/* ============================================================
   Adriano Junior · personal site v4
   Theme: dark tech, locked dark. One accent: signal blue.
   Type: Space Grotesk (display/body) + JetBrains Mono (meta).
   Shape system: surfaces 16px, interactive pills, chips pills.
   ============================================================ */

@font-face {
	font-family: 'Space Grotesk';
	src: url('../fonts/space-grotesk-400.woff2') format('woff2');
	font-weight: 400;
	font-display: swap;
}
@font-face {
	font-family: 'Space Grotesk';
	src: url('../fonts/space-grotesk-500.woff2') format('woff2');
	font-weight: 500;
	font-display: swap;
}
@font-face {
	font-family: 'Space Grotesk';
	src: url('../fonts/space-grotesk-700.woff2') format('woff2');
	font-weight: 700;
	font-display: swap;
}
@font-face {
	font-family: 'JetBrains Mono';
	src: url('../fonts/jetbrains-mono-400.woff2') format('woff2');
	font-weight: 400;
	font-display: swap;
}
@font-face {
	font-family: 'JetBrains Mono';
	src: url('../fonts/jetbrains-mono-500.woff2') format('woff2');
	font-weight: 500;
	font-display: swap;
}

:root {
	--bg: #0b0d11;
	--bg-elevated: #12151b;
	--line: #232833;
	--text: #e9ecf1;
	--text-muted: #9aa3b0;
	--accent: #4c9eff;
	--accent-soft: rgba(76, 158, 255, 0.12);
	--radius-surface: 16px;
	--font-sans: 'Space Grotesk', system-ui, sans-serif;
	--font-mono: 'JetBrains Mono', ui-monospace, monospace;
	--nav-height: 68px;
	--ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

* {
	margin: 0;
	box-sizing: border-box;
}

html {
	scroll-behavior: smooth;
	scroll-padding-top: calc(var(--nav-height) + 1rem);
	overflow-x: clip; /* clamp decorative hero glow that drifts past the right edge */
}

body {
	overflow-x: clip; /* hero glow blob may drift past the viewport edge */
	background: var(--bg);
	color: var(--text);
	font-family: var(--font-sans);
	font-weight: 400;
	line-height: 1.6;
	-webkit-font-smoothing: antialiased;
}

::selection {
	background: var(--accent);
	color: #0b0d11;
}

img {
	max-width: 100%;
	display: block;
}

.hidden {
	/* display: none !important; */
	visibility: hidden !important;
}

/* ============ NAV ============ */

.site-nav {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	z-index: 10;
	height: var(--nav-height);
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0 1.25rem;
	background: rgba(11, 13, 17, 0.82);
	backdrop-filter: blur(12px);
	-webkit-backdrop-filter: blur(12px);
	border-bottom: 1px solid var(--line);
}

.nav-brand {
	font-family: var(--font-mono);
	font-size: 0.95rem;
	font-weight: 500;
	color: var(--text);
	text-decoration: none;
	letter-spacing: -0.02em;
}

.brand-accent {
	color: var(--accent);
}

.nav-links {
	display: flex;
	gap: 2rem;
}

.nav-links a {
	color: var(--text-muted);
	text-decoration: none;
	font-size: 0.95rem;
	transition: color 0.25s var(--ease-out);
}

.nav-links a:hover,
.nav-links a:focus-visible {
	color: var(--text);
}

.nav-links a.active {
	color: var(--accent);
}

.nav-toggle {
	display: none;
	flex-direction: column;
	justify-content: center;
	gap: 6px;
	width: 44px;
	height: 44px;
	padding: 10px;
	background: none;
	border: none;
	cursor: pointer;
}

.nav-toggle span {
	display: block;
	height: 2px;
	width: 100%;
	background: var(--text);
	border-radius: 2px;
	transition: transform 0.3s var(--ease-out), opacity 0.3s var(--ease-out);
}

/* Mobile nav */
@media (max-width: 767.9px) {
	.nav-toggle {
		display: flex;
	}

	.nav-links {
		position: fixed;
		top: var(--nav-height);
		left: 0;
		right: 0;
		flex-direction: column;
		gap: 0;
		background: var(--bg-elevated);
		border-bottom: 1px solid var(--line);
		transform: translateY(-110%);
		transition: transform 0.35s var(--ease-out);
		visibility: hidden;
	}

	.nav-links.open {
		transform: translateY(0);
		visibility: visible;
	}

	.nav-links a {
		padding: 1rem 1.25rem;
		border-top: 1px solid var(--line);
		font-size: 1.05rem;
	}

	.nav-toggle[aria-expanded="true"] span:first-child {
		transform: translateY(4px) rotate(45deg);
	}

	.nav-toggle[aria-expanded="true"] span:last-child {
		transform: translateY(-4px) rotate(-45deg);
	}
}

/* ============ LAYOUT ============ */

main {
	max-width: 1200px;
	margin: 0 auto;
	padding: 0 1.25rem;
}

section {
	padding: 5rem 0;
}

.section-title {
	font-size: clamp(1.75rem, 4vw, 2.5rem);
	font-weight: 700;
	letter-spacing: -0.03em;
	margin-bottom: 2.5rem;
}

/* ============ HERO ============ */

.hero {
	position: relative;
	min-height: 100dvh;
	padding-top: calc(var(--nav-height) + 2rem);
	padding-bottom: 3rem;
	display: grid;
	grid-template-columns: 1fr;
	align-content: center;
	gap: 3rem;
}

.hero-headline {
	font-size: clamp(2.5rem, 6.5vw, 4.5rem);
	font-weight: 700;
	line-height: 1.05;
	letter-spacing: -0.035em;
	max-width: 14ch;
	padding-bottom: 0.15em; /* italic descender reserve */
}

.hero-headline em {
	font-style: italic;
	color: var(--accent);
	line-height: 1.1;
}

.hero-sub {
	margin-top: 1.5rem;
	font-size: 1.15rem;
	color: var(--text-muted);
	max-width: 46ch;
}

.hero-ctas {
	margin-top: 2.25rem;
	display: flex;
	flex-wrap: wrap;
	gap: 0.9rem;
}

.btn {
	display: inline-flex;
	align-items: center;
	padding: 0.8rem 1.7rem;
	border-radius: 999px;
	font-size: 1rem;
	font-weight: 500;
	text-decoration: none;
	white-space: nowrap;
	transition: transform 0.2s var(--ease-out), background 0.25s var(--ease-out),
		border-color 0.25s var(--ease-out), color 0.25s var(--ease-out);
}

.btn:active {
	transform: scale(0.98);
}

.btn-primary {
	background: var(--accent);
	color: #08111d;
}

.btn-primary:hover,
.btn-primary:focus-visible {
	background: #6cb0ff;
}

.btn-ghost {
	border: 1px solid var(--line);
	color: var(--text);
}

.btn-ghost:hover,
.btn-ghost:focus-visible {
	border-color: var(--accent);
	color: var(--accent);
}

.hero-photo {
	justify-self: center;
	position: relative;
	max-width: 320px;
}

.hero-photo img {
	height: auto;
	width: 100%;
	border-radius: var(--radius-surface);
	filter: grayscale(100%) contrast(1.05);
	border: 1px solid var(--line);
	transition: filter 0.5s var(--ease-out);
}

.hero-photo:hover img {
	filter: grayscale(0%) contrast(1);
}

.hero-photo-caption {
	margin-top: 0.9rem;
	font-family: var(--font-mono);
	font-size: 0.8rem;
	color: var(--text-muted);
}

@media (min-width: 768px) {
	.hero {
		grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
		align-items: center;
		gap: 4rem;
	}

	.hero-photo {
		justify-self: end;
		max-width: 380px;
	}
}

/* ============ ABOUT ============ */

.about-body {
	display: grid;
	gap: 1.25rem;
	max-width: 62ch;
}

.about-lead {
	font-size: 1.25rem;
	line-height: 1.55;
}

.about-body p:not(.about-lead) {
	color: var(--text-muted);
}

.facts {
	margin-top: 3rem;
	display: grid;
	grid-template-columns: 1fr;
	gap: 1px;
	background: var(--line);
	border: 1px solid var(--line);
	border-radius: var(--radius-surface);
	overflow: hidden;
}

.fact {
	background: var(--bg-elevated);
	padding: 1.25rem 1.5rem;
}

.fact dt {
	font-family: var(--font-mono);
	font-size: 0.75rem;
	color: var(--text-muted);
	text-transform: uppercase;
	letter-spacing: 0.08em;
	margin-bottom: 0.35rem;
}

.fact dd {
	margin: 0;
	font-weight: 500;
}

@media (min-width: 640px) {
	.facts {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (min-width: 1024px) {
	.facts {
		grid-template-columns: repeat(4, 1fr);
	}
}

/* ============ EXPERIENCE ============ */

.timeline {
	list-style: none;
	padding: 0;
	display: grid;
	gap: 0;
}

.timeline-item {
	position: relative;
	display: grid;
	grid-template-columns: 1fr;
	gap: 0.5rem;
	padding: 2rem 0 2rem 1.75rem;
	border-left: 1px solid var(--line);
}

.timeline-item::before {
	content: '';
	position: absolute;
	left: -5px;
	top: 2.55rem;
	width: 9px;
	height: 9px;
	border-radius: 50%;
	background: var(--bg);
	border: 2px solid var(--accent);
}

.timeline-period {
	font-family: var(--font-mono);
	font-size: 0.82rem;
	color: var(--text-muted);
}

.timeline-content h3 {
	font-size: 1.2rem;
	font-weight: 700;
	letter-spacing: -0.01em;
}

.timeline-content .at {
	color: var(--accent);
	font-weight: 500;
}

.timeline-content .at::before {
	content: '/ ';
	color: var(--text-muted);
	font-weight: 400;
}

.timeline-content p {
	margin-top: 0.5rem;
	color: var(--text-muted);
	max-width: 68ch;
}

.tags {
	list-style: none;
	padding: 0;
	margin-top: 0.9rem;
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
}

.tags li {
	font-family: var(--font-mono);
	font-size: 0.75rem;
	color: var(--text-muted);
	border: 1px solid var(--line);
	border-radius: 999px;
	padding: 0.2rem 0.7rem;
}

@media (min-width: 900px) {
	.timeline-item {
		grid-template-columns: 190px 1fr;
		gap: 2.5rem;
		padding-left: 2.5rem;
	}

	.timeline-period {
		padding-top: 0.3rem;
	}
}

/* ============ STACK ============ */

.stack-groups {
	display: grid;
	grid-template-columns: 1fr;
	gap: 2.25rem;
}

.stack-group h3 {
	font-size: 1rem;
	font-weight: 500;
	color: var(--text-muted);
	margin-bottom: 0.9rem;
}

.chips {
	list-style: none;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	gap: 0.6rem;
}

.chips li {
	font-family: var(--font-mono);
	font-size: 0.85rem;
	padding: 0.4rem 0.95rem;
	border-radius: 999px;
	background: var(--bg-elevated);
	border: 1px solid var(--line);
	transition: border-color 0.25s var(--ease-out), color 0.25s var(--ease-out);
}

.chips li:hover {
	border-color: var(--accent);
	color: var(--accent);
}

@media (min-width: 768px) {
	.stack-groups {
		grid-template-columns: repeat(2, 1fr);
		gap: 2.5rem 4rem;
	}
}

/* ============ PROJECTS ============ */

.project-index {
	list-style: none;
	padding: 0;
	border-top: 1px solid var(--line);
}

.project-row {
	border-bottom: 1px solid var(--line);
}

.project-link-area {
	display: grid;
	grid-template-columns: 1fr auto;
	align-items: center;
	gap: 0.5rem 1.5rem;
	padding: 1.75rem 0.25rem;
	text-decoration: none;
	color: inherit;
	transition: padding 0.3s var(--ease-out), background 0.3s var(--ease-out);
}

.project-link-area:hover,
.project-link-area:focus-visible {
	background: var(--accent-soft);
	padding-left: 1rem;
	padding-right: 1rem;
	border-radius: var(--radius-surface);
}

.project-main h3 {
	font-size: clamp(1.3rem, 3vw, 1.75rem);
	font-weight: 700;
	letter-spacing: -0.02em;
}

.project-main p {
	margin-top: 0.4rem;
	color: var(--text-muted);
	max-width: 60ch;
	font-size: 0.97rem;
}

.project-meta {
	grid-column: 1;
	font-family: var(--font-mono);
	font-size: 0.78rem;
	color: var(--text-muted);
	margin-top: 0.3rem;
}

.project-arrow {
	grid-column: 2;
	grid-row: 1 / 3;
	font-size: 1.5rem;
	color: var(--text-muted);
	transition: transform 0.3s var(--ease-out), color 0.3s var(--ease-out);
}

.project-link-area:hover .project-arrow,
.project-link-area:focus-visible .project-arrow {
	transform: translate(4px, -4px);
	color: var(--accent);
}

/* Non-clickable project card (private client work) */
.project-link-area.is-static {
	cursor: default;
}

.project-link-area.is-static:hover,
.project-link-area.is-static:focus-visible {
	background: none;
	padding-left: 0.25rem;
	padding-right: 0.25rem;
	border-radius: 0;
}

/* ============ CONTACT ============ */

.contact {
	text-align: center;
	padding: 7rem 0;
}

.contact-headline {
	font-size: clamp(2rem, 5.5vw, 3.5rem);
	font-weight: 700;
	letter-spacing: -0.03em;
	line-height: 1.1;
}

.contact-sub {
	margin: 1.25rem auto 0;
	color: var(--text-muted);
	max-width: 52ch;
}

.contact-email {
	display: inline-block;
	margin-top: 2.25rem;
	font-family: var(--font-mono);
	font-size: clamp(1rem, 3vw, 1.4rem);
	color: var(--accent);
	text-decoration: none;
	border-bottom: 1px solid transparent;
	transition: border-color 0.25s var(--ease-out);
}

.contact-email:hover,
.contact-email:focus-visible {
	border-bottom-color: var(--accent);
}

.social-links {
	margin-top: 2.5rem;
	display: flex;
	justify-content: center;
	gap: 1rem;
}

.social-links a {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 52px;
	height: 52px;
	border-radius: 999px;
	border: 1px solid var(--line);
	color: var(--text-muted);
	font-size: 1.5rem;
	text-decoration: none;
	transition: border-color 0.25s var(--ease-out), color 0.25s var(--ease-out),
		transform 0.2s var(--ease-out);
}

.social-links a:hover,
.social-links a:focus-visible {
	border-color: var(--accent);
	color: var(--accent);
	transform: translateY(-2px);
}

/* ============ FOOTER ============ */

.site-footer {
	max-width: 1200px;
	margin: 0 auto;
	padding: 2rem 1.25rem;
	border-top: 1px solid var(--line);
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 1rem;
	font-family: var(--font-mono);
	font-size: 0.8rem;
	color: var(--text-muted);
}

.footer-archive {
	color: var(--text-muted);
	text-decoration: none;
	border-bottom: 1px solid var(--line);
	transition: color 0.25s var(--ease-out), border-color 0.25s var(--ease-out);
}

.footer-archive:hover,
.footer-archive:focus-visible {
	color: var(--text);
	border-color: var(--text);
}

/* ============ SCROLL REVEAL ============ */

@media (prefers-reduced-motion: no-preference) {
	.reveal {
		opacity: 0;
		transform: translateY(28px);
		transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out);
	}

	.reveal.visible {
		opacity: 1;
		transform: translateY(0);
	}

	.hero-text,
	.hero-photo {
		animation: hero-in 0.9s var(--ease-out) both;
	}

	.hero-photo {
		animation-delay: 0.15s;
	}

	@keyframes hero-in {
		from {
			opacity: 0;
			transform: translateY(24px);
		}
		to {
			opacity: 1;
			transform: translateY(0);
		}
	}

	/* Accent underline sweep on the highlighted headline word */
	.hero-headline em {
		position: relative;
		display: inline-block;
	}

	.hero-headline em::after {
		content: '';
		position: absolute;
		left: 0;
		right: 0;
		bottom: -0.02em;
		height: 3px;
		border-radius: 2px;
		background: var(--accent);
		transform: scaleX(0);
		transform-origin: left;
		animation: sweep-in 0.5s var(--ease-out) 1.05s both;
	}

	@keyframes sweep-in {
		to {
			transform: scaleX(1);
		}
	}

	/* Terminal-style typing + blinking cursor on the photo caption.
	   22ch = "Ribeirão Preto, Brazil" in the mono font. */
	.hero-photo-caption {
		width: 22ch;
		overflow: hidden;
		white-space: nowrap;
		border-right: 2px solid var(--accent);
		animation: caption-typing 1.3s steps(22) 0.8s both,
			caption-blink 1s steps(1) infinite;
	}

	@keyframes caption-typing {
		from {
			width: 0;
		}
		to {
			width: 22ch;
		}
	}

	@keyframes caption-blink {
		50% {
			border-right-color: transparent;
		}
	}

	/* Photo tilt (transform set from JS on fine-pointer devices) */
	.hero-photo img {
		transition: filter 0.5s var(--ease-out), transform 0.4s var(--ease-out);
		will-change: transform;
	}

	/* Faint accent glow drifting behind the hero */
	.hero::before {
		content: '';
		position: absolute;
		top: 8%;
		left: -12%;
		width: 620px;
		height: 620px;
		border-radius: 50%;
		background: radial-gradient(circle, rgba(76, 158, 255, 0.08), transparent 70%);
		pointer-events: none;
		z-index: -1;
		animation: hero-glow 22s ease-in-out infinite alternate;
	}

	@keyframes hero-glow {
		to {
			transform: translate(45vw, 22vh);
		}
	}

	/* One-shot pulse on timeline dots as items reveal */
	.timeline-item.visible::before {
		animation: dot-pulse 0.9s var(--ease-out) 1;
	}

	@keyframes dot-pulse {
		from {
			box-shadow: 0 0 0 0 rgba(76, 158, 255, 0.45);
		}
		to {
			box-shadow: 0 0 0 14px rgba(76, 158, 255, 0);
		}
	}
}
