/* =============================================================
   Michael Dial, PhD — portfolio
   Aesthetic: animated particle hero (à la dhaitz.github.io) flowing
   into a clean academic portfolio (à la fmattioni.me).
   Design tokens are in :root — change --accent to re-skin.
   ============================================================= */

:root {
  --accent:        #5eead4;   /* teal — used for particles, links, highlights */
  --accent-strong: #14b8a6;

  --bg:            #ffffff;
  --bg-elev:       #f7f8f8;
  --text:          #1a1c1e;
  --text-muted:    #5b6266;
  --border:        #e6e8ea;
  --shadow:        0 1px 2px rgba(0,0,0,.04), 0 12px 32px rgba(0,0,0,.06);

  /* The hero is always dark, regardless of theme */
  --hero-bg:       #0b1120;
  --hero-bg-2:     #111a2e;
  --hero-text:     #f5f7fa;
  --hero-muted:    #9aa7bd;

  --font-display: "Georgia", "Times New Roman", serif;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --maxw: 1040px;
  --radius: 14px;
}

:root[data-theme="dark"] {
  --bg:            #0d1117;
  --bg-elev:       #161b22;
  --text:          #f0f3f6;
  --text-muted:    #9aa4b0;
  --border:        #262d36;
  --shadow:        0 1px 2px rgba(0,0,0,.3), 0 12px 32px rgba(0,0,0,.4);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:#0d1117; --bg-elev:#161b22; --text:#f0f3f6; --text-muted:#9aa4b0;
    --border:#262d36; --shadow:0 1px 2px rgba(0,0,0,.3), 0 12px 32px rgba(0,0,0,.4);
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
.container { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: 1.5rem; }
a { color: var(--accent-strong); text-decoration: none; }
a:hover { text-decoration: underline; }

.skip-link { position: absolute; left: -999px; top: 0; background: var(--accent-strong); color: #fff; padding: .6rem 1rem; z-index: 100; }
.skip-link:focus { left: 0; }

/* ------------------------------- NAV ------------------------------- */
.site-header {
  position: fixed; inset: 0 0 auto 0; z-index: 50; height: 64px;
  display: flex; align-items: center;
  transition: background .3s, border-color .3s, backdrop-filter .3s;
  border-bottom: 1px solid transparent;
}
/* Transparent over the dark hero; solid once scrolled past it */
.site-header.is-scrolled {
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom-color: var(--border);
}
.nav { display: flex; align-items: center; gap: 1.5rem; width: 100%; }
.nav__brand { font-family: var(--font-display); font-size: 1.15rem; font-weight: 700; color: var(--hero-text); }
.site-header.is-scrolled .nav__brand { color: var(--text); }
.nav__brand:hover { text-decoration: none; }
.nav__brand-accent { color: var(--accent); }
.nav__links { display: flex; gap: 1.4rem; list-style: none; margin: 0 0 0 auto; padding: 0; }
.nav__links a { color: var(--hero-muted); font-size: .95rem; font-weight: 500; }
.site-header.is-scrolled .nav__links a { color: var(--text-muted); }
.nav__links a:hover { color: var(--accent); text-decoration: none; }

.theme-toggle {
  background: transparent; border: 1px solid rgba(255,255,255,.25); color: var(--hero-text);
  width: 38px; height: 38px; border-radius: 10px; cursor: pointer;
  display: grid; place-items: center; transition: background .15s, border-color .15s, color .3s;
}
.site-header.is-scrolled .theme-toggle { border-color: var(--border); color: var(--text); }
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }
.theme-toggle__moon { display: none; }
:root[data-theme="dark"] .theme-toggle__sun { display: none; }
:root[data-theme="dark"] .theme-toggle__moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle__sun { display: none; }
  :root:not([data-theme="light"]) .theme-toggle__moon { display: block; }
}
@media (max-width: 620px) { .nav__links { display: none; } }

/* ------------------------------- HERO ------------------------------- */
.hero {
  position: relative; min-height: 100vh; min-height: 100svh;
  display: grid; place-items: center; text-align: center; overflow: hidden;
  background: radial-gradient(120% 120% at 50% 0%, var(--hero-bg-2) 0%, var(--hero-bg) 60%);
  color: var(--hero-text); padding: 6rem 1.5rem 3rem;
}
.hero__canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.hero__content { position: relative; z-index: 2; max-width: 760px; }
.hero__eyebrow { color: var(--accent); font-weight: 600; letter-spacing: .18em; text-transform: uppercase; font-size: .8rem; margin: 0 0 1rem; }
.hero__name { font-family: var(--font-display); font-size: clamp(2.6rem, 7vw, 4.75rem); line-height: 1.03; margin: 0 0 1.2rem; font-weight: 700; letter-spacing: -.01em; }
.hero__cred { color: var(--hero-muted); font-weight: 400; }
.hero__tagline { font-size: clamp(1.05rem, 2.4vw, 1.35rem); color: var(--hero-muted); margin: 0 auto 1rem; max-width: 40ch; }
.hero__location { display: inline-flex; align-items: center; gap: .35rem; color: var(--hero-muted); font-size: .95rem; margin: 0 0 2.2rem; opacity: .85; }
.hero__location svg { flex: none; }

/* ---- social icon buttons (the link hub) ---- */
.socials { display: flex; flex-wrap: wrap; justify-content: center; gap: .9rem; list-style: none; margin: 0 0 3rem; padding: 0; }
.social {
  display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%;
  color: var(--hero-text); border: 1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.04); transition: transform .18s, background .18s, border-color .18s, color .18s;
}
.social svg { width: 22px; height: 22px; }
.social:hover { transform: translateY(-4px); color: var(--hero-bg); background: var(--accent); border-color: var(--accent); text-decoration: none; box-shadow: 0 8px 22px rgba(94,234,212,.35); }

/* ---- scroll cue ---- */
.scroll-cue { display: inline-flex; flex-direction: column; align-items: center; gap: .3rem; color: var(--hero-muted); font-size: .72rem; letter-spacing: .18em; text-transform: uppercase; }
.scroll-cue:hover { color: var(--accent); text-decoration: none; }
.scroll-cue__arrow { font-size: 1.1rem; animation: bob 1.8s ease-in-out infinite; }
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(6px); } }
@media (prefers-reduced-motion: reduce) { .scroll-cue__arrow { animation: none; } }

/* ------------------------------- BUTTONS ------------------------------- */
.btn { display: inline-block; padding: .8rem 1.6rem; border-radius: 999px; font-weight: 600; font-size: .95rem; transition: transform .12s, box-shadow .15s; }
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn--primary { background: var(--accent-strong); color: #fff; box-shadow: var(--shadow); }
.btn--ghost { border: 1px solid var(--border); color: var(--text); }
.btn--ghost:hover { border-color: var(--accent-strong); color: var(--accent-strong); }

/* ------------------------------- SECTIONS ------------------------------- */
.section { padding-block: 4.5rem; }
.section + .section { border-top: 1px solid var(--border); }
.section__title { font-family: var(--font-display); font-size: clamp(1.6rem, 4vw, 2.1rem); margin: 0 0 .5rem; font-weight: 700; }
.section__lead { color: var(--text-muted); margin: 0 0 2rem; font-size: 1.05rem; }
.section--contact { text-align: center; }
.section--contact .section__lead { margin-bottom: 1.4rem; }

/* ---- about ---- */
.about { display: grid; grid-template-columns: 220px 1fr; gap: 2.5rem; align-items: start; }
.about__photo img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--radius); box-shadow: var(--shadow); }
.about__photo img.is-missing {
  display: grid; place-items: center; min-height: 220px;
  background: repeating-linear-gradient(45deg, var(--bg-elev), var(--bg-elev) 12px, var(--bg) 12px, var(--bg) 24px);
  border: 1px dashed var(--border);
}
.about__body p { margin: 0 0 1rem; }
.about__body p:first-of-type { margin-top: 0; }
.about__facts { list-style: none; padding: 0; margin: 1.5rem 0 0; display: flex; flex-wrap: wrap; gap: .8rem 2.2rem; }
.about__facts li { color: var(--text-muted); font-size: .95rem; }
.about__facts strong { display: block; color: var(--text); font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; }
@media (max-width: 640px) { .about { grid-template-columns: 1fr; } .about__photo { max-width: 200px; } }

/* ---- cards ---- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 1.2rem; }
.card { background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; transition: transform .15s, border-color .15s, box-shadow .15s; }
.card:hover { transform: translateY(-3px); border-color: var(--accent-strong); box-shadow: var(--shadow); }
.card__tag { color: var(--accent-strong); font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; margin: 0 0 .5rem; }
.card__title { font-family: var(--font-display); font-size: 1.2rem; margin: 0 0 .5rem; }
.card__desc { color: var(--text-muted); font-size: .94rem; margin: 0 0 1rem; }
.card__link { font-weight: 600; font-size: .9rem; }

/* ---- publications ---- */
.pub-links { display: flex; flex-wrap: wrap; gap: .8rem; margin: 0 0 2rem; }
.pubs { list-style: none; counter-reset: pub; padding: 0; margin: 0; display: grid; gap: 1.4rem; }
.pub { position: relative; padding-left: 2.4rem; }
.pub::before { counter-increment: pub; content: counter(pub); position: absolute; left: 0; top: 0; width: 1.7rem; height: 1.7rem; display: grid; place-items: center; border-radius: 50%; background: var(--bg-elev); border: 1px solid var(--border); color: var(--text-muted); font-size: .8rem; font-weight: 700; }
.pub__title { font-weight: 600; margin: 0 0 .25rem; }
.pub__meta { color: var(--text-muted); font-size: .92rem; margin: 0 0 .35rem; }
.pub__link { font-size: .88rem; font-weight: 600; }

/* ------------------------------- FOOTER ------------------------------- */
.site-footer { border-top: 1px solid var(--border); padding-block: 2rem; }
.site-footer__inner { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .5rem; color: var(--text-muted); font-size: .88rem; }
.site-footer p { margin: 0; }
.site-footer__muted { opacity: .8; }
