/* Nicolai Marquardt — personal site
   Manrope body + Newsreader serif display; b/w with a single accent.
   ------------------------------------------------------------- */
:root {
  --ink: #111111;
  --ink-soft: #4f4f4f;
  --ink-faint: #8a8a8a;
  --paper: #fdfcf9;
  --line: #e9e6dd;
  --line-strong: #d5d1c4;
  --accent: #2c5f5d;
  --accent-soft: #e9efee;
  --grey-icon: #9a9a9a;
  --font-body: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-display: 'Newsreader', Georgia, serif;
  --font-italic: 'Newsreader', Georgia, serif;
  --font-mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);

  /* ── Tweak-panel variables (per-target font controls) ── */
  --cf-name-family: 'system-ui', -apple-system, BlinkMacSystemFont, sans-serif;
  --cf-name-size: 35px;
  --cf-name-weight: 300;
  --cf-name-style: normal;
  --cf-name-transform: none;
  --cf-name-tracking: -0.035em;

  /* Last name (em part) — independent so first/last can have different styles */
  --cf-name2-family: 'system-ui', -apple-system, BlinkMacSystemFont, sans-serif;
  --cf-name2-size: 35px;
  --cf-name2-weight: 400;
  --cf-name2-style: italic;
  --cf-name2-transform: none;
  --cf-name2-tracking: -0.05em;
  --cf-name2-color: var(--accent);
  /* always follows the single accent */

  --cf-nav-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --cf-nav-size: 15.5px;
  --cf-nav-weight: 400;
  --cf-nav-style: normal;
  --cf-nav-transform: none;
  --cf-nav-tracking: 0.01em;
  --cf-nav-pad-y: 3.5px;
  --cf-nav-gap: 0px;

  --cf-about-family: 'Manrope', -apple-system, BlinkMacSystemFont, sans-serif;
  --cf-about-size: 17px;
  --cf-about-size-1: 19px;
  --cf-about-size-2: 15.5px;
  --cf-about-weight: 400;
  --cf-about-style: normal;
  --cf-about-tracking: -0.004em;
  --cf-about-leading: 1.6;

  --cf-section-family: 'Manrope', -apple-system, BlinkMacSystemFont, sans-serif;
  --cf-section-size: 22.5px;
  --cf-section-weight: 400;
  --cf-section-style: normal;
  --cf-section-transform: none;
  --cf-section-tracking: 0em;
  --cf-section-mb: 22px;
  --cf-section-gap: 72px;

  --cf-body-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --cf-body-size: 15px;
  --cf-body-weight: 400;
  --cf-body-leading: 1.6;

  /* Publications spacing + year pill ── */
  --cf-pub-gap: 21px;
  --cf-pub-year-size: 12px;
  --cf-pub-year-weight: 300;
  --cf-pub-year-pad-x: 8px;
  --cf-pub-year-pad-y: 3px;
  --cf-pub-year-line-width: 1px;
  --cf-pub-year-line-style: solid;
  --cf-pub-year-line-dash: 6px;
  --cf-pub-year-line-color: #e9e6dd;

  /* Sketchnote grid + card ── */
  --cf-sn-cols: 4;
  --cf-sn-gap: 9px;
  --cf-sn-radius: 0px;
  --cf-sn-cap-size: 11.5px;
  --cf-sn-sub-size: 10px;
  --cf-sn-cap-pad: 9px 10px 11px;
  --cf-sn-thumb-bg: #ffffff;
  --cf-sn-img-pad: 10px;
  --cf-sn-img-outline-width: 1.5px;
  --cf-sn-img-outline-color: #424242;
  --cf-sn-text-gap: 1px;
  --cf-sn-img-opacity: 0.65;
  --cf-sn-img-opacity-hover: 1;
  --cf-sn-wide-outline-width: 3.5px;
  --cf-sn-wide-filter: none;
  --cf-sn-wide-opacity: 1;

  /* Books ── */
  --cf-book-list-gap: 46px;
  --cf-book-cover-w: 178px;
  --cf-book-cover-h: 228px;
  --cf-book-gap: 37px;
  --cf-book-title-size: 21.5px;
  --cf-book-au-size: 15px;
  --cf-book-pub-size: 12px;
  --cf-book-desc-size: 14px;
  --cf-book-res-size: 13px;

  /* Featured research cards ── */
  --cf-feat-mt: 15px;
  /* space above the row of cards */
  --cf-feat-label-gap: 12px;
  /* space between the kicker label and the cards */
  --cf-feat-gap: 12px;
  /* gap between adjacent cards */
  --cf-feat-outline-width: 1px;
  /* card border thickness */
  --cf-feat-outline-color: #e9e6dd;
  /* card border colour (matches --line) */
  --cf-feat-shadow-size: 1;
  /* scalar multiplier for the drop-shadow blur/spread */
  /* Composed permanent shadow; toggling via the panel swaps this to `none`.
     Always references --cf-feat-shadow-size so the size slider works live. */
  --cf-feat-shadow:
    0 calc(4px * var(--cf-feat-shadow-size, 1)) calc(8px * var(--cf-feat-shadow-size, 1)) rgba(0, 0, 0, 0.05),
    0 calc(12px * var(--cf-feat-shadow-size, 1)) calc(26px * var(--cf-feat-shadow-size, 1)) rgba(0, 0, 0, 0.10);

  /* Layout dividers (toggleable from settings panel) ── */
  --cf-divider-vertical: none;
  --cf-bio-sep-1: none;
  /* below portrait */
  --cf-bio-sep-2: none;
  /* below name */
  --cf-bio-sep-3: none;
  /* below role */
  --cf-bio-sep-4: none;
  /* below summary */
  --cf-nav-sep-1: none;
  /* between About / Research */
  --cf-nav-sep-2: none;
  /* between Research / Books */
  --cf-nav-sep-3: none;
  /* between Books / Sketchnotes */
  --cf-nav-sep-4: none;
  /* between Sketchnotes / CV */
  --cf-links-sep: none;
  /* between nav and contact */

  /* Pub-highlight pulse (warm amber, fits paper/accent palette) ── */
  --highlight-color: rgba(217, 152, 90, 0.18);
}

* {
  box-sizing: border-box;
}

html,
body {
  background: var(--paper);
  color: var(--ink);
  margin: 0;
}

body {
  font-family: var(--cf-body-family);
  font-size: var(--cf-body-size);
  line-height: var(--cf-body-leading);
  font-weight: var(--cf-body-weight);
  font-feature-settings: "kern", "liga", "calt";
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.005em;
}

::selection {
  background: var(--accent);
  color: var(--paper);
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

em {
  font-style: italic;
}

/* ——— Shell ——— */
.shell {
  display: grid;
  grid-template-columns: 320px 1fr;
  min-height: 100vh;
}

/* ——— Sidebar ——— */
aside.bio {
  border-right: var(--cf-divider-vertical);
  padding: 56px 32px 40px;
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  background: var(--paper);
}

aside.bio::-webkit-scrollbar {
  width: 6px;
}

aside.bio::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: 3px;
}

/* ——— Portrait ——— */
.portrait {
  width: 160px;
  height: 160px;
  margin-bottom: 22px;
  overflow: hidden;
  background: var(--accent-soft);
  display: block;
  cursor: pointer;
}

.portrait img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center top;
  transition: transform 220ms ease, filter 220ms ease;
}

.portrait:hover img {
  transform: scale(1.015);
  filter: brightness(1.02);
}

aside.bio h1 a.to-top {
  color: inherit;
  text-decoration: none;
  border-bottom: none;
  cursor: pointer;
  display: inline-block;
}

/* ——— Microsoft logo (greyscale) ——— */
.ms-logo {
  display: inline-block;
  vertical-align: -2px;
  margin-right: 6px;
}

.org {
  white-space: nowrap;
}

/* ——— Inline MS logo inside about prose (grey, matches cap-height of body) */
.about .ms-nowrap {
  white-space: nowrap;
}

.about .ms-logo-inline {
  display: inline-block;
  width: 0.72em;
  height: 0.72em;
  vertical-align: baseline;
  margin: 0 3px 0 2px;
  color: #8a8a8a;
}

/* ——— Name + role + summary ——— */
aside.bio h1 {
  font-family: var(--cf-name-family);
  font-weight: var(--cf-name-weight);
  font-style: var(--cf-name-style);
  font-size: var(--cf-name-size);
  line-height: 1.02;
  letter-spacing: var(--cf-name-tracking);
  text-transform: var(--cf-name-transform);
  margin: 0 0 12px;
  color: var(--ink);
}

aside.bio h1 em {
  font-family: var(--cf-name2-family);
  font-size: var(--cf-name2-size);
  font-weight: var(--cf-name2-weight);
  font-style: var(--cf-name2-style);
  letter-spacing: var(--cf-name2-tracking);
  text-transform: var(--cf-name2-transform);
  color: var(--cf-name2-color);
}

aside.bio .role {
  font-family: var(--font-body);
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink-soft);
  margin: 0 0 16px;
  letter-spacing: -0.003em;
}

aside.bio .role strong {
  color: var(--ink);
  font-weight: 600;
}

aside.bio .role a {
  color: inherit;
  border-bottom: 1px solid transparent;
  transition: color 140ms ease, border-color 140ms ease;
}

aside.bio .role a:hover {
  color: var(--ink);
  text-decoration: none;
  border-bottom-color: var(--line-strong);
}

aside.bio .summary {
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--ink-soft);
  margin: 0 0 20px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

/* ——— Side nav ——— */
nav.side {
  display: flex;
  flex-direction: column;
  gap: var(--cf-nav-gap);
  margin: 0 -8px 26px;
}

nav.side a {
  color: var(--ink);
  font-family: var(--cf-nav-family);
  font-size: var(--cf-nav-size);
  font-weight: var(--cf-nav-weight);
  font-style: var(--cf-nav-style);
  text-transform: var(--cf-nav-transform);
  letter-spacing: var(--cf-nav-tracking);
  padding: var(--cf-nav-pad-y) 8px;
  border: 1px solid transparent;
  border-radius: 3px;
  transition: border-color 120ms ease, color 120ms ease, background 120ms ease;
}

nav.side a:hover {
  color: var(--accent);
  border-color: var(--line-strong);
  text-decoration: none;
  background: rgba(255, 255, 255, 0.6);
}

nav.side .nav-sep {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 4px 6px;
  height: 0;
  display: none;
}

nav.side .nav-sep[data-sep="1"] {
  display: var(--cf-nav-sep-1, none);
}

nav.side .nav-sep[data-sep="2"] {
  display: var(--cf-nav-sep-2, none);
}

nav.side .nav-sep[data-sep="3"] {
  display: var(--cf-nav-sep-3, none);
}

nav.side .nav-sep[data-sep="4"] {
  display: var(--cf-nav-sep-4, none);
}

/* Inter-section bio separators (each one toggled independently) */
aside.bio .bio-sep {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 14px 0;
  height: 0;
  display: none;
}

aside.bio .bio-sep[data-sep="1"] {
  display: var(--cf-bio-sep-1, none);
}

aside.bio .bio-sep[data-sep="2"] {
  display: var(--cf-bio-sep-2, none);
}

aside.bio .bio-sep[data-sep="3"] {
  display: var(--cf-bio-sep-3, none);
}

aside.bio .bio-sep[data-sep="4"] {
  display: var(--cf-bio-sep-4, none);
}

aside.bio .links {
  margin-top: auto;
  padding-top: 18px;
  border-top: var(--cf-links-sep, 1px solid var(--line));
  font-size: 12px;
  color: var(--ink-soft);
  line-height: 1.55;
}

aside.bio .links a {
  color: var(--ink);
}

aside.bio .links a:hover {
  color: var(--accent);
}

aside.bio .links .email {
  display: block;
  margin-bottom: 6px;
}

aside.bio .links .address {
  margin: 0 0 6px;
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--ink-soft);
}

aside.bio .links .address a {
  color: var(--ink-soft);
}

aside.bio .links .address a:hover {
  color: var(--accent);
}

aside.bio .links .profile-row {
  display: block;
  font-size: 11.5px;
}

aside.bio .links .profile-row a {
  color: var(--ink-soft);
}

aside.bio .links .profile-row a:hover {
  color: var(--accent);
}

aside.bio .links .profile-row .sep {
  color: var(--line-strong);
  margin: 0 5px;
}

/* ——— Right content ——— */
main.content {
  padding: 56px 60px 96px;
  max-width: 880px;
}

section {
  margin-bottom: var(--cf-section-gap);
  scroll-margin-top: 56px;
}

section:last-child {
  margin-bottom: 0;
}

section#about {
  margin-bottom: calc(var(--cf-section-gap) - 12px);
  scroll-margin-top: 56px;
}

h2.section {
  font-family: var(--cf-section-family);
  font-size: var(--cf-section-size);
  font-weight: var(--cf-section-weight);
  font-style: var(--cf-section-style);
  letter-spacing: var(--cf-section-tracking);
  text-transform: var(--cf-section-transform);
  color: var(--accent);
  margin: 0 0 var(--cf-section-mb);
  padding-bottom: 13px;
  border-bottom: 1px solid var(--line);
}

/* ——— About ——— */
.about {
  max-width: none;
}

.about p {
  font-family: var(--cf-about-family);
  font-size: var(--cf-about-size);
  line-height: var(--cf-about-leading);
  font-weight: var(--cf-about-weight);
  font-style: var(--cf-about-style);
  letter-spacing: var(--cf-about-tracking);
  color: var(--ink);
  margin: 0 0 22px;
  max-width: 100%;
}

.about p.bio-1 {
  font-size: var(--cf-about-size-1);
  line-height: 1.55;
  margin-top: 0;
}

.about p.bio-2 {
  font-size: var(--cf-about-size-2);
  margin-bottom: 0;
}

.about a {
  color: var(--ink);
  border-bottom: 1px solid var(--line-strong);
  transition: color 140ms ease, border-color 140ms ease;
}

.about a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
  text-decoration: none;
}

.about em {
  color: var(--ink);
  font-style: italic;
}

/* ——— Featured projects ——— */
.featured {
  margin: var(--cf-feat-mt, 8px) 0 34px;
}

.featured-label {
  font-family: var(--font-body);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 0 0 var(--cf-feat-label-gap, 12px);
  font-weight: 500;
}

.featured-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--cf-feat-gap, 14px);
}

.featured-card {
  appearance: none;
  background: #fff;
  border: var(--cf-feat-outline-width, 1px) solid var(--cf-feat-outline-color, var(--line));
  border-radius: 10px;
  padding: 0;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  font: inherit;
  color: inherit;
  box-shadow: var(--cf-feat-shadow, none);
  transition: transform 200ms ease, box-shadow 200ms ease, border-color 200ms ease;
}

.featured-card:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05), 0 12px 26px rgba(0, 0, 0, 0.10);
}

.featured-card:focus {
  outline: none;
}

.featured-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.fc-thumb {
  aspect-ratio: 16 / 9;
  background: #f3f3f1;
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}

.fc-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: left center;
  display: block;
}

.fc-thumb-empty {
  background: linear-gradient(135deg, #f0efed 0%, #eae9e7 100%);
}

.fc-body {
  padding: 12px 13px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1 1 auto;
}

.fc-title {
  font-family: var(--font-section);
  font-size: 15px;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.fc-blurb {
  font-family: var(--font-body);
  font-size: 12px;
  line-height: 1.45;
  color: var(--ink-soft);
  margin: 0;
}

/* Footer pinned to the bottom of each featured card with a direct PDF download */
.fc-foot {
  padding: 0 13px 12px;
  display: flex;
  justify-content: flex-start;
}

.fc-pdf {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  text-decoration: none;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  padding: 3px 8px 3px 7px;
  background: #fff;
  transition: color 140ms ease, border-color 140ms ease, background 140ms ease;
}

.fc-pdf:hover,
.fc-pdf:focus {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(44, 95, 93, 0.06);
}

.fc-pdf svg {
  width: 12px;
  height: 12px;
}

@media (max-width: 980px) {
  .featured-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ——— Publications ——— */
.pub-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: var(--cf-pub-gap);
}

.pub {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 24px;
  align-items: start;
  border-radius: 4px;
  padding: 2px 6px;
  margin: -2px -6px;
}

.pub.pub-highlight {
  animation: pubFlash 3200ms cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes pubFlash {
  0% {
    background-color: var(--highlight-color);
    box-shadow: 0 0 0 1px rgba(217, 152, 90, 0.22);
  }

  18% {
    background-color: var(--highlight-color);
    box-shadow: 0 0 0 1px rgba(217, 152, 90, 0.22);
  }

  100% {
    background-color: rgba(217, 152, 90, 0);
    box-shadow: 0 0 0 1px rgba(217, 152, 90, 0);
  }
}

.pub-thumb {
  width: 110px;
  height: 142px;
  background: #f3f1ea;
  border: 1px solid var(--line-strong);
  overflow: hidden;
  transition: transform 200ms ease, box-shadow 200ms ease;
  display: block;
}

.pub-thumb img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: left top;
}

.pub:hover .pub-thumb {
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
}

.pub-body {
  min-width: 0;
}

.pub-title {
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.01em;
  margin: 0 0 6px;
  color: var(--ink);
}

.pub-title a {
  color: var(--ink);
}

.pub-title a:hover {
  color: var(--accent);
  text-decoration: none;
}

.pub-authors {
  font-size: 13px;
  color: var(--ink-soft);
  margin: 0 0 4px;
  line-height: 1.5;
}

.pub-authors .au {
  white-space: nowrap;
}

.pub-authors .me {
  color: var(--ink);
  font-weight: 600;
}

.pub-venue {
  font-family: var(--font-italic);
  font-style: italic;
  font-size: 14px;
  color: var(--ink-soft);
  margin: 0 0 10px;
}

.pub-venue .award {
  display: inline-block;
  font-family: var(--font-body);
  background: #e2dfd6;
  color: var(--ink);
  font-weight: 600;
  font-style: normal;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.10em;
  margin-left: 10px;
  padding: 3px 8px;
  border-radius: 3px;
  vertical-align: 1px;
  border: 1px solid #cfcdc4;
}

.pub-venue .award::before {
  content: "★";
  font-size: 9px;
  margin-right: 5px;
  opacity: 0.7;
  letter-spacing: 0;
  color: var(--ink-soft);
}

/* ——— Publication icon row ——— */
.pub-icons {
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
}

.pub-icons a,
.pub-icons button.cite-btn,
.pub-icons button.links-btn {
  color: var(--grey-icon);
  background: none;
  border: none;
  padding: 0;
  font-family: var(--font-body);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.01em;
  transition: color 120ms ease;
}

.pub-icons a:hover,
.pub-icons button.cite-btn:hover,
.pub-icons button.links-btn:hover {
  color: var(--accent);
  text-decoration: none;
}

.pub-icons button.cite-btn[aria-expanded="true"],
.pub-icons button.links-btn[aria-expanded="true"] {
  color: var(--accent);
}

.pub-icons svg {
  width: 14px;
  height: 14px;
  display: block;
}

/* ——— Inline cite & links popovers (under the icons, arrow tip points to button) ——— */
.cite-pop,
.links-pop {
  margin-top: 0;
  height: 0;
  overflow: hidden;
  opacity: 0;
  transform: translateY(-4px);
  transition:
    height 360ms var(--ease-in-out),
    margin-top 360ms var(--ease-in-out),
    opacity 220ms ease,
    transform 280ms var(--ease-out);
  position: relative;
}

.cite-pop.open,
.links-pop.open {
  opacity: 1;
  transform: translateY(0);
  margin-top: 18px;
}

.cite-arrow {
  position: absolute;
  top: 10px;
  left: var(--arrow-x, 24px);
  width: 14px;
  height: 14px;
  background: var(--paper);
  border-left: 1px solid var(--line-strong);
  border-top: 1px solid var(--line-strong);
  transform: translateX(-50%) translateY(-50%) rotate(45deg);
  z-index: 2;
}

.cite-card {
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04), 0 18px 38px rgba(0, 0, 0, 0.07);
  margin-top: 11px;
  /* leave room for the arrow */
  overflow: hidden;
  position: relative;
  z-index: 1;
}

.cite-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #fbfaf5 0%, var(--paper) 100%);
}

.cite-head .cite-lab {
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.cite-head .cite-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cite-head .cite-status {
  font-size: 10.5px;
  color: var(--accent);
  letter-spacing: 0.04em;
  opacity: 0;
  transition: opacity 200ms ease;
}

.cite-head .cite-status.show {
  opacity: 1;
}

.cite-head .copy-btn,
.cite-head .close-btn,
.cite-head .copy-summary-btn,
.cite-head .copy-bib-btn {
  font-family: var(--font-body);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 5px 10px;
  border-radius: 3px;
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease, border-color 140ms ease;
}

.cite-head .copy-btn,
.cite-head .copy-summary-btn,
.cite-head .copy-bib-btn {
  background: var(--ink);
  color: white;
  border: 1px solid var(--ink);
}

.cite-head .copy-bib-btn {
  background: transparent;
  color: var(--ink);
  border-color: var(--ink);
}

.cite-head .copy-btn:hover,
.cite-head .copy-summary-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
}

.cite-head .copy-bib-btn:hover {
  background: var(--ink);
  color: white;
}

.cite-head .close-btn {
  background: transparent;
  color: var(--ink-soft);
  border: 1px solid var(--line-strong);
  padding: 4px 9px 5px;
  font-size: 13px;
  letter-spacing: 0;
  line-height: 1;
}

.cite-head .close-btn:hover {
  color: var(--ink);
  border-color: var(--ink);
}

.cite-card pre.bibtex {
  margin: 0;
  padding: 14px 16px 16px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--ink);
  background: #fafaf5;
  overflow-x: auto;
  white-space: pre;
}

/* ——— Links popover body ——— */
.links-body {
  padding: 16px 18px 17px;
  background: #fafaf5;
}

.links-summary {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--ink);
}

.links-summary .who {
  color: var(--ink-soft);
  font-size: 12px;
  letter-spacing: 0.01em;
  margin-right: 4px;
}

.links-summary .who .vy {
  font-variant: small-caps;
  letter-spacing: 0.05em;
}

.links-summary .ttl {
  font-weight: 600;
  display: inline;
}

.links-summary a {
  color: var(--ink);
  border-bottom: 1px solid var(--line-strong);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0 0 1px;
  margin: 0 1px;
  text-decoration: none;
}

.links-summary a:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.links-plain,
.links-bibtex {
  position: absolute;
  left: -9999px;
  top: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.pub-more {
  margin-top: 36px;
  padding-top: 22px;
  border-top: 1px dashed var(--line);
  font-size: 12.5px;
  color: var(--ink-soft);
  line-height: 1.6;
}

.pub-more a {
  color: var(--ink);
  border-bottom: 1px solid var(--line-strong);
}

.pub-more a:hover {
  color: var(--accent);
  border-color: var(--accent);
  text-decoration: none;
}

/* ——— Intro paragraph + year heading inside publications ——— */
.pub-intro {
  margin: 0 0 32px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--ink-soft);
  padding-bottom: 22px;
  border-bottom: 1px dashed var(--line);
}

.pub-intro a {
  color: var(--ink);
  border-bottom: 1px solid var(--line-strong);
}

.pub-intro a:hover {
  color: var(--accent);
  border-color: var(--accent);
  text-decoration: none;
}

/* Year header: pill on the left, line extending to the right (vertically centred) */
.pub-year {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--cf-section-family);
  font-weight: var(--cf-pub-year-weight);
  font-size: var(--cf-pub-year-size);
  letter-spacing: 0.01em;
  color: var(--ink);
  margin: 38px 0 14px;
  padding: 0;
  border: none;
}

.pub-year .y {
  display: inline-block;
  padding: var(--cf-pub-year-pad-y) var(--cf-pub-year-pad-x);
  border: var(--cf-pub-year-line-width) solid var(--line-strong);
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.6);
  line-height: 1.1;
}

.pub-year .ln {
  flex: 1 1 auto;
  height: 0;
  border-top-width: var(--cf-pub-year-line-width);
  border-top-style: var(--cf-pub-year-line-style);
  border-top-color: var(--cf-pub-year-line-color);
}

.pub-year .ln.dashed-spacer {
  /* width hint applied via inline style or dash-array fallback */
}

.pub-year:first-of-type {
  margin-top: 0;
}

/* placeholder thumbnail for papers without local PDF */
.pub.no-thumb .pub-thumb {
  background: repeating-linear-gradient(135deg, #f3f1ea 0 6px, #ecead9 6px 12px);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
}

.pub-thumb-placeholder {
  width: 60%;
  height: 70%;
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

/* ——— Books ——— */
.book-list {
  display: grid;
  gap: var(--cf-book-list-gap, 36px);
}

.book {
  display: grid;
  grid-template-columns: var(--cf-book-cover-w, 166px) 1fr;
  gap: var(--cf-book-gap, 28px);
  align-items: start;
}

.book-cover {
  width: var(--cf-book-cover-w, 166px);
  height: var(--cf-book-cover-h, 228px);
  background: #f3f1ea;
  border: 1px solid var(--line-strong);
  overflow: hidden;
  transition: transform 200ms ease, box-shadow 220ms ease;
}

.book-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.book:hover .book-cover {
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
}

.book-meta .ttl {
  font-family: var(--font-italic);
  font-style: italic;
  font-size: var(--cf-book-title-size, 23px);
  line-height: 1.3;
  margin: 0 0 5px;
}

.book-meta .au {
  font-size: var(--cf-book-au-size, 13px);
  color: var(--ink-soft);
  margin: 0 0 4px;
}

.book-meta .pub {
  font-size: var(--cf-book-pub-size, 12px);
  color: var(--ink-faint);
  margin: 0 0 8px;
  font-family: var(--font-italic);
  font-style: italic;
  white-space: nowrap;
}

.book-meta p.desc {
  font-size: var(--cf-book-desc-size, 14px);
  color: var(--ink-soft);
  line-height: 1.6;
  margin: 0 0 14px;
}

.book-resources {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}

.book-resources-label {
  font-family: var(--font-display);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 0 0 10px;
}

.book-resources ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
}

.book-resources li {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 14px;
  align-items: baseline;
  font-size: var(--cf-book-res-size, 13px);
  line-height: 1.5;
}

.book-resources a {
  color: var(--ink);
  font-weight: 500;
  border-bottom: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  transition: color 140ms ease;
}

.book-resources a:hover {
  color: var(--accent);
  text-decoration: none;
}

.book-resources a svg {
  width: 13px;
  height: 13px;
  color: #9a9a9a;
  flex-shrink: 0;
  transition: color 140ms ease;
}

.book-resources a:hover svg {
  color: var(--accent);
}

.book-resources .caption {
  color: var(--ink-faint);
  font-size: 12.5px;
}

@media (max-width: 640px) {
  .book-resources li {
    grid-template-columns: 1fr;
    gap: 2px;
  }
}

/* ——— Sketchnotes (square b/w in cards) ——— */
.sn-grid {
  display: grid;
  grid-template-columns: repeat(var(--cf-sn-cols, 4), 1fr);
  gap: var(--cf-sn-gap, 10px);
}

.sn-card {
  background: white;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--cf-sn-radius, 0px);
  cursor: pointer;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  text-align: left;
  font: inherit;
  color: var(--ink);
  transition: transform 180ms ease, box-shadow 220ms ease, border-color 180ms ease;
}

.sn-card .sn-thumb {
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: var(--cf-sn-thumb-bg, #ffffff);
  padding: var(--cf-sn-img-pad, 0px);
  box-sizing: border-box;
}

.sn-card .sn-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  box-sizing: border-box;
  border: var(--cf-sn-img-outline-width, 0px) solid var(--cf-sn-img-outline-color, #e5e5e5);
  filter: grayscale(100%) contrast(1.02);
  opacity: var(--cf-sn-img-opacity, 1);
  transition: filter 240ms ease, opacity 240ms ease;
}

.sn-card .sn-cap {
  padding: var(--cf-sn-cap-pad, 9px 10px 11px);
  margin-top: var(--cf-sn-text-gap, 0px);
  font-family: var(--font-body);
  font-size: var(--cf-sn-cap-size, 11px);
  line-height: 1.35;
  color: var(--ink-soft);
  font-weight: 500;
  letter-spacing: -0.003em;
}

.sn-card .sn-sub {
  margin-top: 2px;
  font-size: var(--cf-sn-sub-size, 10px);
  color: var(--ink-faint);
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sn-card:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05), 0 12px 26px rgba(0, 0, 0, 0.10);
}

.sn-card:hover .sn-thumb img {
  filter: grayscale(0%) contrast(1);
  opacity: var(--cf-sn-img-opacity-hover, 1);
}

/* ——— Sketchnote wide card (spans 2 columns, landscape thumb) ——— */
.sn-card.sn-wide {
  grid-column: span 2;
}

.sn-card.sn-wide .sn-thumb {
  aspect-ratio: 2 / 1;
}

.sn-card.sn-wide .sn-thumb img {
  border-width: var(--cf-sn-wide-outline-width, 3px);
  /* Show the top of the landscape thumb (so the title strip is visible) */
  object-position: top center;
  /* Optional: render wide cards in full color at full opacity */
  filter: var(--cf-sn-wide-filter, grayscale(100%) contrast(1.02));
  opacity: var(--cf-sn-wide-opacity, var(--cf-sn-img-opacity, 1));
}

.sn-card.sn-wide:hover .sn-thumb img {
  filter: var(--cf-sn-wide-filter, grayscale(0%) contrast(1));
  opacity: 1;
}

.sn-card:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ——— CV section ——— */
.cv-block {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 32px;
  align-items: start;
}

.cv-pages {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.cv-page {
  background: white;
  border: 1px solid var(--line);
  display: block;
  transition: transform 180ms ease, box-shadow 220ms ease;
  cursor: pointer;
}

.cv-page img {
  width: 100%;
  height: auto;
  display: block;
}

.cv-page:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05), 0 12px 26px rgba(0, 0, 0, 0.10);
}

.cv-download {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  background: var(--ink);
  color: white;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid var(--ink);
  transition: background 160ms ease, color 160ms ease, border-color 160ms ease;
  text-decoration: none;
  white-space: nowrap;
}

.cv-download:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
  text-decoration: none;
}

.cv-download svg {
  width: 16px;
  height: 16px;
}

.cv-download.secondary {
  background: transparent;
  color: var(--ink);
  border-color: var(--line-strong);
}

.cv-download.secondary:hover {
  background: #f3f1ea;
  color: var(--accent);
  border-color: var(--accent);
}

.cv-meta {
  margin-top: 14px;
  font-size: 12.5px;
  color: var(--ink-soft);
  line-height: 1.55;
}

.cv-side {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-end;
}

.cv-side .small {
  font-size: 11px;
  color: var(--ink-faint);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* ——— Sketchnote lightbox ——— */
.lightbox {
  position: fixed;
  inset: 0;
  background: #000;
  opacity: 0;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  cursor: zoom-out;
  transition: opacity 420ms var(--ease-out);
}

.lightbox.open {
  opacity: 1;
  pointer-events: auto;
}

.lightbox .lb-stage {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 90vw;
  max-height: 90vh;
  transform: scale(0.985);
  opacity: 0;
  transition: opacity 380ms 80ms var(--ease-out), transform 460ms 80ms var(--ease-out);
}

.lightbox.open .lb-stage {
  opacity: 1;
  transform: scale(1);
}

.lightbox .lb-stage img {
  max-width: 90vw;
  max-height: 90vh;
  width: auto;
  height: auto;
  display: block;
}

/* Round nav buttons inside stage — hover-only */
.lightbox .lb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%) scale(0.94);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: #fff;
  display: grid;
  place-items: center;
  font-family: var(--font-body);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms var(--ease-out), transform 220ms var(--ease-out), background 160ms ease, border-color 160ms ease;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  z-index: 2;
}

.lightbox .lb-prev {
  left: 14px;
}

.lightbox .lb-next {
  right: 14px;
}

.lightbox .lb-nav:hover {
  background: rgba(0, 0, 0, 0.85);
  border-color: rgba(255, 255, 255, 0.55);
}

.lightbox .lb-stage:hover .lb-nav,
.lightbox.lb-active .lb-nav {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(-50%) scale(1);
}

/* Bottom-left 3-box legend — hover-only */
.lightbox .legend {
  position: absolute;
  left: 14px;
  bottom: 14px;
  display: flex;
  gap: 6px;
  align-items: stretch;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 280ms var(--ease-out), transform 320ms var(--ease-out);
  pointer-events: none;
  max-width: calc(100% - 28px);
  z-index: 2;
}

.lightbox .lb-stage:hover .legend,
.lightbox.lb-active .legend {
  opacity: 1;
  transform: translateY(0);
}

.lightbox .legend>span {
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  font-family: var(--font-body);
  letter-spacing: 0.02em;
  padding: 7px 12px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

.lightbox .legend .lg-year {
  font-size: 20px;
  font-weight: 500;
  letter-spacing: 0.04em;
}

.lightbox .legend .lg-who {
  font-size: 14px;
  font-weight: 500;
}

.lightbox .legend .lg-title {
  font-size: 12px;
  font-weight: 300;
  color: rgba(255, 255, 255, 0.82);
  letter-spacing: 0.04em;
  max-width: 60vw;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lightbox .legend>span:empty {
  display: none;
}

@media (max-width: 760px) {
  .lightbox .legend {
    flex-wrap: wrap;
    gap: 4px;
    left: 8px;
    bottom: 8px;
  }

  .lightbox .legend .lg-title {
    max-width: 80vw;
  }

  .lightbox .lb-nav {
    width: 40px;
    height: 40px;
    font-size: 22px;
  }
}

/* ——— Responsive ——— */
@media (max-width: 980px) {
  .shell {
    grid-template-columns: 1fr;
  }

  aside.bio {
    position: static;
    height: auto;
    overflow: visible;
    border-right: none;
    border-bottom: 1px solid var(--line);
    padding: 40px 24px;
  }

  aside.bio .links {
    margin-top: 20px;
  }

  main.content {
    padding: 48px 24px 64px;
  }

  nav.side {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
  }

  .sn-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .cv-block {
    grid-template-columns: 1fr;
  }

  .cv-pages {
    grid-template-columns: repeat(2, 1fr);
  }

  .cv-side {
    align-items: flex-start;
  }

  .pub {
    grid-template-columns: 88px 1fr;
    gap: 18px;
  }

  .pub-thumb {
    width: 88px;
    height: 114px;
  }
}
