/* Catarina Carneiro de Sousa — public site
   Dark only. Monochrome anthracite. One family: Inria Serif. */

:root {
  --bg: #17181a;
  --bg-deep: #121315;
  --surface: #1e1f22;
  --surface-2: #26282b;
  --line: #2c2e31;
  --line-strong: #3d4044;
  --muted: #8b8e92;
  --text: #cfcfcc;
  --strong: #f5f5f5;

  --font: "Inria Serif", Georgia, "Times New Roman", serif;
  --fs-label: 0.75rem;
  --fs-small: 0.875rem;
  --fs-body: 1.0625rem;
  --fs-lead: clamp(1.125rem, 1rem + 0.45vw, 1.3125rem);
  --fs-h3: 1.3125rem;
  --fs-h2: clamp(1.5rem, 1.2rem + 1.2vw, 2.125rem);
  --fs-title: clamp(2.25rem, 1.4rem + 3.6vw, 4.5rem);
  --fs-hero: clamp(2.5rem, 1rem + 6.4vw, 7rem);

  --gutter: clamp(16px, 4vw, 56px);
  --maxw: 1440px;
  --measure: 66ch;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --hit: 44px;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--fs-body);
  font-weight: 400;
  line-height: 1.6;
  font-kerning: normal;
  font-variant-numeric: oldstyle-nums proportional-nums;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
}
main { flex: 1 0 auto; outline: none; }
html, body { overflow-x: clip; }

img, svg, video, iframe { display: block; max-width: 100%; }
picture { display: contents; }

a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.2em; text-decoration-color: var(--line-strong); transition: color .2s var(--ease), text-decoration-color .2s var(--ease); }
a:hover { color: var(--strong); text-decoration-color: currentColor; }
:focus-visible { outline: 1px solid var(--strong); outline-offset: 3px; border-radius: 1px; }

h1, h2, h3 { color: var(--strong); font-weight: 300; line-height: 1.1; margin: 0; letter-spacing: -0.005em; }
p { margin: 0 0 1em; }
::selection { background: var(--line-strong); color: var(--strong); }

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

.label {
  font-size: var(--fs-label);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 400;
  line-height: 1.4;
  font-variant-numeric: lining-nums tabular-nums;
}

.skip { position: absolute; left: var(--gutter); top: -100px; z-index: 100; background: var(--strong); color: var(--bg); padding: .5rem .9rem; text-decoration: none; }
.skip:focus { top: .75rem; }

/* ---------------------------------------------------------------- header & nav */
.site-header { position: relative; z-index: 20; }
/* Desktop: the header stays at the top; once the page scrolls it gets a dark glassy background */
@media (min-width: 721px) {
  html { scroll-padding-top: 88px; }
  .site-header {
    position: sticky; top: 0;
    border-bottom: 1px solid transparent;
    transition: background-color .3s var(--ease), border-color .3s var(--ease), -webkit-backdrop-filter .3s var(--ease), backdrop-filter .3s var(--ease);
  }
  .is-scrolled .site-header {
    background: rgba(18, 19, 21, .72);
    -webkit-backdrop-filter: blur(16px) saturate(140%); backdrop-filter: blur(16px) saturate(140%);
    border-bottom-color: rgba(255, 255, 255, .06);
  }
  @supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .is-scrolled .site-header { background: rgba(18, 19, 21, .96); }
  }
}

/* Round dark buttons fixed on screen (phones): the menu button and "back to top" */
.to-top { display: none; }
@media (max-width: 720px) {
  .to-top {
    position: fixed; right: 10px; bottom: calc(14px + env(safe-area-inset-bottom)); z-index: 25;
    display: flex; align-items: center; justify-content: center; width: 48px; height: 48px; padding: 0;
    border: 0; border-radius: 50%; background: #0c0d0e; color: var(--strong); cursor: pointer;
    opacity: 0; visibility: hidden; transform: translateY(8px);
    transition: opacity .25s var(--ease), transform .25s var(--ease), visibility 0s linear .25s;
  }
  .to-top .icon { width: 22px; height: 22px; }
  .past-fold .to-top { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
  body.nav-open .to-top, body.lb-open .to-top { opacity: 0; visibility: hidden; }
}
.site-header__inner {
  max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter);
  min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.wordmark {
  font-size: var(--fs-small); letter-spacing: 0.04em; text-decoration: none; color: var(--strong);
  padding: .6rem 0; min-height: var(--hit); display: inline-flex; align-items: center;
}
.nav__list { list-style: none; margin: 0; padding: 0; display: flex; gap: clamp(.75rem, 2.4vw, 2.25rem); }
.nav__list a {
  display: inline-flex; align-items: center; min-height: var(--hit); padding: 0 .1rem;
  font-size: var(--fs-label); letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); text-decoration: none;
}
.nav__list a:hover { color: var(--strong); }
.nav__list a[aria-current="page"] { color: var(--strong); text-decoration: underline; text-decoration-color: var(--muted); text-underline-offset: .55em; }
.nav__toggle { display: none; }
.nav__panel { display: contents; }
.nav__social { display: none; }

@media (max-width: 720px) {
  .nav__toggle {
    position: fixed; top: calc(12px + env(safe-area-inset-top)); right: 10px; z-index: 40;
    display: inline-flex; align-items: center; justify-content: center; width: 48px; height: 48px; padding: 0;
    background: transparent; border: 0; border-radius: 50%; color: var(--strong); cursor: pointer;
    transition: background-color .3s var(--ease);
  }
  /* the dark circle fades in once the page is scrolled; never behind the close button */
  .is-scrolled .nav__toggle { background: #0c0d0e; }
  .nav.is-open .nav__toggle { background: transparent; }
  .nav__toggle .icon { width: 24px; height: 24px; }
  .nav__toggle .icon--close { display: none; }
  .nav__panel {
    position: fixed; inset: 0; z-index: 30; background: var(--bg);
    display: flex; flex-direction: column; padding: calc(72px + 1rem + env(safe-area-inset-top)) var(--gutter) calc(1.5rem + env(safe-area-inset-bottom));
    overflow-y: auto; overscroll-behavior: contain;
    opacity: 0; visibility: hidden; transform: translateY(-6px);
    transition: opacity .25s var(--ease), transform .25s var(--ease), visibility 0s linear .25s;
  }
  .nav__list { flex-direction: column; gap: 0; }
  .nav__list li { border-bottom: 1px solid var(--line); }
  .nav__list a,
  .nav__list a[aria-current="page"] { font-size: var(--fs-h2); letter-spacing: 0; text-transform: none; color: var(--text); text-decoration: none; min-height: 64px; width: 100%; font-weight: 300; }
  .nav__list a:hover { color: var(--strong); }
  .nav__social { display: flex; list-style: none; margin: 2rem 0 0 -6px; padding: 0; gap: .5rem; }
  .nav__social a { display: inline-flex; align-items: center; justify-content: center; width: 56px; height: 56px; color: var(--muted); border-radius: 50%; }
  .nav__social a:hover { color: var(--strong); }
  .nav__social .icon { width: 44px; height: 44px; }
  .nav.is-open .nav__panel { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
  .nav.is-open .icon--open { display: none; }
  .nav.is-open .icon--close { display: block; }
  body.nav-open { overflow: hidden; }
}

/* ---------------------------------------------------------------- page scaffolding */
.page-head, .project, .projects, .pubs, .about, .contact, .not-found {
  max-width: var(--maxw); margin-left: auto; margin-right: auto; padding-left: var(--gutter); padding-right: var(--gutter);
}
.page-head { padding-top: clamp(2rem, 7vw, 6rem); padding-bottom: clamp(1.5rem, 4vw, 3rem); }
.page-title { font-size: var(--fs-title); line-height: 1; letter-spacing: -0.015em; }
.page-intro { max-width: var(--measure); margin-top: 1.5rem; color: var(--text); }

.prose { max-width: var(--measure); }
.prose p { margin: 0 0 1em; }
.prose p:last-child { margin-bottom: 0; }
.prose a { text-decoration: underline; }
.prose em { font-style: italic; }
.prose strong { font-weight: 700; color: var(--strong); }
.prose h2, .prose h3 { font-size: var(--fs-h3); margin: 1.6em 0 .6em; }
.prose ul, .prose ol { padding-left: 1.2em; margin: 0 0 1em; }
.prose blockquote { margin: 1.2em 0; padding-left: 1.2em; border-left: 1px solid var(--line-strong); font-style: italic; }
.prose--lead { font-size: var(--fs-lead); line-height: 1.55; }

.link-arrow { display: inline-flex; align-items: center; gap: .45em; min-height: var(--hit); text-decoration: none; color: var(--strong); }
.link-arrow:hover .icon { transform: translateX(3px); }
.link-arrow .icon { transition: transform .2s var(--ease); }

/* ---------------------------------------------------------------- home */
.hero {
  max-width: var(--maxw); margin: 0 auto; padding: clamp(1.5rem, 6vw, 5.5rem) var(--gutter) clamp(1.5rem, 3.5vw, 3rem);
}
.hero__name {
  font-size: var(--fs-hero); font-weight: 300; line-height: .95; letter-spacing: -0.025em; color: var(--strong);
  max-width: 14ch; text-wrap: balance;
}
/* Desktop: smaller name, confined to the left 60% of the width */
@media (max-width: 720px) {
  .hero__name { line-height: 1.12; }
}
@media (min-width: 900px) {
  .hero__name { font-size: clamp(2.25rem, 5vw - 6px, 4.1rem); max-width: 60%; }
}
.hero__tagline { margin: clamp(.9rem, 2vw, 1.6rem) 0 0; display: flex; align-items: baseline; gap: .8rem; }
.hero__aka { font-size: var(--fs-label); letter-spacing: .22em; color: var(--muted); }
.hero__alias { font-style: italic; font-weight: 300; font-size: var(--fs-h2); color: var(--text); line-height: 1.1; }

/* Home: header + name + slideshow fit the first screen; the slideshow takes all remaining height */
.page-home main { display: flex; flex-direction: column; min-height: calc(100vh - 72px); min-height: calc(100svh - 72px); }
.page-home .hero { flex: none; width: 100%; }
/* Generous space between the slideshow and the footer (phones: see the 640px block) */
.page-home main { margin-bottom: clamp(4rem, 9vh, 8rem); }
.slideshow { --cap: 5.25rem; position: relative; flex: 1 1 auto; display: flex; flex-direction: column; min-height: 360px; max-height: 1180px; padding-bottom: clamp(.75rem, 2vw, 1.5rem); }
.slideshow__track { position: relative; flex: 1 1 auto; min-height: 0; }
.slide {
  position: absolute; inset: 0; margin: 0; display: grid; grid-template-rows: minmax(0, 1fr) var(--cap);
  opacity: 0; visibility: hidden; transition: opacity 1.1s var(--ease), visibility 0s linear 1.1s;
}
.slide.is-active { opacity: 1; visibility: visible; transition-delay: 0s; z-index: 1; }
.slide__link { display: flex; align-items: center; justify-content: center; padding: 0 var(--gutter); min-height: 0; }
.slide__img { width: auto; height: auto; max-width: min(100%, var(--w)); max-height: 100%; object-fit: contain; }
/* A project's poster image fills the whole image area, cropped where necessary */
.slide--fill .slide__link { padding: 0; }
.slide--fill .slide__img { width: 100%; height: 100%; max-width: none; max-height: none; object-fit: cover; }
.slide__caption {
  width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 1rem calc(var(--gutter) + 220px) 0 var(--gutter);
  display: flex; flex-direction: column; align-items: flex-start; gap: .25rem;
}
.slide__caption a { text-decoration: none; }
.slide__title { font-size: var(--fs-h3); color: var(--strong); font-style: italic; font-weight: 300; }
.slide__meta { font-size: var(--fs-label); letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.slideshow__controls {
  position: absolute; left: 0; right: 0; bottom: calc(var(--cap) - 3.2rem + clamp(.75rem, 2vw, 1.5rem)); z-index: 2; pointer-events: none;
  max-width: var(--maxw); margin: 0 auto; padding: .45rem calc(var(--gutter) - 10px) 0 var(--gutter);
  display: flex; justify-content: flex-end; align-items: center;
}
.slideshow__controls > * { pointer-events: auto; }
@media (max-width: 640px) {
  .slideshow { --cap: 9.25rem; min-height: 300px; }
  /* Generous space under the project name. The slideshow still fits the visible screen (svh);
     the gap also covers the browser bars collapsing (lvh - svh), so the footer is never in view on opening. */
  .page-home main { margin-bottom: 5rem; margin-bottom: calc(100lvh - 100svh + 5rem); }
  .slide__link { padding: 0; }
  .slide__caption { padding: 3.4rem var(--gutter) 0; }
  /* counter in line with the project name on the left, buttons on the right */
  .slideshow__controls { justify-content: flex-start; padding-left: var(--gutter); padding-right: var(--gutter); bottom: calc(var(--cap) - 3.2rem + clamp(.75rem, 2vw, 1.5rem)); }
  .slideshow__controls .counter { margin-right: auto; }
}
.counter { margin: 0 .6rem 0 0; font-size: var(--fs-label); letter-spacing: .16em; color: var(--muted); font-variant-numeric: lining-nums tabular-nums; }
.counter__current { color: var(--strong); }
.counter__sep { margin: 0 .35em; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: var(--hit); height: var(--hit); padding: 0; border: 0; background: none; color: var(--muted); cursor: pointer;
  border-radius: 50%; transition: color .2s var(--ease), background-color .2s var(--ease);
}
.icon-btn:hover { color: var(--strong); background: var(--surface); }
.icon-btn .icon { width: 20px; height: 20px; }
.slideshow__toggle .icon--play { display: none; }
.slideshow.is-paused .slideshow__toggle .icon--play { display: block; }
.slideshow.is-paused .slideshow__toggle .icon--pause { display: none; }

/* ---------------------------------------------------------------- projects: filters */
.listbar { display: flex; align-items: center; justify-content: space-between; gap: .5rem 1.5rem; margin-top: clamp(1.5rem, 3vw, 2.5rem); }
.listbar .filters { flex: 1 1 auto; min-width: 0; }
.viewswitch {
  flex: none; display: inline-flex; align-items: center; min-height: var(--hit);
  font-size: var(--fs-label); letter-spacing: .16em; text-transform: uppercase; color: var(--text);
  text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: .5em;
}
.viewswitch:hover { color: var(--strong); text-decoration-color: currentColor; }
.filters ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0 1.4rem; }
.filters a {
  display: inline-flex; align-items: center; min-height: var(--hit);
  font-size: var(--fs-label); letter-spacing: .16em; text-transform: uppercase; color: var(--muted); text-decoration: none;
}
.filters a:hover { color: var(--strong); }
.filters a[aria-current="true"] { color: var(--strong); text-decoration: underline; text-underline-offset: .5em; text-decoration-color: var(--muted); }
@media (max-width: 640px) {
  .listbar { flex-direction: column-reverse; align-items: stretch; gap: 0; }
  .viewswitch { align-self: flex-end; }
  .filters ul { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-right: calc(var(--gutter) * -1); padding-right: var(--gutter); gap: 0 1.1rem; }
  .filters ul::-webkit-scrollbar { display: none; }
  .filters li { flex: none; }
}

/* ---------------------------------------------------------------- projects: shared */
.projects { padding-bottom: clamp(3rem, 8vw, 7rem); }
.cat + .cat { margin-top: clamp(3rem, 7vw, 6rem); }
.cat__title { font-size: var(--fs-h2); display: flex; align-items: baseline; gap: .9rem; padding-bottom: 1rem; }
.group { margin-top: 1.4rem; }
.group + .group { margin-top: clamp(1.8rem, 4vw, 3rem); }
.group__title {
  font-size: var(--fs-label); letter-spacing: .16em; text-transform: uppercase; color: var(--muted); font-weight: 400;
  margin-bottom: .4rem;
}
[hidden] { display: none !important; }

/* index layout */
.index { list-style: none; margin: 0; padding: 0; border-bottom: 1px solid var(--line); }
.index__item { border-top: 1px solid var(--line); }
.index__link {
  position: relative; display: grid; grid-template-columns: 4.5rem 1fr auto; align-items: baseline; gap: 1rem;
  min-height: 56px; padding: .85rem 0; text-decoration: none;
}
.index__title { grid-column: 2; font-size: clamp(1.25rem, 1.05rem + .8vw, 1.75rem); font-weight: 300; color: var(--text); line-height: 1.2; transition: color .2s var(--ease), transform .3s var(--ease); }
.index__year { grid-column: 3; font-size: var(--fs-small); color: var(--muted); font-variant-numeric: lining-nums tabular-nums; white-space: nowrap; }
.index__link:hover .index__title, .index__link:focus-visible .index__title { color: var(--strong); }
.index__thumb { display: none; }

@media (hover: hover) and (min-width: 900px) {
  .index__link:hover .index__title { transform: translateX(.35rem); }
  .index__thumb {
    display: flex; align-items: center; justify-content: flex-end;
    position: absolute; right: 9rem; top: 50%; width: 320px; height: 220px; z-index: 5;
    transform: translateY(-50%) scale(.98); opacity: 0; pointer-events: none;
    transition: opacity .25s var(--ease), transform .35s var(--ease);
  }
  .index__thumb img { max-width: min(100%, var(--w)); max-height: 100%; width: auto; height: auto; object-fit: contain; }
  .index__link:hover .index__thumb, .index__link:focus-visible .index__thumb { opacity: 1; transform: translateY(-50%); }
}
@media (hover: none), (max-width: 899px) {
  .index__link { grid-template-columns: 72px 1fr auto; align-items: center; gap: .9rem; padding: .6rem 0; }
  .index__thumb { display: flex; width: 72px; height: 54px; align-items: center; justify-content: center; background: var(--bg-deep); }
  .index__thumb img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; }
}

/* list / gallery views: both are in the page, the root class picks one */
.projects--list .view-gallery, .projects--gallery .view-list { display: none; }

/* gallery view: square tiles, at most three columns, centred with generous side space */
.projects--gallery { --tiles-max: 1120px; padding-left: clamp(var(--gutter), 9vw, 10rem); padding-right: clamp(var(--gutter), 9vw, 10rem); }
.projects--gallery .cat { max-width: var(--tiles-max); margin-left: auto; margin-right: auto; }
.tiles { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2px; }
.tile { min-width: 0; }
.tile__link { position: relative; display: block; text-decoration: none; color: var(--text); }
.tile__media { display: block; aspect-ratio: 1 / 1; overflow: hidden; background: var(--bg-deep); }
.tile__img, .tile__media img { display: block; width: 100%; height: 100%; max-width: none; object-fit: cover; transition: filter .35s var(--ease), transform .6s var(--ease); }
.tile__info { display: flex; flex-direction: column; gap: .3rem; }
.tile__name { font-size: clamp(1.125rem, 1rem + .5vw, 1.4rem); font-weight: 300; line-height: 1.2; color: var(--strong); overflow-wrap: break-word; hyphens: auto; }
.tile__meta { font-size: var(--fs-label); letter-spacing: .14em; text-transform: uppercase; line-height: 1.5; color: #c9cacc; font-variant-numeric: lining-nums; }

@media (max-width: 999px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* desktop (mouse): darken the image and show the name over it */
@media (hover: hover) and (min-width: 641px) {
  .tile__info {
    position: absolute; inset: 0; justify-content: center; align-items: center; text-align: center;
    padding: clamp(1rem, 2.5vw, 2rem); background: rgba(10, 10, 11, .72);
    opacity: 0; transition: opacity .3s var(--ease);
  }
  .tile__link:hover .tile__info, .tile__link:focus-visible .tile__info { opacity: 1; }
  .tile__link:hover .tile__img, .tile__link:focus-visible .tile__img { transform: scale(1.02); }
  .tile__link:focus-visible { outline-offset: 2px; }
}
/* touch screens and phones: the information sits under each image */
@media (hover: none), (max-width: 640px) {
  .tiles { row-gap: 1.6rem; }
  .tile__info { padding: .7rem 0 0; }
  .tile__name { font-size: 1.125rem; }
}
@media (max-width: 640px) {
  .projects--gallery { padding-left: max(48px, var(--gutter)); padding-right: max(48px, var(--gutter)); }
  .tiles { grid-template-columns: 1fr; row-gap: 2rem; }
}

/* ---------------------------------------------------------------- project */
.preview-note { max-width: var(--maxw); margin: 0 auto; padding: .7rem var(--gutter); background: var(--surface-2); color: var(--strong); font-size: var(--fs-small); }
.project__head { padding: clamp(1.5rem, 5vw, 4.5rem) 0 clamp(1.5rem, 4vw, 3rem); }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 0 .55rem; font-size: var(--fs-label); letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.crumbs a { text-decoration: none; display: inline-flex; align-items: center; min-height: 36px; }
.crumbs__sep { color: var(--line-strong); }
.project__title { font-size: var(--fs-title); line-height: 1.02; letter-spacing: -0.015em; margin-top: .6rem; max-width: 22ch; }
.project__about { max-width: var(--measure); padding-bottom: clamp(2rem, 5vw, 3.5rem); }
.project__short {
  margin: 0; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 4; line-clamp: 4; overflow: hidden;
}
.project__short[hidden], .project__full[hidden] { display: none; }
.project__full .credits { margin-top: 2rem; }
.readmore {
  display: inline-flex; align-items: center; min-height: var(--hit); margin-top: .35rem; padding: 0;
  background: none; border: 0; font: inherit; font-weight: 700; color: var(--strong); cursor: pointer;
  text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: .2em;
}
.readmore:hover { text-decoration-color: currentColor; }
@media (max-width: 640px) { .project__short { -webkit-line-clamp: 3; line-clamp: 3; } }

.project__cover { width: 100vw; margin: 0 0 clamp(2.5rem, 7vw, 5rem) calc(50% - 50vw); }
.project__cover-img { display: block; width: 100%; height: auto; max-width: none; }
@media (max-width: 640px) { .project__cover { width: 100%; margin-left: 0; } }

/* project images: square tiles, at most three per row, centred; single column of whole images on phones */
.pgrid {
  list-style: none; margin: 0 auto; padding: 0 clamp(0px, 6vw, 7rem) clamp(3rem, 8vw, 6rem);
  max-width: calc(1120px + 2 * clamp(0px, 6vw, 7rem));
  display: flex; flex-wrap: wrap; justify-content: flex-start; gap: 2px;
}
.ptile { flex: 0 0 calc((100% - 4px) / 3); min-width: 0; }
.ptile__link { cursor: zoom-in; }
.ptile--video .ptile__link { cursor: pointer; }
.ptile__media { position: relative; }
.ptile__play {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 1;
  display: flex; align-items: center; justify-content: center; width: 64px; height: 64px; border-radius: 50%;
  background: rgba(10, 10, 11, .55); border: 1px solid rgba(255, 255, 255, .35); color: var(--strong);
}
.ptile__play .icon { width: 26px; height: 26px; margin-left: 3px; }
.ptile--video .tile__img { opacity: .75; }
@media (max-width: 999px) { .ptile { flex-basis: calc((100% - 2px) / 2); } }
@media (hover: none), (max-width: 640px) { .ptile__info { display: none !important; } }
@media (max-width: 640px) {
  .project { padding-left: 0; padding-right: 0; }
  .project__head, .project__about, .pager { padding-left: var(--gutter); padding-right: var(--gutter); }
  .pgrid { padding: 0 0 3rem; gap: 1.25rem; }
  .ptile { flex-basis: 100%; }
  .ptile__media { aspect-ratio: auto; background: none; }
  .ptile .tile__img { height: auto; object-fit: contain; }
  .ptile--video .ptile__media { aspect-ratio: 16 / 9; background: var(--bg-deep); }
  .ptile--video .tile__img { height: 100%; object-fit: cover; }
}

.video { position: relative; width: min(100%, 1120px); aspect-ratio: 16 / 9; background: var(--bg-deep); border: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .6rem; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; z-index: 2; }
.video__poster { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; object-fit: cover; opacity: .5; pointer-events: none; }
.video__play, .video__note { position: relative; z-index: 1; }
.video.is-playing .video__poster { display: none; }
.video__play { display: inline-flex; align-items: center; gap: .7rem; min-height: var(--hit); padding: .6rem 1.1rem; background: none; border: 1px solid var(--line-strong); color: var(--strong); font: inherit; cursor: pointer; border-radius: 999px; transition: background-color .2s var(--ease); }
.video__play:hover { background: var(--surface-2); }
.video__note { margin: 0; font-size: var(--fs-label); color: var(--muted); letter-spacing: .04em; }
.video__note a { display: inline-flex; align-items: center; gap: .25em; }
.video__note .icon { width: 1em; height: 1em; }
.video.is-playing .video__play, .video.is-playing .video__note { display: none; }

.credits { grid-column: 2; }
.credits { margin-top: 2rem; padding-top: 1.4rem; border-top: 1px solid var(--line); font-size: var(--fs-small); color: var(--muted); }
.credits .label { margin-bottom: .8rem; }
.pager { display: grid; grid-template-columns: 1fr auto 1fr; gap: 1rem; align-items: start; border-top: 1px solid var(--line); padding: 1.75rem 0 clamp(3rem, 7vw, 5rem); }
.pager a { text-decoration: none; display: flex; flex-direction: column; gap: .35rem; min-height: var(--hit); }
.pager .label { display: inline-flex; align-items: center; gap: .45em; }
.pager .label .icon { width: 1.1em; height: 1.1em; }
.pager__title { font-size: var(--fs-h3); font-weight: 300; font-style: italic; color: var(--text); line-height: 1.2; }
.pager a:hover .pager__title { color: var(--strong); }
.pager__next { text-align: right; align-items: flex-end; }
.pager__all { align-self: center; font-size: var(--fs-label); letter-spacing: .16em; text-transform: uppercase; color: var(--muted); justify-content: center; }
@media (max-width: 640px) {
  .pager { grid-template-columns: 1fr 1fr; padding-left: var(--gutter); padding-right: var(--gutter); }
  .pager__all { grid-column: 1 / -1; grid-row: 2; justify-self: center; }
}

/* lightbox */
.lightbox {
  position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 0; border: 0;
  background: rgba(14, 15, 16, .985); color: var(--text); overflow: hidden;
}
.lightbox:focus, .lightbox:focus-visible { outline: none; }
.lightbox::backdrop { background: rgba(14, 15, 16, .9); }
.lightbox[open] { display: flex; flex-direction: column; animation: lb-in .25s var(--ease); }
@keyframes lb-in { from { opacity: 0; } to { opacity: 1; } }
.lightbox__stage { flex: 1 1 auto; min-height: 0; display: flex; align-items: center; justify-content: center; padding: clamp(8px, 2vw, 28px); touch-action: pan-y pinch-zoom; }
.lightbox__img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; user-select: none; -webkit-user-drag: none; transition: opacity .2s var(--ease), transform .2s var(--ease); }
.lightbox__img.is-loading { opacity: .25; }
.lightbox__video { flex: none; background: #000; }
.lightbox__video iframe { display: block; width: 100%; height: 100%; border: 0; }
.lightbox__info {
  flex: none; max-height: 30vh; overflow-y: auto; padding: .2rem var(--gutter) .9rem; text-align: center;
}
.lightbox__info[hidden] { display: none; }
.lightbox__info p { max-width: var(--measure); margin: 0 auto; }
.lightbox__caption { font-size: var(--fs-small); font-style: italic; color: var(--strong); }
.lightbox__desc { margin-top: .35rem !important; font-size: var(--fs-small); color: var(--text); white-space: pre-line; }
.lightbox__caption[hidden] + .lightbox__desc { margin-top: 0 !important; }
.lightbox__bar {
  flex: none; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 1rem;
  padding: .4rem var(--gutter) calc(.4rem + env(safe-area-inset-bottom)); border-top: 1px solid var(--line);
}
.lightbox__count { margin: 0; font-size: var(--fs-label); letter-spacing: .16em; color: var(--muted); font-variant-numeric: lining-nums tabular-nums; }
.lightbox__btns { display: flex; }
body.lb-open { overflow: hidden; }

/* ---------------------------------------------------------------- publications */
.profiles { list-style: none; display: flex; flex-wrap: wrap; gap: 0 1.6rem; margin: 1.6rem 0 0; padding: 0; }
.profiles a, .links ul a {
  display: inline-flex; align-items: center; gap: .35em; min-height: var(--hit); text-decoration: none;
  font-size: var(--fs-label); letter-spacing: .16em; text-transform: uppercase; color: var(--muted);
}
.profiles a:hover, .links ul a:hover { color: var(--strong); }
.profiles .icon, .links .icon, .pub__links .icon { width: .95em; height: .95em; }

.pubs { padding-bottom: clamp(3rem, 8vw, 7rem); }
.pubs__year { border-top: 1px solid var(--line); }
.pubs--years .pubs__year { display: grid; grid-template-columns: minmax(0, 10rem) minmax(0, 1fr); gap: 0 clamp(1.5rem, 4vw, 4rem); }
.pubs__y {
  font-size: var(--fs-h2); font-weight: 300; color: var(--muted); padding-top: 1.05rem;
  font-variant-numeric: lining-nums tabular-nums; letter-spacing: 0;
}
@media (min-width: 801px) { .pubs__y { position: sticky; top: 1rem; align-self: start; } }
.pubs__list { list-style: none; margin: 0; padding: 0; }
.pub { padding: 1.1rem 0 1.2rem; max-width: 72ch; }
.pub + .pub { border-top: 1px solid var(--line); }
.pub__cite { margin: 0; text-wrap: pretty; }
.pub__cite a { text-decoration: underline; }
.pub__cite em { color: var(--strong); }
.pub__links { display: flex; flex-wrap: wrap; gap: 0 1.2rem; margin: .45rem 0 0; }
.pub__links a { display: inline-flex; align-items: center; gap: .3em; min-height: 36px; font-size: var(--fs-label); letter-spacing: .16em; text-transform: uppercase; color: var(--muted); text-decoration: none; }
.pub__links a:hover { color: var(--strong); }
@media (max-width: 800px) {
  .pubs--years .pubs__year { grid-template-columns: 1fr; }
  .pubs--years .pubs__year + .pubs__year { margin-top: 2.25rem; }
  .pubs__y { padding-top: 1.4rem; font-size: var(--fs-h3); color: var(--strong); }
}

/* ---------------------------------------------------------------- about */
.about { padding-bottom: clamp(3rem, 8vw, 7rem); display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 15rem); gap: 0 clamp(2rem, 6vw, 6rem); }
.about .page-head { grid-column: 1 / -1; padding-left: 0; padding-right: 0; margin: 0; }
.about__body { grid-column: 1; }
.about__side { grid-column: 2; align-self: start; }
@media (max-width: 800px) {
  .about { grid-template-columns: 1fr; }
  .about__side { grid-column: 1; margin-top: 2.5rem; }
}

/* links block (About, Contact): groups separated by horizontal rules */
.links { border-top: 1px solid var(--line); }
.links__group { padding: .6rem 0; }
.links__group + .links__group { border-top: 1px solid var(--line); }
.links ul { list-style: none; margin: 0; padding: 0; }

/* ---------------------------------------------------------------- contact & forms */
.contact { padding-bottom: clamp(3rem, 8vw, 7rem); display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 15rem); gap: 0 clamp(2rem, 6vw, 6rem); }
.contact .page-head { grid-column: 1 / -1; padding-left: 0; padding-right: 0; margin: 0; }
.contact > .notice, .contact > p { grid-column: 1; }
.contact__main { grid-column: 1; min-width: 0; }
.contact__side { grid-column: 2; align-self: start; margin-top: 2rem; }
@media (max-width: 800px) {
  .contact { grid-template-columns: 1fr; }
  .contact__side { grid-column: 1; margin-top: 3rem; }
}
.form { max-width: 40rem; margin-top: 2rem; }
.field { margin-bottom: 1.4rem; }
.field label { display: block; margin-bottom: .45rem; font-size: var(--fs-label); letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.field input, .field textarea {
  width: 100%; font: inherit; color: var(--strong); background: var(--surface);
  border: 1px solid var(--line); border-radius: 2px; padding: .75rem .85rem; min-height: var(--hit);
  transition: border-color .2s var(--ease), background-color .2s var(--ease);
}
.field textarea { resize: vertical; min-height: 10rem; line-height: 1.5; }
.field input:hover, .field textarea:hover { border-color: var(--line-strong); }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--muted); background: var(--surface-2); }
.field.has-error input, .field.has-error textarea { border-color: #a9a9a5; }
.field__error { margin: .45rem 0 0; font-size: var(--fs-small); color: var(--strong); font-style: italic; }
.form__hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; overflow: hidden; }
.form__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.5rem; margin-top: 1.8rem; }
.form__note { margin: 0; font-size: var(--fs-small); color: var(--muted); }
.cf-turnstile { margin: .5rem 0 0; }
.btn {
  display: inline-flex; align-items: center; gap: .6rem; min-height: var(--hit); padding: .55rem 1.2rem;
  font: inherit; font-size: var(--fs-label); letter-spacing: .16em; text-transform: uppercase; color: var(--strong);
  background: none; border: 1px solid var(--line-strong); border-radius: 999px; cursor: pointer;
  transition: background-color .2s var(--ease), border-color .2s var(--ease);
}
.btn:hover { background: var(--surface-2); border-color: var(--muted); }
.btn .icon { width: 1.1em; height: 1.1em; }
.notice { max-width: 40rem; padding: 1rem 1.2rem; border: 1px solid var(--line-strong); border-radius: 2px; margin: 0 0 1.5rem; }
.notice--error { color: var(--strong); }

/* ---------------------------------------------------------------- 404 */
.not-found { padding-top: clamp(3rem, 10vw, 8rem); padding-bottom: clamp(4rem, 10vw, 8rem); }
.not-found__code { font-size: clamp(5rem, 18vw, 14rem); line-height: .8; font-weight: 300; color: var(--line-strong); margin: 0 0 1.5rem; font-variant-numeric: lining-nums; letter-spacing: -0.03em; }
.not-found .page-title { margin-bottom: 1rem; }
.not-found__links { list-style: none; padding: 0; margin: 2rem 0 0; display: flex; flex-wrap: wrap; gap: 0 2rem; }

/* ---------------------------------------------------------------- footer */
.site-footer { background: var(--bg-deep); margin-top: auto; }
.site-footer__inner {
  max-width: var(--maxw); margin: 0 auto; padding: .7rem var(--gutter) calc(.9rem + env(safe-area-inset-bottom));
  display: grid; grid-template-columns: 1fr auto auto; grid-template-areas: "author social science" "note note note";
  align-items: center; gap: 0 2.2rem;
}
.site-footer__author { grid-area: author; margin: 0; font-size: var(--fs-small); color: var(--text); font-variant-numeric: lining-nums; }
.site-footer__social { grid-area: social; list-style: none; margin: 0; padding: 0; display: flex; gap: .1rem; }
.site-footer__social a { display: inline-flex; align-items: center; justify-content: center; width: var(--hit); height: var(--hit); color: var(--muted); border-radius: 50%; }
.site-footer__social a:hover { color: var(--strong); background: var(--surface); }
.site-footer__social .icon { width: 19px; height: 19px; }
.site-footer__science { grid-area: science; list-style: none; margin: 0; padding: 0 0 0 2.2rem; display: flex; gap: 0 1.2rem; border-left: 1px solid var(--line); }
.site-footer__science a { display: inline-flex; align-items: center; min-height: var(--hit); text-decoration: none; font-size: var(--fs-label); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.site-footer__science a:hover { color: var(--strong); }
.site-footer__note { grid-area: note; margin: 0; font-size: var(--fs-label); color: var(--muted); letter-spacing: .04em; }
@media (max-width: 800px) {
  .site-footer__inner { grid-template-columns: 1fr auto; grid-template-areas: "author social" "science science" "note note"; gap: .2rem 1rem; padding-top: 1rem; padding-bottom: calc(1.6rem + env(safe-area-inset-bottom)); }
  .site-footer__social { margin-right: -10px; gap: .15rem; }
  .site-footer__social a { width: 48px; height: 48px; }
  .site-footer__social .icon { width: 28px; height: 28px; }
  .site-footer__science { border-left: 0; padding-left: 0; flex-wrap: wrap; gap: 0; }
  .site-footer__science li + li::before { content: "|"; color: var(--line-strong); margin: 0 .75rem; }
  .site-footer__science li { display: inline-flex; align-items: center; }
  .site-footer__note { margin-top: .4rem; }
}

@media print {
  .site-header, .site-footer, .slideshow__controls, .pager, .filters { display: none; }
  body { background: #fff; color: #000; }
}
