/* ================================================================
   Kean Shi — Academic Homepage, "The Cut-Outs"
   Inspired by Matisse: gouache paper, vermillion, ultramarine,
   ochre, leaf green. Collage-bento hero, rotated paper tiles,
   scrolling interests ticker, wavy bands.
   Type: Fraunces (display) / Montserrat Alternates (body, local)
   ================================================================ */

/* ---------- Local body font ---------- */

@font-face {
  font-family: "Montserrat Alternates";
  src: url("fonts/Montserrat_Alternates/MontserratAlternates-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Montserrat Alternates";
  src: url("fonts/Montserrat_Alternates/MontserratAlternates-Italic.ttf") format("truetype");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "Montserrat Alternates";
  src: url("fonts/Montserrat_Alternates/MontserratAlternates-SemiBold.ttf") format("truetype");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Montserrat Alternates";
  src: url("fonts/Montserrat_Alternates/MontserratAlternates-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Gouache paper + warm ink */
  --color-background: #f7efde;
  --color-foreground: #2b1d12;
  --color-card: #fbf6ea;
  --color-border: #e3d5b8;
  --color-muted-foreground: #6d5b45;

  /* Matisse gouaches — text-safe versions */
  --color-red: #c93a1b;
  --color-blue: #274690;
  --color-green: #2e6b3e;
  /* Shape/background-only versions (not for body text) */
  --color-red-bright: #e2492a;
  --color-ochre: #e0a32e;
  --color-pink: #e8a48e;

  --color-band: #efe3c8;
  --color-contact-band: #c93a1b;
  --color-on-contact: #f9efdc;

  --color-link: var(--color-blue);
  --color-ring: #274690;

  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-sans: "Montserrat Alternates", -apple-system, "Segoe UI", sans-serif;

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 1rem;
  --space-4: 1.5rem;
  --space-5: 2rem;
  --space-6: 3rem;
  --space-7: 4.5rem;

  --container-max: 68rem;
  --duration: 200ms;
}

[data-theme="dark"] {
  /* "Jazz" night — deep ultramarine paper */
  --color-background: #1b2440;
  --color-foreground: #f5ebd8;
  --color-card: #24304f;
  --color-border: #3a4a75;
  --color-muted-foreground: #b8c2dd;

  --color-red: #ff7a5c;
  --color-blue: #9db8e8;
  --color-green: #8fcb9b;
  --color-red-bright: #ff6a48;
  --color-ochre: #f0bc55;
  --color-pink: #e8a48e;

  --color-band: #223054;
  --color-contact-band: #a33017;
  --color-on-contact: #f9efdc;

  --color-link: var(--color-blue);
  --color-ring: #9db8e8;
}

/* ---------- Base ---------- */

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 4.5rem;
  overflow-x: hidden;
  overflow-x: clip;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.7;
  color: var(--color-foreground);
  background: var(--color-background);
  /* rotated cut-out shapes must never cause sideways scroll */
  overflow-x: hidden;
  overflow-x: clip;
  transition: background-color var(--duration) ease, color var(--duration) ease;
}

h1, h2, h3 {
  font-family: var(--font-display);
  line-height: 1.1;
  margin: 0 0 var(--space-3);
  font-weight: 650;
}

h2 { font-size: clamp(1.75rem, 3.5vw, 2.4rem); }
h3 { font-size: 1.25rem; }

p { margin: 0 0 var(--space-3); }

a {
  color: var(--color-link);
  text-decoration-color: color-mix(in srgb, var(--color-link) 45%, transparent);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.2em;
  transition: color var(--duration) ease, text-decoration-color var(--duration) ease;
  cursor: pointer;
}

a:hover {
  color: var(--color-red);
  text-decoration-color: currentColor;
}

sup {
  font-size: 0.7em;
  line-height: 0;
}

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

::selection {
  background: color-mix(in srgb, var(--color-ochre) 45%, transparent);
}

.container {
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--space-4);
}

.icon {
  width: 1.1em;
  height: 1.1em;
  flex-shrink: 0;
  vertical-align: -0.15em;
}

.skip-link {
  position: absolute;
  left: var(--space-3);
  top: -100%;
  z-index: 100;
  padding: var(--space-2) var(--space-3);
  background: var(--color-foreground);
  color: var(--color-background);
  border-radius: 0 0 6px 6px;
}

.skip-link:focus {
  top: 0;
  color: var(--color-background);
}

/* ---------- Cut-out shapes ---------- */

.shape {
  position: absolute;
  z-index: 0;
  pointer-events: none;
}

.shape path {
  fill: currentColor;
}

.shape-star-1 {
  top: 2.5rem;
  right: 4%;
  width: clamp(3.5rem, 7vw, 6rem);
  color: var(--color-ochre);
  transform: rotate(14deg);
}

.shape-star-2 {
  bottom: 1.25rem;
  right: 1.5rem;
  width: clamp(2rem, 4vw, 3rem);
  color: var(--color-red-bright);
  transform: rotate(-18deg);
}

.shape-leaf {
  bottom: -1.5rem;
  left: -2.5rem;
  width: clamp(5rem, 12vw, 10rem);
  color: var(--color-green);
  opacity: 0.9;
  transform: rotate(-32deg);
}

.shape-star-3 {
  top: 2.5rem;
  right: 3%;
  width: clamp(2.5rem, 5vw, 4rem);
  color: var(--color-blue);
  transform: rotate(9deg);
}

.shape-leaf-2 {
  top: 1.5rem;
  right: 5%;
  width: clamp(3.5rem, 8vw, 6.5rem);
  color: var(--color-on-contact);
  opacity: 0.45;
  transform: rotate(40deg);
}

/* Gentle drift for the cut-outs (JS-gated, reduced-motion safe) */
@keyframes drift {
  from { translate: 0 0; }
  to { translate: 0 -10px; }
}

.js .shape {
  animation: drift 5s ease-in-out infinite alternate;
}

.js .shape-leaf { animation-duration: 6s; animation-delay: -1s; }
.js .shape-star-2 { animation-duration: 4.5s; animation-delay: -3s; }
.js .shape-leaf-2 { animation-duration: 6.5s; animation-delay: -2.5s; }

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--color-background) 90%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 3px solid var(--color-foreground);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  min-height: 3.75rem;
}

.brand {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 800;
  text-decoration: none;
  color: var(--color-foreground);
  margin-right: auto;
}

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

.nav-list {
  display: flex;
  gap: var(--space-4);
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-list a {
  position: relative;
  display: inline-block;
  padding: var(--space-2) 0;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--color-foreground);
}

.nav-list a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0.3rem;
  height: 0.45em;
  z-index: -1;
  background: var(--color-ochre);
  opacity: 0.55;
  border-radius: 2px;
  transform: scaleX(0) rotate(-1.5deg);
  transform-origin: left;
  transition: transform var(--duration) ease;
}

.nav-list a:hover::after,
.nav-list a:focus-visible::after {
  transform: scaleX(1) rotate(-1.5deg);
}

.theme-toggle {
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 2px solid var(--color-foreground);
  border-radius: 999px;
  background: var(--color-ochre);
  color: #2b1d12;
  cursor: pointer;
  transition: background-color var(--duration) ease, transform var(--duration) ease;
}

[data-theme="dark"] .theme-toggle {
  background: var(--color-card);
  color: var(--color-ochre);
}

.theme-toggle:hover {
  transform: scale(1.08) rotate(20deg);
}

.theme-toggle .icon {
  width: 1.2rem;
  height: 1.2rem;
}

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

/* ---------- Hero: collage bento ---------- */

.hero {
  position: relative;
  padding-block: var(--space-6) var(--space-7);
}

.bento {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  grid-template-rows: auto auto;
  gap: var(--space-5);
  align-items: stretch;
}

.tile {
  position: relative;
  padding: var(--space-5);
  background: var(--color-card);
  border: 2.5px solid var(--color-foreground);
  border-radius: 18px;
}

.tile-name {
  grid-row: 1 / 3;
  transform: rotate(-0.8deg);
  box-shadow: 10px 10px 0 0 var(--color-blue);
  padding: var(--space-6) var(--space-5);
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
}

.tile-portrait {
  transform: rotate(1.2deg);
  box-shadow: 8px 8px 0 0 var(--color-red-bright);
  display: grid;
  place-items: center;
  padding: var(--space-4);
}

.tile-links {
  list-style: none;
  margin: 0;
  transform: rotate(-1deg);
  box-shadow: 8px 8px 0 0 var(--color-ochre);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
  align-content: center;
  padding: var(--space-4);
}

.kicker {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-red);
  margin-bottom: var(--space-3);
}

.tile-name h1 {
  font-size: clamp(3rem, 7.5vw, 5.25rem);
  font-weight: 850;
  line-height: 0.95;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-4);
  position: relative;
}

/* Ochre brush swatch behind the name */
.tile-name h1::before {
  content: "";
  position: absolute;
  left: -0.15em;
  top: 0.52em;
  width: 2.4em;
  height: 0.62em;
  z-index: -1;
  background: var(--color-ochre);
  opacity: 0.5;
  border-radius: 46% 54% 60% 40% / 55% 45% 55% 45%;
  transform: rotate(-2deg);
  transform-origin: left center;
}

.js .tile-name h1::before {
  animation: sweep 0.7s 0.45s cubic-bezier(0.16, 1, 0.3, 1) backwards;
}

@keyframes sweep {
  from { transform: rotate(-2deg) scaleX(0); }
  to { transform: rotate(-2deg) scaleX(1); }
}

.name-cn {
  display: inline-block;
  font-family: "ZCOOL KuaiLe", var(--font-sans);
  font-size: 0.38em;
  font-weight: 400;
  color: var(--color-red);
  letter-spacing: 0.12em;
  transform: rotate(-3deg) translateY(-0.3em);
}

.lede {
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 2.2vw, 1.4rem);
  font-weight: 500;
  line-height: 1.5;
  margin-bottom: 0;
  max-width: 30em;
}

.lede em {
  font-style: normal;
  padding: 0 0.2em;
  border-radius: 4px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.lede em:first-of-type {
  background: color-mix(in srgb, var(--color-ochre) 45%, transparent);
}

.lede em:last-of-type {
  background: color-mix(in srgb, var(--color-pink) 45%, transparent);
}

.portrait-frame {
  width: min(100%, 300px);
}

.portrait {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 43% 57% 49% 51% / 51% 44% 56% 49%;
  border: 4px solid var(--color-foreground);
  transform: rotate(-1.5deg);
  transition: transform var(--duration) ease, border-radius 400ms ease;
}

.portrait-frame:hover .portrait {
  transform: rotate(1.5deg) scale(1.02);
  border-radius: 51% 49% 55% 45% / 45% 53% 47% 55%;
}

/* Entrance stagger (JS-gated so no-JS users see content immediately) */
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.js .tile {
  animation: rise 0.55s cubic-bezier(0.16, 1, 0.3, 1) backwards;
}

/* Rise must land on each tile's resting rotation */
.js .tile-name {
  animation-name: rise-name;
  animation-delay: 0.08s;
}
.js .tile-portrait {
  animation-name: rise-portrait;
  animation-delay: 0.18s;
}
.js .tile-links {
  animation-name: rise-links;
  animation-delay: 0.28s;
}

@keyframes rise-name {
  from { opacity: 0; transform: rotate(-0.8deg) translateY(16px); }
  to { opacity: 1; transform: rotate(-0.8deg); }
}

@keyframes rise-portrait {
  from { opacity: 0; transform: rotate(1.2deg) translateY(16px); }
  to { opacity: 1; transform: rotate(1.2deg); }
}

@keyframes rise-links {
  from { opacity: 0; transform: rotate(-1deg) translateY(16px); }
  to { opacity: 1; transform: rotate(-1deg); }
}

/* ---------- Contact chips ---------- */

.chip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 2.75rem;
  padding: var(--space-2) var(--space-3);
  border: 2px solid var(--color-foreground);
  border-radius: 999px;
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--color-foreground);
  transition: transform var(--duration) ease, box-shadow var(--duration) ease;
}

.tile-links li:nth-child(odd) .chip { transform: rotate(-1.2deg); }
.tile-links li:nth-child(even) .chip { transform: rotate(1.2deg); }

.chip:hover {
  color: var(--color-foreground);
  transform: rotate(0deg) translateY(-3px);
  box-shadow: 3px 4px 0 0 var(--color-foreground);
}

.chip-red { background: color-mix(in srgb, var(--color-red-bright) 32%, var(--color-background)); }
.chip-blue { background: color-mix(in srgb, var(--color-blue) 26%, var(--color-background)); }
.chip-green { background: color-mix(in srgb, var(--color-green) 28%, var(--color-background)); }
.chip-ochre { background: color-mix(in srgb, var(--color-ochre) 45%, var(--color-background)); }

/* ---------- Interests ticker ---------- */

.ticker {
  overflow: hidden;
  background: var(--color-foreground);
  color: var(--color-background);
  border-block: 3px solid var(--color-foreground);
  padding-block: var(--space-2);
}

.ticker-track {
  display: flex;
  width: max-content;
}

.js .ticker-track {
  animation: ticker 32s linear infinite;
}

.ticker-group {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding-right: var(--space-4);
  white-space: nowrap;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.ticker-star {
  width: 0.9em;
  height: 0.9em;
  flex-shrink: 0;
  fill: var(--color-ochre);
}

@keyframes ticker {
  to { transform: translateX(-50%); }
}

/* ---------- Sections & wavy dividers ---------- */

.section {
  position: relative;
  padding-block: var(--space-6);
}

.section-title {
  display: inline-block;
  font-weight: 800;
  margin-bottom: var(--space-5);
  transform: rotate(-1.2deg);
  position: relative;
  z-index: 1;
}

.section-title::after {
  content: "";
  display: block;
  width: 100%;
  height: 0.3em;
  margin-top: 0.15em;
  border-radius: 46% 54% 60% 40% / 70% 30% 70% 30%;
}

.section-title-blue { color: var(--color-blue); }
.section-title-blue::after { background: var(--color-blue); }

.section-title-red { color: var(--color-red); }
.section-title-red::after { background: var(--color-red); }

.section-title-green { color: var(--color-green); }
.section-title-green::after { background: var(--color-green); }

/* Ochre fails text contrast on cream — ink title, ochre underline */
.section-title-ochre { color: var(--color-foreground); }
.section-title-ochre::after { background: var(--color-ochre); }

.section-title-contact { color: var(--color-on-contact); }
.section-title-contact::after { background: var(--color-ochre); }

.divider {
  display: block;
  width: 100%;
  height: clamp(24px, 4vw, 48px);
}

.divider-flip {
  transform: rotate(180deg);
}

.fill-band { fill: var(--color-band); }
.fill-contact { fill: var(--color-contact-band); }

.band {
  background: var(--color-band);
}

/* ---------- Scroll reveal (classes added by JS only) ---------- */

.js .reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.45s ease, transform 0.45s cubic-bezier(0.16, 1, 0.3, 1);
  transition-delay: var(--reveal-delay, 0s);
}

.js .reveal.revealed {
  opacity: 1;
  transform: none;
}

/* Rotated elements must reveal into their rotation, not flatten it */
.js .section-title.reveal { transform: translateY(14px) rotate(-1.2deg); }
.js .section-title.reveal.revealed { transform: rotate(-1.2deg); }

.js .pub.reveal.revealed:nth-child(odd) { transform: rotate(-0.7deg); }
.js .pub.reveal.revealed:nth-child(even) { transform: rotate(0.6deg); }

.js .mini-tile-a.reveal.revealed { transform: rotate(-1deg); }
.js .mini-tile-b.reveal.revealed { transform: rotate(0.8deg); }

/* After the reveal finishes, restore snappy hover transitions */
.js .reveal.settled {
  transition: box-shadow var(--duration) ease, transform var(--duration) ease;
  transition-delay: 0s;
}

/* ---------- About ---------- */

.about-body {
  max-width: 48rem;
  font-size: 1.02rem;
}

.inline-logo {
  height: 1.15em;
  width: auto;
  vertical-align: -0.2em;
  border-radius: 3px;
}

.contact-cta {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
}

/* ---------- News ---------- */

.news-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-width: 46rem;
}

.news-list li {
  position: relative;
  display: grid;
  grid-template-columns: 6rem 1fr;
  gap: var(--space-3);
  padding: var(--space-3) 0 var(--space-3) 2rem;
}

/* Cut-out star bullets, cycling gouache colors */
.news-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 1.35rem;
  width: 1.1rem;
  height: 1.1rem;
  clip-path: polygon(50% 0%, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0% 50%, 39% 39%);
  background: var(--color-red-bright);
  transform: rotate(10deg);
}

.news-list li:nth-child(4n+2)::before { background: var(--color-blue); transform: rotate(-12deg); }
.news-list li:nth-child(4n+3)::before { background: var(--color-ochre); transform: rotate(24deg); }
.news-list li:nth-child(4n+4)::before { background: var(--color-green); transform: rotate(-6deg); }

.news-list li + li {
  border-top: 2px dashed color-mix(in srgb, var(--color-foreground) 22%, transparent);
}

.news-date {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--color-red);
  font-variant-numeric: tabular-nums;
  padding-top: 0.1em;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ---------- Research plaques ---------- */

.pub-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--space-5);
}

.pub {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 17rem) minmax(0, 1fr);
  gap: var(--space-4);
  padding: var(--space-4);
  background: var(--color-card);
  border: 2.5px solid var(--color-foreground);
  border-radius: 14px;
  transition: transform var(--duration) ease, box-shadow var(--duration) ease;
}

/* Alternate the figure side, collage-style */
.pub:nth-child(even) {
  grid-template-columns: minmax(0, 1fr) minmax(0, 17rem);
}

.pub:nth-child(even) .pub-img { order: 2; }

.pub:nth-child(odd) { transform: rotate(-0.7deg); }
.pub:nth-child(even) { transform: rotate(0.6deg); }

.pub:nth-child(4n+1) { box-shadow: 8px 8px 0 0 var(--color-red-bright); }
.pub:nth-child(4n+2) { box-shadow: 8px 8px 0 0 var(--color-blue); }
.pub:nth-child(4n+3) { box-shadow: 8px 8px 0 0 var(--color-ochre); }
.pub:nth-child(4n+4) { box-shadow: 8px 8px 0 0 var(--color-green); }

.pub:hover,
.js .pub.reveal.revealed:hover {
  transform: rotate(0deg) translate(-2px, -4px);
}

.pub:nth-child(4n+1):hover { box-shadow: 12px 13px 0 0 var(--color-red-bright); }
.pub:nth-child(4n+2):hover { box-shadow: 12px 13px 0 0 var(--color-blue); }
.pub:nth-child(4n+3):hover { box-shadow: 12px 13px 0 0 var(--color-ochre); }
.pub:nth-child(4n+4):hover { box-shadow: 12px 13px 0 0 var(--color-green); }

.pub-img {
  width: 100%;
  height: auto;
  border: 2px solid var(--color-foreground);
  border-radius: 10px;
  background: #fff;
  align-self: start;
}

.pub-body {
  min-width: 0;
}

.pub-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: var(--space-2);
}

.pub-authors {
  margin-bottom: var(--space-1);
  color: var(--color-muted-foreground);
  font-size: 0.92rem;
}

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

.pub-venue {
  font-size: 0.92rem;
  font-weight: 700;
  margin-bottom: var(--space-3);
}

.badge {
  display: inline-block;
  padding: 0.1em 0.7em;
  margin-left: 0.25em;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  background: color-mix(in srgb, var(--color-blue) 22%, var(--color-background));
  border: 1.5px solid var(--color-foreground);
  color: var(--color-foreground);
  transform: rotate(-2deg);
}

.pub-links {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  min-height: 2.1rem;
  padding: 0 var(--space-3);
  border: 2px solid var(--color-foreground);
  border-radius: 999px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--color-foreground);
  background: transparent;
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--duration) ease, transform var(--duration) ease;
}

.link-btn:hover {
  color: var(--color-foreground);
  background: color-mix(in srgb, var(--color-ochre) 45%, transparent);
  transform: rotate(-2deg);
}

.abs-toggle[aria-expanded="true"] {
  background: color-mix(in srgb, var(--color-ochre) 55%, transparent);
}

/* Grid-rows accordion: animates open/closed without fixed heights */
.abstract {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 320ms cubic-bezier(0.16, 1, 0.3, 1);
}

.abstract > div {
  overflow: hidden;
}

.abstract p {
  margin: var(--space-3) 0 0;
  padding-top: var(--space-3);
  border-top: 2px dashed color-mix(in srgb, var(--color-foreground) 22%, transparent);
  font-size: 0.9rem;
  color: var(--color-muted-foreground);
  text-align: justify;
}

.abstract.open {
  grid-template-rows: 1fr;
}

.pub-more {
  margin-top: var(--space-5);
  color: var(--color-muted-foreground);
}

/* ---------- Path: experience + education ---------- */

.path-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-6);
  align-items: start;
}

.path-heading {
  font-size: 1.35rem;
  color: var(--color-red);
  transform: rotate(-1deg);
  display: inline-block;
  margin-bottom: var(--space-4);
}

.path-col:last-child .path-heading {
  color: var(--color-blue);
}

.path-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--space-4);
}

.path-item {
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
}

.path-logo {
  width: 3rem;
  height: 3rem;
  flex-shrink: 0;
  object-fit: contain;
  background: #fff;
  border: 2px solid var(--color-foreground);
  border-radius: 12px;
  padding: 0.3rem;
  transform: rotate(-3deg);
}

.path-item:nth-child(even) .path-logo {
  transform: rotate(3deg);
}

.path-body {
  min-width: 0;
}

.path-org {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-1) var(--space-2);
  font-weight: 700;
  margin-bottom: 0.1rem;
}

.path-date {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--color-red);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
}

.path-desc {
  margin: 0;
  font-size: 0.92rem;
  color: var(--color-muted-foreground);
}

/* ---------- Awards & services tiles ---------- */

.tile-duo {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: var(--space-5);
  align-items: stretch;
}

.mini-tile {
  padding: var(--space-4) var(--space-5);
  background: var(--color-card);
  border: 2.5px solid var(--color-foreground);
  border-radius: 14px;
}

.mini-tile .section-title {
  font-size: 1.5rem;
  margin-bottom: var(--space-4);
}

.mini-tile-a {
  transform: rotate(-1deg);
  box-shadow: 8px 8px 0 0 var(--color-ochre);
}

.mini-tile-b {
  transform: rotate(0.8deg);
  box-shadow: 8px 8px 0 0 var(--color-green);
}

.award-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.award-list li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-3);
  padding-block: var(--space-2);
}

.award-list li + li {
  border-top: 2px dashed color-mix(in srgb, var(--color-foreground) 22%, transparent);
}

.award-date {
  flex-shrink: 0;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--color-red);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
}

.award-highlight {
  font-style: normal;
  font-weight: 700;
  padding: 0 0.2em;
  border-radius: 4px;
  background: color-mix(in srgb, var(--color-ochre) 45%, transparent);
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

/* ---------- Contact / Footer ---------- */

.contact-band {
  background: var(--color-contact-band);
  color: var(--color-on-contact);
}

.contact-band a {
  color: var(--color-on-contact);
  text-decoration-color: color-mix(in srgb, var(--color-on-contact) 55%, transparent);
  font-weight: 700;
}

.contact-band a:hover {
  color: var(--color-ochre);
}

.contact-layout {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5);
  flex-wrap: wrap;
}

.contact-lede {
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 2.2vw, 1.4rem);
  max-width: 38rem;
}

.visitor-map {
  display: inline-block;
  flex-shrink: 0;
  padding: var(--space-2) var(--space-3) var(--space-3);
  background: #f9efdc;
  border: 2.5px solid #2b1d12;
  border-radius: 12px;
  box-shadow: 6px 6px 0 0 var(--color-ochre);
  transform: rotate(-1.2deg);
  line-height: 0;
}

.visitor-map-caption {
  margin: 0 0 var(--space-2);
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 650;
  font-style: italic;
  line-height: 1.3;
  color: #2b1d12;
}

/* The widget inline-styles its "Total Pageviews" label dark; it sits on the
   ultramarine map, so force it readable */
.visitor-map div div {
  color: #f9efdc !important;
}

.site-footer {
  border-top: 2px dashed color-mix(in srgb, var(--color-on-contact) 40%, transparent);
  padding-block: var(--space-4) var(--space-5);
  margin-top: var(--space-5);
}

.footer-inner p {
  margin: 0;
  font-size: 0.9rem;
  color: color-mix(in srgb, var(--color-on-contact) 85%, transparent);
}

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  .pub,
  .pub:nth-child(even) {
    grid-template-columns: 1fr;
  }

  .pub:nth-child(even) .pub-img { order: 0; }
}

@media (max-width: 767px) {
  .header-inner {
    flex-wrap: wrap;
    padding-block: var(--space-2);
    gap: var(--space-1) var(--space-3);
  }

  .header-inner nav {
    order: 3;
    width: 100%;
  }

  .nav-list {
    flex-wrap: wrap;
    gap: var(--space-3);
  }

  .hero {
    padding-block: var(--space-5) var(--space-6);
  }

  .bento {
    grid-template-columns: 1fr;
    grid-template-rows: none;
    gap: var(--space-4);
  }

  .tile-name {
    grid-row: auto;
    padding: var(--space-5) var(--space-4);
  }

  .tile-name,
  .tile-portrait,
  .tile-links {
    box-shadow: 6px 6px 0 0 var(--color-blue);
  }

  .tile-portrait { box-shadow: 6px 6px 0 0 var(--color-red-bright); }
  .tile-links { box-shadow: 6px 6px 0 0 var(--color-ochre); }

  .portrait-frame {
    max-width: 220px;
  }

  .shape-leaf {
    left: -3.5rem;
  }

  .news-list li {
    grid-template-columns: 1fr;
    gap: var(--space-1);
  }

  .news-list li::before {
    top: 1.15rem;
  }

  .path-grid {
    grid-template-columns: 1fr;
    gap: var(--space-5);
  }

  .tile-duo {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }

  .award-list li {
    flex-direction: column;
    gap: var(--space-1);
  }
}

@media (max-width: 480px) {
  .nav-list a {
    font-size: 0.85rem;
  }
}

/* ---------- Motion preferences ---------- */

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

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
