/**
 * Math 55 - Design-Forward Stylesheet
 * Dark mode with caustics-inspired aesthetic
 */

/* ============================================
   CSS Variables
   ============================================ */
:root {
	/* Colors */
	--bg-dark: #0a0a0a;
	--bg-surface: #111111;
	--bg-elevated: #1a1a1a;
	--bg-card: rgba(20, 20, 20, 0.8);
	
	--text-primary: #fafafa;
	--text-secondary: rgba(250, 250, 250, 0.7);
	--text-muted: rgba(250, 250, 250, 0.4);
	
	--accent-crimson: #A51C30;
	--accent-crimson-light: #c73e52;
	--accent-green: #1E5631;
	--accent-green-light: #2d8c4a;
	
	--border-subtle: rgba(255, 255, 255, 0.08);
	--border-light: rgba(255, 255, 255, 0.12);
	
	/* Typography */
	--font-display: 'Instrument Serif', Georgia, serif;
	--font-body: 'Space Grotesk', -apple-system, sans-serif;
	--font-mono: 'JetBrains Mono', monospace;
	
	/* Spacing */
	--nav-height: 72px;
	--section-padding: clamp(4rem, 10vw, 8rem);
}

/* ============================================
   Reset & Base
   ============================================ */
*, *::before, *::after {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}

html {
	font-size: 16px;
	scroll-behavior: smooth;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

body {
	font-family: var(--font-body);
	background: var(--bg-dark);
	color: var(--text-primary);
	line-height: 1.6;
	overflow-x: hidden;
}

::selection {
	background: var(--accent-crimson);
	color: white;
}

/* ============================================
   Caustics Canvas Background
   ============================================ */
#caustics-canvas {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	z-index: 0;
	pointer-events: none;
}

.overlay-gradient {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	z-index: 1;
	pointer-events: none;
	background: 
		radial-gradient(ellipse at 30% 20%, rgba(165, 28, 48, 0.08) 0%, transparent 50%),
		radial-gradient(ellipse at 70% 80%, rgba(30, 86, 49, 0.06) 0%, transparent 50%),
		linear-gradient(to bottom, transparent 0%, rgba(10, 10, 10, 0.5) 100%);
}

/* ============================================
   Floating Navigation
   ============================================ */
.floating-nav {
	position: fixed;
	top: 1.5rem;
	left: 50%;
	transform: translateX(-50%);
	z-index: 100;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 2rem;
	padding: 0.75rem 1.5rem;
	background: rgba(10, 10, 10, 0.6);
	backdrop-filter: blur(20px);
	-webkit-backdrop-filter: blur(20px);
	border: 1px solid var(--border-subtle);
	border-radius: 100px;
	transition: all 0.3s ease;
}

.floating-nav.nav-scrolled {
	background: rgba(10, 10, 10, 0.9);
	border-color: var(--border-light);
}

.nav-logo {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	color: var(--text-primary);
	font-weight: 600;
	font-size: 0.9rem;
	letter-spacing: 0.05em;
}

.nav-shield {
	color: var(--accent-crimson);
}

.nav-links {
	display: flex;
	align-items: center;
	gap: 0.25rem;
}

.nav-link {
	padding: 0.5rem 1rem;
	color: var(--text-secondary);
	text-decoration: none;
	font-size: 0.875rem;
	font-weight: 500;
	border-radius: 100px;
	transition: all 0.2s ease;
}

.nav-link:hover {
	color: var(--text-primary);
	background: rgba(255, 255, 255, 0.08);
}

.nav-link-icon {
	padding: 0.5rem;
	display: flex;
	align-items: center;
}

/* ============================================
   Hero Section
   ============================================ */
.hero {
	position: relative;
	z-index: 2;
	min-height: 100vh;
	display: flex;
	flex-direction: column;
	justify-content: center;
	padding: var(--section-padding);
	padding-top: calc(var(--nav-height) + var(--section-padding));
}

.hero-content {
	max-width: 700px;
	flex-shrink: 0;
}

.hero-badge {
	display: inline-block;
	padding: 0.75rem 1.5rem;
	margin-bottom: 2rem;
	background: rgba(165, 28, 48, 0.15);
	border: 1px solid rgba(165, 28, 48, 0.3);
	border-radius: 100px;
	font-size: 1.1rem;
	font-weight: 600;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--accent-crimson-light);
}

.hero-title {
	font-family: var(--font-display);
	font-size: clamp(6rem, 18vw, 14rem);
	font-weight: 400;
	line-height: 0.9;
	letter-spacing: -0.03em;
	margin-bottom: 2.5rem;
}

.title-line {
	display: block;
}

.title-accent {
	font-style: italic;
	background: linear-gradient(135deg, var(--accent-crimson-light) 0%, var(--accent-crimson) 100%);
	-webkit-background-clip: text;
	-webkit-text-fill-color: transparent;
	background-clip: text;
}

.hero-subtitle {
	max-width: 650px;
	font-size: 1.75rem;
	line-height: 1.6;
	color: var(--text-secondary);
	margin-bottom: 3rem;
}

/* 3D Harvard Logo */
.hero-3d {
	position: absolute;
	right: 0;
	top: 50%;
	transform: translateY(-50%);
	width: 850px;
	height: 850px;
	pointer-events: auto;
}

#harvard-3d-canvas {
	width: 100%;
	height: 100%;
}

.hero-cta {
	display: flex;
	gap: 1rem;
	flex-wrap: wrap;
}

.btn {
	display: inline-flex;
	align-items: center;
	gap: 0.75rem;
	padding: 1.25rem 2.5rem;
	font-family: var(--font-body);
	font-size: 1.4rem;
	font-weight: 500;
	text-decoration: none;
	border-radius: 100px;
	transition: all 0.3s ease;
	cursor: pointer;
	border: none;
}

.btn-primary {
	background: var(--text-primary);
	color: var(--bg-dark);
}

.btn-primary:hover {
	transform: translateY(-2px);
	box-shadow: 0 10px 40px rgba(255, 255, 255, 0.15);
}

.btn-secondary {
	background: transparent;
	color: var(--text-primary);
	border: 1px solid var(--border-light);
}

.btn-secondary:hover {
	background: rgba(255, 255, 255, 0.05);
	border-color: rgba(255, 255, 255, 0.2);
}

.hero-stats {
	display: flex;
	gap: 4rem;
	margin-top: 2rem;
}

.stat {
	display: flex;
	flex-direction: column;
}

.stat-value {
	font-family: var(--font-display);
	font-size: 4rem;
	font-weight: 400;
	color: var(--text-primary);
}

.stat-label {
	font-size: 1.1rem;
	font-weight: 500;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--text-muted);
}

/* ============================================
   Courses Section
   ============================================ */
.courses-section {
	position: relative;
	z-index: 2;
	padding: var(--section-padding);
	padding-top: 2rem;
}

.section-header {
	text-align: center;
	margin-bottom: 4rem;
}

.section-tag {
	display: inline-block;
	padding: 0.5rem 1rem;
	margin-bottom: 1.25rem;
	background: rgba(255, 255, 255, 0.05);
	border: 1px solid var(--border-subtle);
	border-radius: 100px;
	font-size: 1rem;
	font-weight: 600;
	letter-spacing: 0.15em;
	text-transform: uppercase;
	color: var(--text-muted);
}

.section-title {
	font-family: var(--font-display);
	font-size: clamp(2.5rem, 6vw, 4.5rem);
	font-weight: 400;
	letter-spacing: -0.02em;
}

.course-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
	gap: 2rem;
	max-width: 1200px;
	margin: 0 auto;
}

/* ============================================
   Course Cards
   ============================================ */
.course-card {
	position: relative;
	display: grid;
	grid-template-columns: 1fr 200px;
	min-height: 360px;
	background: var(--bg-card);
	border: 1px solid var(--border-subtle);
	border-radius: 24px;
	overflow: hidden;
	text-decoration: none;
	color: inherit;
	transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
	opacity: 0;
	transform: translateY(30px);
}

.course-card.in-view {
	opacity: 1;
	transform: translateY(0);
}

.course-card:hover {
	transform: translateY(-8px);
	border-color: var(--border-light);
}

.card-glow {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	opacity: 0;
	transition: opacity 0.4s ease;
	pointer-events: none;
}

.course-card-55a .card-glow {
	background: radial-gradient(ellipse at 30% 50%, rgba(165, 28, 48, 0.15) 0%, transparent 70%);
}

.course-card-55b .card-glow {
	background: radial-gradient(ellipse at 30% 50%, rgba(30, 86, 49, 0.15) 0%, transparent 70%);
}

.course-card:hover .card-glow {
	opacity: 1;
}

.card-content {
	position: relative;
	z-index: 1;
	padding: 2rem;
	display: flex;
	flex-direction: column;
}

.card-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 1.5rem;
}

.card-semester {
	font-size: 1rem;
	font-weight: 600;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--text-muted);
}

.card-badge {
	padding: 0.5rem 1rem;
	border-radius: 100px;
	font-family: var(--font-mono);
	font-size: 1.1rem;
	font-weight: 600;
}

.course-card-55a .card-badge {
	background: rgba(165, 28, 48, 0.2);
	color: var(--accent-crimson-light);
}

.course-card-55b .card-badge {
	background: rgba(30, 86, 49, 0.2);
	color: var(--accent-green-light);
}

.card-title {
	font-family: var(--font-display);
	font-size: 2.5rem;
	font-weight: 400;
	margin-bottom: 1rem;
}

.card-description {
	font-size: 1.25rem;
	line-height: 1.6;
	color: var(--text-secondary);
	margin-bottom: 1.5rem;
}

.card-topics {
	display: flex;
	flex-wrap: wrap;
	gap: 0.6rem;
	margin-bottom: auto;
}

.topic {
	padding: 0.4rem 0.8rem;
	background: rgba(255, 255, 255, 0.05);
	border-radius: 6px;
	font-size: 1rem;
	font-weight: 500;
	color: var(--text-muted);
}

.card-footer {
	margin-top: 2rem;
}

.card-link {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	font-size: 1.2rem;
	font-weight: 500;
	transition: gap 0.3s ease;
}

.course-card-55a .card-link {
	color: var(--accent-crimson-light);
}

.course-card-55b .card-link {
	color: var(--accent-green-light);
}

.course-card:hover .card-link {
	gap: 0.75rem;
}

.card-visual {
	position: relative;
	overflow: hidden;
}

.card-canvas {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
}

/* ============================================
   About Section
   ============================================ */
.about-section {
	position: relative;
	z-index: 2;
	padding: var(--section-padding);
	background: linear-gradient(to bottom, transparent 0%, rgba(20, 20, 20, 0.5) 100%);
}

.about-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 4rem;
	max-width: 1200px;
	margin: 0 auto;
	align-items: center;
}

.about-content {
	opacity: 0;
	transform: translateX(-30px);
	transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.about-content.in-view {
	opacity: 1;
	transform: translateX(0);
}

.about-content .section-title {
	text-align: left;
	margin-bottom: 1.5rem;
}

.about-text {
	font-size: 1.35rem;
	line-height: 1.8;
	color: var(--text-secondary);
	margin-bottom: 1.25rem;
}

.about-features {
	margin-top: 2.5rem;
	display: flex;
	flex-direction: column;
	gap: 1.5rem;
}

.feature {
	display: flex;
	gap: 1rem;
	opacity: 0;
	transform: translateY(20px);
	transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.feature.in-view {
	opacity: 1;
	transform: translateY(0);
}

.feature:nth-child(2) { transition-delay: 0.1s; }
.feature:nth-child(3) { transition-delay: 0.2s; }

.feature-icon {
	width: 60px;
	height: 60px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(255, 255, 255, 0.05);
	border: 1px solid var(--border-subtle);
	border-radius: 12px;
	color: var(--text-secondary);
	flex-shrink: 0;
}

.feature-icon svg {
	width: 28px;
	height: 28px;
}

.feature-text h4 {
	font-size: 1.3rem;
	font-weight: 600;
	margin-bottom: 0.35rem;
}

.feature-text p {
	font-size: 1.1rem;
	color: var(--text-muted);
}

.about-visual {
	opacity: 0;
	transform: translateX(30px);
	transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
	transition-delay: 0.2s;
}

.about-visual.in-view {
	opacity: 1;
	transform: translateX(0);
}

.formula-display {
	display: flex;
	flex-direction: column;
	gap: 1.5rem;
	padding: 2rem;
}

.formula-item {
	font-family: var(--font-display);
	font-size: clamp(2rem, 4vw, 3.5rem);
	font-style: italic;
	color: var(--text-muted);
	opacity: 0;
	transform: translateY(20px);
	animation: formulaFade 0.6s ease forwards;
}

.formula-item:nth-child(1) { animation-delay: 0.5s; }
.formula-item:nth-child(2) { animation-delay: 1s; }
.formula-item:nth-child(3) { animation-delay: 1.5s; }
.formula-item:nth-child(4) { animation-delay: 2s; }

@keyframes formulaFade {
	to {
		opacity: 0.6;
		transform: translateY(0);
	}
}

/* ============================================
   Footer
   ============================================ */
.site-footer {
	position: relative;
	z-index: 2;
	padding: 3rem var(--section-padding);
	border-top: 1px solid var(--border-subtle);
}

.footer-content {
	display: flex;
	justify-content: space-between;
	align-items: center;
	max-width: 1200px;
	margin: 0 auto;
}

.footer-brand {
	display: flex;
	align-items: center;
	gap: 1rem;
}

.footer-shield {
	color: var(--accent-crimson);
}

.footer-info {
	display: flex;
	flex-direction: column;
}

.footer-title {
	font-weight: 600;
	font-size: 1.2rem;
}

.footer-subtitle {
	font-size: 1rem;
	color: var(--text-muted);
}

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

.footer-links a {
	color: var(--text-secondary);
	text-decoration: none;
	font-size: 1.1rem;
	transition: color 0.2s ease;
}

.footer-links a:hover {
	color: var(--text-primary);
}

.footer-bottom {
	max-width: 1200px;
	margin: 2rem auto 0;
	padding-top: 2rem;
	border-top: 1px solid var(--border-subtle);
	text-align: center;
}

.footer-bottom p {
	font-size: 1rem;
	color: var(--text-muted);
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 1024px) {
	.course-grid {
		grid-template-columns: 1fr;
	}

	.about-grid {
		grid-template-columns: 1fr;
		gap: 3rem;
	}

	.about-visual {
		order: -1;
	}
}

@media (max-width: 1400px) {
	.hero-3d {
		width: 700px;
		height: 700px;
		right: -5%;
	}
}

@media (max-width: 1200px) {
	.hero-3d {
		width: 550px;
		height: 550px;
		right: -10%;
	}
}

@media (max-width: 1024px) {
	.hero-3d {
		display: none;
	}
}

@media (max-width: 768px) {
	:root {
		--section-padding: 1.5rem;
	}

	.floating-nav {
		top: 1rem;
		padding: 0.5rem 1rem;
	}

	.nav-logo span {
		display: none;
	}

	.hero-title {
		font-size: clamp(3.5rem, 15vw, 6rem);
	}

	.hero-subtitle {
		font-size: 1.25rem;
	}

	.btn {
		font-size: 1.1rem;
		padding: 1rem 1.75rem;
	}

	.stat-value {
		font-size: 2.5rem;
	}

	.hero-stats {
		position: relative;
		bottom: auto;
		left: auto;
		margin-top: 3rem;
		gap: 2rem;
	}

	.stat-value {
		font-size: 2rem;
	}

	.course-card {
		grid-template-columns: 1fr;
		min-height: auto;
	}

	.card-visual {
		height: 150px;
	}

	.footer-content {
		flex-direction: column;
		gap: 2rem;
		text-align: center;
	}
}

/* ============================================
   Course Page Styles (for course.html)
   ============================================ */
.course-page-nav {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	z-index: 100;
	padding: 1rem var(--section-padding);
	background: rgba(10, 10, 10, 0.9);
	backdrop-filter: blur(20px);
	border-bottom: 1px solid var(--border-subtle);
}

.course-page-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	max-width: 1400px;
	margin: 0 auto;
}

.back-link {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	color: var(--text-secondary);
	text-decoration: none;
	font-size: 0.875rem;
	transition: color 0.2s ease;
}

.back-link:hover {
	color: var(--text-primary);
}
