:root {
  --ink: #17191b;
  --muted: #626970;
  --line: #d9dcde;
  --line-strong: #b8c0c4;
  --paper: #f7f6f2;
  --surface: #ffffff;
  --soft: #eef1ef;
  --accent: #315d6b;
  --accent-dark: #234650;
  --accent-soft: #e7eff1;
  --shadow: 0 14px 34px rgba(23, 25, 27, 0.07);
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 1.02rem;
  line-height: 1.7;
}

h1,
h2,
h3,
h4,
.navbar-brand {
  color: var(--ink);
  font-family: Georgia, "Times New Roman", Times, serif;
  font-weight: 700;
}

h1 {
  letter-spacing: -0.035em;
}

h2 {
  margin-top: 3rem;
  margin-bottom: 1rem;
  letter-spacing: -0.02em;
}

h3 {
  margin-top: 0;
  font-size: 1.25rem;
  letter-spacing: -0.012em;
}

p {
  color: #303438;
}

a {
  color: var(--accent-dark);
  text-decoration-color: rgba(49, 93, 107, 0.45);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

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

a:focus-visible,
button:focus-visible,
.btn:focus-visible {
  outline: 3px solid rgba(49, 93, 107, 0.28);
  outline-offset: 3px;
}

.navbar {
  background: rgba(255, 255, 255, 0.96) !important;
  border-bottom: 1px solid var(--line);
  box-shadow: 0 4px 18px rgba(23, 25, 27, 0.035);
  backdrop-filter: blur(12px);
}

.navbar-brand {
  font-size: 1.1rem;
  letter-spacing: -0.015em;
}

.navbar .nav-link {
  color: var(--ink) !important;
  font-size: 0.88rem;
  font-weight: 550;
}

.navbar .nav-link.active {
  color: var(--accent-dark) !important;
  font-weight: 700;
}

.navbar .nav-link.active::after {
  display: block;
  width: 100%;
  height: 2px;
  margin-top: 0.15rem;
  background: var(--accent);
  content: "";
}

main.content {
  max-width: 1060px;
}

.quarto-title-block {
  margin-bottom: 2rem;
}

.quarto-title-block .title {
  margin-bottom: 0.75rem;
  font-size: clamp(2.6rem, 6vw, 4.5rem);
}

.page-lede {
  max-width: 800px;
  margin-bottom: 3.5rem;
  color: #303438;
  font-family: Georgia, "Times New Roman", Times, serif;
  font-size: 1.25rem;
  line-height: 1.65;
}

.hero {
  margin-top: -1rem;
  padding: 4.5rem 1.5rem 4rem;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(circle at 88% 20%, rgba(49, 93, 107, 0.14), transparent 28rem),
    linear-gradient(135deg, #fbfaf7 0%, var(--paper) 54%, #edf2f1 100%);
}

.hero-inner,
.section-shell {
  max-width: 1180px;
  margin: 0 auto;
}

.hero-inner {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(300px, 0.7fr);
  gap: clamp(3rem, 7vw, 6.5rem);
  align-items: center;
}

.hero h1 {
  max-width: 790px;
  margin: 0.75rem 0 1.5rem;
  font-size: clamp(3.1rem, 6.7vw, 5.5rem);
  line-height: 1.02;
}

/* The homepage sets a title only so Quarto leaves the hero h1 in place. */
.home-page #title-block-header {
  display: none;
}

.hero-single {
  grid-template-columns: minmax(0, 1fr);
}

.hero-copy > p {
  max-width: 760px;
  margin-bottom: 1.4rem;
  color: #34393d;
  font-size: 1.22rem;
  line-height: 1.65;
}

.hero-copy > p.hero-meta {
  margin-bottom: 2rem;
  color: var(--muted);
  font-size: 0.95rem;
}

/* Homepage project index */
.projects-shell {
  scroll-margin-top: 4.5rem;
}

.jump-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.4rem;
  align-items: baseline;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}

.jump-row span {
  color: var(--ink);
  font-family: Georgia, "Times New Roman", Times, serif;
  font-size: 1.6rem;
  font-weight: 700;
}

.jump-row a {
  font-size: 0.92rem;
  font-weight: 650;
}

.projects-note {
  margin: 1rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.project-group {
  scroll-margin-top: 4.5rem;
}

.project-group > h2 {
  margin-top: 3rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--line);
  font-size: 1.5rem;
}

.project-card .pdf-link + .pdf-link {
  margin-left: 1.1rem;
}

.project-type,
.project-tools,
.project-result span {
  margin-bottom: 0.55rem;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 750;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.section-shell {
  padding: 5rem 1.5rem 0;
}

.contact-band h2 {
  margin-top: 0.2rem;
  font-size: clamp(2rem, 4.5vw, 3.15rem);
}

.project-grid {
  display: grid;
  gap: 1.35rem;
  margin: 1.5rem 0 2.5rem;
}

.project-grid-wide {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 1rem;
}

.project-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.project-card {
  display: flex;
  flex-direction: column;
  padding: 1.65rem;
  box-shadow: 0 8px 24px rgba(23, 25, 27, 0.035);
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.project-card:hover {
  transform: translateY(-3px);
  border-color: rgba(49, 93, 107, 0.55);
  box-shadow: var(--shadow);
}

.project-card h3 {
  margin-bottom: 0.9rem;
  font-size: 1.4rem;
  line-height: 1.25;
}

/* Project figures: a fixed 16:10 frame so cards align regardless of the
   source image's aspect ratio. Contain, not cover, so axes never get cropped. */
.project-figure {
  position: relative;
  display: block;
  aspect-ratio: 16 / 10;
  margin: -1.65rem -1.65rem 1.35rem;
  padding: 0.75rem;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  border-radius: 12px 12px 0 0;
  background: #f3f4f1;
  cursor: zoom-in;
}

.project-figure img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 220ms ease;
}

.project-card:hover .project-figure img {
  transform: scale(1.015);
}

.project-figure:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: -3px;
}

.project-figure:has(.figure-count) {
  padding-bottom: 2.1rem;
}

.figure-count {
  position: absolute;
  right: 0.7rem;
  bottom: 0.45rem;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  background: rgba(23, 25, 27, 0.72);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 650;
  letter-spacing: 0.02em;
  line-height: 1.5;
}

/* Quarto wraps everything after a card's h3 in a <section>. Make it a flex
   column so the repository link sits at the bottom of every card. */
.project-card > section {
  display: flex;
  flex: 1;
  flex-direction: column;
}

.project-card > section > p:last-child {
  margin-top: auto;
  margin-bottom: 0;
  padding-top: 0.85rem;
}

@media (max-width: 760px) {
  .project-figure {
    padding: 0.5rem;
  }

  .project-figure:has(.figure-count) {
    padding-bottom: 2rem;
  }
}

/* An odd card at the end of a two-column section spans the row as a feature
   card: a wide figure on top, then the text in two columns. */
@media (min-width: 761px) {
  .project-grid-wide > .project-card:last-child:nth-child(odd) {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    column-gap: 2.4rem;
    align-content: start;
  }

  .project-grid-wide > .project-card:last-child:nth-child(odd) > section {
    display: contents;
  }

  .project-grid-wide > .project-card:last-child:nth-child(odd) > .project-figure {
    grid-column: 1 / -1;
    aspect-ratio: 21 / 9;
  }

  .project-grid-wide > .project-card:last-child:nth-child(odd) .project-type,
  .project-grid-wide > .project-card:last-child:nth-child(odd) h3,
  .project-grid-wide > .project-card:last-child:nth-child(odd) h3 + p {
    grid-column: 1;
  }

  .project-grid-wide > .project-card:last-child:nth-child(odd) .project-result {
    grid-column: 2;
    grid-row: 2 / span 3;
    align-self: start;
    margin-top: 0;
  }

  .project-grid-wide > .project-card:last-child:nth-child(odd) .project-tools {
    grid-column: 2;
    grid-row: 5;
  }

  .project-grid-wide > .project-card:last-child:nth-child(odd) section > p:last-child {
    grid-column: 2;
    grid-row: 6;
    padding-top: 0;
  }
}

.project-card > p:last-child {
  margin-top: auto;
  margin-bottom: 0;
  padding-top: 0.85rem;
}

.project-card a {
  font-size: 0.9rem;
  font-weight: 750;
}

.project-result {
  margin: 1rem 0;
  border: 1px solid rgba(49, 93, 107, 0.15);
  border-radius: 8px;
  background: var(--accent-soft);
}

.project-result {
  padding: 1rem 1.1rem;
}

.project-result span,
.project-result strong {
  display: block;
}

.project-result span {
  margin-bottom: 0.35rem;
}

.project-result strong {
  color: #28363b;
  font-size: 0.92rem;
  line-height: 1.5;
}

.project-tools {
  margin: 0.25rem 0 0.7rem;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.5;
}

.contact-section {
  padding-bottom: 5rem;
}

.contact-band {
  display: flex;
  gap: 2rem;
  align-items: center;
  justify-content: space-between;
  margin-top: 1rem;
  padding: 2.5rem;
  border: 1px solid rgba(49, 93, 107, 0.22);
  border-radius: 14px;
  background: linear-gradient(135deg, var(--surface), var(--accent-soft));
}

.contact-band h2 {
  margin-bottom: 0.65rem;
}

.contact-band p:last-child {
  margin-bottom: 0;
}

.contact-actions {
  flex: 0 0 auto;
  white-space: nowrap;
}

.btn {
  margin: 0 0.5rem 0.5rem 0;
  padding: 0.72rem 1.05rem;
  border-radius: 5px;
  font-size: 0.88rem;
  font-weight: 750;
}

.btn-primary {
  border-color: var(--accent-dark);
  background: var(--accent-dark);
  color: #ffffff;
}

.btn-primary:hover,
.btn-primary:focus {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.btn-outline-dark {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.55);
  color: var(--ink);
}

.btn-outline-dark:hover,
.btn-outline-dark:focus {
  border-color: var(--accent-dark);
  background: var(--accent-dark);
  color: #ffffff;
}

.cv-page {
  max-width: 850px;
}

.cv-contact {
  margin: -0.25rem 0 2rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9rem;
}

.cv-page h2 {
  margin-top: 3.25rem;
  padding-bottom: 0.55rem;
  border-bottom: 1px solid var(--line);
}

.cv-page h3 {
  margin-top: 2.25rem;
  margin-bottom: 0.15rem;
}

.cv-page h3 + p {
  margin-top: 0;
  color: #303438;
}

.cv-page li {
  margin-bottom: 0.4rem;
}

.cv-page > p {
  max-width: 820px;
}

.cv-entry {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 1.15rem;
  margin: 2.25rem 0 2.75rem;
}

.cv-entry-logos {
  display: flex;
  flex-direction: column;
  align-items: center;
  align-self: stretch;
}

.cv-entry-logos::after {
  width: 1px;
  min-height: 1.25rem;
  flex: 1;
  margin-top: 0.75rem;
  background: var(--line);
  content: "";
}

.org-logo,
.org-monogram {
  width: 58px;
  height: 58px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 5px 14px rgba(23, 25, 27, 0.055);
}

.org-logo {
  display: block;
  padding: 4px;
  object-fit: contain;
}

.org-monogram {
  display: grid;
  place-items: center;
  background: var(--accent-dark);
  color: #ffffff;
  font-family: Georgia, "Times New Roman", Times, serif;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.logo-stack .org-logo {
  width: 43px;
  height: 43px;
  border-radius: 8px;
  box-shadow: 0 4px 11px rgba(23, 25, 27, 0.07);
}

.logo-stack .org-logo + .org-logo {
  margin-top: -7px;
}

.cv-entry-content {
  min-width: 0;
}

.cv-page .cv-entry-content > h3 {
  margin-top: 0;
  margin-bottom: 0.15rem;
}

.cv-entry-content > ul:last-child {
  margin-bottom: 0;
}

.nav-footer {
  margin-top: 5rem;
  padding-top: 1.5rem;
  padding-bottom: 1.5rem;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.82rem;
}

.nav-footer a {
  color: var(--muted);
}

@media (max-width: 960px) {
  .hero-inner {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .project-grid-wide {
    grid-template-columns: 1fr;
  }

  .contact-band {
    display: block;
  }

  .contact-actions {
    margin-top: 1.5rem;
    white-space: normal;
  }

  .nav-footer-center {
    display: none;
  }
}

@media (max-width: 576px) {
  body {
    font-size: 0.98rem;
  }

  .hero {
    padding: 4.2rem 1rem 4rem;
  }

  .hero h1 {
    font-size: clamp(2.75rem, 14vw, 4rem);
  }

  .section-shell {
    padding: 4rem 1rem 0;
  }

  .page-lede {
    font-size: 1.08rem;
  }

  .project-card {
    border-radius: 9px;
  }

  .contact-band {
    padding: 1.6rem;
  }

  .cv-contact {
    line-height: 1.9;
  }

  .cv-entry {
    grid-template-columns: 52px minmax(0, 1fr);
    gap: 0.85rem;
  }

  .org-logo,
  .org-monogram {
    width: 46px;
    height: 46px;
    border-radius: 8px;
  }

  .logo-stack .org-logo {
    width: 36px;
    height: 36px;
    border-radius: 7px;
  }

  .org-monogram {
    font-size: 0.95rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

@media print {
  .navbar,
  #TOC,
  .quarto-title-banner,
  .quarto-secondary-nav,
  .nav-footer {
    display: none !important;
  }

  body {
    background: #ffffff;
    color: #000000;
    font-size: 10.5pt;
    line-height: 1.45;
  }

  main.content,
  .cv-page {
    max-width: none;
  }

  .cv-entry {
    display: block;
    margin: 1.5rem 0;
  }

  .cv-entry-logos {
    display: none;
  }

  h2,
  h3 {
    break-after: avoid;
  }

  li,
  p {
    orphans: 3;
    widows: 3;
  }

  a {
    color: #000000;
    text-decoration: none;
  }
}

/* Figure lightbox (assets/js/lightbox.js) */
.lb {
  width: min(1200px, calc(100vw - 2rem));
  max-width: none;
  max-height: calc(100vh - 2rem);
  padding: 0;
  overflow: visible;
  border: 0;
  background: transparent;
}

.lb::backdrop {
  background: rgba(17, 19, 21, 0.86);
}

.lb-figure {
  margin: 0;
  overflow: hidden;
  border-radius: 10px;
  background: var(--surface);
}

.lb-img {
  display: block;
  width: 100%;
  max-height: calc(100vh - 9rem);
  object-fit: contain;
  background: #f3f4f1;
}

.lb-caption {
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  padding: 0.8rem 1.1rem;
  color: var(--ink);
  font-size: 0.9rem;
  line-height: 1.5;
}

.lb-count {
  flex: none;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.lb-btn {
  position: absolute;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  font-size: 1.7rem;
  line-height: 1;
  cursor: pointer;
}

.lb-btn:focus-visible {
  outline: 3px solid #9fc3cf;
  outline-offset: 2px;
}

.lb-close {
  top: -0.6rem;
  right: -0.6rem;
}

.lb-prev,
.lb-next {
  top: calc(50% - 2rem);
}

.lb-prev {
  left: -1.4rem;
}

.lb-next {
  right: -1.4rem;
}

.lb-btn[hidden] {
  display: none;
}

@media (max-width: 760px) {
  .lb-prev {
    left: 0.4rem;
  }

  .lb-next {
    right: 0.4rem;
  }

  .lb-close {
    top: 0.4rem;
    right: 0.4rem;
  }
}

@media print {
  .figure-count {
    display: none;
  }
}
