/* One fixed profile; only the content rail moves between screens. */
html.profile-layout { --profile-stage-offset: 90px; }
html.profile-layout,
html.tab-navigation { scrollbar-gutter: stable; }
/* Keep the underline's space when selection changes, including during transitions. */
.profile-layout .masthead__menu-item:not(.selected) > a,
.tab-navigation .masthead__menu-item:not(.selected) > a {
  border-bottom: 2px solid transparent;
}
.profile-layout:not(.debut-active) body {
  padding-top: var(--profile-stage-offset) !important;
}
.profile-layout #main,
.tab-navigation #main {
  --tab-stage-offset: var(--profile-stage-offset, var(--tab-nav-height, 70px));
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 44px;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 36px 18px 24px;
  animation: none;
}
.tab-navigation #main {
  grid-template-rows: minmax(0, 1fr);
  height: calc(100vh - var(--tab-stage-offset));
  height: calc(100svh - var(--tab-stage-offset));
  min-height: 0;
}
.profile-layout #main::before,
.profile-layout #main::after,
.tab-navigation #main::before,
.tab-navigation #main::after { display: none; }
.debut-active.tab-navigation #main { --tab-stage-offset: 90px; min-height: 0; }
.tab-navigation #main.tab-no-sidebar { grid-template-columns: minmax(0, 1fr); }
html.tab-secondary { overflow-y: hidden; }
.profile-layout #main > .sidebar,
.tab-navigation #main > .sidebar {
  position: relative;
  z-index: 1;
  float: none;
  top: auto;
  width: 100%;
  max-width: none;
  height: auto;
  max-height: 100%;
  margin: 0;
  padding-top: 0 !important;
  overflow-y: auto;
}
.profile-layout:not(.tab-navigation) #main > .sidebar {
  position: sticky;
  top: calc(var(--profile-stage-offset) + 36px);
  align-self: start;
  max-height: calc(100vh - var(--profile-stage-offset) - 60px);
  max-height: calc(100svh - var(--profile-stage-offset) - 60px);
}
.profile-layout #main > .page__related { grid-column: 2; }
.tab-rail {
  --tab-sep: 32px;
  position: relative;
  display: flex;
  column-gap: var(--tab-sep);
  min-width: 0;
  min-height: 0;
  width: 100%;
  height: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}
.tab-rail::-webkit-scrollbar { display: none; }
.tab-panel {
  position: relative;
  flex: 0 0 100%;
  min-width: 0;
  width: 100%;
  height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}
.tab-page {
  display: flow-root;
  min-height: 100%;
  padding: 0 0 36px;
}
.profile-layout #main > .page,
.profile-layout #main > .archive,
.tab-page > .page,
.tab-page > .archive,
.tab-page > .container {
  float: none;
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 0;
}
.profile-layout #main > .page,
.tab-page > .page { max-width: 820px; }
.tab-load-error { padding-top: 36px; }
@media (max-width: 1023px) {
  .tab-rail { --tab-sep: 20px; }
  .profile-layout #main,
  .tab-navigation #main {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    gap: 20px;
    padding: 24px 16px 16px;
  }
  .tab-navigation #main.tab-no-sidebar { grid-template-rows: minmax(0, 1fr); }
  .profile-layout:not(.tab-navigation) #main > .sidebar,
  .profile-layout #main > .sidebar,
  .tab-navigation #main > .sidebar {
    position: relative;
    top: auto;
    max-height: 160px;
    overflow: visible;
  }
  .profile-layout #main > .page__related { grid-column: 1; }
  /* Use the same compact profile below the content layout's desktop breakpoint. */
  .profile-layout .author__avatar { display: table-cell; width: 36px; }
  .profile-layout .author__avatar img { width: 36px; max-width: 36px; padding: 0; border: 0; }
  .profile-layout .author__content {
    display: table-cell;
    width: auto;
    padding-left: 15px;
    padding-right: 25px;
  }
  .profile-layout .author__name,
  .profile-layout .author__bio,
  .profile-layout .author__pronouns { margin: 0; }
  .profile-layout .author__urls-wrapper { display: table-cell; }
  .profile-layout .author__urls-wrapper button { display: inline-block; }
  .profile-layout .author__urls {
    /* The legacy resize handler writes display inline at its older 925px breakpoint. */
    display: none !important;
    position: absolute;
    margin-top: 15px;
    padding: 10px;
    border: 1px solid var(--global-border-color);
    background: var(--global-bg-color);
  }
  .profile-layout .author__urls-wrapper button.open + .author__urls { display: block !important; }
}
@media print {
  .profile-layout #main,
  .tab-navigation #main { display: block; height: auto; }
  .profile-layout:not(.tab-navigation) #main > .sidebar { position: static; max-height: none; }
  .tab-rail { display: block; height: auto; overflow: visible; }
  .tab-panel { display: none; height: auto; overflow: visible; }
  .tab-panel[aria-hidden='false'] { display: block; }
}
