/* LaTeX Computer Modern (self-declared to avoid the upstream package's
   non-standard `font-style: roman`, which some browsers reject). */
@font-face {
  font-family: "CMU Serif";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("https://cdn.jsdelivr.net/npm/computer-modern@0.1.2/fonts/cmu-serif-500-roman.woff2") format("woff2");
}
@font-face {
  font-family: "CMU Serif";
  font-style: italic;
  font-weight: 500;
  font-display: swap;
  src: url("https://cdn.jsdelivr.net/npm/computer-modern@0.1.2/fonts/cmu-serif-500-italic.woff2") format("woff2");
}
@font-face {
  font-family: "CMU Serif";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("https://cdn.jsdelivr.net/npm/computer-modern@0.1.2/fonts/cmu-serif-700-roman.woff2") format("woff2");
}
@font-face {
  font-family: "CMU Serif";
  font-style: italic;
  font-weight: 700;
  font-display: swap;
  src: url("https://cdn.jsdelivr.net/npm/computer-modern@0.1.2/fonts/cmu-serif-700-italic.woff2") format("woff2");
}

:root {
  --bg: #ffffff;
  --ink: #1f2328;
  --muted: #5f6672;
  --label: #5b6270; /* section labels: >= 4.5:1 on the pastel ground */
  --faint: #9aa1ab;
  --line: #ececec;
  --accent: #2f6db3;
  --accent-soft: rgba(47, 109, 179, 0.1);
  /* shades of blue for icons */
  --blue-1: #1e4e79;
  --blue-2: #2f6db3;
  --blue-3: #3b82c4;
  --blue-4: #5aa0dd;
  --maxw: 720px;
  --font-latex: "CMU Serif", "Latin Modern Roman", Georgia, "Times New Roman", serif;
  --font-serif: "EB Garamond", Georgia, "Times New Roman", serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-punk: "Bungee", "Permanent Marker", var(--font-latex);
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  overflow-x: clip;
  background-color: #eaf2fc;
  background-image:
    url("assets/pattern.svg"),
    radial-gradient(680px 520px at -2% -6%, rgba(126, 176, 236, 0.8), transparent 56%),
    radial-gradient(640px 520px at 104% -4%, rgba(250, 178, 202, 0.72), transparent 54%),
    radial-gradient(620px 600px at 102% 110%, rgba(198, 170, 241, 0.66), transparent 56%),
    radial-gradient(680px 620px at -4% 112%, rgba(158, 226, 197, 0.72), transparent 58%);
  background-size: 164px 164px, 100% 100%, 100% 100%, 100% 100%, 100% 100%;
  background-attachment: fixed;
  background-repeat: repeat, no-repeat, no-repeat, no-repeat, no-repeat;
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: 1.125rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 150ms ease, opacity 150ms ease;
}

a:hover,
a:focus-visible {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

h1,
h2,
h3,
p {
  margin: 0;
}

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

/* land section headings below the sticky header, not under it */
section[id] {
  scroll-margin-top: 4.75rem;
}

a,
button {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

h1,
h2,
h3,
.dd-title {
  text-wrap: balance;
}

.prose p,
.entry-body p,
.dd-desc {
  text-wrap: pretty;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: 1rem;
  z-index: 20;
  transform: translateY(-150%);
  background: var(--ink);
  color: #fff;
  padding: 0.55rem 0.75rem;
  border-radius: 6px;
}

.skip-link:focus {
  transform: translateY(0);
}

/* ---------- Header / nav ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem clamp(1rem, 5vw, 2rem);
  background: rgba(255, 255, 255, 0.72);
  border-bottom: 1px solid transparent;
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  transition: border-color 220ms ease, box-shadow 220ms ease;
}

.site-header.is-scrolled {
  border-bottom-color: var(--line);
  box-shadow: 0 6px 22px rgba(30, 60, 100, 0.06);
}

.brand {
  color: var(--ink);
  font-family: var(--font-latex);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0;
}

.brand:hover {
  text-decoration: none;
  color: var(--accent);
}

.nav-links {
  display: flex;
  gap: clamp(0.8rem, 2vw, 1.6rem);
  font-family: var(--font-sans);
  font-size: 0.9rem;
}

.nav-links a {
  color: var(--muted);
  position: relative;
}

.nav-links a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -3px;
  width: 100%;
  height: 1.5px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 200ms ease;
}

.nav-links a:hover,
.nav-links a.is-active {
  color: var(--ink);
  text-decoration: none;
}

.nav-links a:hover::after,
.nav-links a.is-active::after {
  transform: scaleX(1);
}

/* text buttons dim the instant they're pressed */
.nav-links a:active,
.brand:active {
  opacity: 0.55;
  transition-duration: 0ms;
}

/* ---------- Layout ---------- */
main {
  width: min(var(--maxw), calc(100% - 2.5rem));
  margin: 0 auto;
  padding: clamp(2.5rem, 7vw, 4.5rem) 0 2rem;
}

/* ---------- Profile hero ---------- */
.profile {
  text-align: center;
  padding-bottom: clamp(1.5rem, 5vw, 2.5rem);
}

/* portrait card (3:4) rather than a head-only circle, so shoulders and outfit show */
.portrait-frame {
  position: relative;
  display: inline-block;
  border-radius: 26px;
}

/* soft ring that scales in behind the photo */
.portrait-frame::after {
  content: "";
  position: absolute;
  inset: -9px;
  border-radius: 34px;
  border: 1px solid var(--accent-soft);
  box-shadow: 0 0 0 6px rgba(47, 109, 179, 0.04);
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 700ms ease 250ms, transform 700ms ease 250ms;
  pointer-events: none;
}

.portrait-frame.in-view::after {
  opacity: 1;
  transform: scale(1);
}

.portrait {
  display: block;
  width: 240px;
  height: 320px;
  object-fit: cover;
  object-position: 50% 30%;
  border-radius: 26px;
  border: 3px solid #fff;
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.1);
  transition: transform 400ms cubic-bezier(0.22, 1, 0.36, 1), box-shadow 400ms ease;
}

.portrait-frame:hover .portrait {
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.16);
}

/* photo reveal: blur + zoom resolving to sharp */
.reveal-photo {
  opacity: 0;
  transform: scale(1.14);
  filter: blur(12px);
  transition: opacity 900ms cubic-bezier(0.22, 1, 0.36, 1),
    transform 900ms cubic-bezier(0.22, 1, 0.36, 1),
    filter 900ms cubic-bezier(0.22, 1, 0.36, 1);
  will-change: opacity, transform, filter;
}

.reveal-photo.in-view {
  opacity: 1;
  transform: none;
  filter: none;
}

h1 {
  margin-top: 1.1rem;
  font-family: var(--font-latex);
  font-size: clamp(2.1rem, 6vw, 2.9rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.012em;
}

.tagline {
  margin-top: 0.85rem;
  font-family: var(--font-punk);
  color: var(--accent);
  font-weight: 400;
  line-height: 0.92;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: center;
  gap: 0.1em 0.28em;
}

.tagline .t {
  font-size: clamp(2.4rem, 8.5vw, 3.9rem);
  letter-spacing: 0.01em;
  text-shadow: 2px 2px 0 rgba(47, 109, 179, 0.16);
}

.tagline .sep {
  font-size: clamp(0.85rem, 2vw, 1.15rem);
  color: var(--blue-4);
  font-style: normal;
  transform: translateY(-0.35em);
}

.tagline .sc {
  font-size: 0.42em;
  letter-spacing: 0.04em;
  color: var(--blue-1);
}

.affil {
  margin-top: 0.55rem;
  color: var(--muted);
  font-size: 0.98rem;
}

.social {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem 1.2rem;
  padding: 0;
  margin: 1.15rem 0 0;
  font-size: 0.95rem;
}

.social li {
  position: relative;
}

.social li + li::before {
  content: "";
  position: absolute;
  left: -0.62rem;
  top: 50%;
  width: 1px;
  height: 0.9em;
  transform: translateY(-50%);
  background: var(--line);
}

/* icon-button variant (profile) */
.social-icons {
  gap: 0.85rem;
}

.social-icons li + li::before {
  display: none;
}

.ic {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: #eef4fb;
  border: 1px solid #dbe7f4;
  color: var(--blue-2);
  transition: transform 280ms cubic-bezier(0.22, 1, 0.36, 1),
    background-color 200ms ease, color 200ms ease, box-shadow 280ms ease,
    border-color 200ms ease;
}

.ic svg {
  width: 29px;
  height: 29px;
  fill: currentColor;
  transition: transform 280ms cubic-bezier(0.22, 1, 0.36, 1);
}

.ic:hover,
.ic:focus-visible {
  transform: translateY(-6px) scale(1.1);
  text-decoration: none;
  box-shadow: 0 14px 24px rgba(47, 109, 179, 0.24);
}

.ic:hover svg,
.ic:focus-visible svg {
  transform: scale(1.08) rotate(-10deg);
}

.ic:active {
  transform: translateY(-2px) scale(0.94);
  transition-duration: 90ms;
}

/* text-link variant (contact) → interactive pills */
.social:not(.social-icons) li + li::before {
  display: none;
}

.social:not(.social-icons) a {
  display: inline-block;
  padding: 0.34em 0.95em;
  border: 1px solid #dbe7f4;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.65);
  color: var(--blue-2);
  transition: transform 240ms cubic-bezier(0.22, 1, 0.36, 1),
    background-color 200ms ease, color 200ms ease, box-shadow 240ms ease, border-color 200ms ease;
}

.social:not(.social-icons) a:hover,
.social:not(.social-icons) a:focus-visible {
  transform: translateY(-3px);
  background: var(--blue-2);
  color: #fff;
  border-color: var(--blue-2);
  text-decoration: none;
  box-shadow: 0 8px 18px rgba(47, 109, 179, 0.28);
}

.social:not(.social-icons) a:active {
  transform: scale(0.96);
  transition-duration: 90ms;
}

/* each icon a different shade of blue */
.social-icons li:nth-child(1) .ic { color: var(--blue-2); }
.social-icons li:nth-child(1) .ic:hover { background: rgba(47, 109, 179, 0.16); border-color: rgba(47, 109, 179, 0.4); }
.social-icons li:nth-child(2) .ic { color: var(--blue-1); }
.social-icons li:nth-child(2) .ic:hover { background: rgba(30, 78, 121, 0.16); border-color: rgba(30, 78, 121, 0.4); }
.social-icons li:nth-child(3) .ic { color: var(--blue-3); }
.social-icons li:nth-child(3) .ic:hover { background: rgba(59, 130, 196, 0.16); border-color: rgba(59, 130, 196, 0.4); }
.social-icons li:nth-child(4) .ic { color: #2867b2; }
.social-icons li:nth-child(4) .ic:hover { background: rgba(40, 103, 178, 0.16); border-color: rgba(40, 103, 178, 0.4); }
.social-icons li:nth-child(5) .ic { color: #14324f; }
.social-icons li:nth-child(5) .ic:hover { background: rgba(20, 50, 79, 0.15); border-color: rgba(20, 50, 79, 0.4); }
.social-icons li:nth-child(6) .ic { color: var(--blue-4); }
.social-icons li:nth-child(6) .ic:hover { background: rgba(90, 160, 221, 0.18); border-color: rgba(90, 160, 221, 0.45); }
.social-icons li:nth-child(7) .ic { color: #3f78bd; }
.social-icons li:nth-child(7) .ic:hover { background: rgba(63, 120, 189, 0.16); border-color: rgba(63, 120, 189, 0.4); }

/* ---------- Section blocks ---------- */
.block {
  padding: clamp(1.6rem, 4vw, 2.3rem) 0;
  border-top: 1px solid var(--line);
}

.block > h2 {
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--label);
  margin-bottom: 1.2rem;
}

.prose p {
  color: #3b414a;
  max-width: 65ch;
}

.prose p + p {
  margin-top: 0.85rem;
}

/* ---------- News ---------- */
.news-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.9rem;
}

.news-list li {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 1rem;
  color: #3b414a;
}

.news-date {
  font-family: var(--font-sans);
  color: var(--faint);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
  padding-top: 0.28rem;
}

/* ---------- Entries (research, education, service) ---------- */
.entries {
  display: grid;
  gap: 1.5rem;
}

.entry {
  display: grid;
  grid-template-columns: 128px 1fr;
  gap: 1.4rem;
}

.entry-when {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding-top: 0.15rem;
}

.logo-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  padding: 7px;
  margin-bottom: 0.55rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 11px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  transition: transform 260ms ease, box-shadow 260ms ease;
}

.logo-chip img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

.entry:hover .logo-chip {
  transform: translateY(-2px);
  box-shadow: 0 5px 14px rgba(47, 109, 179, 0.2);
}

.entry-when span {
  font-family: var(--font-sans);
  color: var(--muted);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}

.entry-when em {
  font-family: var(--font-sans);
  font-style: normal;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--accent);
}

.entry-body h3 {
  font-family: var(--font-latex);
  font-size: 1.18rem;
  font-weight: 700;
  letter-spacing: 0;
  margin-bottom: 0.15rem;
}

.entry-affil {
  color: var(--accent);
  font-size: 0.9rem;
  margin-bottom: 0.4rem !important;
}

.entry-body p {
  color: #4a5058;
  font-size: 0.96rem;
}

/* ---------- Skills ---------- */
.skills {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.4rem;
}

.skills h3 {
  font-family: var(--font-latex);
  font-size: 1.08rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.skills p {
  color: #4a5058;
  font-size: 0.95rem;
}

/* ---------- Footer ---------- */
.site-footer {
  width: min(var(--maxw), calc(100% - 2.5rem));
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.5rem 0 2.5rem;
  border-top: 1px solid var(--line);
  font-family: var(--font-sans);
  color: var(--muted);
  font-size: 0.82rem;
}

/* ---------- Scroll progress bar ---------- */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 4px;
  width: 0;
  z-index: 30;
  background: var(--blue-2);
  box-shadow: 0 0 12px rgba(47, 109, 179, 0.55);
  transition: background-color 120ms linear;
}

/* ---------- Section-heading icons ---------- */
.h-ic {
  width: 1.25em;
  height: 1.25em;
  fill: var(--blue-2);
  vertical-align: -0.22em;
  margin-left: 0.5em;
}

/* ---------- Publications: academic list ---------- */
.pub-list {
  display: grid;
  gap: 1.7rem;
}

.pub-title {
  font-family: var(--font-latex);
  font-size: 1.32rem;
  font-weight: 700;
  line-height: 1.26;
  margin-bottom: 0.35rem;
}

.pub-title a {
  color: var(--ink);
  text-decoration: none;
  padding: 0.02em 0.1em;
  /* cancel the highlight padding so linked and unlinked titles share one left edge */
  margin: 0 -0.1em;
  border-radius: 4px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  transition: color 160ms ease, background-color 160ms ease;
}

.pub-title a:hover,
.pub-title a:focus-visible {
  color: var(--blue-2);
  background: rgba(47, 109, 179, 0.14);
  text-decoration: none;
}

.pub-authors {
  color: #4a5058;
  font-size: 0.96rem;
  line-height: 1.5;
  margin-bottom: 0.2rem;
}

.pub-authors strong {
  color: var(--blue-1);
}

.pub-venue {
  font-size: 0.92rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.pub-venue em {
  font-style: italic;
}

.pub-meta-links {
  font-family: var(--font-sans);
  font-size: 0.9rem;
}

.pub-meta-links a {
  color: var(--blue-2);
}

.pub-meta-links a:hover {
  color: var(--ink);
}

.pub-meta-links .sep {
  color: var(--faint);
  margin: 0 0.5rem;
}


/* ---------- Selected Work: album shelf ---------- */
.h2-hint {
  font-family: var(--font-sans);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--blue-2);
  margin-left: 0.5rem;
}

.deck-stage {
  display: grid;
  grid-template-columns: 1.02fr 1fr;
  align-items: center;
  gap: clamp(1rem, 3.5vw, 2.6rem);
  width: min(1060px, 96vw);
  margin-left: calc(50% - min(530px, 48vw));
}

.deck {
  position: relative;
  width: 100%;
  height: 440px;
  overflow: hidden;
  perspective: 1500px;
  perspective-origin: 52% 46%;
  touch-action: pan-y;
  cursor: grab;
}

.deck.dragging {
  cursor: grabbing;
}

.deck:focus-visible {
  outline-offset: 6px;
  border-radius: 18px;
}

.deck-card {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 190px;
  height: 190px;
  margin: -100px 0 0 -95px;
  padding: 16px;
  border: 3px solid rgba(255, 255, 255, 0.85);
  border-radius: 18px;
  cursor: pointer; /* back cards: tap to bring forward */
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  background: linear-gradient(135deg, var(--c1), var(--c2) 50%, var(--c3));
  background-size: 220% 220%;
  animation: coverFlow 9s ease-in-out infinite;
  box-shadow: 0 24px 48px rgba(20, 40, 70, 0.34);
  transform-style: preserve-3d;
  transition: opacity 280ms ease, filter 280ms ease;
  will-change: transform, opacity;
}

.deck-card.is-front {
  cursor: grab;
}

.deck.dragging .deck-card {
  transition: none;
  cursor: grabbing;
}

.deck-card:nth-child(2n) { animation-delay: -2.2s; }
.deck-card:nth-child(3n) { animation-delay: -4.4s; }
.deck-card:nth-child(4n) { animation-delay: -6.6s; }

/* light sweep on hover */
.deck-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 32%, rgba(255, 255, 255, 0.4) 50%, transparent 68%);
  transform: translateX(-130%);
  pointer-events: none;
}

.deck-card:hover {
  filter: brightness(1.12) !important;
  box-shadow: 0 26px 52px rgba(20, 40, 70, 0.42);
}

.deck-card:hover::after {
  animation: sheen 850ms ease;
}

.dc-no {
  position: absolute;
  top: 10px;
  left: 15px;
  font-family: var(--font-punk);
  font-size: 2.2rem;
  line-height: 1;
  color: rgba(255, 255, 255, 0.94);
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.24);
  z-index: 2;
}

.dc-logo {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 78px;
  height: 78px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 13px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 20px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
}

.dc-logo img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.dc-tag {
  font-family: var(--font-sans);
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #fff;
  background: rgba(0, 0, 0, 0.26);
  padding: 0.25em 0.6em;
  border-radius: 999px;
  backdrop-filter: blur(2px);
}

.deck-detail {
  min-width: 0;
}

.dd-tag {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--blue-2);
  background: rgba(47, 109, 179, 0.1);
  padding: 0.32em 0.8em;
  border-radius: 999px;
  margin-bottom: 0.85rem;
}

.dd-title {
  font-family: var(--font-latex);
  font-size: clamp(1.4rem, 3vw, 1.85rem);
  font-weight: 700;
  line-height: 1.22;
  margin-bottom: 0.45rem;
}

.dd-title a {
  color: var(--ink);
  text-decoration: none;
  transition: color 160ms ease;
}

.dd-title a:hover {
  color: var(--blue-2);
  text-decoration: none;
}

.dd-arrow {
  display: inline-block;
  color: var(--blue-2);
  font-size: 0.9em;
  transition: transform 200ms ease;
}

.dd-title a:hover .dd-arrow {
  transform: translateX(5px);
}

.dd-affil {
  color: var(--blue-1);
  font-size: 0.95rem;
  margin-bottom: 0.7rem;
}

.dd-desc {
  color: #4a5058;
  font-size: 0.98rem;
  line-height: 1.6;
}

.deck-detail.dd-in {
  animation: ddInNext 380ms cubic-bezier(0.22, 1, 0.36, 1);
}

.deck-detail.dd-in[data-dir="prev"] {
  animation-name: ddInPrev;
}

@keyframes ddInNext {
  from { opacity: 0; transform: translateX(14px); }
  to { opacity: 1; transform: none; }
}

@keyframes ddInPrev {
  from { opacity: 0; transform: translateX(-14px); }
  to { opacity: 1; transform: none; }
}

@keyframes ddFade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.deck-nav {
  display: inline-flex;
  align-items: center;
  gap: 1rem;
  margin-top: 1.3rem;
}

.deck-nav button {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid #dbe7f4;
  background: rgba(255, 255, 255, 0.7);
  color: var(--blue-2);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  transition: transform 240ms cubic-bezier(0.22, 1, 0.36, 1),
    background-color 200ms ease, color 200ms ease, box-shadow 240ms ease, border-color 200ms ease;
}

.deck-nav button:hover {
  transform: translateY(-3px);
  background: var(--blue-2);
  color: #fff;
  border-color: var(--blue-2);
  box-shadow: 0 8px 18px rgba(47, 109, 179, 0.28);
}

.deck-nav button:active {
  transform: scale(0.92);
  transition-duration: 80ms;
}

.deck-count {
  font-family: var(--font-sans);
  font-variant-numeric: tabular-nums;
  font-size: 0.85rem;
  color: var(--muted);
  min-width: 4.5rem;
}

@keyframes coverFlow {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

@keyframes sheen {
  from { transform: translateX(-130%); }
  to { transform: translateX(130%); }
}

/* ---------- Foldable full list ---------- */
.fold-lead {
  color: var(--muted);
  font-size: 0.95rem;
  margin-bottom: 1rem;
}

.fold-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--blue-2);
  padding: 0.5em 1.1em;
  border: 1px solid #dbe7f4;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  transition: transform 240ms cubic-bezier(0.22, 1, 0.36, 1),
    background-color 200ms ease, color 200ms ease, box-shadow 240ms ease, border-color 200ms ease;
}

.fold-toggle:hover {
  transform: translateY(-2px);
  background: rgba(47, 109, 179, 0.1);
  border-color: rgba(47, 109, 179, 0.4);
  box-shadow: 0 8px 18px rgba(47, 109, 179, 0.18);
}

.fold-toggle:active {
  transform: scale(0.96);
  transition-duration: 80ms;
}

.fold-toggle .ft-count {
  font-variant-numeric: tabular-nums;
  color: #fff;
  background: var(--blue-2);
  border-radius: 999px;
  padding: 0.05em 0.55em;
  font-size: 0.76rem;
}

.fold-toggle .ft-chev {
  transition: transform 320ms ease;
}

.fold-toggle[aria-expanded="true"] .ft-chev {
  transform: rotate(180deg);
}

.fold {
  display: grid;
  grid-template-rows: 0fr;
  /* animate the gap with the height so opening doesn't jump */
  transition: grid-template-rows 460ms cubic-bezier(0.22, 1, 0.36, 1),
    margin-top 460ms cubic-bezier(0.22, 1, 0.36, 1);
}

.fold.open {
  grid-template-rows: 1fr;
  margin-top: 1.6rem;
}

.fold-inner {
  overflow: hidden;
  min-height: 0;
}

@media (prefers-reduced-motion: reduce) {
  .fold {
    transition: none;
  }
}

/* ---------- Confetti canvas ---------- */
.confetti-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 60;
}

.portrait {
  cursor: pointer;
}

/* ---------- Reveal animation ---------- */
.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 620ms cubic-bezier(0.22, 1, 0.36, 1),
    transform 620ms cubic-bezier(0.22, 1, 0.36, 1);
  will-change: opacity, transform;
}

.reveal.in-view {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .reveal,
  .reveal-photo {
    opacity: 1;
    transform: none;
    filter: none;
    transition: none;
  }
  .deck-card,
  .deck-card:hover::after {
    animation: none;
  }
  .deck-detail.dd-in,
  .deck-detail.dd-in[data-dir="prev"] {
    animation-name: ddFade;
  }
  .portrait-frame::after {
    transition: none;
  }
  /* keep color feedback on hover, drop the movement */
  .ic:hover,
  .ic:focus-visible,
  .ic:hover svg,
  .ic:focus-visible svg,
  .social:not(.social-icons) a:hover,
  .deck-nav button:hover,
  .fold-toggle:hover,
  .portrait-frame:hover .portrait,
  .entry:hover .logo-chip {
    transform: none;
  }
}

/* Touch screens: no sticky hover lifts after a tap; presses still respond instantly */
@media (hover: none) {
  .ic:hover,
  .ic:hover svg,
  .social:not(.social-icons) a:hover,
  .deck-nav button:hover,
  .fold-toggle:hover,
  .portrait-frame:hover .portrait,
  .entry:hover .logo-chip {
    transform: none;
  }
  .ic:active {
    transform: scale(0.94);
  }
  .social:not(.social-icons) a:active,
  .fold-toggle:active {
    transform: scale(0.96);
  }
  .deck-nav button:active {
    transform: scale(0.92);
  }
}

@media (prefers-reduced-transparency: reduce) {
  .site-header {
    background: #fff;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}

@media (prefers-contrast: more) {
  .site-header {
    background: #fff;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    border-bottom-color: var(--ink);
  }
  :root {
    --muted: #3f4550;
    --label: #3f4550;
    --line: #9aa1ab;
  }
}

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  .portrait {
    width: 204px;
    height: 272px;
    border-radius: 22px;
  }

  .portrait-frame {
    border-radius: 22px;
  }

  .portrait-frame::after {
    border-radius: 30px;
  }

  section[id] {
    scroll-margin-top: 6.75rem;
  }

  .site-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.6rem;
  }

  .nav-links {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 0.15rem;
  }

  .entry,
  .news-list li {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }

  .entry-when {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    padding-top: 0;
  }

  .logo-chip {
    margin-bottom: 0;
    width: 40px;
    height: 40px;
  }

  .skills {
    grid-template-columns: 1fr;
  }

  .deck-stage {
    grid-template-columns: 1fr;
    gap: 0.5rem;
    width: 100%;
    margin-left: 0;
  }

  .deck {
    height: 360px;
  }

  .deck-card {
    width: 168px;
    height: 168px;
    margin: -89px 0 0 -84px;
  }

  .deck-detail {
    text-align: center;
  }

  .dd-tag {
    margin-bottom: 0.6rem;
  }

  .site-footer {
    flex-direction: column;
    gap: 0.3rem;
  }
}
