/* ==========================================================================
   Design tokens (values taken from the Twenty Twenty-Four theme the site
   was originally built with, so the fluid sizes match exactly)
   ========================================================================== */

@font-face {
  font-family: "Inter";
  src: url("/assets/fonts/inter-variable.woff2") format("woff2");
  font-weight: 300 900;
  font-style: normal;
  font-display: fallback;
}

@font-face {
  font-family: "Cardo";
  src: url("/assets/fonts/cardo-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: fallback;
}

:root {
  /* Follows the system setting; [data-theme] (set by the theme toggle)
     forces one. Each colour is light-dark(<light value>, <dark value>). */
  color-scheme: light dark;

  --color-base: light-dark(#f9f9f9, #181b1f);
  --color-surface: light-dark(#ffffff, #22262b);
  --color-contrast: light-dark(#111111, #e6e6e6);
  --color-text-soft: light-dark(#3d3d3d, #b8bcc2);
  --color-link: light-dark(#2b3d7c, #9db0f0);
  --color-muted: light-dark(#808080, #8f959c);
  --color-border: light-dark(#b5bdbc, #3a3f45);
  --color-date: light-dark(#39414d, #a9b1bd);
  --color-button: light-dark(#1a1a1a, #e6e6e6);
  --color-button-icon: light-dark(#ffffff, #181b1f);
  --shadow-card: light-dark(rgb(17 17 17 / 0.06), rgb(0 0 0 / 0.45));

  /* The footer is dark in both themes. */
  --color-footer: light-dark(#1a1a1a, #0b0c0d);
  --color-footer-text: #f9f9f9;
  --color-footer-title: #d6d6d6;
  --color-footer-muted: #b5bdbc;

  --font-body: "Inter", sans-serif;
  --font-heading: "Cardo", serif;

  --fs-small: 0.9rem;
  --fs-medium: 1.05rem;
  --fs-large: clamp(1.39rem, 1.39rem + ((1vw - 0.2rem) * 1.008), 1.85rem);
  --fs-x-large: clamp(1.85rem, 1.85rem + ((1vw - 0.2rem) * 1.425), 2.5rem);
  --fs-xx-large: clamp(2.5rem, 2.5rem + ((1vw - 0.2rem) * 1.688), 3.27rem);
  --fs-subheading: clamp(0.957rem, 0.957rem + ((1vw - 0.2rem) * 1.081), 1.45rem);
  --fs-list: clamp(0.875rem, 0.875rem + ((1vw - 0.2rem) * 0.164), 0.95rem);
  --fs-nav: clamp(0.875rem, 0.875rem + ((1vw - 0.2rem) * 0.274), 1rem);

  --space-10: 1rem;
  --space-20: min(1.5rem, 2vw);
  --space-30: min(2.5rem, 3vw);
  --space-40: min(4rem, 5vw);
  --space-50: min(6.5rem, 8vw);
  --space-60: min(10.5rem, 13vw);

  --wide-size: 1050px;
  --content-size: 620px;
}

:root[data-theme="light"] {
  color-scheme: light;
}

:root[data-theme="dark"] {
  color-scheme: dark;
}

/* ==========================================================================
   Base
   ========================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  /* Dark so the area below a short page's footer matches the footer. */
  background-color: var(--color-footer);
  color: var(--color-contrast);
  font-family: var(--font-body);
  font-size: var(--fs-medium);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

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

h1,
h2,
h3 {
  font-size: inherit;
  font-weight: inherit;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: var(--color-link);
  text-decoration: underline;
}

a:hover {
  text-decoration: none;
}

ul {
  padding-left: var(--space-10);
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  border: 0;
  white-space: nowrap;
}

.skip-link:focus {
  position: absolute !important;
  top: 5px;
  left: 5px;
  z-index: 100000;
  width: auto;
  height: auto;
  padding: 15px 23px 14px;
  clip-path: none;
  background-color: #eee;
  color: #444;
  font-size: 1em;
  line-height: normal;
  text-decoration: none;
}

/* Horizontal page padding + centred 1050px column used by every section. */
.section {
  padding-inline: var(--space-50);
}

.wide {
  max-width: var(--wide-size);
  margin-inline: auto;
}

.narrow {
  max-width: var(--content-size);
  margin-inline: auto;
}

.justify {
  text-align: justify;
}

/* ==========================================================================
   Header
   ========================================================================== */

.site-header {
  background-color: var(--color-base);
  padding: 20px var(--space-50);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  padding-bottom: var(--space-10);
  border-bottom: 1px solid var(--color-border);
}

.site-title {
  font-size: clamp(0.984rem, 0.984rem + ((1vw - 0.2rem) * 1.131), 1.5rem);
  font-weight: 600;
}

.site-title a {
  color: var(--color-contrast);
  text-decoration: none;
}

.site-tagline {
  font-size: clamp(0.875rem, 0.875rem + ((1vw - 0.2rem) * 0.384), 1.05rem);
}

.site-nav {
  font-size: var(--fs-nav);
  font-weight: 500;
}

.site-nav__list {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-30);
  margin: 0;
  padding: 0;
  list-style: none;
  line-height: 1.55;
}

.site-nav__list a {
  color: var(--color-contrast);
  text-decoration: none;
}

.site-nav__list a:hover,
.site-nav__list a:focus-visible {
  text-decoration: underline;
}

.nav-toggle,
.nav-close {
  display: none;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.nav-toggle svg,
.nav-close svg {
  display: block;
  fill: currentColor;
}

.site-header__actions {
  display: flex;
  align-items: center;
  gap: var(--space-30);
}

.theme-toggle {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  margin-right: -6px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--color-contrast);
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.theme-toggle[hidden] {
  display: none;
}

.theme-toggle:hover {
  background-color: var(--color-surface);
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--color-link);
  outline-offset: 2px;
}

.theme-toggle svg {
  display: block;
  fill: currentColor;
}

/* Show the icon of the theme you would switch to. */
:root[data-theme="dark"] .theme-toggle__icon--moon,
:root:not([data-theme="dark"]) .theme-toggle__icon--sun {
  display: none;
}

/* Mobile: hamburger + full-screen overlay (same breakpoint as WordPress). */
@media (max-width: 599px) {
  .nav-toggle {
    display: block;
  }

  .site-header__actions {
    gap: 12px;
  }

  .theme-toggle {
    order: -1;
    margin-right: 0;
  }

  .site-nav__panel {
    display: none;
  }

  .site-nav.is-open .site-nav__panel {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: block;
    padding: var(--space-10) var(--space-50);
    overflow: auto;
    background-color: var(--color-surface);
    animation: overlay-in 0.1s ease-out;
  }

  .site-nav.is-open .nav-close {
    display: block;
    margin-left: auto;
  }

  .site-nav.is-open .site-nav__list {
    flex-direction: column;
    align-items: flex-end;
    gap: var(--space-30);
    padding-top: 2rem;
  }

  body.has-menu-open {
    overflow: hidden;
  }
}

@keyframes overlay-in {
  from {
    opacity: 0;
    transform: translateY(0.5em);
  }
}

/* ==========================================================================
   Main / page shells
   ========================================================================== */

main {
  background-color: var(--color-base);
}

.page {
  padding-block: var(--space-30);
}

.page-title {
  margin-bottom: var(--space-40);
  font-family: var(--font-heading);
  font-size: var(--fs-x-large);
  font-weight: 400;
  line-height: 1.2;
  text-align: center;
}

.page-intro {
  text-align: center;
}

.spacer-50 {
  height: 50px;
}

.spacer-60 {
  height: 60px;
}

/* Section heading ("Publications") and sub-heading ("Journals"). */
.heading-large {
  font-size: var(--fs-large);
  font-weight: 700;
  line-height: 1.55;
}

.heading-sub {
  font-size: var(--fs-subheading);
  font-weight: 700;
  line-height: 1.55;
}

/* A titled block of content. Children shrink to their content width, as the
   original WordPress groups did, so justified text wraps the same way. */
.block {
  margin-top: 30px;
}

.stack {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.stack > .heading-large {
  margin-bottom: 20px;
}

/* ==========================================================================
   Home
   ========================================================================== */

.home-intro {
  padding-top: calc(var(--space-10) + var(--space-20));
}

.home-columns {
  display: flex;
  gap: 50px var(--space-20);
}

.home-columns__aside {
  flex: 0 1 40%;
  min-width: 0;
}

.home-columns__bio {
  flex: 0 1 60%;
  min-width: 0;
  align-self: center;
  text-align: justify;
}

.home-columns__bio p + p {
  margin-top: var(--space-30);
}

.profile-photo {
  display: flex;
  justify-content: center;
  margin-bottom: 30px;
}

.profile-photo img {
  width: 300px;
  border-radius: 20px;
}

.link-list-title {
  font-weight: 700;
}

.link-list {
  margin-top: 0.5rem;
  padding-left: calc(var(--space-20) + var(--space-10));
  font-size: var(--fs-list);
}

.news-list {
  margin-top: 0.5rem;
  padding-left: calc(var(--space-20) + var(--space-10));
  font-size: var(--fs-list);
  text-align: justify;
}

.quick-links {
  display: flex;
  gap: var(--space-60) 0;
  padding-block: var(--space-20);
}

.quick-link {
  flex: 1 1 0;
  align-self: center;
  text-align: center;
}

.quick-link__button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  padding: 30px;
  border-radius: 100%;
  background-color: var(--color-button);
  color: var(--color-button-icon);
  vertical-align: top;
  transition: transform 0.12s ease;
}

.quick-link__button:hover {
  transform: scale(1.05);
}

.quick-link__button svg {
  width: 60px;
  height: 60px;
  fill: currentColor;
}

.quick-link__label {
  font-size: clamp(0.875rem, 0.875rem + ((1vw - 0.2rem) * 0.603), 1.15rem);
  font-weight: 700;
}

@media (max-width: 781px) {
  .home-columns,
  .quick-links {
    flex-wrap: wrap;
  }

  .home-columns__aside,
  .home-columns__bio,
  .quick-link {
    flex-basis: 100%;
  }
}

/* ==========================================================================
   Research
   ========================================================================== */

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

.pub-group > .heading-sub {
  padding-bottom: 5px;
}

.pub-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-10);
  margin-block: 10px;
  font-size: var(--fs-small);
  text-align: justify;
}

.pub__authors {
  color: var(--color-muted);
  font-weight: 700;
}

.pub__title {
  color: var(--color-link);
  font-weight: 700;
}

.pub__note {
  color: var(--color-contrast);
  font-weight: 400;
}

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

.small-list {
  font-size: var(--fs-small);
}

.small-list ul {
  padding-left: var(--space-10);
}

.copyright {
  margin-top: 70px;
  font-size: 0.7rem;
  text-align: justify;
}

/* ==========================================================================
   Teaching
   ========================================================================== */

.block-50 {
  margin-top: 50px;
}

.teaching-heading {
  margin-bottom: 20px;
}

.calendly-inline-widget {
  min-width: 100%;
  height: 700px;
}

/* ==========================================================================
   Blog index
   ========================================================================== */

.post-list {
  display: flex;
  flex-direction: column;
  gap: 32px;
  margin: 0 auto;
  padding: 0;
  list-style: none;
}

@media (min-width: 768px) {
  .post-list {
    max-width: 80vw;
  }
}

.post-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 32px;
  padding: 16px;
  border-radius: 16px;
  transition: background-color 0.2s ease;
}

.post-card:hover,
.post-card:focus-within {
  background-color: var(--color-surface);
  box-shadow: 0 1px 2px var(--shadow-card), 0 8px 24px var(--shadow-card);
}

.post-card__image {
  flex: 0 0 38%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 10px;
}

.post-card__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.post-card:hover .post-card__image img {
  transform: scale(1.04);
}

.post-card__body {
  flex: 1 1 auto;
  min-width: 0;
}

.post-card__meta {
  color: var(--color-date);
  font-size: var(--fs-small);
}

.post-card__meta span {
  margin-inline: 0.35em;
}

.post-card__title {
  margin-top: 8px;
  font-size: clamp(1.1rem, 1.1rem + ((1vw - 0.2rem) * 0.767), 1.5rem);
  font-weight: 700;
  line-height: 1.25;
}

.post-card__title a {
  color: var(--color-contrast);
  text-decoration: none;
}

/* Make the whole card clickable through the title link. */
.post-card__title a::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
}

.post-card__title a:focus-visible {
  outline: none;
}

.post-card:has(.post-card__title a:focus-visible) {
  outline: 2px solid var(--color-link);
  outline-offset: 2px;
}

.post-card__excerpt {
  display: -webkit-box;
  margin-top: 12px;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  color: var(--color-text-soft);
  font-size: var(--fs-small);
}

.post-card__more {
  display: inline-block;
  margin-top: 16px;
  color: var(--color-link);
  font-size: var(--fs-small);
  font-weight: 600;
}

.post-card__arrow {
  display: inline-block;
  transition: transform 0.2s ease;
}

.post-card:hover .post-card__arrow {
  transform: translateX(4px);
}

/* Phones: image on top, full width. */
@media (max-width: 599px) {
  .post-card {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
    padding: 12px;
  }

  .post-card__image {
    aspect-ratio: 2 / 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .post-card,
  .post-card__image img,
  .post-card__arrow {
    transition: none;
  }

  .post-card:hover .post-card__image img,
  .post-card:hover .post-card__arrow {
    transform: none;
  }
}

/* ==========================================================================
   Blog post
   ========================================================================== */

.post__hero img {
  width: 100%;
  border-radius: 24px;
  object-fit: cover;
}

.post__title {
  margin-top: calc(30px + 0.5rem);
  font-family: var(--font-heading);
  font-size: var(--fs-x-large);
  font-weight: 400;
  line-height: 1.15;
  text-align: center;
}

.post__content {
  padding-top: 30px;
  padding-bottom: calc(20px + 50px);
}

.post__content > p {
  text-align: justify;
}

.post__content > * + * {
  margin-top: 30px;
}

.post__content > p + p {
  margin-top: 20px;
}

.post-image {
  max-width: 491px;
  margin-inline: auto;
}

.post-image img {
  border-radius: 24px;
}

/* Image galleries: one row, equal-width cropped images. */
.gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 0 var(--space-10);
}

.gallery figure {
  display: flex;
  flex: 1 1 0;
  min-width: 0;
}

.gallery img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@media (max-width: 599px) {
  .gallery figure {
    flex-basis: calc(50% - var(--space-10) / 2);
  }
}

/* ==========================================================================
   404
   ========================================================================== */

.not-found {
  padding-block: var(--space-50);
  text-align: center;
}

.not-found h1 {
  font-family: var(--font-heading);
  font-size: var(--fs-xx-large);
  font-weight: 400;
  line-height: 1.15;
}

.not-found p {
  margin-top: var(--space-30);
}

/* ==========================================================================
   Footer
   ========================================================================== */

.site-footer {
  padding: 20px var(--space-50);
  background-color: var(--color-footer);
  color: var(--color-footer-text);
}

.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--space-50);
  padding-block: var(--space-20);
}

.site-footer__address {
  flex-grow: 1;
}

.site-footer__title {
  margin-bottom: 10px;
  color: var(--color-footer-title);
  font-weight: 700;
}

.site-footer__lines {
  max-width: var(--content-size);
  color: var(--color-footer-muted);
  font-size: var(--fs-nav);
  text-align: justify;
}

.social-links {
  display: flex;
  justify-content: center;
  gap: 0 20px;
  margin: 0;
  padding: 0;
  list-style: none;
  line-height: 0;
}

.social-links a {
  display: block;
  color: var(--color-footer-text);
  transition: transform 0.1s ease;
}

.social-links a:hover {
  transform: scale(1.1);
}

.social-links svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}
