/* ==========================================================================
   Angelo Feraudo: single-page site
   Plain CSS, no framework. Colors are tokens on :root with a dark variant
   (system preference, overridable with the theme toggle via [data-theme]).
   ========================================================================== */

/* ---------- Tokens ---------- */
:root {
  --bg: #fafaf8;
  --surface: #ffffff;
  --surface-2: #f2f2ef;
  --ink: #15161a;
  --ink-2: #3c3e45;
  --muted: #696c74;
  --line: #e6e5e0;
  --line-strong: #d2d1cb;
  --accent: #2453d4;
  --accent-hover: #1a40ad;
  --accent-soft: #e8eefc;
  --on-accent: #ffffff;
  --grid: rgba(21, 22, 26, 0.055);
  --glow: rgba(36, 83, 212, 0.22);
  --ok: #12825f;
  --ok-soft: rgba(18, 130, 95, 0.16);
  --header-bg: rgba(250, 250, 248, 0.8);

  --journal: #2453d4;
  --journal-soft: #e8eefc;
  --conference: #0d7466;
  --conference-soft: #e0f3ef;
  --preprint: #9a5208;
  --preprint-soft: #fbefdf;

  --contact-bg: #121318;
  --contact-ink: #f4f4f5;
  --contact-muted: #a9acb5;
  --contact-line: rgba(255, 255, 255, 0.14);
  --contact-accent: #8fb0ff;

  --shadow-sm: 0 1px 2px rgba(16, 17, 20, 0.05), 0 6px 16px -6px rgba(16, 17, 20, 0.1);
  --shadow-lg: 0 1px 2px rgba(16, 17, 20, 0.05), 0 16px 36px -10px rgba(16, 17, 20, 0.18), 0 44px 90px -28px rgba(16, 17, 20, 0.22);

  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --radius: 14px;
  --radius-lg: 22px;
  --container: 1120px;
  --gutter: clamp(16px, 4vw, 32px);
  --header-h: 64px;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d0e11;
    --surface: #14161a;
    --surface-2: #1b1d22;
    --ink: #ececee;
    --ink-2: #c4c6cc;
    --muted: #979aa3;
    --line: #25282e;
    --line-strong: #353941;
    --accent: #84a6ff;
    --accent-hover: #a9c1ff;
    --accent-soft: #1a2442;
    --on-accent: #0d0e11;
    --grid: rgba(236, 236, 238, 0.05);
    --glow: rgba(110, 145, 255, 0.2);
    --ok: #4ade9f;
    --ok-soft: rgba(74, 222, 159, 0.18);
    --header-bg: rgba(13, 14, 17, 0.78);

    --journal: #93b0ff;
    --journal-soft: #1a2442;
    --conference: #5fd6c4;
    --conference-soft: #11302c;
    --preprint: #f0b660;
    --preprint-soft: #33260f;

    --contact-bg: #171a21;
    --contact-line: rgba(255, 255, 255, 0.1);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4), 0 6px 16px -6px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 1px 2px rgba(0, 0, 0, 0.4), 0 20px 50px -12px rgba(0, 0, 0, 0.6);

    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0d0e11;
  --surface: #14161a;
  --surface-2: #1b1d22;
  --ink: #ececee;
  --ink-2: #c4c6cc;
  --muted: #979aa3;
  --line: #25282e;
  --line-strong: #353941;
  --accent: #84a6ff;
  --accent-hover: #a9c1ff;
  --accent-soft: #1a2442;
  --on-accent: #0d0e11;
  --grid: rgba(236, 236, 238, 0.05);
  --glow: rgba(110, 145, 255, 0.2);
  --ok: #4ade9f;
  --ok-soft: rgba(74, 222, 159, 0.18);
  --header-bg: rgba(13, 14, 17, 0.78);

  --journal: #93b0ff;
  --journal-soft: #1a2442;
  --conference: #5fd6c4;
  --conference-soft: #11302c;
  --preprint: #f0b660;
  --preprint-soft: #33260f;

  --contact-bg: #171a21;
  --contact-line: rgba(255, 255, 255, 0.1);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4), 0 6px 16px -6px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 1px 2px rgba(0, 0, 0, 0.4), 0 20px 50px -12px rgba(0, 0, 0, 0.6);

  color-scheme: dark;
}

/* ---------- Base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 12px);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

img,
svg {
  display: block;
  max-width: 100%;
}

img {
  height: auto;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  color: var(--ink);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.015em;
}

p {
  margin: 0 0 1em;
}

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--accent-hover);
}

button {
  font: inherit;
}

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

::selection {
  background: var(--accent-soft);
  color: var(--ink);
}

[hidden] {
  display: none !important;
}

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

.icon {
  width: 1.15em;
  height: 1.15em;
  flex: none;
}

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -60px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--ink);
  color: var(--bg);
  font-weight: 600;
  text-decoration: none;
}

.skip-link:focus {
  top: 12px;
  color: var(--bg);
}

.kicker {
  margin: 0 0 10px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

/* ---------- Buttons & pills ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 0.97rem;
  font-weight: 550;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

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

.btn-primary:hover {
  background: var(--accent);
  color: var(--on-accent);
}

.btn-ghost {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line-strong);
}

.btn-ghost:hover {
  color: var(--ink);
  border-color: var(--ink);
}

.link-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-size: 0.85rem;
  font-weight: 500;
  line-height: 1.3;
  text-decoration: none;
  transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease;
}

.link-pill .icon {
  width: 0.95em;
  height: 0.95em;
}

.link-pill:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.link-pill.sm {
  padding: 3px 10px;
  font-size: 0.78rem;
}

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-2);
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
}

.text-link .icon {
  width: 1em;
  height: 1em;
}

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

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--header-bg);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
}

.site-header.is-scrolled,
.site-header.menu-open {
  border-bottom-color: var(--line);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 20px;
  height: var(--header-h);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 600;
  letter-spacing: -0.01em;
  text-decoration: none;
  white-space: nowrap;
}

.brand:hover {
  color: var(--ink);
}

.brand-mark {
  width: 32px;
  height: auto;
  transition: transform 0.3s ease;
}

.brand:hover .brand-mark {
  transform: rotate(-6deg);
}

.site-nav {
  margin-left: auto;
}

.site-nav ul {
  display: flex;
  gap: 2px;
}

.site-nav a {
  display: block;
  padding: 7px 13px;
  border-radius: 999px;
  color: var(--ink-2);
  font-size: 0.92rem;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.site-nav a:hover,
.site-nav a.is-active {
  color: var(--ink);
  background: var(--surface-2);
}

.header-actions {
  display: flex;
  gap: 4px;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.icon-btn:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.icon-btn .icon {
  width: 20px;
  height: 20px;
}

/* Theme toggle shows the icon of the theme you'd switch to */
.theme-toggle .icon-sun {
  display: none;
}

:root[data-theme="dark"] .theme-toggle .icon-sun {
  display: block;
}

:root[data-theme="dark"] .theme-toggle .icon-moon {
  display: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun {
    display: block;
  }

  :root:not([data-theme="light"]) .theme-toggle .icon-moon {
    display: none;
  }
}

.menu-toggle,
.menu-toggle .icon-close,
.menu-open .menu-toggle .icon-menu {
  display: none;
}

.menu-open .menu-toggle .icon-close {
  display: block;
}

/* No JS (no theme toggle, no menu button): keep nav visible and wrapping */
html:not(.js) .header-actions {
  display: none;
}

@media (max-width: 860px) {
  html:not(.js) .header-inner {
    flex-wrap: wrap;
    height: auto;
    padding-block: 12px;
    gap: 8px;
  }

  html:not(.js) .site-nav {
    margin-left: 0;
    width: 100%;
  }

  html:not(.js) .site-nav ul {
    flex-wrap: wrap;
  }

  .js .menu-toggle {
    display: inline-grid;
  }

  .js .header-actions {
    margin-left: auto;
  }

  .js .site-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin: 0;
    padding: 8px var(--gutter) 20px;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow-sm);
  }

  .js .menu-open .site-nav {
    display: block;
  }

  .js .site-nav ul {
    flex-direction: column;
    gap: 2px;
  }

  .js .site-nav a {
    padding: 12px 14px;
    border-radius: 12px;
    font-size: 1rem;
  }
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding-block: clamp(40px, 7vw, 96px) clamp(64px, 9vw, 120px);
}

/* faint grid, a nod to network topology */
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 44px 44px;
  background-position: center top;
  -webkit-mask-image: radial-gradient(ellipse 70% 70% at 70% 35%, #000 10%, transparent 75%);
  mask-image: radial-gradient(ellipse 70% 70% at 70% 35%, #000 10%, transparent 75%);
  pointer-events: none;
}

.hero-grid {
  display: grid;
  gap: clamp(40px, 6vw, 72px);
  align-items: center;
}

@media (min-width: 900px) {
  .hero-grid {
    grid-template-columns: minmax(0, 1.12fr) minmax(0, 0.88fr);
  }
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  max-width: 100%;
  margin: 0 0 28px;
  padding: 6px 14px 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-2);
  font-family: var(--font-mono);
  font-size: 0.76rem;
  letter-spacing: 0.02em;
  line-height: 1.4;
}

.status-dot {
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 4px var(--ok-soft);
}

.hero-title {
  margin-bottom: 24px;
  font-size: clamp(2.75rem, 4.6vw + 1.25rem, 5.25rem);
  font-weight: 650;
  line-height: 0.98;
  letter-spacing: -0.045em;
}

.hero-lead {
  max-width: 34em;
  margin-bottom: 34px;
  color: var(--ink-2);
  font-size: clamp(1.1rem, 0.5vw + 1rem, 1.28rem);
  line-height: 1.6;
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 36px;
}

.social {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.social a {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink-2);
  transition: color 0.15s ease, border-color 0.15s ease, transform 0.2s ease;
}

.social a:hover {
  color: var(--accent);
  border-color: var(--accent);
  transform: translateY(-2px);
}

.social .icon {
  width: 19px;
  height: 19px;
}

.hero-media {
  position: relative;
  isolation: isolate;
  width: 100%;
  max-width: 460px;
  margin: 0;
  justify-self: center;
}

.hero-media::before {
  content: "";
  position: absolute;
  inset: 10% -14% -8% 6%;
  z-index: -1;
  border-radius: 50%;
  background: radial-gradient(closest-side, var(--glow), transparent);
  filter: blur(24px);
}

.hero-photo {
  overflow: hidden;
  aspect-ratio: 4 / 5;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-2);
  box-shadow: var(--shadow-lg);
}

.hero-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 50%;
}

@media (max-width: 899px) {
  .hero-media {
    max-width: 560px;
    justify-self: start;
  }

  .hero-photo {
    aspect-ratio: 4 / 3;
  }

  .hero-photo img {
    object-position: 50% 28%;
  }
}

/* entrance animation (CSS only, so it never waits for JS) */
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.hero-copy > * {
  animation: rise 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.hero-copy > :nth-child(2) { animation-delay: 0.06s; }
.hero-copy > :nth-child(3) { animation-delay: 0.12s; }
.hero-copy > :nth-child(4) { animation-delay: 0.18s; }
.hero-copy > :nth-child(5) { animation-delay: 0.24s; }

.hero-media {
  animation: rise 0.9s 0.15s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

/* ---------- Sections ---------- */
.section {
  padding-block: clamp(64px, 9vw, 112px);
  border-top: 1px solid var(--line);
}

.section-grid {
  display: grid;
  gap: 32px;
}

@media (min-width: 960px) {
  .section-grid {
    grid-template-columns: 210px minmax(0, 1fr);
    gap: 56px;
  }

  .section-label {
    position: sticky;
    top: calc(var(--header-h) + 32px);
    align-self: start;
  }
}

.section-title {
  font-size: clamp(1.75rem, 1.4vw + 1.2rem, 2.375rem);
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.section-intro {
  margin: 14px 0 0;
  max-width: 34em;
  color: var(--muted);
  font-size: 0.97rem;
  line-height: 1.55;
}

.subhead {
  margin: 64px 0 4px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- About ---------- */
.about-grid {
  display: grid;
  gap: 40px;
}

@media (min-width: 1080px) {
  .about-grid {
    grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
    gap: 48px;
    align-items: start;
  }
}

.prose p {
  color: var(--ink-2);
}

.prose p:first-child {
  margin-bottom: 1.1em;
  color: var(--ink);
  font-size: clamp(1.15rem, 0.5vw + 1.05rem, 1.32rem);
  line-height: 1.55;
  letter-spacing: -0.01em;
}

.prose a {
  color: var(--ink);
  text-decoration-line: underline;
  text-decoration-color: var(--accent);
}

.prose a:hover {
  color: var(--accent);
}

.prose-more {
  margin: 1.5em 0 0;
}

.prose-more a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
}

.prose-more .icon {
  width: 1em;
  height: 1em;
}

.facts {
  display: grid;
  gap: 28px;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.fact h3 {
  margin-bottom: 14px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.interests {
  display: grid;
  gap: 9px;
}

.interests li {
  position: relative;
  padding-left: 18px;
  color: var(--ink-2);
  font-size: 0.93rem;
  line-height: 1.45;
}

.interests li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.5em;
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: var(--accent);
  opacity: 0.85;
}

.edu {
  display: grid;
  gap: 16px;
}

.edu li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 12px;
  line-height: 1.45;
}

.edu-degree {
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 550;
}

.edu-year {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  padding-top: 1px;
}

.edu-school,
.edu-note {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.88rem;
}

.edu-note {
  font-style: italic;
}

/* ---------- Research ---------- */
.project-grid {
  display: grid;
  gap: 20px;
}

@media (min-width: 720px) {
  .project-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .project-card.is-featured {
    grid-column: 1 / -1;
  }
}

.project-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.project-card:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-sm);
}

.project-card.is-featured {
  padding: clamp(26px, 3.5vw, 36px);
  background:
    radial-gradient(120% 140% at 100% 0%, var(--accent-soft), transparent 55%),
    var(--surface);
}

.project-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.project-icon {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
}

.project-icon .icon {
  width: 20px;
  height: 20px;
}

.project-kind {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.03em;
}

.project-card h3 {
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}

.project-card.is-featured h3 {
  font-size: clamp(1.5rem, 1vw + 1.2rem, 1.9rem);
}

.project-card p {
  margin: 0;
  color: var(--ink-2);
  font-size: 0.98rem;
  line-height: 1.6;
}

.project-card.is-featured p {
  max-width: 44em;
  font-size: 1.03rem;
}

/* data path of the featured project */
.flow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  row-gap: 10px;
  margin: 6px 0 2px;
  font-family: var(--font-mono);
  font-size: 0.74rem;
}

.flow li {
  display: inline-flex;
  align-items: center;
  color: var(--ink-2);
  white-space: nowrap;
}

.flow li + li::before {
  content: "\2192";
  margin: 0 8px;
  color: var(--muted);
}

.flow span {
  padding: 5px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  line-height: 1.2;
}

.flow .is-self span {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--on-accent);
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  line-height: 1.5;
}

.card-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
  padding-top: 6px;
}

.earlier li {
  display: grid;
  gap: 4px 28px;
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
}

@media (min-width: 720px) {
  .earlier li {
    grid-template-columns: 110px minmax(0, 1fr);
  }
}

.earlier-period {
  padding-top: 3px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

.earlier h4 {
  margin-bottom: 6px;
  font-size: 1.06rem;
}

.earlier p {
  margin: 0;
  color: var(--ink-2);
  font-size: 0.96rem;
}

.inline-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  margin-top: 10px !important;
}

.inline-links a {
  font-size: 0.86rem;
  font-weight: 500;
  text-decoration: none;
}

.inline-links a::after {
  content: " ↗";
}

.inline-links a:hover {
  text-decoration: underline;
}

/* ---------- Publications ---------- */
.pub-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}

.filter {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--ink-2);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.filter:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.filter .count {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
}

.filter[aria-pressed="true"] {
  background: var(--ink);
  color: var(--bg);
}

.filter[aria-pressed="true"] .count {
  color: inherit;
  opacity: 0.7;
}

@media (max-width: 480px) {
  .filters {
    gap: 2px;
  }

  .filter {
    gap: 5px;
    padding: 7px 10px;
    font-size: 0.84rem;
  }
}

.pub-year-group + .pub-year-group {
  margin-top: 40px;
}

.pub-year {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line-strong);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.04em;
}

.pub {
  padding: 18px 0 20px;
  border-bottom: 1px solid var(--line);
}

.pub-title {
  margin-bottom: 4px;
  font-size: 1.04rem;
  line-height: 1.42;
  letter-spacing: -0.01em;
}

.pub-title a {
  color: var(--ink);
  text-decoration: none;
}

.pub-title a:hover {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: var(--accent);
}

.pub-authors {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.91rem;
  line-height: 1.5;
}

.pub-authors strong {
  color: var(--ink);
  font-weight: 600;
}

.pub-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.45;
}

.badge {
  padding: 2px 7px;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 0.64rem;
  font-weight: 500;
  letter-spacing: 0.07em;
  line-height: 1.5;
  text-transform: uppercase;
}

.badge-journal {
  background: var(--journal-soft);
  color: var(--journal);
}

.badge-conference {
  background: var(--conference-soft);
  color: var(--conference);
}

.badge-preprint {
  background: var(--preprint-soft);
  color: var(--preprint);
}

.pub-short {
  color: var(--ink-2);
  font-weight: 600;
}

.pub-venue {
  color: var(--muted);
  font-style: italic;
}

.pub-meta .link-pill {
  margin-left: 2px;
}

/* ---------- Experience ---------- */
.timeline {
  position: relative;
}

.tl-item {
  position: relative;
  display: grid;
  gap: 4px 28px;
  padding: 0 0 36px 30px;
}

.tl-item:last-child {
  padding-bottom: 0;
}

/* connector line */
.tl-item::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 14px;
  bottom: -6px;
  width: 1px;
  background: var(--line-strong);
}

.tl-item:last-child::before {
  display: none;
}

/* node */
.tl-item::after {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  width: 11px;
  height: 11px;
  border: 2px solid var(--line-strong);
  border-radius: 50%;
  background: var(--bg);
}

.tl-item.is-current::after {
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

@media (min-width: 720px) {
  .tl-item {
    grid-template-columns: 158px minmax(0, 1fr);
  }
}

.tl-period {
  padding-top: 2px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  white-space: nowrap;
}

.is-current .tl-period {
  color: var(--accent);
}

.tl-role {
  font-size: 1.08rem;
  letter-spacing: -0.01em;
}

.tl-org {
  margin: 3px 0 6px;
  color: var(--ink-2);
  font-size: 0.97rem;
}

.tl-org a {
  color: inherit;
  text-decoration-line: underline;
  text-decoration-color: var(--line-strong);
}

.tl-org a:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

.tl-place {
  color: var(--muted);
}

.tl-note {
  margin: 0;
  max-width: 42em;
  color: var(--muted);
  font-size: 0.93rem;
  line-height: 1.55;
}

/* ---------- Contact ---------- */
.section-contact {
  padding-bottom: clamp(48px, 7vw, 88px);
}

.contact-card {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: grid;
  gap: 40px;
  padding: clamp(28px, 6vw, 72px);
  border-radius: 28px;
  background: var(--contact-bg);
  color: var(--contact-ink);
}

.contact-card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-size: 44px 44px;
  -webkit-mask-image: radial-gradient(ellipse 80% 90% at 100% 0%, #000, transparent 70%);
  mask-image: radial-gradient(ellipse 80% 90% at 100% 0%, #000, transparent 70%);
}

.contact-card::after {
  content: "";
  position: absolute;
  right: -120px;
  top: -140px;
  z-index: -1;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(110, 145, 255, 0.32), transparent);
  filter: blur(10px);
}

@media (min-width: 900px) {
  .contact-card {
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
    align-items: end;
    gap: 56px;
  }
}

.contact-card .kicker {
  color: var(--contact-accent);
}

.contact-title {
  margin-bottom: 16px;
  color: #fff;
  font-size: clamp(2.25rem, 3.5vw + 1rem, 3.75rem);
  font-weight: 650;
  letter-spacing: -0.04em;
  line-height: 1;
}

.contact-text {
  max-width: 30em;
  margin-bottom: 32px;
  color: var(--contact-muted);
  font-size: 1.05rem;
}

.contact-email-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
}

.contact-email {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  max-width: 100%;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.28);
  color: #fff;
  font-size: clamp(1.05rem, 1.4vw + 0.8rem, 1.6rem);
  font-weight: 500;
  letter-spacing: -0.015em;
  text-decoration: none;
  overflow-wrap: anywhere;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.contact-email:hover {
  color: #fff;
  border-color: #fff;
}

.contact-email .icon {
  width: 0.95em;
  height: 0.95em;
  color: var(--contact-accent);
}

.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--contact-line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--contact-ink);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.copy-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.3);
}

.copy-btn .icon {
  width: 14px;
  height: 14px;
}

.copy-btn .icon-check,
.copy-btn.is-copied .icon-copy {
  display: none;
}

.copy-btn.is-copied .icon-check {
  display: block;
  color: #4ade9f;
}

.contact-side {
  display: grid;
  gap: 22px;
}

.contact-address {
  display: flex;
  gap: 10px;
  margin: 0;
  color: var(--contact-muted);
  font-size: 0.93rem;
  line-height: 1.5;
}

.contact-address .icon {
  width: 17px;
  height: 17px;
  margin-top: 2px;
  color: var(--contact-accent);
}

.contact-links {
  display: grid;
  border-top: 1px solid var(--contact-line);
}

.contact-links a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 2px;
  border-bottom: 1px solid var(--contact-line);
  color: var(--contact-ink);
  font-size: 0.97rem;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.15s ease, padding 0.2s ease;
}

.contact-links a:hover {
  color: #fff;
  padding-left: 8px;
}

.contact-links .icon {
  width: 18px;
  height: 18px;
  color: var(--contact-muted);
}

.contact-links .icon-arrow {
  margin-left: auto;
  width: 16px;
  height: 16px;
  transition: transform 0.2s ease, color 0.2s ease;
}

.contact-links a:hover .icon-arrow {
  color: #fff;
  transform: translate(2px, -2px);
}

/* ---------- Footer ---------- */
.site-footer {
  padding: 8px 0 40px;
  color: var(--muted);
  font-size: 0.86rem;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 24px;
}

.footer-inner p {
  margin: 0;
}

.site-footer a {
  color: var(--ink-2);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--accent);
}

/* ---------- 404 ---------- */
.not-found {
  padding-block: clamp(80px, 14vw, 160px);
}

.not-found .section-intro {
  margin-bottom: 32px;
}

/* ---------- Scroll reveal (enabled by main.js) ---------- */
.reveal-ready .reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.reveal-ready .reveal.is-visible {
  opacity: 1;
  transform: none;
}

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

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }

  .reveal-ready .reveal {
    opacity: 1;
    transform: none;
  }
}
