/* Both views use the same in-page navigation and anchor offset. */
:root { --anchor-offset: 81px; }

.content > [data-section],
.content > [data-section] [id],
[data-layout="cv"] .content > [data-section] {
  scroll-margin-top: var(--anchor-offset);
}

@media (max-width: 1050px) {
  :root { --anchor-offset: 108px; }

  .site-header, [data-layout="cv"] .site-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 0 12px;
    padding-inline: clamp(14px, 4vw, 30px);
  }

  .site-header .wordmark, .header-actions { min-height: 48px; }
  .site-header .wordmark { display: flex; align-items: center; gap: 5px; }
  .header-actions { grid-row: 1; grid-column: 2; margin-left: 0; }

  .site-header .main-nav, [data-layout="cv"] .site-header .main-nav {
    position: static;
    grid-column: 1 / -1;
    grid-row: 2;
    display: flex;
    justify-content: flex-start;
    gap: 0;
    min-width: 0;
    margin: 0;
    padding: 0 2px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    background: transparent;
    border-top: 1px solid #a1b7ca45;
    border-bottom: 0;
    scrollbar-width: thin;
  }

  .site-header .main-nav a, [data-layout="cv"] .site-header .main-nav a {
    display: grid;
    place-items: center;
    flex: 1 0 auto;
    min-height: 43px;
    padding: 0 8px;
    font-size: clamp(13px, 3.5vw, 15px);
  }

  .site-header .main-nav a.is-active:after { inset-inline: 6px; }
  .site-header .main-nav a:focus-visible { outline-offset: -3px; }
}

@media (max-width: 700px) {
  [data-layout="cv"] .profile-hero {
    grid-template-columns: clamp(62px, 18vw, 78px) minmax(0, 1fr);
    align-items: center;
    gap: 0 13px;
  }

  [data-layout="cv"] .portrait-panel {
    grid-column: 1;
    grid-row: 1 / 3;
    min-width: 0;
    width: 100%;
    padding: 0;
    align-self: center;
  }

  [data-layout="cv"] .profile h1, [data-layout="cv"] .position { grid-column: 2; }
  .profile .position { font-size: 15px; line-height: 1.48; }
  [data-layout="cv"] .research-lede { margin-top: 13px; }

  .portrait-panel .profile-photo {
    width: 100%;
    max-width: 100%;
    height: auto;
    aspect-ratio: 1;
  }
}

.header-actions, .site-header .wordmark {flex-wrap: nowrap; white-space: nowrap}
.site-header .main-nav a {white-space: nowrap}
.footer-tools {display: flex; align-items: center; flex-wrap: wrap; gap: 6px 15px; margin-inline-start: auto}
.visit-counter {width: auto; height: 20px; flex: none}
.education-advisor {white-space: nowrap}
[data-layout="cv"] .profile-hero {grid-template-columns: clamp(112px, 16vw, 137px) minmax(0, 1fr)}
[data-layout="cv"] .profile-photo {aspect-ratio: 4 / 5}
@media (max-width: 700px) {
  [data-layout="cv"] .profile-hero {
    grid-template-columns: clamp(72px, 22vw, 100px) minmax(0, 1fr);
  }
  .profile h1 {font-size: clamp(23px, 6.5vw, 37px)}
  .profile h1 > span {font-size: clamp(14px, 4.1vw, 23px)}
  .site-header .main-nav {flex-wrap: nowrap}
  .education-advisor {white-space: normal}
  .footer-tools {margin-inline-start: 0}
}
@media (max-width: 380px) {
  .site-header, [data-layout="cv"] .site-header {column-gap: 6px; padding-inline: 10px}
  .site-header .wordmark {font-size: 17px}
  .site-header .wordmark > span {display: none}
  .site-header .header-actions {gap: 5px}
  .site-header .layout-switch {min-height: 30px}
}
