/* =========================================================
   Matthew Saeger — Portfolio
   Modern, dependency-light stylesheet
   ========================================================= */

:root {
  --bg:        #070b14;
  --bg-2:      #0b1120;
  --surface:   rgba(255, 255, 255, 0.04);
  --surface-2: rgba(255, 255, 255, 0.06);
  --border:    rgba(255, 255, 255, 0.10);
  --border-2:  rgba(255, 255, 255, 0.18);
  --text:      #e8eefc;
  --muted:     #9aa7c2;
  --faint:     #6b779a;

  --brand:     #4f8cff;
  --brand-2:   #22d3ee;
  --accent:    #a855f7;
  --grad:      linear-gradient(120deg, #4f8cff 0%, #22d3ee 50%, #a855f7 100%);

  --radius:    18px;
  --radius-sm: 12px;
  --maxw:      1140px;
  --ease:      cubic-bezier(.22, 1, .36, 1);
  --shadow:    0 24px 60px -20px rgba(0, 0, 0, 0.6);
}

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

html { scroll-behavior: smooth; scroll-padding-top: 90px; }

body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, .nav__name {
  font-family: "Space Grotesk", "Inter", sans-serif;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
::selection { background: var(--brand); color: #fff; }

.container { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: 24px; }

/* ---------- Animated background ---------- */
.bg-canvas {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  z-index: -3;
}
.bg-aurora {
  position: fixed; inset: -20% -10% auto -10%;
  height: 80vh; z-index: -2; pointer-events: none;
  background:
    radial-gradient(40% 50% at 20% 20%, rgba(79,140,255,.28), transparent 70%),
    radial-gradient(35% 45% at 80% 15%, rgba(168,85,247,.22), transparent 70%),
    radial-gradient(40% 50% at 60% 40%, rgba(34,211,238,.18), transparent 70%);
  filter: blur(40px);
  animation: aurora 18s ease-in-out infinite alternate;
}
@keyframes aurora {
  0%   { transform: translate3d(-3%, -2%, 0) scale(1); }
  100% { transform: translate3d(4%, 3%, 0) scale(1.15); }
}
.bg-grid {
  position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(circle at 50% 30%, #000 0%, transparent 80%);
  -webkit-mask-image: radial-gradient(circle at 50% 30%, #000 0%, transparent 80%);
}

/* ---------- Scroll progress ---------- */
.scroll-progress {
  position: fixed; top: 0; left: 0; height: 3px; width: 0;
  background: var(--grad); z-index: 100;
  box-shadow: 0 0 12px rgba(79,140,255,.6);
}

/* ---------- Navigation ---------- */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 90;
  transition: background .4s var(--ease), backdrop-filter .4s, border-color .4s, padding .4s;
  border-bottom: 1px solid transparent;
}
.nav.is-scrolled {
  background: rgba(7, 11, 20, 0.72);
  backdrop-filter: blur(14px) saturate(150%);
  -webkit-backdrop-filter: blur(14px) saturate(150%);
  border-bottom-color: var(--border);
}
.nav__inner {
  max-width: var(--maxw); margin-inline: auto;
  padding: 18px 24px;
  display: flex; align-items: center; justify-content: space-between;
}
.nav__brand { display: flex; align-items: center; gap: 12px; font-weight: 600; }
.nav__mark {
  display: grid; place-items: center;
  width: 40px; height: 40px; border-radius: 11px;
  background: var(--grad); color: #fff;
  font-family: "Space Grotesk"; font-weight: 700; font-size: .95rem;
  box-shadow: 0 8px 24px -8px rgba(79,140,255,.7);
}
.nav__name { font-size: 1.02rem; }
.nav__links { display: flex; align-items: center; gap: 6px; }
.nav__link {
  position: relative; padding: 8px 14px; border-radius: 9px;
  color: var(--muted); font-size: .92rem; font-weight: 500;
  transition: color .25s, background .25s;
}
.nav__link:hover { color: var(--text); }
.nav__link.is-active { color: var(--text); }
.nav__link.is-active::after {
  content: ""; position: absolute; left: 14px; right: 14px; bottom: 2px;
  height: 2px; border-radius: 2px; background: var(--grad);
}
.nav__resume {
  margin-left: 10px; padding: 9px 18px; border-radius: 10px;
  background: var(--surface-2); border: 1px solid var(--border-2);
  color: var(--text); font-weight: 600; font-size: .9rem;
  transition: transform .25s var(--ease), border-color .25s, background .25s;
}
.nav__resume:hover { transform: translateY(-2px); border-color: var(--brand); background: rgba(79,140,255,.14); }
.nav__toggle {
  display: none; flex-direction: column; gap: 5px;
  background: none; border: 0; cursor: pointer; padding: 8px;
}
.nav__toggle span {
  width: 24px; height: 2px; background: var(--text); border-radius: 2px;
  transition: transform .3s var(--ease), opacity .3s;
}
.nav__toggle.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav__toggle.is-open span:nth-child(2) { opacity: 0; }
.nav__toggle.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- Hero ---------- */
.hero {
  min-height: 100vh;
  display: flex; flex-direction: column; justify-content: center;
  padding: 140px 24px 80px;
  max-width: var(--maxw); margin-inline: auto;
  position: relative;
}
.hero__inner { max-width: 760px; }
.hero__eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  font-size: .85rem; color: var(--muted); font-weight: 500;
  padding: 7px 16px; border: 1px solid var(--border); border-radius: 100px;
  background: var(--surface);
}
.hero__eyebrow .dot {
  width: 8px; height: 8px; border-radius: 50%; background: #34d399;
  box-shadow: 0 0 0 0 rgba(52,211,153,.6); animation: pulse 2.2s infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(52,211,153,.55); }
  70%  { box-shadow: 0 0 0 9px rgba(52,211,153,0); }
  100% { box-shadow: 0 0 0 0 rgba(52,211,153,0); }
}
.hero__title { font-size: clamp(2.6rem, 7vw, 4.6rem); font-weight: 700; margin: 22px 0 6px; }
.hero__role {
  font-size: clamp(1.3rem, 3.6vw, 2.1rem); font-weight: 500;
  color: var(--muted); min-height: 1.4em; margin-bottom: 22px;
}
.hero__role-static { color: var(--text); }
.typed { color: transparent; background: var(--grad); -webkit-background-clip: text; background-clip: text; }
.typed::after {
  content: "|"; color: var(--brand-2);
  -webkit-text-fill-color: var(--brand-2);
  animation: caret 1s step-end infinite; font-weight: 300;
}
@keyframes caret { 50% { opacity: 0; } }
.grad { color: transparent; background: var(--grad); -webkit-background-clip: text; background-clip: text; }
.hero__lead { font-size: 1.12rem; color: var(--muted); max-width: 620px; }
.hero__lead strong { color: var(--text); font-weight: 600; }
.hero__cta { display: flex; flex-wrap: wrap; gap: 14px; margin: 32px 0 26px; }
.hero__socials { display: flex; gap: 12px; }
.hero__socials a {
  display: grid; place-items: center; width: 44px; height: 44px;
  border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface); color: var(--muted);
  transition: transform .25s var(--ease), color .25s, border-color .25s, background .25s;
}
.hero__socials a:hover { transform: translateY(-3px); color: #fff; border-color: var(--brand); background: rgba(79,140,255,.16); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 13px 24px; border-radius: 12px; font-weight: 600; font-size: .95rem;
  cursor: pointer; border: 1px solid transparent;
  transition: transform .25s var(--ease), box-shadow .25s, background .25s, border-color .25s;
}
.btn--primary {
  background: var(--grad); color: #fff; background-size: 160% 160%;
  box-shadow: 0 14px 34px -12px rgba(79,140,255,.75);
}
.btn--primary:hover { transform: translateY(-3px); background-position: 100% 0; box-shadow: 0 20px 42px -12px rgba(79,140,255,.85); }
.btn--ghost { background: var(--surface); border-color: var(--border-2); color: var(--text); }
.btn--ghost:hover { transform: translateY(-3px); border-color: var(--brand); background: rgba(79,140,255,.12); }
.btn--block { width: 100%; justify-content: center; margin-top: 20px; }

/* Hero stats */
.hero__stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px;
  margin-top: 64px;
}
.stat {
  padding: 24px 20px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border);
  backdrop-filter: blur(8px);
}
.stat__num {
  display: block; font-family: "Space Grotesk"; font-weight: 700;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.stat__label { font-size: .82rem; color: var(--muted); }

/* Hero scroll hint */
.hero__scroll {
  position: absolute; left: 50%; bottom: 28px; transform: translateX(-50%);
}
.mouse {
  display: block; width: 26px; height: 42px; border: 2px solid var(--border-2);
  border-radius: 14px; position: relative;
}
.wheel {
  position: absolute; top: 8px; left: 50%; transform: translateX(-50%);
  width: 4px; height: 8px; border-radius: 3px; background: var(--brand-2);
  animation: wheel 1.6s infinite;
}
@keyframes wheel { 0% { opacity: 0; top: 7px; } 30% { opacity: 1; } 100% { opacity: 0; top: 22px; } }

/* ---------- Sections ---------- */
.section { padding: 100px 0; position: relative; }
.section__head { margin-bottom: 52px; max-width: 720px; }
.section__head--gap { margin-top: 4rem; }
.section__tag {
  font-family: "JetBrains Mono", monospace; font-size: .82rem;
  color: var(--brand-2); letter-spacing: .05em;
}
.section__title { font-size: clamp(1.9rem, 4.5vw, 2.8rem); font-weight: 700; margin-top: 10px; }
.section__sub { color: var(--muted); margin-top: 14px; font-size: 1.05rem; }

/* ---------- About ---------- */
.about { display: grid; grid-template-columns: 1.5fr 1fr; gap: 32px; align-items: start; }
.about__lead p { color: var(--muted); margin-bottom: 18px; font-size: 1.05rem; }
.about__lead strong { color: var(--text); }
.about__chips { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 15px; border-radius: 100px; font-size: .85rem; font-weight: 500;
  background: var(--surface); border: 1px solid var(--border); color: var(--muted);
  transition: transform .25s var(--ease), color .25s, border-color .25s;
}
.chip:hover { transform: translateY(-2px); color: var(--text); border-color: var(--brand); }
.chip i { color: var(--brand-2); }
.about__card {
  padding: 30px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow); position: sticky; top: 110px;
}
.about__card h3 { font-size: 1.2rem; margin-bottom: 18px; }
.info { list-style: none; }
.info li {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--border); font-size: .95rem;
}
.info li:last-child { border-bottom: 0; }
.info span { color: var(--faint); }
.info b { font-weight: 600; text-align: right; }
.info a { color: var(--brand-2); }

/* ---------- Cards (expertise) ---------- */
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.card {
  position: relative; padding: 30px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border);
  overflow: hidden;
  transition: transform .35s var(--ease), border-color .35s, background .35s;
}
.card::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 0%), rgba(79,140,255,.16), transparent 45%);
  opacity: 0; transition: opacity .35s;
}
.card:hover { transform: translateY(-6px); border-color: var(--border-2); }
.card:hover::before { opacity: 1; }
.card__icon {
  display: grid; place-items: center; width: 54px; height: 54px;
  border-radius: 14px; margin-bottom: 18px; font-size: 1.4rem;
  color: #fff; background: linear-gradient(135deg, rgba(79,140,255,.9), rgba(168,85,247,.9));
  box-shadow: 0 10px 26px -10px rgba(79,140,255,.8);
}
.card h3 { font-size: 1.2rem; margin-bottom: 10px; position: relative; }
.card p { color: var(--muted); font-size: .96rem; position: relative; }

/* ---------- Timeline ---------- */
.timeline { position: relative; padding-left: 8px; }
.timeline::before {
  content: ""; position: absolute; left: 9px; top: 6px; bottom: 6px; width: 2px;
  background: linear-gradient(to bottom, var(--brand), var(--accent), transparent);
}
.tl-item { position: relative; padding: 0 0 38px 42px; }
.tl-item::before {
  content: ""; position: absolute; left: 2px; top: 6px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--brand);
  box-shadow: 0 0 0 4px rgba(79,140,255,.16);
}
.tl-item:hover::before { background: var(--brand); }
.tl-time {
  font-family: "JetBrains Mono", monospace; font-size: .8rem;
  color: var(--brand-2); letter-spacing: .02em;
}
.tl-card {
  margin-top: 8px; padding: 22px 24px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border);
  transition: transform .3s var(--ease), border-color .3s, background .3s;
}
.tl-card:hover { transform: translateX(6px); border-color: var(--border-2); background: var(--surface-2); }
.tl-role { font-size: 1.12rem; font-weight: 600; margin-bottom: 4px; }
.tl-org { color: var(--brand-2); font-size: .95rem; font-weight: 500; }
.tl-tags { color: var(--faint); font-size: .82rem; margin: 6px 0 12px; }
.tl-list { list-style: none; }
.tl-list li { color: var(--muted); font-size: .94rem; padding: 5px 0 5px 20px; position: relative; }
.tl-list li::before {
  content: ""; position: absolute; left: 0; top: 12px;
  width: 6px; height: 6px; border-radius: 50%; background: var(--brand);
}
.tl-more { display: none; }
.tl-card.is-open .tl-more { display: block; }
.tl-toggle {
  margin-top: 12px; background: none; border: 0; cursor: pointer;
  color: var(--brand-2); font: inherit; font-size: .85rem; font-weight: 600;
  display: inline-flex; align-items: center; gap: 6px; padding: 0;
}
.tl-toggle i { transition: transform .3s; }
.tl-card.is-open .tl-toggle i { transform: rotate(180deg); }

/* ---------- Certifications ---------- */
.certs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.cert {
  padding: 22px; border-radius: var(--radius-sm);
  background: var(--surface); border: 1px solid var(--border);
  transition: transform .3s var(--ease), border-color .3s, background .3s;
}
.cert:hover { transform: translateY(-5px); border-color: var(--border-2); background: var(--surface-2); }
.cert__top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.cert__icon { font-size: 1.6rem; }
.cert__icon.aws { color: #ff9900; }
.cert__icon.ms { color: #00a4ef; }
.cert__icon.he { color: #c0392b; }
.cert__badge {
  font-size: .68rem; font-weight: 600; padding: 3px 9px; border-radius: 100px;
  background: rgba(79,140,255,.14); color: var(--brand-2);
  text-transform: uppercase; letter-spacing: .04em;
}
.cert h4 { font-size: .98rem; font-weight: 600; line-height: 1.35; }
.cert__org { display: block; color: var(--faint); font-size: .8rem; margin-top: 8px; }
.cert__verify {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 14px;
  font-size: .78rem; font-weight: 600; color: var(--brand-2);
  opacity: 0; transform: translateY(-4px); transition: opacity .25s, transform .25s;
}
.cert__verify i { font-size: .7rem; }
.cert:hover .cert__verify { opacity: 1; transform: none; }

/* ---------- Education ---------- */
.edu {
  display: flex; gap: 22px; align-items: flex-start;
  padding: 30px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border);
}
.edu__icon {
  flex: none; display: grid; place-items: center; width: 56px; height: 56px;
  border-radius: 14px; font-size: 1.5rem; color: #fff;
  background: linear-gradient(135deg, rgba(34,211,238,.9), rgba(79,140,255,.9));
}
.edu h3 { font-size: 1.2rem; }
.edu__years { font-family: "JetBrains Mono", monospace; font-size: .82rem; color: var(--brand-2); }
.edu p { color: var(--muted); margin-top: 10px; font-size: .98rem; }

/* ---------- Publications ---------- */
.pubs { display: grid; gap: 16px; }
.pub {
  display: flex; align-items: center; gap: 20px;
  padding: 22px 24px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border);
  transition: transform .3s var(--ease), border-color .3s, background .3s;
}
.pub:hover { transform: translateY(-4px); border-color: var(--brand); background: rgba(79,140,255,.08); }
.pub__icon {
  flex: none; display: grid; place-items: center; width: 50px; height: 50px;
  border-radius: 13px; font-size: 1.5rem; color: #ff9900;
  background: rgba(255,153,0,.12); border: 1px solid rgba(255,153,0,.25);
}
.pub__body { flex: 1; min-width: 0; }
.pub__body h3 { font-size: 1.08rem; font-weight: 600; line-height: 1.35; }
.pub__meta { color: var(--muted); font-size: .85rem; margin-top: 6px; }
.pub__meta .bullet { color: var(--faint); margin: 0 4px; }
.pub__ext { color: var(--faint); font-size: 1rem; transition: color .25s, transform .25s; }
.pub:hover .pub__ext { color: var(--brand-2); transform: translate(2px, -2px); }

/* ---------- Contact ---------- */
.contact { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.contact__item {
  display: flex; flex-direction: column; gap: 6px;
  padding: 26px 22px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border);
  transition: transform .3s var(--ease), border-color .3s, background .3s;
}
.contact__item[href]:hover { transform: translateY(-5px); border-color: var(--brand); background: rgba(79,140,255,.1); }
.contact__item i { font-size: 1.5rem; color: var(--brand-2); margin-bottom: 6px; }
.contact__item span { color: var(--faint); font-size: .82rem; }
.contact__item b { font-size: 1rem; font-weight: 600; word-break: break-word; }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--border); padding: 36px 0; margin-top: 40px; }
.footer__inner { display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap; }
.footer p { color: var(--muted); font-size: .9rem; }
.footer__socials { display: flex; gap: 12px; }
.footer__socials a {
  display: grid; place-items: center; width: 40px; height: 40px;
  border-radius: 10px; border: 1px solid var(--border); color: var(--muted);
  transition: transform .25s var(--ease), color .25s, border-color .25s;
}
.footer__socials a:hover { transform: translateY(-3px); color: #fff; border-color: var(--brand); }

/* ---------- Back to top ---------- */
.to-top {
  position: fixed; right: 26px; bottom: 26px; z-index: 80;
  display: grid; place-items: center; width: 48px; height: 48px;
  border-radius: 14px; background: var(--grad); color: #fff;
  box-shadow: 0 14px 30px -10px rgba(79,140,255,.8);
  opacity: 0; visibility: hidden; transform: translateY(16px);
  transition: opacity .3s, visibility .3s, transform .3s var(--ease);
}
.to-top.is-visible { opacity: 1; visibility: visible; transform: translateY(0); }
.to-top:hover { transform: translateY(-3px); }

/* ---------- Reveal animation ---------- */
.reveal { opacity: 0; transform: translateY(28px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
.reveal.is-visible { opacity: 1; transform: none; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .nav__links {
    position: fixed; inset: 0 0 0 auto; width: min(80vw, 320px);
    flex-direction: column; align-items: flex-start; gap: 4px;
    padding: 100px 28px 40px;
    background: rgba(9, 14, 26, 0.96);
    backdrop-filter: blur(16px);
    border-left: 1px solid var(--border);
    transform: translateX(100%); transition: transform .4s var(--ease);
  }
  .nav__links.is-open { transform: none; }
  .nav__link { width: 100%; padding: 12px 14px; font-size: 1rem; }
  .nav__resume { margin: 12px 0 0; }
  .nav__toggle { display: flex; z-index: 95; }
  .cards { grid-template-columns: repeat(2, 1fr); }
  .certs { grid-template-columns: repeat(2, 1fr); }
  .contact { grid-template-columns: repeat(2, 1fr); }
  .about { grid-template-columns: 1fr; }
  .about__card { position: static; }
  .hero__stats { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 560px) {
  .cards { grid-template-columns: 1fr; }
  .section { padding: 72px 0; }
  .hero { padding-top: 120px; }
  .edu { flex-direction: column; }
  .footer__inner { flex-direction: column; text-align: center; }
  .pub { flex-wrap: wrap; gap: 14px; }
  .pub__ext { display: none; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
  .reveal { opacity: 1; transform: none; }
}
