/* ============================================================
   Joe Heffer — personal CV site
   Bold & modern, dependency-free. Design tokens live in :root.
   ============================================================ */

/* ---------- Design tokens ---------- */
:root {
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  /* Brand gradient stops */
  --brand-1: #6d5efc;   /* indigo  */
  --brand-2: #a855f7;   /* violet  */
  --brand-3: #ec4899;   /* pink    */
  --brand-2-text: var(--brand-2); /* brand-2 as foreground text; darkened in light theme for contrast */
  --grad: linear-gradient(120deg, var(--brand-1), var(--brand-2) 55%, var(--brand-3));

  --radius: 16px;
  --radius-sm: 10px;
  --maxw: 1080px;

  --ease: cubic-bezier(.22, 1, .36, 1);
  --shadow: 0 20px 50px -20px rgba(20, 12, 60, .45);

  --space: clamp(4rem, 9vw, 8rem);
}

/* Dark theme (default) */
:root[data-theme="dark"] {
  --bg: #0b0b12;
  --bg-alt: #101020;
  --surface: rgba(255, 255, 255, .04);
  --surface-2: rgba(255, 255, 255, .06);
  --border: rgba(255, 255, 255, .10);
  --text: #eef0f6;
  --muted: #a4a7b8;
  --muted-2: #7b7e90;
  --nav-bg: rgba(11, 11, 18, .72);
  --ring: rgba(168, 85, 247, .55);
  color-scheme: dark;
}

/* Light theme */
:root[data-theme="light"] {
  --bg: #f7f7fb;
  --bg-alt: #ffffff;
  --surface: #ffffff;
  --surface-2: #f1f1f8;
  --border: rgba(18, 16, 40, .10);
  --text: #16151f;
  --muted: #55566a;
  --muted-2: #5b5d72;
  --brand-2-text: #7e22ce;
  --nav-bg: rgba(247, 247, 251, .78);
  --ring: rgba(109, 94, 252, .45);
  --shadow: 0 20px 50px -24px rgba(60, 40, 120, .28);
  color-scheme: light;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

h1, h2, h3 { line-height: 1.08; margin: 0; letter-spacing: -.02em; }
p { margin: 0 0 1rem; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

.container { width: min(100% - 2.5rem, var(--maxw)); margin-inline: auto; }

.grad {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 3px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: .5rem;
  z-index: 200;
  background: var(--brand-1);
  color: #fff;
  padding: .6rem 1rem;
  border-radius: 8px;
}
.skip-link:focus { left: .75rem; }

/* ---------- Navigation ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--nav-bg);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s var(--ease);
}
.nav.is-scrolled { border-bottom-color: var(--border); }

.nav__inner {
  width: min(100% - 2.5rem, var(--maxw));
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: 68px;
}

.nav__brand { display: flex; align-items: center; gap: .6rem; font-weight: 700; }
.nav__monogram {
  display: grid;
  place-items: center;
  width: 34px; height: 34px;
  border-radius: 9px;
  background: var(--grad);
  color: #fff;
  font-size: .82rem;
  font-weight: 800;
  letter-spacing: .02em;
  box-shadow: var(--shadow);
}
.nav__name { font-size: 1rem; letter-spacing: -.01em; }

.nav__links { display: flex; gap: .35rem; }
.nav__links a {
  position: relative;
  padding: .5rem .8rem;
  font-size: .92rem;
  color: var(--muted);
  border-radius: 8px;
  transition: color .2s var(--ease), background .2s var(--ease);
}
.nav__links a:hover { color: var(--text); background: var(--surface); }
.nav__links a.is-active { color: var(--text); }
.nav__links a.is-active::after {
  content: "";
  position: absolute;
  left: .8rem; right: .8rem; bottom: .28rem;
  height: 2px;
  border-radius: 2px;
  background: var(--grad);
}

.nav__actions { display: flex; align-items: center; gap: .5rem; }

.theme-toggle {
  display: grid;
  place-items: center;
  width: 38px; height: 38px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: background .2s var(--ease), transform .2s var(--ease), border-color .2s var(--ease);
}
.theme-toggle:hover { background: var(--surface-2); transform: translateY(-1px); }
.theme-toggle__sun { display: none; }
.theme-toggle__moon { display: block; }
:root[data-theme="light"] .theme-toggle__sun { display: block; }
:root[data-theme="light"] .theme-toggle__moon { display: none; }

.nav__toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px; height: 38px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
  padding: 0 9px;
}
.nav__toggle span {
  height: 2px;
  border-radius: 2px;
  background: var(--text);
  transition: transform .3s var(--ease), opacity .2s var(--ease);
}
.nav.is-open .nav__toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav.is-open .nav__toggle span:nth-child(2) { opacity: 0; }
.nav.is-open .nav__toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: min(100svh, 900px);
  display: flex;
  align-items: center;
  padding: 6rem 0 4rem;
  overflow: hidden;
  isolation: isolate;
}

.hero__bg { position: absolute; inset: 0; z-index: -1; }
.hero__orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: .55;
  will-change: transform;
}
.hero__orb--1 {
  width: 44vw; height: 44vw; max-width: 560px; max-height: 560px;
  top: -8%; left: -6%;
  background: radial-gradient(circle at 30% 30%, var(--brand-1), transparent 70%);
  animation: float1 18s var(--ease) infinite alternate;
}
.hero__orb--2 {
  width: 40vw; height: 40vw; max-width: 520px; max-height: 520px;
  top: 8%; right: -8%;
  background: radial-gradient(circle at 60% 40%, var(--brand-3), transparent 70%);
  animation: float2 22s var(--ease) infinite alternate;
}
.hero__orb--3 {
  width: 38vw; height: 38vw; max-width: 500px; max-height: 500px;
  bottom: -14%; left: 30%;
  background: radial-gradient(circle at 50% 50%, var(--brand-2), transparent 70%);
  animation: float3 20s var(--ease) infinite alternate;
}
.hero__grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 54px 54px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, #000 30%, transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, #000 30%, transparent 78%);
  opacity: .5;
}

@keyframes float1 { to { transform: translate(60px, 40px) scale(1.1); } }
@keyframes float2 { to { transform: translate(-50px, 50px) scale(1.08); } }
@keyframes float3 { to { transform: translate(-40px, -50px) scale(1.12); } }

.hero__eyebrow {
  font-family: var(--font-mono);
  font-size: .95rem;
  letter-spacing: .04em;
  color: var(--muted);
  margin-bottom: .6rem;
}
.hero__title {
  font-size: clamp(3rem, 12vw, 8rem);
  font-weight: 800;
  letter-spacing: -.04em;
  margin-bottom: .4rem;
}
.hero__role {
  font-size: clamp(1.15rem, 3.2vw, 1.9rem);
  font-weight: 600;
  color: var(--text);
  margin-bottom: .9rem;
}
.hero__tagline {
  max-width: 44ch;
  font-size: clamp(1rem, 2vw, 1.2rem);
  color: var(--muted);
  margin-bottom: 2.2rem;
}

.hero__cta { display: flex; flex-wrap: wrap; gap: .9rem; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .85rem 1.5rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: .98rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform .2s var(--ease), box-shadow .2s var(--ease), background .2s var(--ease), border-color .2s var(--ease);
}
.btn--primary {
  background: var(--grad);
  color: #fff;
  box-shadow: 0 12px 30px -10px rgba(168, 85, 247, .6);
}
.btn--primary:hover { transform: translateY(-2px); box-shadow: 0 18px 38px -10px rgba(168, 85, 247, .7); }
.btn--ghost {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
.btn--ghost:hover { transform: translateY(-2px); background: var(--surface-2); }

.hero__scroll {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  margin-top: 3rem;
  color: var(--muted-2);
  font-family: var(--font-mono);
  font-size: .8rem;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.hero__scroll-dot {
  width: 22px; height: 34px;
  border: 2px solid var(--border);
  border-radius: 12px;
  position: relative;
}
.hero__scroll-dot::after {
  content: "";
  position: absolute;
  left: 50%; top: 7px;
  width: 4px; height: 6px;
  border-radius: 2px;
  background: var(--brand-2);
  transform: translateX(-50%);
  animation: scrollDot 1.8s var(--ease) infinite;
}
@keyframes scrollDot {
  0% { opacity: 0; transform: translate(-50%, 0); }
  40% { opacity: 1; }
  80% { opacity: 0; transform: translate(-50%, 12px); }
  100% { opacity: 0; }
}

/* ---------- Sections ---------- */
.section { padding: var(--space) 0; }
.section--alt { background: var(--bg-alt); }

.section__head {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 3rem;
}
.section__index {
  font-family: var(--font-mono);
  font-size: 1rem;
  color: var(--brand-2-text);
  font-weight: 700;
}
.section__title {
  font-size: clamp(2rem, 6vw, 3.4rem);
  font-weight: 800;
}

/* ---------- About ---------- */
.about {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: clamp(2rem, 5vw, 4rem);
  align-items: start;
}
.about__lead p { font-size: clamp(1.05rem, 2vw, 1.25rem); color: var(--muted); }
.about__lead p:first-child { color: var(--text); }

.about__aside {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.6rem;
}
.about__portrait {
  display: block;
  width: 100%;
  height: auto;
  max-width: 220px;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin: 0 auto 1.6rem;
}

.about__aside-title {
  font-size: .82rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted-2);
  font-weight: 700;
  margin: 0 0 .9rem;
}
.about__aside-title:not(:first-child) { margin-top: 1.6rem; }

.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .5rem; }
.chip {
  font-size: .86rem;
  padding: .4rem .8rem;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
}

.facts { list-style: none; margin: 0; padding: 0; display: grid; gap: .7rem; }
.facts li { display: flex; justify-content: space-between; gap: 1rem; font-size: .95rem; }
.facts span { color: var(--muted); }
.facts strong { font-weight: 600; text-align: right; }

/* ---------- Timeline ---------- */
.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  position: relative;
}
.timeline::before {
  content: "";
  position: absolute;
  left: 7px; top: 6px; bottom: 6px;
  width: 2px;
  background: linear-gradient(var(--brand-1), var(--brand-3));
  opacity: .5;
}
.timeline__item {
  position: relative;
  padding-left: 2.5rem;
  padding-bottom: 2rem;
}
.timeline__item:last-child { padding-bottom: 0; }
.timeline__marker {
  position: absolute;
  left: 0; top: 6px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--grad);
  box-shadow: 0 0 0 4px var(--bg);
}
.timeline__marker--edu { background: var(--surface-2); border: 2px solid var(--brand-2); }
.section--alt .timeline__marker { box-shadow: 0 0 0 4px var(--bg-alt); }

.timeline__card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem 1.6rem;
  transition: transform .25s var(--ease), border-color .25s var(--ease), box-shadow .25s var(--ease);
}
.timeline__card:hover {
  transform: translateY(-3px);
  border-color: var(--ring);
  box-shadow: var(--shadow);
}
.timeline__date {
  font-family: var(--font-mono);
  font-size: .82rem;
  color: var(--brand-2-text);
  font-weight: 600;
}
.timeline__role { font-size: 1.25rem; font-weight: 700; margin: .3rem 0 .1rem; }
.timeline__org { color: var(--muted); font-weight: 500; margin: 0 0 .6rem; }
.timeline__desc { color: var(--muted); margin: 0 0 .8rem; }
.timeline__tags { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .4rem; }
.timeline__tags li {
  font-family: var(--font-mono);
  font-size: .74rem;
  color: var(--muted-2);
  padding: .2rem .55rem;
  border: 1px solid var(--border);
  border-radius: 6px;
}

/* ---------- Project cards ---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.4rem;
}
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  overflow: hidden;
  transition: transform .25s var(--ease), border-color .25s var(--ease), box-shadow .25s var(--ease);
}
.card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--grad);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .3s var(--ease);
}
.card:hover { transform: translateY(-5px); border-color: var(--ring); box-shadow: var(--shadow); }
.card:hover::before { transform: scaleX(1); }

.card__top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.card__icon {
  display: grid; place-items: center;
  width: 42px; height: 42px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--brand-2-text);
  font-size: 1.1rem;
}
.card__year { font-family: var(--font-mono); font-size: .8rem; color: var(--muted-2); }
.card__title { font-size: 1.2rem; font-weight: 700; margin-bottom: .5rem; }
.card__desc { color: var(--muted); font-size: .96rem; flex: 1; margin-bottom: 1rem; }
.card__tags { list-style: none; margin: 0 0 1rem; padding: 0; display: flex; flex-wrap: wrap; gap: .4rem; }
.card__tags li {
  font-family: var(--font-mono);
  font-size: .74rem;
  color: var(--muted-2);
  padding: .2rem .55rem;
  border: 1px solid var(--border);
  border-radius: 6px;
}
.card__link {
  align-self: flex-start;
  font-weight: 600;
  font-size: .92rem;
  color: var(--brand-2-text);
}
.card__link span { transition: transform .2s var(--ease); display: inline-block; }
.card__link:hover span { transform: translateX(4px); }

/* ---------- AI & research community ---------- */
.ai__intro {
  max-width: 720px;
  font-size: clamp(1.05rem, 2vw, 1.15rem);
  color: var(--muted);
  margin: 0 0 2.2rem;
}
.ai-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; }
.ai-list__item {
  display: flex;
  align-items: flex-start;
  gap: 1.4rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem 1.6rem;
  transition: transform .25s var(--ease), border-color .25s var(--ease), box-shadow .25s var(--ease);
}
.ai-list__item:hover { transform: translateY(-3px); border-color: var(--ring); box-shadow: var(--shadow); }
.ai-list__role {
  flex: 0 0 auto;
  width: 8.5rem;
  font-family: var(--font-mono);
  font-size: .78rem;
  font-weight: 600;
  color: var(--brand-2-text);
  padding-top: .2rem;
}
.ai-list__title { font-size: 1.1rem; font-weight: 700; margin: 0 0 .35rem; }
.ai-list__body p { color: var(--muted); margin: 0; font-size: .96rem; }
.ai__profile { margin: 1.6rem 0 0; }
.ai__profile a { font-weight: 600; color: var(--brand-2-text); }
.ai__profile a span { transition: transform .2s var(--ease); display: inline-block; }
.ai__profile a:hover span { transform: translateX(4px); }

/* ---------- Contact ---------- */
.contact { max-width: 640px; }
.contact__lead { font-size: clamp(1.1rem, 2.4vw, 1.4rem); color: var(--muted); margin-bottom: 1.4rem; }
.contact__email {
  display: inline-block;
  font-size: clamp(1.5rem, 5vw, 2.6rem);
  font-weight: 800;
  letter-spacing: -.03em;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 2rem;
}
.contact__email:hover { opacity: .85; }

.contact__form {
  margin-bottom: 2rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  background: var(--surface);
}
.contact__form iframe { display: block; width: 100%; border: 0; }

.contact__links { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .8rem; }
.contact__links a {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  padding: .7rem 1.2rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  font-weight: 600;
  font-size: .95rem;
  transition: transform .2s var(--ease), background .2s var(--ease), border-color .2s var(--ease);
}
.contact__links a:hover { transform: translateY(-2px); background: var(--surface-2); border-color: var(--ring); }

.contact__ico {
  display: grid; place-items: center;
  width: 22px; height: 22px;
  border-radius: 6px;
  background: var(--grad);
  color: #fff;
  font-size: .7rem;
  font-weight: 700;
  font-style: normal;
}
.contact__ico svg { width: 13px; height: 13px; }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--border); padding: 2rem 0; background: var(--bg-alt); }
.footer__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  color: var(--muted);
  font-size: .9rem;
}
.footer__brand { font-weight: 700; color: var(--text); }
.footer__brand span {
  display: inline-grid; place-items: center;
  width: 26px; height: 26px;
  border-radius: 7px;
  background: var(--grad);
  color: #fff;
  font-size: .68rem;
  font-weight: 800;
  margin-right: .5rem;
  vertical-align: middle;
}
.footer__top { color: var(--muted); font-weight: 600; }
.footer__top:hover { color: var(--text); }

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

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

@media (max-width: 560px) {
  .ai-list__item { flex-direction: column; gap: .4rem; }
  .ai-list__role { width: auto; }
}

@media (max-width: 680px) {
  .nav__links {
    position: fixed;
    inset: 68px 0 auto 0;
    flex-direction: column;
    gap: 0;
    background: var(--nav-bg);
    backdrop-filter: saturate(180%) blur(14px);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    border-bottom: 1px solid var(--border);
    padding: .5rem 1.25rem 1.25rem;
    transform: translateY(-12px);
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s var(--ease), transform .25s var(--ease);
  }
  .nav.is-open .nav__links { transform: none; opacity: 1; pointer-events: auto; }
  .nav__links a { padding: .85rem .6rem; font-size: 1.05rem; border-radius: 10px; }
  .nav__links a.is-active::after { left: .6rem; right: auto; width: 20px; bottom: .5rem; }
  .nav__toggle { display: flex; }
  .nav__name { display: none; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .hero__orb, .hero__scroll-dot::after { animation: none; }
  .reveal { opacity: 1; transform: none; transition: none; }
  * { scroll-behavior: auto; }
}
