/* ==========================================================================
   Components — everything that gets reused.
   Elements set `--rot` inline to vary their tilt; `--tilt` scales the lot.
   ========================================================================== */

.tilt {
  transform: rotate(calc(var(--tilt) * var(--rot, 0) * 1deg));
}

/* --- Navigation links ------------------------------------------------------ */

.site-nav__link {
  position: relative;
  display: inline-block;
  color: var(--ink);
  font-size: 18px;
  line-height: 32px;
  transition: transform 0.1s;
}

.site-nav__link:hover {
  color: var(--ink);
  transform: rotate(-2deg);
}

/* Wobbly marker underline, revealed for the section currently in view. */
.site-nav__link::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 7px;
  opacity: 0;
  background: var(--accent);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 7' preserveAspectRatio='none'%3E%3Cpath d='M1 4 C 10 1, 18 6, 28 3 S 48 1, 59 5' stroke='%23000' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 7' preserveAspectRatio='none'%3E%3Cpath d='M1 4 C 10 1, 18 6, 28 3 S 48 1, 59 5' stroke='%23000' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat;
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
  transition: opacity 0.15s;
}

.site-nav__link.is-active::after {
  opacity: 1;
}

/* --- Buttons --------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 20px;
  font-size: 18px;
  color: var(--ink);
  background: var(--card);
  border: 3px solid var(--ink);
  border-radius: var(--wob);
  box-shadow: var(--sh);
  transition: transform 0.1s, box-shadow 0.1s;
}

.btn:hover {
  color: #fff;
  background: var(--accent);
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 0 var(--shadow);
}

.btn:active {
  transform: translate(4px, 4px);
  box-shadow: none;
}

.btn--blue:hover {
  background: var(--blue);
}

.btn--muted {
  background: var(--muted);
}

/* Compact button — used for "copy" inside a bibtex note. */
.btn--sm {
  min-height: 34px;
  padding: 0 14px;
  font-size: 15px;
  border-width: 2px;
  box-shadow: var(--sh-sm);
}

.btn--sm:hover {
  background: var(--blue);
  transform: none;
  box-shadow: var(--sh-sm);
}

.btn--sm:active {
  transform: translate(3px, 3px);
  box-shadow: none;
}

/* The chalk/paper switch in the top-right corner. */
.theme-toggle {
  min-height: 40px;
  padding: 0 14px;
  font-size: 16px;
  color: var(--ink);
  background: var(--card);
  border: 2.5px solid var(--ink);
  border-radius: var(--wob);
  box-shadow: var(--sh-sm);
  transition: transform 0.1s, box-shadow 0.1s;
}

.theme-toggle:hover {
  color: #fff;
  background: var(--blue);
  transform: translate(1px, 1px);
  box-shadow: 2px 2px 0 0 var(--shadow);
}

.theme-toggle:active {
  transform: translate(3px, 3px);
  box-shadow: none;
}

/* Square icon button — the project carousel arrows. */
.btn-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  color: var(--ink);
  background: var(--card);
  border: 2.5px solid var(--ink);
  border-radius: var(--wobsm);
  box-shadow: var(--sh-sm);
  transition: transform 0.1s, box-shadow 0.1s;
}

.btn-icon:hover {
  color: #fff;
  background: var(--accent);
}

.btn-icon:active {
  transform: translate(3px, 3px);
  box-shadow: none;
}

/* A button that reads as a link. */
.link-btn {
  padding: 0;
  background: none;
  border: none;
  font-family: var(--font-hand);
  font-size: 17px;
  color: var(--blue);
  border-bottom: 2px dotted var(--blue);
}

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

.disclosure-btn {
  margin-top: 14px;
  padding: 6px 0;
}

/* --- Social icon blobs ----------------------------------------------------- */

.icon-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin: 24px 0 0;
  padding: 0;
  list-style: none;
}

.icon-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  color: var(--ink);
  background: var(--card);
  border: 2.5px solid var(--ink);
  border-radius: var(--wob-blob-a);
  transition: transform 0.1s;
}

.icon-link:hover {
  color: #fff;
  background: var(--accent);
  transform: rotate(-6deg);
}

/* Alternate the direction each blob tips on hover. */
.icon-links li:nth-child(even) .icon-link:hover {
  transform: rotate(6deg);
}

.icon-links li:nth-child(2) .icon-link {
  border-radius: var(--wob-blob-b);
}

.icon-links li:nth-child(3) .icon-link {
  border-radius: var(--wob-blob-c);
}

.icon-links li:nth-child(4) .icon-link {
  border-radius: var(--wob-blob-d);
}

/* --- Framed media ---------------------------------------------------------- */

.frame {
  position: relative;
  overflow: hidden;
  aspect-ratio: 1 / 1;
  background: var(--card);
  border: 2px solid var(--ink);
  border-radius: var(--wobsm);
  box-shadow: var(--sh);
}

.frame--lg {
  aspect-ratio: 16 / 9;
  border-width: 3px;
  border-radius: var(--wob-hero);
  box-shadow: var(--sh-xl);
}

.frame--portrait {
  border-width: 3px;
  border-radius: var(--wob-hero);
  box-shadow: var(--sh-lg);
}

.frame--flat {
  background: var(--paper);
  box-shadow: none;
}

/* Takes its shape from the image inside it. Use for figures and paper teasers,
   which have to stay readable rather than be cropped square. */
.frame--auto {
  aspect-ratio: auto;
}

.frame--auto > img,
.frame--auto > video {
  height: auto;
  object-fit: contain;
}

.frame > img,
.frame > video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Placeholder for a picture that has not been dropped in yet. Replace the
   whole element with <img src="…" alt="…"> when the real asset exists. */
.img-slot {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  padding: 14px;
  text-align: center;
  font-size: 16px;
  line-height: 1.35;
  color: var(--ph);
  background: var(--ph-x);
  background-image: linear-gradient(
      135deg,
      transparent 47%,
      var(--ph) 47%,
      var(--ph) 48%,
      transparent 48%
    ),
    linear-gradient(
      45deg,
      transparent 47%,
      var(--ph) 47%,
      var(--ph) 48%,
      transparent 48%
    );
  background-size: 100% 100%;
  opacity: 0.85;
}

/* Pencil corner marks around the portrait. */
.corner-mark {
  position: absolute;
}

.corner-mark--tl {
  top: -16px;
  left: -16px;
}

.corner-mark--br {
  right: -14px;
  bottom: -18px;
}

/* A doodled blob that bobs beside the portrait. */
.doodle-blob {
  position: absolute;
  bottom: -34px;
  left: -30px;
  width: 44px;
  height: 44px;
  border: 3px dashed var(--accent);
  border-radius: var(--wob-blob-c);
  animation: bob 3s ease-in-out infinite;
}

/* A strip of masking tape. Position with the custom properties. */
.tape {
  position: absolute;
  top: var(--tape-top, -10px);
  left: var(--tape-left, auto);
  right: var(--tape-right, auto);
  width: var(--tape-w, 64px);
  height: var(--tape-h, 20px);
  background: var(--tape);
  border-left: 1px dashed var(--tape-edge);
  border-right: 1px dashed var(--tape-edge);
  transform: rotate(calc(var(--tape-rot, -9) * 1deg));
}

.tape--center {
  left: 50%;
  transform: translateX(-50%) rotate(calc(var(--tape-rot, -4) * 1deg));
}

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

.news {
  margin-top: clamp(36px, 5vw, 56px);
}

.news__title {
  font-size: clamp(28px, 3.6vw, 36px);
  margin-bottom: 4px;
}

.timeline {
  position: relative;
  margin-top: 14px;
  padding-left: 26px;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 14px;
  bottom: 14px;
  border-left: 2px dashed var(--ink);
  opacity: 0.4;
}

.timeline__list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* --- Post-it note ---------------------------------------------------------- */

.note {
  position: relative;
  padding: 11px 16px;
  background: var(--postit);
  border: 1px solid var(--tape-edge);
  box-shadow: var(--sh-sm);
}

.note--timeline {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  align-items: baseline;
}

.note--timeline::before {
  content: "";
  position: absolute;
  left: -25px;
  top: 16px;
  width: 13px;
  height: 13px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--accent);
}

.note__date {
  flex: none;
  min-width: 88px;
  font-size: 16px;
  color: var(--postit-fg);
}

.note__body {
  flex: 1 1 240px;
}

/* --- Publication / talk entries -------------------------------------------- */

.entry__title {
  font-size: clamp(21px, 2.4vw, 25px);
  line-height: 1.24;
}

.entry__authors {
  margin: 7px 0 0;
  font-size: 18px;
}

.entry__authors .self {
  font-family: var(--font-marker);
  font-weight: 700;
  font-size: 19px;
}

.entry__venue {
  margin: 2px 0 0;
  font-size: 18px;
  font-style: italic;
}

.entry__status {
  margin: 4px 0 0;
}

.badge-review {
  display: inline-block;
  font-family: var(--font-marker);
  font-weight: 700;
  font-size: 18px;
  font-style: normal;
  color: var(--accent-strong);
  border-bottom: 2px solid var(--accent-strong);
  transform: rotate(calc(var(--tilt) * -1.4deg));
}

/* --- Meta link rows (arXiv · github · bibtex) ------------------------------ */

.meta-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 11px;
  font-size: 17px;
}

/* Hand-drawn squiggle between each pair of links. */
.meta-links > :not(:first-child)::before {
  content: "";
  display: inline-block;
  width: 9px;
  height: 18px;
  margin-right: 10px;
  vertical-align: -4px;
  opacity: 0.5;
  background-color: var(--ink);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 9 18'%3E%3Cpath d='M6 1 C 3 6, 5 12, 2 17' stroke='%23000' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat center / contain;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 9 18'%3E%3Cpath d='M6 1 C 3 6, 5 12, 2 17' stroke='%23000' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat center / contain;
}

/* --- BibTeX drawer --------------------------------------------------------- */

.bibtex {
  position: relative;
  margin-top: 16px;
  padding: 16px 18px;
  background: var(--postit);
  border: 1px solid var(--tape-edge);
  box-shadow: var(--sh);
  transform: rotate(calc(var(--tilt) * var(--rot, 0) * 1deg));
}

.bibtex__code {
  margin: 0;
  font-family: var(--font-hand);
  font-size: 15px;
  line-height: 1.55;
  white-space: pre-wrap;
  color: var(--ink);
}

.bibtex__actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

/* --- Tags ------------------------------------------------------------------ */

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.tag {
  padding: 1px 9px;
  font-size: 15px;
  color: var(--ink);
  background: var(--postit);
  border: 1.5px solid var(--ink);
  border-radius: var(--wobxs);
}

/* --- Projects strip -------------------------------------------------------- */

.projects__controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.projects__strip {
  display: flex;
  gap: 32px;
  margin-top: 26px;
  padding: 8px 4px 16px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
}

/* "Show all projects" swaps the rail for a wrapping grid. */
.projects__strip[data-mode="open"] {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  overflow: visible;
  padding-bottom: 0;
}

.projects__strip[data-mode="open"] > * {
  flex: 1 1 auto;
}

.project-card {
  flex: 0 0 340px;
  scroll-snap-align: start;
  display: block;
  padding: 12px;
  color: var(--ink);
  background: var(--card);
  border: 2px solid var(--ink);
  border-radius: var(--wobmd);
  box-shadow: var(--sh);
  transform: rotate(calc(var(--tilt) * var(--rot, 0) * 1deg));
  transition: transform 0.1s, box-shadow 0.1s;
}

.project-card:hover {
  color: var(--ink);
  transform: rotate(calc(var(--tilt) * var(--rot, 0) * -0.4deg)) translate(-2px, -2px);
  box-shadow: var(--sh-xl);
}

.project-card__title {
  margin-top: 12px;
  font-size: 22px;
}

.project-card__summary {
  margin: 6px 0 0;
  font-size: 17px;
  color: var(--muted-fg);
}

/* The empty slot that hints at how to add another project. */
.project-card--empty {
  flex: 0 0 340px;
  scroll-snap-align: start;
  display: grid;
  place-items: center;
  min-height: 300px;
  padding: 20px;
  opacity: 0.45;
  border: 2px dashed var(--ink);
  border-radius: var(--wobmd);
  transform: rotate(calc(var(--tilt) * -0.5deg));
}

.project-card--empty p {
  margin: 0;
  text-align: center;
  font-size: 17px;
  line-height: 1.45;
}

.project-card--empty code {
  font-family: var(--font-hand);
}

/* --- Project detail page --------------------------------------------------- */

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  color: var(--ink);
  font-size: 18px;
}

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

.project-title {
  margin-top: 18px;
  font-size: clamp(34px, 5.6vw, 52px);
  line-height: 1.06;
}

.scribble-underline {
  display: block;
  margin-top: 2px;
}

.project-hero {
  position: relative;
  margin-top: 24px;
}

.project-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 22px;
}

.prose {
  margin: 30px 0 0;
  font-size: 20px;
  max-width: 62ch;
}

.prose--tight {
  margin-top: 10px;
  font-size: 19px;
}

.prose h2,
.project-section-title {
  margin-top: 32px;
  font-size: clamp(26px, 3.4vw, 32px);
}

.dropcap::first-letter {
  font-family: var(--font-marker);
  font-weight: 700;
  font-size: 3.2em;
  line-height: 0.78;
  float: left;
  padding: 8px 12px 0 0;
}

.codeblock {
  margin-top: 22px;
  padding: 16px 18px;
  background: var(--card);
  border: 2px dashed var(--ink);
  border-radius: var(--wobsm);
  box-shadow: 4px 4px 0 0 var(--tape-edge);
}

.codeblock pre {
  margin: 0;
  font-family: var(--font-hand);
  font-size: 16px;
  line-height: 1.6;
  white-space: pre-wrap;
  color: var(--ink);
}
