/* Start the biography alongside the profile image without title-block spacing. */
.quarto-about-broadside .about-main .about-contents {
  padding-top: 0;
}

.quarto-about-broadside #title-block-header:empty {
  display: none;
}

.quarto-about-broadside main.content,
#quarto-document-content,
#quarto-content #about-me > h2 {
  margin-top: 0;
}

#profile > section.level2 > h2,
div.quarto-about-broadside #highlights > h2,
div.quarto-about-broadside #profile-links-title {
  border-bottom: 1px solid var(--ca-border);
  padding-bottom: 0.45rem;
}

/* Profile photo: a quiet neutral frame, with no inner border. */
div.quarto-about-broadside .about-main .about-entity {
  /* Match profile.jpg (1011 x 1200) so the frame fits the photo. */
  height: auto;
  aspect-ratio: 1011 / 1200;
  align-self: flex-start;
  width: auto;
  min-width: 0;
  background-size: cover;
  /* The top margin keeps the halo clear of the navbar line and the photo
     level with the first heading. The left margin keeps the halo inside the
     page column. */
  margin: 1rem 2.5rem 1.5rem 9px;
  border-radius: 3px;
  box-shadow: 0 0 0 9px var(--ca-raised);
}

/* Full-width highlights below the profile; every card is a single link. */
#highlights {
  grid-column: page-start / page-end;
  margin-top: 2.5rem;
  margin-bottom: 2rem;
}

.highlight-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1.25rem;
}

.highlight-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 0.65rem;
  background: var(--ca-card);
  /* Retain the existing spacing with an invisible border. */
  border: 1px solid transparent;
  border-radius: 7px;
  color: var(--ca-ink);
  text-decoration: none;
  transition: background-color 0.15s;
}

.highlight-card:hover,
.highlight-card:focus-visible {
  color: var(--ca-ink);
  background: var(--ca-hover);
}

.highlight-figure {
  overflow: hidden;
  border: 1px solid var(--ca-grid, var(--ca-border));
  border-radius: 4px;
  color: var(--ca-primary);
  background-color: var(--ca-figure, var(--ca-raised));
}

.highlight-figure svg {
  display: block;
  width: 100%;
  height: auto;
}

/* Ten columns by five rows of whole cells fill each SVG viewport.
   Internal lines meet the rounded border, which forms the grid's outer edge. */
.highlight-world-grid {
  stroke: var(--ca-grid, var(--ca-border));
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.highlight-communication {
  color: var(--ca-pine);
}

.highlight-detail {
  color: var(--ca-plum);
}

.highlight-footer {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.25rem 0.4rem;
  color: var(--ca-muted);
  font-size: 0.75rem;
}

.highlight-footer > * + *::before {
  content: "·";
  margin-right: 0.4rem;
  color: var(--ca-muted);
}

.highlight-card h3 {
  margin: 0.65rem 0 0.55rem;
  font-size: 1.05rem;
  line-height: 1.25;
  text-wrap: wrap;
  overflow-wrap: normal;
  hyphens: none;
}

.highlight-title-phrase {
  white-space: nowrap;
}

.highlight-footer {
  margin-top: auto;
  padding-top: 0.5rem;
  border-top: 1px solid var(--ca-border);
}

@media (max-width: 767.98px) {
  .highlight-grid {
    grid-template-columns: 1fr;
  }

}

@media (prefers-reduced-motion: reduce) {
  .highlight-card {
    transition: none;
  }
}

/* Keep the biography’s bold-italic emphasis in the primary blue. */
#about-me strong em {
  color: var(--ca-primary);
}

/* Education and experience: one row per entry, dates on the right. */
.cv-entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 1.25rem;
  padding: 0.85rem 0;
}

.cv-entry > * {
  grid-column: 1;
  margin: 0;
}

.cv-entry h4 {
  font-size: var(--site-body-size);
  margin: 0 0 0.15rem;
}

.cv-entry > p {
  color: var(--ca-muted);
}

.cv-entry > p:has(> .cv-when) {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: start;
  text-align: right;
}

.cv-when {
  color: var(--ca-muted);
  white-space: nowrap;
}

/* Education dates share the institution row; degrees use the full row below. */
@media (min-width: 768px) {
  #education .cv-entry > p:not(:has(> .cv-when)) {
    grid-column: 1 / -1;
  }

  #education .cv-entry > p:has(> .cv-when) {
    grid-row: 1;
  }
}

/* Profile destinations use a subtle surface tint on hover or focus. */
div.quarto-about-broadside .about-links {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
  padding-top: 2.5rem;
}

div.quarto-about-broadside #profile-links-title {
  grid-column: 1 / -1;
  margin: 0 0 0.25rem;
}

.quarto-about-broadside .about-links .about-link {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.4rem;
  border: 1px solid transparent;
  border-radius: 6px;
  background: var(--ca-card);
  color: var(--ca-ink);
  padding: 0.55rem 1.05rem;
  font-weight: 700;
  transition: color 0.15s, background-color 0.15s;
}

/* Give the CV its own row above the two pairs of profile/contact links. */
.quarto-about-broadside .about-links .about-link[href$=".pdf"] {
  grid-column: 1 / -1;
  color: var(--ca-primary);
}

.quarto-about-broadside .about-links .about-link:hover,
.quarto-about-broadside .about-links .about-link:focus-visible {
  background: var(--ca-hover);
  color: var(--ca-primary);
}

/* Wide screens: share grid rows so Links and Experience start together. */
@media (min-width: 992px) {
  div.quarto-about-broadside {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: auto auto 1fr;
    column-gap: 2.5rem;
  }

  div.quarto-about-broadside .about-main,
  div.quarto-about-broadside .about-main .about-contents,
  div.quarto-about-broadside #profile {
    display: contents !important;
  }

  div.quarto-about-broadside .about-main .about-entity {
    grid-column: 1;
    grid-row: 1 / span 2;
    /* Fit the frame to About Me + Education; crop the image within it. */
    align-self: stretch;
    aspect-ratio: auto;
    min-height: 0;
    background-position: center top;
    margin: 9px;
  }

  #profile > section.level2 {
    grid-column: 2;
  }

  #about-me {
    grid-row: 1;
  }

  #education {
    grid-row: 2;
  }

  #experience,
  div.quarto-about-broadside .about-links {
    grid-row: 3;
    align-self: start;
    margin-top: 2rem;
  }

  #experience > h2 {
    margin-top: 0;
  }

  div.quarto-about-broadside .about-links {
    grid-column: 1;
    gap: 0.75rem;
    padding: 0;
  }
}

/* Quarto stacks the photo above the text below 992px. */
@media (max-width: 991.98px) {
  div.quarto-about-broadside {
    padding-bottom: 0;
  }

  div.quarto-about-broadside .about-links {
    padding-top: 0;
    padding-bottom: 0;
  }

  #highlights {
    margin-top: 1.5rem;
  }

  #highlights > h2 {
    margin-top: 0;
  }

  div.quarto-about-broadside .about-main .about-entity {
    width: min(100% - 18px, 22rem);
    margin: 1.5rem 9px 2rem;
  }
}

@media (max-width: 767.98px) {
  div.quarto-about-broadside .about-main .about-entity {
    width: auto;
    height: auto;
    aspect-ratio: 4 / 5;
    max-height: 24rem;
    align-self: stretch;
    margin: 1.5rem 9px 2rem;
    background-position: center top;
  }

  .quarto-about-broadside .about-links .about-link {
    padding: 0.6rem 0.35rem;
  }

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

  .cv-entry > p:has(> .cv-when) {
    grid-column: 1;
    grid-row: auto;
    text-align: left;
    padding-top: 0.2rem;
  }
}
