:root {
  --background: 0 0% 100%;
  --foreground: 0 0% 0%;
  --card: 0 0% 100%;
  --card-foreground: 0 0% 0%;
  --secondary: 0 0% 95%;
  --secondary-foreground: 0 0% 0%;
  --muted: 0 0% 95%;
  --muted-foreground: 0 0% 40%;
  --accent: 0 0% 95%;
  --accent-foreground: 0 0% 0%;
  --border: 0 0% 90%;
  --radius: 0.5rem;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

html[data-theme="dark"] {
  --background: 0 0% 0%;
  --foreground: 0 0% 100%;
  --card: 0 0% 0%;
  --card-foreground: 0 0% 100%;
  --secondary: 0 0% 10%;
  --secondary-foreground: 0 0% 100%;
  --muted: 0 0% 10%;
  --muted-foreground: 0 0% 60%;
  --accent: 0 0% 10%;
  --accent-foreground: 0 0% 100%;
  --border: 0 0% 15%;
}

* , *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }

html {
  background-color: hsl(var(--background));
  color: hsl(var(--foreground));
}

/* Animated aurora glow — dark theme only, matching the reference site. */
html[data-theme="dark"] {
  background-image:
    radial-gradient(ellipse 80% 60% at 20% 20%, hsl(265 60% 22%) 0, transparent 60%),
    radial-gradient(ellipse 70% 60% at 80% 30%, hsl(215 70% 20%) 0, transparent 55%),
    radial-gradient(ellipse 90% 70% at 50% 90%, hsl(190 65% 18%) 0, transparent 60%);
  background-size: 200% 200%;
  background-attachment: fixed;
  animation: gradient-drift 10s ease-in-out infinite;
}

@keyframes gradient-drift {
  0% { background-position: 0 0, 100% 0, 50% 100%; }
  50% { background-position: 100% 50%, 0 60%, 60% 0; }
  100% { background-position: 0 0, 100% 0, 50% 100%; }
}

@media (prefers-reduced-motion: reduce) {
  html[data-theme="dark"] { animation: none; }
}

::selection { background-color: hsl(265 60% 45% / 0.4); color: hsl(0 0% 100%); }

body {
  margin: 0;
  background-color: transparent;
  color: hsl(var(--foreground));
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.6;
}

a { color: inherit; text-decoration: none; }

.wrap { width: min(896px, calc(100% - 32px)); margin: 0 auto; }
.wrap-wide { width: min(1280px, calc(100% - 32px)); margin: 0 auto; }

/* ---------- Header ---------- */
header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; margin-bottom: 24px;
}
@media (min-width: 768px) { header { padding: 16px; margin-bottom: 48px; } }

.logo { font-size: 1.125rem; font-weight: 700; }
@media (min-width: 768px) { .logo { font-size: 1.25rem; } }

nav.main-nav { display: flex; align-items: stretch; gap: 4px; }

.glass-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: var(--radius);
  border: 1px solid hsl(var(--border) / 0.6);
  background: hsl(var(--background) / 0.4);
  color: hsl(var(--foreground));
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.05);
  font-weight: 500; font-size: 0.8rem; cursor: pointer;
  padding: 0 12px; height: 36px;
  transition: background-color 200ms var(--ease), border-color 200ms var(--ease), box-shadow 200ms var(--ease), transform 200ms var(--ease), color 200ms var(--ease);
}
@media (min-width: 768px) { .glass-btn { font-size: 0.9rem; padding: 0 16px; } }

.glass-btn:hover {
  background: hsl(var(--accent) / 0.6);
  border-color: hsl(var(--border));
  color: hsl(var(--accent-foreground));
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  transform: translateY(-2px);
}
.glass-btn.is-active { background: hsl(var(--accent) / 0.7); border-color: hsl(var(--border)); }

.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: var(--radius);
  border: none; background: transparent; color: hsl(var(--foreground)); cursor: pointer;
  transition: background-color 200ms var(--ease);
}
.icon-btn:hover { background: hsl(var(--accent) / 0.6); }
.icon-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn .icon-moon { display: none; }
html[data-theme="dark"] .icon-btn .icon-sun { display: none; }
html[data-theme="dark"] .icon-btn .icon-moon { display: block; }

/* ---------- Glass card system ---------- */
.glass-card {
  border-radius: 1rem;
  border: 1px solid hsl(var(--border) / 0.5);
  background: hsl(var(--card) / 0.5);
  color: hsl(var(--card-foreground));
  box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.05), 0 4px 6px -4px rgb(0 0 0 / 0.05);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}

.lift-on-hover { transition: transform 200ms var(--ease); }
.lift-on-hover:hover { transform: translateY(-4px); }

/* ---------- Intro layout: floating portrait + (hero text / experience) ---------- */
.intro-grid {
  display: flex; flex-direction: column; gap: 20px;
  padding: 0 16px; margin-bottom: 24px;
}
@media (min-width: 768px) {
  .intro-grid { flex-direction: row; align-items: flex-start; gap: 28px; }
}

/* The portrait is its own card, deliberately separate from the text card,
   and sticks in place ("floats") alongside the text column as the page
   scrolls. */
.portrait-col { width: 100%; max-width: 300px; margin: 0 auto; }
@media (min-width: 768px) {
  .portrait-col { width: 320px; flex-shrink: 0; margin: 0; position: sticky; top: 92px; }
}
@media (min-width: 1024px) {
  .portrait-col { width: 380px; }
}

.floating-portrait { padding: 12px; }
.floating-portrait img {
  display: block; width: 100%; height: auto; border-radius: 0.75rem;
}

.side-col { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 20px; }

/* The main content block (experience, skills, projects) is a visually
   distinct area below the hero/portrait row, not sharing a container
   with the floating image. */
.main-block { margin-top: 8px; }

/* ---------- Hero ---------- */
.hero-card { padding: 24px; }
@media (min-width: 768px) { .hero-card { padding: 28px; } }

.hero-name { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.01em; margin: 0 0 16px; }
@media (min-width: 640px) { .hero-name { font-size: 1.875rem; } }
@media (min-width: 768px) { .hero-name { font-size: 2.25rem; } }

.hero-body { font-size: 1rem; }
.hero-body p { margin: 0 0 14px; }
.hero-body p:last-child { margin-bottom: 0; }
@media (min-width: 640px) { .hero-body { font-size: 1.125rem; } }
@media (min-width: 768px) { .hero-body { font-size: 1.25rem; } }
@media (min-width: 1024px) { .hero-body { font-size: 1.4rem; } }

.hero-body a { font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }

/* ---------- Section titles ---------- */
.section-title {
  font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; color: hsl(var(--muted-foreground));
  margin: 0 0 14px; padding: 0 16px;
}

/* ---------- Experience ---------- */
.exp-section { padding-bottom: 24px; }
.exp-list { display: grid; gap: 12px; padding: 0 16px; }

.exp-card { width: 100%; padding: 16px; }

.exp-card-top {
  display: flex; flex-direction: column; align-items: flex-start; gap: 14px;
}
@media (min-width: 640px) { .exp-card-top { flex-direction: row; align-items: center; } }

/* Bullets + skills reveal underneath the card on hover/keyboard focus.
   grid-template-rows 0fr -> 1fr animates height without a fixed max-height. */
.exp-expand {
  display: grid; grid-template-rows: 0fr;
  transition: grid-template-rows 320ms var(--ease);
}
.exp-expand-inner { overflow: hidden; }
.exp-link:hover .exp-expand,
.exp-link:focus-visible .exp-expand {
  grid-template-rows: 1fr;
}

.exp-bullets {
  margin: 16px 0 0; padding-left: 18px; color: hsl(var(--muted-foreground)); font-size: 0.88rem;
}
.exp-bullets li { margin: 6px 0; }
.exp-bullets strong { color: hsl(var(--foreground)); }
.exp-expand .tag-row { margin-top: 12px; }

.exp-logo-box {
  flex-shrink: 0; width: 64px; height: 64px; border-radius: 0.6rem; overflow: hidden;
  background: transparent; display: grid; place-items: center; padding: 4px;
  transition: transform 300ms var(--ease);
}
.exp-card:hover .exp-logo-box { transform: scale(1.05); }
.exp-logo-box img { width: 100%; height: 100%; object-fit: contain; }

/* McMaster's official mark ships as a white-on-transparent PNG (meant for
   colored backgrounds). Used as a mask so it recolors to the current
   theme's foreground instead of vanishing on a light background. */
.exp-logo-mask {
  flex-shrink: 0; width: 64px; height: 64px; border-radius: 0.6rem;
  background-color: hsl(var(--foreground));
  -webkit-mask-image: url("assets/logos/mcmaster_m.png");
  mask-image: url("assets/logos/mcmaster_m.png");
  -webkit-mask-size: contain; mask-size: contain;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-position: center; mask-position: center;
  transition: transform 300ms var(--ease), background-color 200ms var(--ease);
}
.exp-card:hover .exp-logo-mask { transform: scale(1.05); }

.exp-info { flex-grow: 1; min-width: 0; }
.exp-role { display: block; font-weight: 600; font-size: 1rem; }
@media (min-width: 640px) { .exp-role { font-size: 1.125rem; } }
.exp-meta { display: block; color: hsl(var(--muted-foreground)); font-size: 0.875rem; margin-top: 2px; }
@media (min-width: 640px) { .exp-meta { font-size: 1rem; } }

.exp-dates { flex-shrink: 0; color: hsl(var(--muted-foreground)); font-size: 0.75rem; text-align: left; }
@media (min-width: 640px) { .exp-dates { font-size: 0.875rem; text-align: right; } }
.exp-dates p { margin: 0; }

/* ---------- Skills ---------- */
.skills-section { padding: 0 16px 24px; }
.skills-groups { display: grid; gap: 14px; }
.skills-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.skills-row-label { font-size: 0.85rem; color: hsl(var(--muted-foreground)); min-width: 96px; }

.tag {
  display: inline-flex; align-items: center;
  border: 1px solid hsl(var(--border) / 0.6);
  background: hsl(var(--secondary) / 0.5);
  color: hsl(var(--secondary-foreground));
  padding: 4px 10px; border-radius: 999px; font-size: 0.78rem;
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  transition: background-color 150ms var(--ease), border-color 150ms var(--ease);
}
.tag:hover { background: hsl(var(--secondary) / 0.8); border-color: hsl(var(--border)); }

/* ---------- Projects ---------- */
.project-grid { display: grid; grid-template-columns: 1fr; gap: 20px; padding: 0 16px; }
@media (min-width: 768px) { .project-grid { grid-template-columns: 1fr 1fr; gap: 24px; } }
@media (min-width: 1024px) { .project-grid.grid-3 { grid-template-columns: 1fr 1fr 1fr; } }

.project-card { display: flex; flex-direction: column; height: 100%; overflow: hidden; }

.project-head { padding: 20px 20px 0; }
.project-name { margin: 0; font-weight: 650; font-size: 1.2rem; letter-spacing: -0.01em; }
@media (min-width: 640px) { .project-name { font-size: 1.4rem; } }

.project-body { padding: 12px 20px 20px; display: flex; flex-direction: column; flex-grow: 1; gap: 12px; }
.project-kicker {
  font-size: 0.72rem; color: hsl(var(--muted-foreground)); text-transform: uppercase; letter-spacing: 0.05em;
  margin: 0;
}
.project-desc { color: hsl(var(--muted-foreground)); font-size: 0.92rem; margin: 0; flex-grow: 1; }

.tag-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; }

.project-link {
  display: block; width: calc(100% - 40px); margin: 0 20px 20px; height: 44px;
  text-align: center; line-height: 44px;
}

/* ---------- View all link ---------- */
.view-all-wrap { padding: 4px 16px 0; }
.view-all { display: inline-block; font-size: 0.9rem; font-weight: 600; }
.view-all:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Projects page heading ---------- */
.projects-page-title {
  font-size: 1.7rem; font-weight: 700; letter-spacing: -0.01em; margin: 8px 0 6px; padding: 0 16px;
}
@media (min-width: 768px) { .projects-page-title { font-size: 2.1rem; } }
.projects-page-sub { color: hsl(var(--muted-foreground)); margin: 0 0 32px; padding: 0 16px; }

/* ---------- Footer ---------- */
footer {
  border-top: 1px solid hsl(var(--border));
  padding: 32px 16px 56px; margin-top: 24px;
}
.footer-inner {
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  width: min(1280px, 100%); margin: 0 auto;
}
@media (min-width: 768px) { .footer-inner { flex-direction: row; justify-content: space-between; } }

.footer-links { display: flex; gap: 8px; flex-wrap: wrap; }
.footer-icon-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: var(--radius);
  font-size: 0.78rem; font-weight: 500; color: hsl(var(--foreground));
  transition: background-color 200ms var(--ease);
}
.footer-icon-btn:hover { background: hsl(var(--accent) / 0.6); }
.footer-icon-btn svg { width: 15px; height: 15px; }

.footer-sig { color: hsl(var(--muted-foreground)); font-size: 0.82rem; margin: 0; }

/* ---------- Reveal animation ---------- */
.reveal { opacity: 0; transform: translateY(10px); transition: opacity 420ms var(--ease), transform 420ms var(--ease); }
.reveal.is-visible { opacity: 1; transform: translateY(0); }

@media (prefers-reduced-motion: reduce) {
  .reveal, .lift-on-hover, .exp-card, .exp-logo-box, .glass-btn { transition: none; }
}
